Skip to contentSkip to conversation

build: make sharing of objects explicit

PATCH Superseded Juan Quintela 4 participants 9 messages Feb 24, 2011 Kbuild

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover build: make sharing of objects explicit

Hi

- all tools shared the same list of object files, create a variable instead or repeating them (tools-obj-y).
- tools and softmmu targets share lots of objects, just make that explicit with shared-obj-y.

Please review, Juan.

Juan Quintela (2):
build: Create tools-obj-y variable
build: create shared-obj-y for tools/qemu-softmmu

 Makefile      |    8 +++++---
 Makefile.objs |   14 +++++++++-----
 2 files changed, 14 insertions(+), 8 deletions(-)
Signature · 1 line
1.7.4
#1 lore raw

PATCH 1/2 build: Create tools-obj-y variable

All our tools have to have exactly all this objects, just share them.

---
 Makefile |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
Makefile +7 -3
index eca4c76..9e090cb 100644
@@ -150,14 +150,18 @@ version.o: $(SRC_PATH)/version.rc config-host.mak
 version-obj-$(CONFIG_WIN32) += version.o
 ######################################################################
 
+tools-obj-y=qemu-tool.o qemu-error.o $(oslib-obj-y) $(trace-obj-y)
+tools-obj-y+=$(block-obj-y) $(qobject-obj-y) $(version-obj-y)
+tools-obj-y+=qemu-timer-common.o
+
 qemu-img.o: qemu-img-cmds.h
 qemu-img.o qemu-tool.o qemu-nbd.o qemu-io.o cmd.o: $(GENERATED_HEADERS)
 
-qemu-img$(EXESUF): qemu-img.o qemu-tool.o qemu-error.o $(oslib-obj-y) $(trace-obj-y) $(block-obj-y) $(qobject-obj-y) $(version-obj-y) qemu-timer-common.o
+qemu-img$(EXESUF): qemu-img.o $(tools-obj-y)
 
-qemu-nbd$(EXESUF): qemu-nbd.o qemu-tool.o qemu-error.o $(oslib-obj-y) $(trace-obj-y) $(block-obj-y) $(qobject-obj-y) $(version-obj-y) qemu-timer-common.o
+qemu-nbd$(EXESUF): qemu-nbd.o $(tools-obj-y)
 
-qemu-io$(EXESUF): qemu-io.o cmd.o qemu-tool.o qemu-error.o $(oslib-obj-y) $(trace-obj-y) $(block-obj-y) $(qobject-obj-y) $(version-obj-y) qemu-timer-common.o
+qemu-io$(EXESUF): qemu-io.o cmd.o $(tools-obj-y)
 
 qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx
 	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $@")
Signature · 1 line
1.7.4
#2 lore raw

PATCH 2/2 build: create shared-obj-y for tools/qemu-softmmu

In reply to Juan Quintela

There are objects that need to be in both places, just make it explicit in a single place.

---
 Makefile      |    4 +---
 Makefile.objs |   14 +++++++++-----
 2 files changed, 10 insertions(+), 8 deletions(-)
Makefile +1 -3
index 9e090cb..1902f96 100644
@@ -150,9 +150,7 @@ version.o: $(SRC_PATH)/version.rc config-host.mak
 version-obj-$(CONFIG_WIN32) += version.o
 ######################################################################
 
-tools-obj-y=qemu-tool.o qemu-error.o $(oslib-obj-y) $(trace-obj-y)
-tools-obj-y+=$(block-obj-y) $(qobject-obj-y) $(version-obj-y)
-tools-obj-y+=qemu-timer-common.o
+tools-obj-y = qemu-tool.o $(shared-obj-y) $(trace-obj-y) $(version-obj-y)
 
 qemu-img.o: qemu-img-cmds.h
 qemu-img.o qemu-tool.o qemu-nbd.o qemu-io.o cmd.o: $(GENERATED_HEADERS)
Makefile.objs +9 -5
index 9e98a66..5849487 100644
@@ -54,17 +54,21 @@ fsdev-nested-$(CONFIG_VIRTFS) = qemu-fsdev.o
 fsdev-obj-$(CONFIG_VIRTFS) += $(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) $(oslib-obj-y)
+shared-obj-y += qemu-timer-common.o
+
+######################################################################
 # 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) blockdev.o
+common-obj-y = $(shared-obj-y) blockdev.o
 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 cursor.o async.o qemu-error.o
-common-obj-y += $(oslib-obj-y)
+common-obj-y += readline.o console.o cursor.o async.o
 common-obj-$(CONFIG_WIN32) += os-win32.o
 common-obj-$(CONFIG_POSIX) += os-posix.o
 
@@ -145,7 +149,7 @@ common-obj-y += iov.o acl.o
 common-obj-$(CONFIG_THREAD) += qemu-thread.o
 common-obj-$(CONFIG_POSIX) += compatfd.o
 common-obj-y += notify.o event_notifier.o
-common-obj-y += qemu-timer.o qemu-timer-common.o
+common-obj-y += qemu-timer.o
 
 slirp-obj-y = cksum.o if.o ip_icmp.o ip_input.o ip_output.o
 slirp-obj-y += slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o
Signature · 1 line
1.7.4
#3 lore raw

Re: [Qemu-devel] [PATCH 2/2] build: create shared-obj-y for tools/qemu-softmmu

Makefile.objs fsdev-nested-$(CONFIG_VIRTFS) = qemu-fsdev.o · line 60

Quoted 4 lines · Juan Quintela
Makefile.objs +4 -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) $(oslib-obj-y)
+shared-obj-y += qemu-timer-common.o

I don't feel very strongly about this, but:
It seems a bit odd to have a shared-obj-y variable that isn't actually a list of shared objects (ie .so files, DLLs). Maybe there's a better name?

-- PMM

#4 lore raw

Re: [Qemu-devel] [PATCH 2/2] build: create shared-obj-y for tools/qemu-softmmu

Quoted 9 lines · Peter Maydell

Makefile.objs fsdev-nested-$(CONFIG_VIRTFS) = qemu-fsdev.o · line 60

Quoted 4 lines · Juan Quintela
Makefile.objs +4 -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) $(oslib-obj-y)
+shared-obj-y += qemu-timer-common.o

I don't feel very strongly about this, but:
It seems a bit odd to have a shared-obj-y variable that isn't actually a list of shared objects (ie .so files, DLLs). Maybe there's a better name?

common-obj-y?

#5 lore raw

[Qemu-devel] Re: [PATCH 2/2] build: create shared-obj-y for tools/qemu-softmmu

Quoted 12 lines · Markus Armbruster
Quoted 9 lines · Peter Maydell

Makefile.objs fsdev-nested-$(CONFIG_VIRTFS) = qemu-fsdev.o · line 60

Quoted 4 lines · Juan Quintela
Makefile.objs +4 -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) $(oslib-obj-y)
+shared-obj-y += qemu-timer-common.o

I don't feel very strongly about this, but:
It seems a bit odd to have a shared-obj-y variable that isn't actually a list of shared objects (ie .so files, DLLs). Maybe there's a better name?

Quoted 1 line

common-obj-y?

already taken :-(

common-obj-y is the list of files that are shared by all qemu-softmmu

######################################################################
# 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) blockdev.o
...

so, this is the list of files that are shared between all the softmmu (common) and the tools.

I am open to suggestions, but all names I thought are worse than shared (common-common-obj-y) :p

Later, Juan.

#6 lore raw

[Qemu-devel] Re: [PATCH 2/2] build: create shared-obj-y for tools/qemu-softmmu

Quoted 27 lines · Juan Quintela
Quoted 12 lines · Markus Armbruster
Quoted 9 lines · Peter Maydell

Makefile.objs fsdev-nested-$(CONFIG_VIRTFS) = qemu-fsdev.o · line 60

Quoted 4 lines · Juan Quintela
Makefile.objs +4 -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) $(oslib-obj-y)
+shared-obj-y += qemu-timer-common.o

I don't feel very strongly about this, but:
It seems a bit odd to have a shared-obj-y variable that isn't actually a list of shared objects (ie .so files, DLLs). Maybe there's a better name?

Quoted 1 line

common-obj-y?

already taken :-(

common-obj-y is the list of files that are shared by all qemu-softmmu

######################################################################
# 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) blockdev.o
...
Quoted 5 lines

so, this is the list of files that are shared between all the softmmu (common) and the tools.

I am open to suggestions, but all names I thought are worse than shared (common-common-obj-y) :p

really-common-obj-y? ;)

Seriously, what about renaming common-obj-y away? target-indep-obj-y?

#7 lore raw

[Qemu-devel] Re: [PATCH 2/2] build: create shared-obj-y for tools/qemu-softmmu

Quoted 3 lines · Markus Armbruster

really-common-obj-y?;)

Seriously, what about renaming common-obj-y away? target-indep-obj-y?

softmmu-obj-y?

Paolo

#8 lore raw

[Qemu-devel] Re: [PATCH 2/2] build: create shared-obj-y for tools/qemu-softmmu

Quoted 6 lines · Paolo Bonzini
Quoted 3 lines · Markus Armbruster

really-common-obj-y?;)

Seriously, what about renaming common-obj-y away? target-indep-obj-y?

softmmu-obj-y?

Waiting for Anthony to decide anything, renaming the variable is the easy thing to do.

Later, Juan.