Skip to contentSkip to conversation

Makefile: remoeve duplicate qemu-error.o

PATCH In review Juan Quintela 3 participants 7 messages May 11, 2010 Kbuild

lore
Share & tools
lore
#0 lore raw

cover Makefile: remoeve duplicate qemu-error.o

Hi

qemu-error.o appears in several places in Makefile*, with several combinations of make; make clean; make
you could get a build error. Fix it defining it in a single place. Once there, just create a shared-obj-y for objects that are needed for both tools and qemu binary. This should remove this error in the future.

once there, fix fsdevel to check for CONFIG_LINUX only once instead of 4 times.

Juan Quintela (2):
Create shared-obj-y
state that fsdev depends on LINUX only once

 Makefile      |    8 +++++---
 Makefile.objs |   15 +++++++++------
 2 files changed, 14 insertions(+), 9 deletions(-)
#1 lore raw

PATCH 1/2 Create shared-obj-y

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.

---
 Makefile      |    8 +++++---
 Makefile.objs |    9 ++++++---
 2 files changed, 11 insertions(+), 6 deletions(-)
Makefile +5 -3
index eb9e02b..ba1611b 100644
@@ -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   $@")
Makefile.objs +6 -3
index ecdd53e..95d864b 100644
@@ -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
Signature · 1 line
1.6.6.1
#2 lore raw

Re: [Qemu-devel] [PATCH 1/2] Create shared-obj-y

Quoted 3 lines · 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.

Yup, that's what I should've done when I added qemu-error.c.

#3 lore raw

Re: [Qemu-devel] [PATCH 1/2] Create shared-obj-y

In reply to Juan Quintela

Am 11.05.2010 13:13, schrieb Juan Quintela:

Quoted 9 lines

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.

Makefile.objs fsdev-nested-$(CONFIG_LINUX) = qemu-fsdev.o · line 43

Quoted 5 lines
Makefile.objs +2 -0
@@ -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

#4 lore raw

Re: [Qemu-devel] [PATCH 1/2] Create shared-obj-y

Quoted 12 lines · Kevin Wolf

Am 11.05.2010 13:13, schrieb Juan Quintela:

Quoted 11 lines

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.

Makefile.objs +0 -0
@@ -39,16 +39,19 @@ fsdev-nested-$(CONFIG_LINUX) = qemu-fsdev.o
 fsdev-obj-$(CONFIG_LINUX) += $(addprefix fsdev/, $(fsdev-nested-y))
 
Quoted 7 lines

Makefile.objs fsdev-nested-$(CONFIG_LINUX) = qemu-fsdev.o · line 43

Quoted 3 lines
Makefile.objs +2 -0
 ######################################################################
+# 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.

#5 lore raw

[Qemu-devel] Re: [PATCH 1/2] Create shared-obj-y

In reply to Kevin Wolf
Quoted 12 lines · Kevin Wolf

Am 11.05.2010 13:13, schrieb Juan Quintela:

Quoted 11 lines

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.

Makefile.objs +0 -0
@@ -39,16 +39,19 @@ fsdev-nested-$(CONFIG_LINUX) = qemu-fsdev.o
 fsdev-obj-$(CONFIG_LINUX) += $(addprefix fsdev/, $(fsdev-nested-y))
 
Quoted 7 lines

Makefile.objs fsdev-nested-$(CONFIG_LINUX) = qemu-fsdev.o · line 43

Quoted 3 lines
Makefile.objs +2 -0
 ######################################################################
+# 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.

#6 lore raw

PATCH 2/2 state that fsdev depends on LINUX only once

In reply to Juan Quintela
---
 Makefile.objs |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
Makefile.objs +3 -3
index 95d864b..f963c3f 100644
@@ -35,8 +35,8 @@ net-nested-$(CONFIG_SLIRP) += slirp.o
 net-nested-$(CONFIG_VDE) += vde.o
 net-obj-y += $(addprefix net/, $(net-nested-y))
 
-fsdev-nested-$(CONFIG_LINUX) = qemu-fsdev.o
-fsdev-obj-$(CONFIG_LINUX) += $(addprefix fsdev/, $(fsdev-nested-y))
+fsdev-nested-y = qemu-fsdev.o
+fsdev-obj-y += $(addprefix fsdev/, $(fsdev-nested-y))
 
 ######################################################################
 # shared-obj-y has the object that are shared by qemu binary and tools
@@ -50,7 +50,7 @@ shared-obj-y = qemu-error.o $(block-obj-y) $(qobject-obj-y)
 
 common-obj-y = $(shared-obj-y)
 common-obj-y += $(net-obj-y)
-common-obj-$(CONFIG_LINUX) += $(fsdev-obj-$(CONFIG_LINUX))
+common-obj-$(CONFIG_LINUX) += $(fsdev-obj-y)
 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
Signature · 1 line
1.6.6.1