@@ -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)
@@ -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
This way we don't have to repeat them in two places. Signed-off-by: Juan Quintela <quintela@redhat.com> --- Makefile | 4 +--- Makefile.objs | 14 +++++++++----- 2 files changed, 10 insertions(+), 8 deletions(-)