Skip to contentSkip to conversation

build: make sharing of objects explicit

PATCH New Juan Quintela 1 participant 4 messages Mar 10, 2011 Kbuild

lore
Share & tools
lore
#0 lore raw

v2 cover build: make sharing of objects explicit

Hi

Another week, another version.

v2:
- rename common-obj-y to softmmu-obj-y, so we can use common-obj-y for objects shared between tools and softmmu.

v1:

- 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 (3):
build: Create tools-obj-y variable
build: Rename common-obj-y to softmmu-obj-y
build: Create common-obj-y for objects shared between tools and
softmmu

 Makefile        |   12 +++--
 Makefile.objs   |  120 ++++++++++++++++++++++++++++--------------------------
 Makefile.target |    2 +-
 3 files changed, 70 insertions(+), 64 deletions(-)
Signature · 1 line
1.7.4
#1 lore raw

PATCH v2 1/3 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 v2 2/3 build: Rename common-obj-y to softmmu-obj-y

In reply to Juan Quintela

It really represent object files shared between all softmmu targets. We will use common-obj-y for objects shared between softmmu and tools on next commit

---
 Makefile        |    4 +-
 Makefile.objs   |  116 +++++++++++++++++++++++++++---------------------------
 Makefile.target |    2 +-
 3 files changed, 61 insertions(+), 61 deletions(-)
Makefile +2 -2
index 9e090cb..7811d74 100644
@@ -87,8 +87,8 @@ ifneq ($(wildcard config-host.mak),)
 include $(SRC_PATH)/Makefile.objs
 endif
 
-$(common-obj-y): $(GENERATED_HEADERS)
-$(filter %-softmmu,$(SUBDIR_RULES)): $(trace-obj-y) $(common-obj-y) subdir-libdis
+$(softmmu-obj-y): $(GENERATED_HEADERS)
+$(filter %-softmmu,$(SUBDIR_RULES)): $(trace-obj-y) $(softmmu-obj-y) subdir-libdis
 
 $(filter %-user,$(SUBDIR_RULES)): $(GENERATED_HEADERS) $(trace-obj-y) subdir-libdis-user subdir-libuser
 
Makefile.objs +58 -58

141 lines not on this page · raw message

Makefile.target +1 -1
index f0df98e..f77b0dc 100644
@@ -343,7 +343,7 @@ monitor.o: hmp-commands.h qmp-commands.h
 
 $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS)
 
-obj-y += $(addprefix ../, $(common-obj-y))
+obj-y += $(addprefix ../, $(softmmu-obj-y))
 obj-y += $(addprefix ../libdis/, $(libdis-y))
 obj-y += $(libobj-y)
 obj-y += $(addprefix $(HWDIR)/, $(hw-obj-y))
Signature · 1 line
1.7.4
#3 lore raw

PATCH v2 3/3 build: Create common-obj-y for objects shared between tools and softmmu

In reply to Juan Quintela

This way we don't have to repeat them in two places.

---
 Makefile      |    4 +---
 Makefile.objs |   14 +++++++++-----
 2 files changed, 10 insertions(+), 8 deletions(-)
Makefile +1 -3
index 7811d74..42d2cab 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 $(common-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 b525e81..7e54ae3 100644
@@ -54,17 +54,21 @@ fsdev-nested-$(CONFIG_VIRTFS) = qemu-fsdev.o
 fsdev-obj-$(CONFIG_VIRTFS) += $(addprefix fsdev/, $(fsdev-nested-y))
 
 ######################################################################
+# common-obj-y has the object that are shared by qemu softmmu and tools
+
+common-obj-y  = qemu-error.o $(block-obj-y) $(qobject-obj-y) $(oslib-obj-y)
+common-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.
 
-softmmu-obj-y = $(block-obj-y) blockdev.o
+softmmu-obj-y = $(common-obj-y) blockdev.o
 softmmu-obj-y += $(net-obj-y)
-softmmu-obj-y += $(qobject-obj-y)
 softmmu-obj-$(CONFIG_LINUX) += $(fsdev-obj-$(CONFIG_LINUX))
-softmmu-obj-y += readline.o console.o cursor.o async.o qemu-error.o
-softmmu-obj-y += $(oslib-obj-y)
+softmmu-obj-y += readline.o console.o cursor.o async.o
 softmmu-obj-$(CONFIG_WIN32) += os-win32.o
 softmmu-obj-$(CONFIG_POSIX) += os-posix.o
 
@@ -145,7 +149,7 @@ softmmu-obj-y += iov.o acl.o
 softmmu-obj-$(CONFIG_THREAD) += qemu-thread.o
 softmmu-obj-$(CONFIG_POSIX) += compatfd.o
 softmmu-obj-y += notify.o event_notifier.o
-softmmu-obj-y += qemu-timer.o qemu-timer-common.o
+softmmu-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