@@ -157,9 +157,28 @@ tools-obj-y = $(oslib-obj-y) $(trace-obj-y) qemu-tool.o qemu-timer.o \
qemu-timer-common.o main-loop.o notify.o iohandler.o cutils.o async.o
tools-obj-$(CONFIG_POSIX) += compatfd.o
-qemu-img$(EXESUF): qemu-img.o $(tools-obj-y) $(block-obj-y)
-qemu-nbd$(EXESUF): qemu-nbd.o $(tools-obj-y) $(block-obj-y)
-qemu-io$(EXESUF): qemu-io.o cmd.o $(tools-obj-y) $(block-obj-y)
+qemu-img-trace-objs=qemu-img.o $(tools-obj-y) $(block-obj-y)
+qemu-nbd-trace-objs=qemu-nbd.o $(tools-obj-y) $(block-obj-y)
+qemu-io-trace-objs=qemu-io.o cmd.o $(tools-obj-y) $(block-obj-y)
+qemu-img-all-objs=$(qemu-img-trace-objs)
+qemu-nbd-all-objs=$(qemu-nbd-trace-objs)
+qemu-io-all-objs=$(qemu-io-trace-objs)
+ifdef CONFIG_TRACE_DTRACE
+qemu-img-all-objs+=qemu-img.dtrace.o
+qemu-nbd-all-objs+=qemu-nbd.dtrace.o
+qemu-io-trace-objs+=qemu-img.dtrace.o
+endif
+
+qemu-img.dtrace.o: trace-dtrace.dtrace $(qemu-img-trace-objs)
+ $(call DTRACE,$@,trace-dtrace.dtrace,$(qemu-img-trace-objs))
+qemu-nbd.dtrace.o: trace-dtrace.dtrace $(qemu-nbd-trace-objs)
+ $(call DTRACE,$@,trace-dtrace.dtrace,$(qemu-nbd-trace-objs))
+qemu-io.dtrace.o: trace-dtrace.dtrace $(qemu-io-trace-objs)
+ $(call DTRACE,$@,trace-dtrace.dtrace,$(qemu-io-trace-objs))
+
+qemu-img$(EXESUF): $(qemu-img-all-objs)
+qemu-nbd$(EXESUF): $(qemu-nbd-all-objs)
+qemu-io$(EXESUF): $(qemu-io-all-objs)
qemu-bridge-helper$(EXESUF): qemu-bridge-helper.o
qemu-bridge-helper.o: $(GENERATED_HEADERS)
@@ -206,7 +225,17 @@ QGALIB_GEN=$(addprefix $(qapi-dir)/, qga-qapi-types.h qga-qapi-visit.h qga-qmp-c
$(QGALIB_OBJ): $(QGALIB_GEN) $(GENERATED_HEADERS)
$(qga-obj-y) qemu-ga.o: $(QGALIB_GEN) $(GENERATED_HEADERS)
-qemu-ga$(EXESUF): qemu-ga.o $(qga-obj-y) $(tools-obj-y) $(qapi-obj-y) $(qobject-obj-y) $(version-obj-y) $(QGALIB_OBJ)
+qemu-ga-trace-objs=qemu-ga.o $(qga-obj-y) $(tools-obj-y) $(qapi-obj-y) $(qobject-obj-y) $(version-obj-y) $(QGALIB_OBJ)
+qemu-ga-all-objs=$(qemu-ga-trace-objs)
+ifdef CONFIG_TRACE_DTRACE
+qemu-ga-all-objs+=qemu-ga.dtrace.o
+endif
+
+qemu-ga.dtrace.o: trace-dtrace.dtrace $(qemu-ga-trace-objs)
+ $(call DTRACE,$@,trace-dtrace.dtrace,$(qemu-ga-trace-objs))
+
+qemu-ga$(EXESUF): $(qemu-ga-all-objs)
+
QEMULIBS=libhw32 libhw64 libuser libdis libdis-user
@@ -394,20 +394,8 @@ trace-dtrace.dtrace-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host
$(call quiet-command,sh $(SRC_PATH)/scripts/tracetool --$(TRACE_BACKEND) -d < $< > $@," GEN trace-dtrace.dtrace")
@cmp -s $@ trace-dtrace.dtrace || cp $@ trace-dtrace.dtrace
-trace-dtrace.o: trace-dtrace.dtrace $(GENERATED_HEADERS)
- $(call quiet-command,dtrace -o $@ -G -s $<, " GEN trace-dtrace.o")
-
-ifeq ($(LIBTOOL),)
-trace-dtrace.lo: trace-dtrace.dtrace
- @echo "missing libtool. please install and rerun configure."; exit 1
-else
-trace-dtrace.lo: trace-dtrace.dtrace
- $(call quiet-command,$(LIBTOOL) --mode=compile --tag=CC dtrace -o $@ -G -s $<, " lt GEN trace-dtrace.o")
-endif
-
trace/simple.o: trace/simple.c $(GENERATED_HEADERS)
-trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
ifneq ($(TRACE_BACKEND),dtrace)
trace-obj-y = trace.o
endif
@@ -444,7 +444,17 @@ $(QEMU_PROGW): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y)
$(QEMU_PROG): $(QEMU_PROGW)
$(call quiet-command,$(OBJCOPY) --subsystem console $(QEMU_PROGW) $(QEMU_PROG)," GEN $(TARGET_DIR)$(QEMU_PROG)")
else
-$(QEMU_PROG): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y)
+
+target-trace-objs=$(obj-y) $(obj-$(TARGET_BASE_ARCH)-y)
+target-all-objs=$(target-trace-objs)
+ifdef CONFIG_TRACE_DTRACE
+target-all-objs+=$(QEMU_PROG).dtrace.o
+endif
+
+$(QEMU_PROG).dtrace.o: ../trace-dtrace.dtrace $(target-trace-objs)
+ $(call DTRACE,$@,../trace-dtrace.dtrace,$(target-trace-objs))
+
+$(QEMU_PROG): $(target-all-objs)
$(call LINK,$^)
endif
@@ -33,6 +33,12 @@ endif
LINK = $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $(sort $(1)) $(LIBS)," LINK $(TARGET_DIR)$@")
+ifdef CONFIG_SOLARIS
+DTRACE = $(call quiet-command,dtrace -o $(1) -G -s $(2) $(3), " GEN $(TARGET_DIR)$(1)")
+else
+DTRACE = $(call quiet-command,dtrace -o $(1) -G -s $(2), " GEN $(TARGET_DIR)$(1)")
+endif
+
%$(EXESUF): %.o
$(call LINK,$^)
Solaris requires that dtrace is supplied with all objects when generating the dtrace object file. This patch updates the build for each of the utility binaries and the main target generation. Signed-off-by: Lee Essen <lee.essen@nowonline.co.uk> --- Makefile | 37 +++++++++++++++++++++++++++++++++---- Makefile.objs | 12 ------------ Makefile.target | 12 +++++++++++- rules.mak | 6 ++++++ 4 files changed, 50 insertions(+), 17 deletions(-)