diff mbox

[34/54] char: create chardev-obj-y

Message ID 20161212224325.20790-35-marcandre.lureau@redhat.com
State New
Headers show

Commit Message

Marc-André Lureau Dec. 12, 2016, 10:43 p.m. UTC
This will help to split char.c in several units without having to
reference them all everywhere.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 Makefile               | 3 ++-
 Makefile.objs          | 4 +++-
 Makefile.target        | 3 +++
 chardev/Makefile.objs  | 2 +-
 tests/Makefile.include | 4 ++--
 5 files changed, 11 insertions(+), 5 deletions(-)

Comments

Paolo Bonzini Dec. 13, 2016, 11:10 a.m. UTC | #1
On 12/12/2016 23:43, Marc-André Lureau wrote:
> This will help to split char.c in several units without having to
> reference them all everywhere.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  Makefile               | 3 ++-
>  Makefile.objs          | 4 +++-
>  Makefile.target        | 3 +++
>  chardev/Makefile.objs  | 2 +-
>  tests/Makefile.include | 4 ++--
>  5 files changed, 11 insertions(+), 5 deletions(-)

Any reason to do this instead of keeping common-obj-y?

Thanks,

Paolo
Marc-André Lureau Dec. 13, 2016, 12:40 p.m. UTC | #2
Hi

On Tue, Dec 13, 2016 at 2:18 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

>
>
> On 12/12/2016 23:43, Marc-André Lureau wrote:
> > This will help to split char.c in several units without having to
> > reference them all everywhere.
> >
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > ---
> >  Makefile               | 3 ++-
> >  Makefile.objs          | 4 +++-
> >  Makefile.target        | 3 +++
> >  chardev/Makefile.objs  | 2 +-
> >  tests/Makefile.include | 4 ++--
> >  5 files changed, 11 insertions(+), 5 deletions(-)
>
> Any reason to do this instead of keeping common-obj-y?
>
>
common-obj-y has a lot of other units, including vl.o, making it not
possible to link with tests/test-char for ex. However, if we changed it to
link with everything except vl.c (or other changes), we may be able to link
with and test spice-qemu-char. The resulting binaries will likely explode
though.

Thanks,
>
> Paolo
>
> --
Marc-André Lureau
Paolo Bonzini Dec. 13, 2016, 12:52 p.m. UTC | #3
On 13/12/2016 13:40, Marc-André Lureau wrote:
> 
>     On 12/12/2016 23:43, Marc-André Lureau wrote:
>     > This will help to split char.c in several units without having to
>     > reference them all everywhere.
>     >
>     > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com
>     <mailto:marcandre.lureau@redhat.com>>
>     > ---
>     >  Makefile               | 3 ++-
>     >  Makefile.objs          | 4 +++-
>     >  Makefile.target        | 3 +++
>     >  chardev/Makefile.objs  | 2 +-
>     >  tests/Makefile.include | 4 ++--
>     >  5 files changed, 11 insertions(+), 5 deletions(-)
> 
>     Any reason to do this instead of keeping common-obj-y?
> 
> 
> common-obj-y has a lot of other units, including vl.o, making it not
> possible to link with tests/test-char for ex. However, if we changed it
> to link with everything except vl.c (or other changes), we may be able
> to link with and test spice-qemu-char. The resulting binaries will
> likely explode though.

Ok, so it's for tests.  Fair enough!

Paolo
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 474cc5e66a..318a3499ab 100644
--- a/Makefile
+++ b/Makefile
@@ -145,6 +145,7 @@  endif
 
 dummy := $(call unnest-vars,, \
                 stub-obj-y \
+                chardev-obj-y \
                 util-obj-y \
                 qga-obj-y \
                 ivshmem-client-obj-y \
@@ -220,7 +221,7 @@  subdir-dtc:dtc/libfdt dtc/tests
 dtc/%:
 	mkdir -p $@
 
-$(SUBDIR_RULES): libqemuutil.a libqemustub.a $(common-obj-y) $(qom-obj-y) $(crypto-aes-obj-$(CONFIG_USER_ONLY))
+$(SUBDIR_RULES): libqemuutil.a libqemustub.a $(common-obj-y) $(chardev-obj-y) $(qom-obj-y) $(crypto-aes-obj-$(CONFIG_USER_ONLY))
 
 ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS))
 # Only keep -O and -g cflags
diff --git a/Makefile.objs b/Makefile.objs
index 6cf903baa1..ccd627d8bb 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -51,7 +51,7 @@  common-obj-$(CONFIG_POSIX) += os-posix.o
 common-obj-$(CONFIG_LINUX) += fsdev/
 
 common-obj-y += migration/
-common-obj-y += chardev/ #aio.o
+common-obj-y += #aio.o
 common-obj-y += page_cache.o
 
 common-obj-$(CONFIG_SPICE) += spice-qemu-char.o
@@ -79,6 +79,8 @@  common-obj-$(CONFIG_SECCOMP) += qemu-seccomp.o
 
 common-obj-$(CONFIG_FDT) += device_tree.o
 
+chardev-obj-y = chardev/
+
 ######################################################################
 # qapi
 
diff --git a/Makefile.target b/Makefile.target
index 7a5080e94a..8799cd9972 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -170,12 +170,14 @@  all-obj-y := $(obj-y)
 target-obj-y :=
 block-obj-y :=
 common-obj-y :=
+chardev-obj-y :=
 include $(SRC_PATH)/Makefile.objs
 dummy := $(call unnest-vars,,target-obj-y)
 target-obj-y-save := $(target-obj-y)
 dummy := $(call unnest-vars,.., \
                block-obj-y \
                block-obj-m \
+               chardev-obj-y \
                crypto-obj-y \
                crypto-aes-obj-y \
                qom-obj-y \
@@ -184,6 +186,7 @@  dummy := $(call unnest-vars,.., \
                common-obj-m)
 target-obj-y := $(target-obj-y-save)
 all-obj-y += $(common-obj-y)
+all-obj-y += $(chardev-obj-y)
 all-obj-y += $(target-obj-y)
 all-obj-y += $(qom-obj-y)
 all-obj-$(CONFIG_SOFTMMU) += $(block-obj-y)
diff --git a/chardev/Makefile.objs b/chardev/Makefile.objs
index 3fc5539518..8bf131b461 100644
--- a/chardev/Makefile.objs
+++ b/chardev/Makefile.objs
@@ -1 +1 @@ 
-common-obj-y += char.o
+chardev-obj-y += char.o
diff --git a/tests/Makefile.include b/tests/Makefile.include
index ca57fe61d6..c719c7a7a4 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -488,7 +488,7 @@  tests/check-qjson$(EXESUF): tests/check-qjson.o $(test-util-obj-y)
 tests/check-qom-interface$(EXESUF): tests/check-qom-interface.o $(test-qom-obj-y)
 tests/check-qom-proplist$(EXESUF): tests/check-qom-proplist.o $(test-qom-obj-y)
 
-tests/test-char$(EXESUF): tests/test-char.o chardev/char.o qemu-timer.o $(test-util-obj-y) $(qtest-obj-y) $(test-io-obj-y)
+tests/test-char$(EXESUF): tests/test-char.o qemu-timer.o $(test-util-obj-y) $(qtest-obj-y) $(test-io-obj-y) $(chardev-obj-y)
 tests/test-coroutine$(EXESUF): tests/test-coroutine.o $(test-block-obj-y)
 tests/test-aio$(EXESUF): tests/test-aio.o $(test-block-obj-y)
 tests/test-throttle$(EXESUF): tests/test-throttle.o $(test-block-obj-y)
@@ -678,7 +678,7 @@  tests/usb-hcd-ehci-test$(EXESUF): tests/usb-hcd-ehci-test.o $(libqos-usb-obj-y)
 tests/usb-hcd-xhci-test$(EXESUF): tests/usb-hcd-xhci-test.o $(libqos-usb-obj-y)
 tests/pc-cpu-test$(EXESUF): tests/pc-cpu-test.o
 tests/postcopy-test$(EXESUF): tests/postcopy-test.o
-tests/vhost-user-test$(EXESUF): tests/vhost-user-test.o chardev/char.o qemu-timer.o $(qtest-obj-y) $(test-io-obj-y) $(libqos-virtio-obj-y) $(libqos-pc-obj-y)
+tests/vhost-user-test$(EXESUF): tests/vhost-user-test.o qemu-timer.o $(qtest-obj-y) $(test-io-obj-y) $(libqos-virtio-obj-y) $(libqos-pc-obj-y) $(chardev-obj-y)
 tests/qemu-iotests/socket_scm_helper$(EXESUF): tests/qemu-iotests/socket_scm_helper.o
 tests/test-qemu-opts$(EXESUF): tests/test-qemu-opts.o $(test-util-obj-y)
 tests/test-write-threshold$(EXESUF): tests/test-write-threshold.o $(test-block-obj-y)