Patchwork [1/2] Create shared-obj-y

login
register
mail settings
Submitter Juan Quintela
Date May 11, 2010, 11:13 a.m.
Message ID <967a05760ff3819dd26ae0e9e2fb2062e34c265f.1273576209.git.quintela@redhat.com>
Download mbox | patch
Permalink /patch/52283/
State New
Headers show

Comments

Juan Quintela - May 11, 2010, 11:13 a.m.
This variable contains the objects shared between tools and qemu binary.
Add qemu-error.o only in one place, it "could" be built in two places
depending of make ordering.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 Makefile      |    8 +++++---
 Makefile.objs |    9 ++++++---
 2 files changed, 11 insertions(+), 6 deletions(-)
Markus Armbruster - May 11, 2010, 11:45 a.m.
Juan Quintela <quintela@redhat.com> writes:

> This variable contains the objects shared between tools and qemu binary.
> Add qemu-error.o only in one place, it "could" be built in two places
> depending of make ordering.

Yup, that's what I should've done when I added qemu-error.c.
Kevin Wolf - May 11, 2010, 11:52 a.m.
Am 11.05.2010 13:13, schrieb Juan Quintela:
> This variable contains the objects shared between tools and qemu binary.
> Add qemu-error.o only in one place, it "could" be built in two places
> depending of make ordering.
> 
> Signed-off-by: Juan Quintela <quintela@redhat.com>

> --- a/Makefile.objs
> +++ b/Makefile.objs
> @@ -39,16 +39,19 @@ fsdev-nested-$(CONFIG_LINUX) = qemu-fsdev.o
>  fsdev-obj-$(CONFIG_LINUX) += $(addprefix fsdev/, $(fsdev-nested-y))
> 
>  ######################################################################
> +# shared-obj-y has the object that are shared by qemu binary and tools
> +shared-obj-y = qemu-error.o $(block-obj-y) $(qobject-obj-y)

Currently, block-obj-y contains some more files which are not really
related to the block layer, such as cutils.o or osdep.o. Should they be
moved here while we're at it?

Kevin
Markus Armbruster - May 11, 2010, 12:07 p.m.
Kevin Wolf <kwolf@redhat.com> writes:

> Am 11.05.2010 13:13, schrieb Juan Quintela:
>> This variable contains the objects shared between tools and qemu binary.
>> Add qemu-error.o only in one place, it "could" be built in two places
>> depending of make ordering.
>> 
>> Signed-off-by: Juan Quintela <quintela@redhat.com>
>
>> --- a/Makefile.objs
>> +++ b/Makefile.objs
>> @@ -39,16 +39,19 @@ fsdev-nested-$(CONFIG_LINUX) = qemu-fsdev.o
>>  fsdev-obj-$(CONFIG_LINUX) += $(addprefix fsdev/, $(fsdev-nested-y))
>> 
>>  ######################################################################
>> +# shared-obj-y has the object that are shared by qemu binary and tools
>> +shared-obj-y = qemu-error.o $(block-obj-y) $(qobject-obj-y)
>
> Currently, block-obj-y contains some more files which are not really
> related to the block layer, such as cutils.o or osdep.o. Should they be
> moved here while we're at it?

Think so.
Juan Quintela - May 11, 2010, 12:17 p.m.
Kevin Wolf <kwolf@redhat.com> wrote:
> Am 11.05.2010 13:13, schrieb Juan Quintela:
>> This variable contains the objects shared between tools and qemu binary.
>> Add qemu-error.o only in one place, it "could" be built in two places
>> depending of make ordering.
>> 
>> Signed-off-by: Juan Quintela <quintela@redhat.com>
>
>> --- a/Makefile.objs
>> +++ b/Makefile.objs
>> @@ -39,16 +39,19 @@ fsdev-nested-$(CONFIG_LINUX) = qemu-fsdev.o
>>  fsdev-obj-$(CONFIG_LINUX) += $(addprefix fsdev/, $(fsdev-nested-y))
>> 
>>  ######################################################################
>> +# shared-obj-y has the object that are shared by qemu binary and tools
>> +shared-obj-y = qemu-error.o $(block-obj-y) $(qobject-obj-y)
>
> Currently, block-obj-y contains some more files which are not really
> related to the block layer, such as cutils.o or osdep.o. Should they be
> moved here while we're at it?

Agreed, I was just doing the "minimal" impact change.  block-obj-y was
the variable that fit better in old style.

Later, Juan.

Patch

diff --git a/Makefile b/Makefile
index eb9e02b..ba1611b 100644
--- a/Makefile
+++ b/Makefile
@@ -135,11 +135,13 @@  iov.o: iov.c iov.h
 qemu-img.o: qemu-img-cmds.h
 qemu-img.o qemu-tool.o qemu-nbd.o qemu-io.o: $(GENERATED_HEADERS)

-qemu-img$(EXESUF): qemu-img.o qemu-tool.o qemu-error.o $(block-obj-y) $(qobject-obj-y)
+TOOLS_OBJ=qemu-tool.o $(shared-obj-y)

-qemu-nbd$(EXESUF): qemu-nbd.o qemu-tool.o qemu-error.o $(block-obj-y) $(qobject-obj-y)
+qemu-img$(EXESUF): qemu-img.o $(TOOLS_OBJ)

-qemu-io$(EXESUF): qemu-io.o cmd.o qemu-tool.o qemu-error.o $(block-obj-y) $(qobject-obj-y)
+qemu-nbd$(EXESUF): qemu-nbd.o $(TOOLS_OBJ)
+
+qemu-io$(EXESUF): qemu-io.o cmd.o $(TOOLS_OBJ)

 qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx
 	$(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@,"  GEN   $@")
diff --git a/Makefile.objs b/Makefile.objs
index ecdd53e..95d864b 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -39,16 +39,19 @@  fsdev-nested-$(CONFIG_LINUX) = qemu-fsdev.o
 fsdev-obj-$(CONFIG_LINUX) += $(addprefix fsdev/, $(fsdev-nested-y))

 ######################################################################
+# shared-obj-y has the object that are shared by qemu binary and tools
+shared-obj-y = qemu-error.o $(block-obj-y) $(qobject-obj-y)
+
+######################################################################
 # libqemu_common.a: Target independent part of system emulation. The
 # long term path is to suppress *all* target specific code in case of
 # system emulation, i.e. a single QEMU executable should support all
 # CPUs and machines.

-common-obj-y = $(block-obj-y)
+common-obj-y = $(shared-obj-y)
 common-obj-y += $(net-obj-y)
-common-obj-y += $(qobject-obj-y)
 common-obj-$(CONFIG_LINUX) += $(fsdev-obj-$(CONFIG_LINUX))
-common-obj-y += readline.o console.o async.o qemu-error.o
+common-obj-y += readline.o console.o async.o
 common-obj-y += tcg-runtime.o host-utils.o
 common-obj-y += irq.o ioport.o input.o
 common-obj-$(CONFIG_PTIMER) += ptimer.o