Skip to contentSkip to conversation

build: Use separate makefile for "trace/"

PATCH In review Lluís Vilanova 2 participants 9 messages Dec 11, 2012 – Dec 14, 2012 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 build: Use separate makefile for "trace/"

---
 .gitignore                          |    6 +--
 Makefile                            |    8 ++-
 Makefile.objs                       |   64 +---------------------------
 scripts/tracetool/backend/dtrace.py |    2 -
 trace/Makefile.objs                 |   81 +++++++++++++++++++++++++++++++++++
 5 files changed, 92 insertions(+), 69 deletions(-)
 create mode 100644 trace/Makefile.objs
.gitignore +3 -3
index bd6ba1c..b67a37e 100644
@@ -3,9 +3,9 @@ config-all-devices.*
 config-host.*
 config-target.*
 trace.h
-trace.c
-trace-dtrace.h
-trace-dtrace.dtrace
+trace/generated.c
+trace/generated-dtrace.h
+trace/generated-dtrace.dtrace
 *-timestamp
 *-softmmu
 *-darwin-user
Makefile +4 -4
index e9d6848..9dbcca3 100644
@@ -33,10 +33,10 @@ endif
 
 GENERATED_HEADERS = config-host.h trace.h qemu-options.def
 ifeq ($(TRACE_BACKEND),dtrace)
-GENERATED_HEADERS += trace-dtrace.h
+GENERATED_HEADERS += trace/generated-dtrace.h
 endif
 GENERATED_HEADERS += qmp-commands.h qapi-types.h qapi-visit.h
-GENERATED_SOURCES += qmp-marshal.c qapi-types.c qapi-visit.c trace.c
+GENERATED_SOURCES += qmp-marshal.c qapi-types.c qapi-visit.c trace/generated.c
 
 # Don't try to regenerate Makefile or configure
 # We don't generate any of them
@@ -252,9 +252,9 @@ clean:
 	rm -f *.a *.lo $(TOOLS) $(HELPERS-y) qemu-ga TAGS cscope.* *.pod *~ */*~
 	rm -Rf .libs
 	rm -f qemu-img-cmds.h
-	rm -f trace-dtrace.dtrace trace-dtrace.dtrace-timestamp
 	@# May not be present in GENERATED_HEADERS
-	rm -f trace-dtrace.h trace-dtrace.h-timestamp
+	rm -f trace/generated-dtrace.dtrace trace/generated-dtrace.dtrace-timestamp
+	rm -f trace/generated-dtrace.h trace/generated-dtrace.h-timestamp
 	rm -f $(foreach f,$(GENERATED_HEADERS),$(f) $(f)-timestamp)
 	rm -f $(foreach f,$(GENERATED_SOURCES),$(f) $(f)-timestamp)
 	rm -rf qapi-generated
Makefile.objs +3 -61

74 lines not on this page · raw message

scripts/tracetool/backend/dtrace.py +1 -1
index 23c43e2..0cbc68a 100644
@@ -37,7 +37,7 @@ def c(events):
 
 
 def h(events):
-    out('#include "trace-dtrace.h"',
+    out('#include "trace/generated-dtrace.h"',
         '')
 
     for e in events:
trace/Makefile.objs new file +81 -0

81 lines not on this page · raw message

#1 lore raw

Il 11/12/2012 22:44, Lluís Vilanova ha scritto:

Quoted 115 lines
---
 .gitignore                          |    6 +--
 Makefile                            |    8 ++-
 Makefile.objs                       |   64 +---------------------------
 scripts/tracetool/backend/dtrace.py |    2 -
 trace/Makefile.objs                 |   81 +++++++++++++++++++++++++++++++++++
 5 files changed, 92 insertions(+), 69 deletions(-)
 create mode 100644 trace/Makefile.objs
.gitignore +3 -3
index bd6ba1c..b67a37e 100644
@@ -3,9 +3,9 @@ config-all-devices.*
 config-host.*
 config-target.*
 trace.h
-trace.c
-trace-dtrace.h
-trace-dtrace.dtrace
+trace/generated.c
+trace/generated-dtrace.h
+trace/generated-dtrace.dtrace
 *-timestamp
 *-softmmu
 *-darwin-user
Makefile +4 -4
index e9d6848..9dbcca3 100644
@@ -33,10 +33,10 @@ endif
 
 GENERATED_HEADERS = config-host.h trace.h qemu-options.def
 ifeq ($(TRACE_BACKEND),dtrace)
-GENERATED_HEADERS += trace-dtrace.h
+GENERATED_HEADERS += trace/generated-dtrace.h
 endif
 GENERATED_HEADERS += qmp-commands.h qapi-types.h qapi-visit.h
-GENERATED_SOURCES += qmp-marshal.c qapi-types.c qapi-visit.c trace.c
+GENERATED_SOURCES += qmp-marshal.c qapi-types.c qapi-visit.c trace/generated.c
 
 # Don't try to regenerate Makefile or configure
 # We don't generate any of them
@@ -252,9 +252,9 @@ clean:
 	rm -f *.a *.lo $(TOOLS) $(HELPERS-y) qemu-ga TAGS cscope.* *.pod *~ */*~
 	rm -Rf .libs
 	rm -f qemu-img-cmds.h
-	rm -f trace-dtrace.dtrace trace-dtrace.dtrace-timestamp
 	@# May not be present in GENERATED_HEADERS
-	rm -f trace-dtrace.h trace-dtrace.h-timestamp
+	rm -f trace/generated-dtrace.dtrace trace/generated-dtrace.dtrace-timestamp
+	rm -f trace/generated-dtrace.h trace/generated-dtrace.h-timestamp
 	rm -f $(foreach f,$(GENERATED_HEADERS),$(f) $(f)-timestamp)
 	rm -f $(foreach f,$(GENERATED_SOURCES),$(f) $(f)-timestamp)
 	rm -rf qapi-generated
Makefile.objs +0 -51
index 3c7abca..24832a2 100644
@@ -147,66 +147,7 @@ libdis-$(CONFIG_LM32_DIS) += lm32-dis.o
 ######################################################################
 # trace
 
-ifeq ($(TRACE_BACKEND),dtrace)
-TRACE_H_EXTRA_DEPS=trace-dtrace.h
-endif
-trace.h: trace.h-timestamp $(TRACE_H_EXTRA_DEPS)
-trace.h-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
-	$(call quiet-command,$(TRACETOOL) \
-		--format=h \
-		--backend=$(TRACE_BACKEND) \
-		< $< > $@,"  GEN   trace.h")
-	@cmp -s $@ trace.h || cp $@ trace.h
-
-trace.c: trace.c-timestamp
-trace.c-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
-	$(call quiet-command,$(TRACETOOL) \
-		--format=c \
-		--backend=$(TRACE_BACKEND) \
-		< $< > $@,"  GEN   trace.c")
-	@cmp -s $@ trace.c || cp $@ trace.c
-
-trace.o: trace.c $(GENERATED_HEADERS)
-
-trace-dtrace.h: trace-dtrace.dtrace
-	$(call quiet-command,dtrace -o $@ -h -s $<, "  GEN   trace-dtrace.h")
-
-# Normal practice is to name DTrace probe file with a '.d' extension
-# but that gets picked up by QEMU's Makefile as an external dependency
-# rule file. So we use '.dtrace' instead
-trace-dtrace.dtrace: trace-dtrace.dtrace-timestamp
-trace-dtrace.dtrace-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
-	$(call quiet-command,$(TRACETOOL) \
-		--format=d \
-		--backend=$(TRACE_BACKEND) \
-		< $< > $@,"  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

Makefile.objs libdis-$(CONFIG_LM32_DIS) += lm32-dis.o · line 150

Quoted 10 lines
Makefile.objs +1 -9
-endif
-
-trace-obj-$(CONFIG_TRACE_DEFAULT) += trace/default.o
-trace-obj-$(CONFIG_TRACE_SIMPLE) += trace/simple.o
-trace-obj-$(CONFIG_TRACE_SIMPLE) += qemu-timer-common.o
-trace-obj-$(CONFIG_TRACE_STDERR) += trace/stderr.o
-trace-obj-y += trace/control.o
-
-$(trace-obj-y): $(GENERATED_HEADERS)
+trace-obj-y += trace/

Please just put it into oslib-obj-y.

Quoted 29 lines
Makefile.objs +2 -1
 ######################################################################
 # smartcard
@@ -250,5 +191,6 @@ nested-vars += \
 	block-obj-y \
 	user-obj-y \
 	common-obj-y \
-	extra-obj-y
+	extra-obj-y \
+	trace-obj-y
 dummy := $(call unnest-vars)
scripts/tracetool/backend/dtrace.py +1 -1
index 23c43e2..0cbc68a 100644
@@ -37,7 +37,7 @@ def c(events):
 
 
 def h(events):
-    out('#include "trace-dtrace.h"',
+    out('#include "trace/generated-dtrace.h"',
         '')
 
     for e in events:
trace/Makefile.objs new file +0 -0
new file mode 100644
index 0000000..d7e8cdf

trace/Makefile.objs line 7

Quoted 7 lines
trace/Makefile.objs new file +7 -0
@@ -0,0 +1,81 @@
+# -*- mode: makefile -*-
+
+trace/simple.o: trace/simple.c $(GENERATED_HEADERS)
+
+trace-obj-$(CONFIG_TRACE_DEFAULT) += default.o
+trace-obj-$(CONFIG_TRACE_SIMPLE) += simple.o
+trace-obj-$(CONFIG_TRACE_SIMPLE) += ../qemu-timer-common.o

Is this line needed? (Actually, it is obviously unneeded if you use oslib-obj-y). I am also worried that it causes duplicate symbols when you link in both qemu-timer-common.o and trace/../qemu-timer-common.o. The $(sort) invocation in the LINK macro of rules.mak will not treat these two paths as duplicate.

trace/Makefile.objs line 15

Quoted 8 lines
trace/Makefile.objs new file +8 -0
+trace-obj-$(CONFIG_TRACE_STDERR) += stderr.o
+trace-obj-y += control.o
+
+
+######################################################################
+# Auto-generated tracing routines
+
+# NOTE: "trace.h" is kept in the top-level dir to shorten common include path

Ok, I'll take care of moving it to trace/ later when I do the same for all other includes.

trace/Makefile.objs line 28

Quoted 13 lines
trace/Makefile.objs new file +13 -0
+ifeq ($(TRACE_BACKEND),dtrace)
+TRACE_H_EXTRA_DEPS=trace/generated-dtrace.h
+endif
+trace.h: trace.h-timestamp $(TRACE_H_EXTRA_DEPS)
+trace.h-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
+	$(call quiet-command,$(TRACETOOL) \
+		--format=h \
+		--backend=$(TRACE_BACKEND) \
+		< $< > $@,"  GEN   trace.h")
+	@cmp -s $@ trace.h || cp $@ trace.h
+
+
+trace/generated.c: trace/generated.c-timestamp

Please use $(obj)/generated.c, and similarly for everything else.

Quoted 43 lines
trace/Makefile.objs new file +43 -0
+trace/generated.c-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
+	$(call quiet-command,$(TRACETOOL) \
+		--format=c \
+		--backend=$(TRACE_BACKEND) \
+		< $< > $@,"  GEN   trace/generated.c")
+	@cmp -s $@ trace/generated.c || cp $@ trace/generated.c
+
+trace/generated.o: trace/generated.c trace.h
+
+
+ifneq ($(TRACE_BACKEND),dtrace)
+trace-obj-y += generated.o
+endif
+
+
+######################################################################
+# Auto-generated DTrace code
+
+# Normal practice is to name DTrace probe file with a '.d' extension
+# but that gets picked up by QEMU's Makefile as an external dependency
+# rule file. So we use '.dtrace' instead
+trace/generated-dtrace.dtrace: trace/generated-dtrace.dtrace-timestamp
+trace/generated-dtrace.dtrace-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
+	$(call quiet-command,$(TRACETOOL) \
+		--format=d \
+		--backend=$(TRACE_BACKEND) \
+		< $< > $@,"  GEN   trace/generated-dtrace.dtrace")
+	@cmp -s $@ trace/generated-dtrace.dtrace || cp $@ trace/generated-dtrace.dtrace
+
+
+trace/generated-dtrace.h: trace/generated-dtrace.dtrace
+	$(call quiet-command,dtrace -o $@ -h -s $<, "  GEN   trace/generated-dtrace.h")
+
+trace/generated-dtrace.o: trace/generated-dtrace.dtrace $(GENERATED_HEADERS)
+	$(call quiet-command,dtrace -o $@ -G -s $<, "  GEN   trace/generated-dtrace.o")
+
+
+ifeq ($(LIBTOOL),)
+trace/generated-dtrace.lo: trace/generated-dtrace.dtrace
+	@echo "missing libtool. please install and rerun configure."; exit 1
+else
+trace/generated-dtrace.lo: trace/generated-dtrace.dtrace
+	$(call quiet-command,$(LIBTOOL) --mode=compile --tag=CC dtrace -o $@ -G -s $<, "  lt GEN trace/generated-dtrace.lo")

trace/Makefile.objs line 81

Quoted 10 lines
trace/Makefile.objs new file +10 -0
+endif
+
+
+trace-obj-$(CONFIG_TRACE_DTRACE) += generated-dtrace.o
+
+
+######################################################################
+# Keep at bottom
+
+$(trace-obj-y): $(GENERATED_HEADERS)

This does not do what you think, because trace-obj-y includes a relative path. It can be simply

trace/%.o: $(GENERATED_HEADERS)

but it is actually unnecessary because of this in the toplevel:

# Add a dependency on the generated files, so that they are always

# rebuilt before other object files
ifneq ($(filter-out %clean,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
Makefile: $(GENERATED_HEADERS)
endif

Paolo

#2 lore raw
Quoted 120 lines · Paolo Bonzini

Il 11/12/2012 22:44, Lluís Vilanova ha scritto:

Quoted 119 lines

---

.gitignore                          |    6 +--
Makefile                            |    8 ++-
Makefile.objs                       |   64 +---------------------------
scripts/tracetool/backend/dtrace.py |    2 -
trace/Makefile.objs                 |   81 +++++++++++++++++++++++++++++++++++
5 files changed, 92 insertions(+), 69 deletions(-)

create mode 100644 trace/Makefile.objs

.gitignore +0 -0
index bd6ba1c..b67a37e 100644
@@ -3,9 +3,9 @@ config-all-devices.*

config-host.*
config-target.*
trace.h

.gitignore +3 -3
-trace.c
-trace-dtrace.h
-trace-dtrace.dtrace
+trace/generated.c
+trace/generated-dtrace.h
+trace/generated-dtrace.dtrace

*-timestamp
*-softmmu
*-darwin-user

Makefile +0 -0
index e9d6848..9dbcca3 100644
@@ -33,10 +33,10 @@ endif
 

GENERATED_HEADERS = config-host.h trace.h qemu-options.def ifeq ($(TRACE_BACKEND),dtrace)

Makefile +1 -1
-GENERATED_HEADERS += trace-dtrace.h
+GENERATED_HEADERS += trace/generated-dtrace.h

endif
GENERATED_HEADERS += qmp-commands.h qapi-types.h qapi-visit.h

Makefile +1 -1
-GENERATED_SOURCES += qmp-marshal.c qapi-types.c qapi-visit.c trace.c
+GENERATED_SOURCES += qmp-marshal.c qapi-types.c qapi-visit.c trace/generated.c

# Don't try to regenerate Makefile or configure
# We don't generate any of them

Makefile +0 -0
@@ -252,9 +252,9 @@ clean:

rm -f *.a *.lo $(TOOLS) $(HELPERS-y) qemu-ga TAGS cscope.* *.pod *~ */*~ rm -Rf .libs
rm -f qemu-img-cmds.h

Makefile +0 -1
-	rm -f trace-dtrace.dtrace trace-dtrace.dtrace-timestamp

@# May not be present in GENERATED_HEADERS

Makefile +2 -1
-	rm -f trace-dtrace.h trace-dtrace.h-timestamp
+	rm -f trace/generated-dtrace.dtrace trace/generated-dtrace.dtrace-timestamp
+	rm -f trace/generated-dtrace.h trace/generated-dtrace.h-timestamp

rm -f $(foreach f,$(GENERATED_HEADERS),$(f) $(f)-timestamp) rm -f $(foreach f,$(GENERATED_SOURCES),$(f) $(f)-timestamp) rm -rf qapi-generated

Makefile.objs +0 -55
index 3c7abca..24832a2 100644
@@ -147,66 +147,7 @@ libdis-$(CONFIG_LM32_DIS) += lm32-dis.o
 ######################################################################
 # trace
 
-ifeq ($(TRACE_BACKEND),dtrace)
-TRACE_H_EXTRA_DEPS=trace-dtrace.h
-endif
-trace.h: trace.h-timestamp $(TRACE_H_EXTRA_DEPS)
-trace.h-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
-	$(call quiet-command,$(TRACETOOL) \
-		--format=h \
-		--backend=$(TRACE_BACKEND) \
-		< $< > $@,"  GEN   trace.h")
-	@cmp -s $@ trace.h || cp $@ trace.h
-
-trace.c: trace.c-timestamp
-trace.c-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
-	$(call quiet-command,$(TRACETOOL) \
-		--format=c \
-		--backend=$(TRACE_BACKEND) \
-		< $< > $@,"  GEN   trace.c")
-	@cmp -s $@ trace.c || cp $@ trace.c
-
-trace.o: trace.c $(GENERATED_HEADERS)
-
-trace-dtrace.h: trace-dtrace.dtrace
-	$(call quiet-command,dtrace -o $@ -h -s $<, "  GEN   trace-dtrace.h")
-
-# Normal practice is to name DTrace probe file with a '.d' extension
-# but that gets picked up by QEMU's Makefile as an external dependency
-# rule file. So we use '.dtrace' instead
-trace-dtrace.dtrace: trace-dtrace.dtrace-timestamp
-trace-dtrace.dtrace-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
-	$(call quiet-command,$(TRACETOOL) \
-		--format=d \
-		--backend=$(TRACE_BACKEND) \
-		< $< > $@,"  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
-
-trace-obj-$(CONFIG_TRACE_DEFAULT) += trace/default.o
-trace-obj-$(CONFIG_TRACE_SIMPLE) += trace/simple.o
Quoted 8 lines

Makefile.objs libdis-$(CONFIG_LM32_DIS) += lm32-dis.o · line 150

Quoted 6 lines
Makefile.objs +1 -5
-trace-obj-$(CONFIG_TRACE_SIMPLE) += qemu-timer-common.o
-trace-obj-$(CONFIG_TRACE_STDERR) += trace/stderr.o
-trace-obj-y += trace/control.o
-
-$(trace-obj-y): $(GENERATED_HEADERS)
+trace-obj-y += trace/

Please just put it into oslib-obj-y.

You mean line "trace-obj-y += trace/"?

Quoted 34 lines
Quoted 34 lines
Makefile.objs +2 -1
 ######################################################################
 # smartcard
@@ -250,5 +191,6 @@ nested-vars += \
 block-obj-y \
 user-obj-y \
 common-obj-y \
-	extra-obj-y
+	extra-obj-y \
+	trace-obj-y
 dummy := $(call unnest-vars)
scripts/tracetool/backend/dtrace.py +0 -0
index 23c43e2..0cbc68a 100644
@@ -37,7 +37,7 @@ def c(events):
 
 

def h(events):

scripts/tracetool/backend/dtrace.py +1 -1
-    out('#include "trace-dtrace.h"',
+    out('#include "trace/generated-dtrace.h"',

'')

for e in events:

trace/Makefile.objs new file +5 -0
new file mode 100644
index 0000000..d7e8cdf
@@ -0,0 +1,81 @@
+# -*- mode: makefile -*-
+
+trace/simple.o: trace/simple.c $(GENERATED_HEADERS)
+
+trace-obj-$(CONFIG_TRACE_DEFAULT) += default.o
Quoted 8 lines

trace/Makefile.objs line 7

Quoted 2 lines
trace/Makefile.objs new file +2 -0
+trace-obj-$(CONFIG_TRACE_SIMPLE) += simple.o
+trace-obj-$(CONFIG_TRACE_SIMPLE) += ../qemu-timer-common.o

Is this line needed? (Actually, it is obviously unneeded if you use oslib-obj-y). I am also worried that it causes duplicate symbols when you link in both qemu-timer-common.o and trace/../qemu-timer-common.o. The $(sort) invocation in the LINK macro of rules.mak will not treat these two paths as duplicate.

"trace-obj-y" is required by some binaries other than QEMU itself, as they use routines that require the tracing infrastructure (e.g., qemu-img, which only includes "qemu-timer-common.o" as a dependency through "tools-obj-y").

I'm not sure how the subdir magic treats paths, but mapping all paths in final vars into their respective absolute path should simplify things.

In any case, compiling with backends none, stderr, and stdout turns up no linking problems.

Quoted 11 lines

trace/Makefile.objs line 15

Quoted 8 lines
trace/Makefile.objs new file +8 -0
+trace-obj-$(CONFIG_TRACE_STDERR) += stderr.o
+trace-obj-y += control.o
+
+
+######################################################################
+# Auto-generated tracing routines
+
+# NOTE: "trace.h" is kept in the top-level dir to shorten common include path

Ok, I'll take care of moving it to trace/ later when I do the same for all other includes.

I'll send a new version generating "trace/generated.h" and having "trace.h" just include it for now.

Quoted 7 lines
Quoted 7 lines
trace/Makefile.objs new file +7 -0
+ifeq ($(TRACE_BACKEND),dtrace)
+TRACE_H_EXTRA_DEPS=trace/generated-dtrace.h
+endif
+trace.h: trace.h-timestamp $(TRACE_H_EXTRA_DEPS)
+trace.h-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
+	$(call quiet-command,$(TRACETOOL) \
+		--format=h \
Quoted 8 lines

trace/Makefile.objs line 28

Quoted 6 lines
trace/Makefile.objs new file +6 -0
+		--backend=$(TRACE_BACKEND) \
+		< $< > $@,"  GEN   trace.h")
+	@cmp -s $@ trace.h || cp $@ trace.h
+
+
+trace/generated.c: trace/generated.c-timestamp

Please use $(obj)/generated.c, and similarly for everything else.

Tried it, but "obj" is set to ".", although looking at "rules.mak" that should not be the case...

Inserting "$(error obj=$(obj))" in "trace/Makefile.objs" shows "./trace", but echoing "obj" in any of the rules shows ".".

Quoted 59 lines
Quoted 43 lines
trace/Makefile.objs new file +43 -0
+trace/generated.c-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
+	$(call quiet-command,$(TRACETOOL) \
+		--format=c \
+		--backend=$(TRACE_BACKEND) \
+		< $< > $@,"  GEN   trace/generated.c")
+	@cmp -s $@ trace/generated.c || cp $@ trace/generated.c
+
+trace/generated.o: trace/generated.c trace.h
+
+
+ifneq ($(TRACE_BACKEND),dtrace)
+trace-obj-y += generated.o
+endif
+
+
+######################################################################
+# Auto-generated DTrace code
+
+# Normal practice is to name DTrace probe file with a '.d' extension
+# but that gets picked up by QEMU's Makefile as an external dependency
+# rule file. So we use '.dtrace' instead
+trace/generated-dtrace.dtrace: trace/generated-dtrace.dtrace-timestamp
+trace/generated-dtrace.dtrace-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
+	$(call quiet-command,$(TRACETOOL) \
+		--format=d \
+		--backend=$(TRACE_BACKEND) \
+		< $< > $@,"  GEN   trace/generated-dtrace.dtrace")
+	@cmp -s $@ trace/generated-dtrace.dtrace || cp $@ trace/generated-dtrace.dtrace
+
+
+trace/generated-dtrace.h: trace/generated-dtrace.dtrace
+	$(call quiet-command,dtrace -o $@ -h -s $<, "  GEN   trace/generated-dtrace.h")
+
+trace/generated-dtrace.o: trace/generated-dtrace.dtrace $(GENERATED_HEADERS)
+	$(call quiet-command,dtrace -o $@ -G -s $<, "  GEN   trace/generated-dtrace.o")
+
+
+ifeq ($(LIBTOOL),)
+trace/generated-dtrace.lo: trace/generated-dtrace.dtrace
+	@echo "missing libtool. please install and rerun configure."; exit 1
+else
+trace/generated-dtrace.lo: trace/generated-dtrace.dtrace
+	$(call quiet-command,$(LIBTOOL) --mode=compile --tag=CC dtrace -o $@ -G -s $<, "  lt GEN trace/generated-dtrace.lo")

trace/Makefile.objs line 81

Quoted 10 lines
trace/Makefile.objs new file +10 -0
+endif
+
+
+trace-obj-$(CONFIG_TRACE_DTRACE) += generated-dtrace.o
+
+
+######################################################################
+# Keep at bottom
+
+$(trace-obj-y): $(GENERATED_HEADERS)

This does not do what you think, because trace-obj-y includes a relative path. It can be simply

trace/%.o: $(GENERATED_HEADERS)

Quoted 7 lines

but it is actually unnecessary because of this in the toplevel:

# Add a dependency on the generated files, so that they are always

# rebuilt before other object files
ifneq ($(filter-out %clean,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
Makefile: $(GENERATED_HEADERS)
endif

Nice, I wasn't aware of this addition. Then I suppose none of the rules need to depend on GENERATED_HEADERS.

BTW, can I extend the GENERATED_HEADERS variable contents right from "trace/Makefile.objs" even though it's not explicitly included from the top-level makefile?

I'm sure this has already been previously discussed to the point of extenuation, but what are the reasons for not using autotools?

Thanks,
Lluis

Signature · 4 lines
 "And it's much the same thing with knowledge, for whenever you learn
 something new, the whole world becomes that much richer."
 -- The Princess of Pure Reason, as told by Norton Juster in The Phantom
 Tollbooth
#3 lore raw

Il 12/12/2012 15:53, Lluís Vilanova ha scritto:

Quoted 131 lines
Quoted 120 lines · Paolo Bonzini

Il 11/12/2012 22:44, Lluís Vilanova ha scritto:

Quoted 119 lines

---

.gitignore                          |    6 +--
Makefile                            |    8 ++-
Makefile.objs                       |   64 +---------------------------
scripts/tracetool/backend/dtrace.py |    2 -
trace/Makefile.objs                 |   81 +++++++++++++++++++++++++++++++++++
5 files changed, 92 insertions(+), 69 deletions(-)

create mode 100644 trace/Makefile.objs

.gitignore +0 -0
index bd6ba1c..b67a37e 100644
@@ -3,9 +3,9 @@ config-all-devices.*

config-host.*
config-target.*
trace.h

.gitignore +3 -3
-trace.c
-trace-dtrace.h
-trace-dtrace.dtrace
+trace/generated.c
+trace/generated-dtrace.h
+trace/generated-dtrace.dtrace

*-timestamp
*-softmmu
*-darwin-user

Makefile +0 -0
index e9d6848..9dbcca3 100644
@@ -33,10 +33,10 @@ endif
 

GENERATED_HEADERS = config-host.h trace.h qemu-options.def ifeq ($(TRACE_BACKEND),dtrace)

Makefile +1 -1
-GENERATED_HEADERS += trace-dtrace.h
+GENERATED_HEADERS += trace/generated-dtrace.h

endif
GENERATED_HEADERS += qmp-commands.h qapi-types.h qapi-visit.h

Makefile +1 -1
-GENERATED_SOURCES += qmp-marshal.c qapi-types.c qapi-visit.c trace.c
+GENERATED_SOURCES += qmp-marshal.c qapi-types.c qapi-visit.c trace/generated.c

# Don't try to regenerate Makefile or configure
# We don't generate any of them

Makefile +0 -0
@@ -252,9 +252,9 @@ clean:

rm -f *.a *.lo $(TOOLS) $(HELPERS-y) qemu-ga TAGS cscope.* *.pod *~ */*~ rm -Rf .libs
rm -f qemu-img-cmds.h

Makefile +0 -1
-	rm -f trace-dtrace.dtrace trace-dtrace.dtrace-timestamp

@# May not be present in GENERATED_HEADERS

Makefile +2 -1
-	rm -f trace-dtrace.h trace-dtrace.h-timestamp
+	rm -f trace/generated-dtrace.dtrace trace/generated-dtrace.dtrace-timestamp
+	rm -f trace/generated-dtrace.h trace/generated-dtrace.h-timestamp

rm -f $(foreach f,$(GENERATED_HEADERS),$(f) $(f)-timestamp) rm -f $(foreach f,$(GENERATED_SOURCES),$(f) $(f)-timestamp) rm -rf qapi-generated

Makefile.objs +0 -55
index 3c7abca..24832a2 100644
@@ -147,66 +147,7 @@ libdis-$(CONFIG_LM32_DIS) += lm32-dis.o
 ######################################################################
 # trace
 
-ifeq ($(TRACE_BACKEND),dtrace)
-TRACE_H_EXTRA_DEPS=trace-dtrace.h
-endif
-trace.h: trace.h-timestamp $(TRACE_H_EXTRA_DEPS)
-trace.h-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
-	$(call quiet-command,$(TRACETOOL) \
-		--format=h \
-		--backend=$(TRACE_BACKEND) \
-		< $< > $@,"  GEN   trace.h")
-	@cmp -s $@ trace.h || cp $@ trace.h
-
-trace.c: trace.c-timestamp
-trace.c-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
-	$(call quiet-command,$(TRACETOOL) \
-		--format=c \
-		--backend=$(TRACE_BACKEND) \
-		< $< > $@,"  GEN   trace.c")
-	@cmp -s $@ trace.c || cp $@ trace.c
-
-trace.o: trace.c $(GENERATED_HEADERS)
-
-trace-dtrace.h: trace-dtrace.dtrace
-	$(call quiet-command,dtrace -o $@ -h -s $<, "  GEN   trace-dtrace.h")
-
-# Normal practice is to name DTrace probe file with a '.d' extension
-# but that gets picked up by QEMU's Makefile as an external dependency
-# rule file. So we use '.dtrace' instead
-trace-dtrace.dtrace: trace-dtrace.dtrace-timestamp
-trace-dtrace.dtrace-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
-	$(call quiet-command,$(TRACETOOL) \
-		--format=d \
-		--backend=$(TRACE_BACKEND) \
-		< $< > $@,"  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
-
-trace-obj-$(CONFIG_TRACE_DEFAULT) += trace/default.o
-trace-obj-$(CONFIG_TRACE_SIMPLE) += trace/simple.o
Quoted 8 lines

Makefile.objs libdis-$(CONFIG_LM32_DIS) += lm32-dis.o · line 150

Quoted 6 lines
Makefile.objs +1 -5
-trace-obj-$(CONFIG_TRACE_SIMPLE) += qemu-timer-common.o
-trace-obj-$(CONFIG_TRACE_STDERR) += trace/stderr.o
-trace-obj-y += trace/control.o
-
-$(trace-obj-y): $(GENERATED_HEADERS)
+trace-obj-y += trace/

Please just put it into oslib-obj-y.

Quoted 1 line

You mean line "trace-obj-y += trace/"?

Yeah, make it

oslib-obj-y += trace/

and get rid of trace-obj-y.

Quoted 44 lines
Quoted 35 lines
Quoted 35 lines
Makefile.objs +2 -1
 ######################################################################
 # smartcard
@@ -250,5 +191,6 @@ nested-vars += \
 block-obj-y \
 user-obj-y \
 common-obj-y \
-	extra-obj-y
+	extra-obj-y \
+	trace-obj-y
 dummy := $(call unnest-vars)
scripts/tracetool/backend/dtrace.py +0 -0
index 23c43e2..0cbc68a 100644
@@ -37,7 +37,7 @@ def c(events):
 
 

def h(events):

scripts/tracetool/backend/dtrace.py +1 -1
-    out('#include "trace-dtrace.h"',
+    out('#include "trace/generated-dtrace.h"',

'')

for e in events:

trace/Makefile.objs new file +5 -0
new file mode 100644
index 0000000..d7e8cdf
@@ -0,0 +1,81 @@
+# -*- mode: makefile -*-
+
+trace/simple.o: trace/simple.c $(GENERATED_HEADERS)
+
+trace-obj-$(CONFIG_TRACE_DEFAULT) += default.o
Quoted 8 lines

trace/Makefile.objs line 7

Quoted 2 lines
trace/Makefile.objs new file +2 -0
+trace-obj-$(CONFIG_TRACE_SIMPLE) += simple.o
+trace-obj-$(CONFIG_TRACE_SIMPLE) += ../qemu-timer-common.o

Is this line needed? (Actually, it is obviously unneeded if you use oslib-obj-y). I am also worried that it causes duplicate symbols when you link in both qemu-timer-common.o and trace/../qemu-timer-common.o. The $(sort) invocation in the LINK macro of rules.mak will not treat these two paths as duplicate.

Quoted 3 lines

"trace-obj-y" is required by some binaries other than QEMU itself, as they use routines that require the tracing infrastructure (e.g., qemu-img, which only includes "qemu-timer-common.o" as a dependency through "tools-obj-y").

Yes, but they all use oslib-obj-y too. qemu-timer-common.o is part of oslib-obj-y.

Quoted 2 lines

I'm not sure how the subdir magic treats paths, but mapping all paths in final vars into their respective absolute path should simplify things.

Difficult to do in make. :(

Quoted 2 lines

In any case, compiling with backends none, stderr, and stdout turns up no linking problems.

And simple too? (I suppose stdout is a typo for simple).

Quoted 13 lines
Quoted 12 lines

trace/Makefile.objs line 15

Quoted 9 lines
trace/Makefile.objs new file +8 -0
+trace-obj-$(CONFIG_TRACE_STDERR) += stderr.o
+trace-obj-y += control.o
+
+
+######################################################################
+# Auto-generated tracing routines
+
+# NOTE: "trace.h" is kept in the top-level dir to shorten common include path

Ok, I'll take care of moving it to trace/ later when I do the same for all other includes.

Quoted 2 lines

I'll send a new version generating "trace/generated.h" and having "trace.h" just include it for now.

Ok, thanks.

Quoted 17 lines
Quoted 16 lines
Quoted 4 lines
trace/Makefile.objs new file +3 -0
+ifeq ($(TRACE_BACKEND),dtrace)
+TRACE_H_EXTRA_DEPS=trace/generated-dtrace.h
+endif

trace/Makefile.objs line 28

Quoted 10 lines
trace/Makefile.objs new file +10 -0
+trace.h: trace.h-timestamp $(TRACE_H_EXTRA_DEPS)
+trace.h-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
+	$(call quiet-command,$(TRACETOOL) \
+		--format=h \
+		--backend=$(TRACE_BACKEND) \
+		< $< > $@,"  GEN   trace.h")
+	@cmp -s $@ trace.h || cp $@ trace.h
+
+
+trace/generated.c: trace/generated.c-timestamp

Please use $(obj)/generated.c, and similarly for everything else.

Quoted 5 lines

Tried it, but "obj" is set to ".", although looking at "rules.mak" that should not be the case...

Inserting "$(error obj=$(obj))" in "trace/Makefile.objs" shows "./trace", but echoing "obj" in any of the rules shows ".".

In the rules it is, because the rules expand variables later when the command runs. But in the targets it should be evaluated correctly, because the targets expand variables earlier when they are read. As long as you use $@ and $< and $^ in the rules, you're safe. Anyway, this can be done later.

Quoted 3 lines

BTW, can I extend the GENERATED_HEADERS variable contents right from "trace/Makefile.objs" even though it's not explicitly included from the top-level makefile?

Hmm, risky. :) Need to look at the actual patch, let's do one thing at a time.

Quoted 2 lines

I'm sure this has already been previously discussed to the point of extenuation, but what are the reasons for not using autotools?

Autoconf -> no point, but someone needs to do the work.

Automake -> the build system is just too different.

Libtool -> using it already. :)

Paolo

#4 lore raw

Paolo Bonzini writes:
[...]

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

Makefile.objs libdis-$(CONFIG_LM32_DIS) += lm32-dis.o · line 150

Quoted 3 lines
Makefile.objs +1 -2
-
-$(trace-obj-y): $(GENERATED_HEADERS)
+trace-obj-y += trace/

Please just put it into oslib-obj-y.

Quoted 7 lines
Quoted 1 line

You mean line "trace-obj-y += trace/"?

Yeah, make it

oslib-obj-y += trace/

and get rid of trace-obj-y.

Mmm, but according to Makefile.objs:

oslib-obj-y is code depending on the OS (win32 vs posix)

[...]

Quoted 6 lines
Quoted 3 lines

"trace-obj-y" is required by some binaries other than QEMU itself, as they use routines that require the tracing infrastructure (e.g., qemu-img, which only includes "qemu-timer-common.o" as a dependency through "tools-obj-y").

Yes, but they all use oslib-obj-y too. qemu-timer-common.o is part of oslib-obj-y.

Removed. Still, see above.

Quoted 4 lines
Quoted 2 lines

I'm not sure how the subdir magic treats paths, but mapping all paths in final vars into their respective absolute path should simplify things.

Difficult to do in make. :(

Among many other things, AFAIR the linux kernel build system uses absolute paths, but I think it also uses make to get into each subdirectory (as opposed to QEMU), which I simplifies coding such a build system.

Quoted 4 lines
Quoted 2 lines

In any case, compiling with backends none, stderr, and stdout turns up no linking problems.

And simple too? (I suppose stdout is a typo for simple).

Yes, sorry.

Quoted 19 lines
Quoted 19 lines
Quoted 7 lines
Quoted 7 lines
trace/Makefile.objs new file +7 -0
+ifeq ($(TRACE_BACKEND),dtrace)
+TRACE_H_EXTRA_DEPS=trace/generated-dtrace.h
+endif
+trace.h: trace.h-timestamp $(TRACE_H_EXTRA_DEPS)
+trace.h-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
+	$(call quiet-command,$(TRACETOOL) \
+		--format=h \
Quoted 8 lines

trace/Makefile.objs line 28

Quoted 6 lines
trace/Makefile.objs new file +6 -0
+		--backend=$(TRACE_BACKEND) \
+		< $< > $@,"  GEN   trace.h")
+	@cmp -s $@ trace.h || cp $@ trace.h
+
+
+trace/generated.c: trace/generated.c-timestamp

Please use $(obj)/generated.c, and similarly for everything else.

Tried it, but "obj" is set to ".", although looking at "rules.mak" that should not be the case...

Quoted 8 lines
Quoted 2 lines

Inserting "$(error obj=$(obj))" in "trace/Makefile.objs" shows "./trace", but echoing "obj" in any of the rules shows ".".

In the rules it is, because the rules expand variables later when the command runs. But in the targets it should be evaluated correctly, because the targets expand variables earlier when they are read. As long as you use $@ and $< and $^ in the rules, you're safe. Anyway, this can be done later.

Ok, done. But this behaviour easily leads to errors. It might be safer to switch into a per-directory call to $(MAKE), although this would for sure be a completely different patch.

Quoted 6 lines
Quoted 3 lines

BTW, can I extend the GENERATED_HEADERS variable contents right from "trace/Makefile.objs" even though it's not explicitly included from the top-level makefile?

Hmm, risky. :) Need to look at the actual patch, let's do one thing at a time.

For now I'll leave it just as it is.

Quoted 8 lines
Quoted 2 lines

I'm sure this has already been previously discussed to the point of extenuation, but what are the reasons for not using autotools?

Autoconf -> no point, but someone needs to do the work.

Automake -> the build system is just too different.

Libtool -> using it already. :)

Ok, so it's not something against the suite per-se, but about porting work.

The thing I like about automake is that it provides a clear set of vars to manage the per-dir builds, thanks to using a per-dir $(MAKE); but I'm not sure how the per-target build would be managed (except by having a separate configure+make for each of them).

This could also be provided by having the QEMU build infrastructure use $(MAKE) to enter into each directory, and having it produce an ar file (or a set of them) with a "standard" name as a result (using libtool).

But I'm not sure how well would that work when building in Windows (is libtool available there?).

Thanks,
Lluis

Signature · 4 lines
 "And it's much the same thing with knowledge, for whenever you learn
 something new, the whole world becomes that much richer."
 -- The Princess of Pure Reason, as told by Norton Juster in The Phantom
 Tollbooth
#5 lore raw
Quoted 10 lines
Quoted 6 lines

Yeah, make it

oslib-obj-y += trace/

and get rid of trace-obj-y.

Mmm, but according to Makefile.objs:

oslib-obj-y is code depending on the OS (win32 vs posix)

True... I'd like to simplify this jungle sooner or later though.

We can keep trace-obj-y, but please do leave out qemu-timer-common.o

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

I'm not sure how the subdir magic treats paths, but mapping all paths in final vars into their respective absolute path should simplify things.

Difficult to do in make. :(

Among many other things, AFAIR the linux kernel build system uses absolute paths, but I think it also uses make to get into each subdirectory (as opposed to QEMU), which I simplifies coding such a build system.

We already use recursive make to compile each target. I think the current QEMU build system is a good balance between non-recursive and recursive make.

Quoted 10 lines
Quoted 8 lines

I'm sure this has already been previously discussed to the point of extenuation, but what are the reasons for not using autotools?

Autoconf -> no point, but someone needs to do the work.

Automake -> the build system is just too different.

Libtool -> using it already. :)

Quoted 6 lines

Ok, so it's not something against the suite per-se, but about porting work.

The thing I like about automake is that it provides a clear set of vars to manage the per-dir builds, thanks to using a per-dir $(MAKE); but I'm not sure how the per-target build would be managed (except by having a separate configure+make for each of them).

Yes, that would be it. Even an autoconf conversion probably would have to use separate configure scripts for the global project and for each target.

Quoted 3 lines

This could also be provided by having the QEMU build infrastructure use $(MAKE) to enter into each directory, and having it produce an ar file (or a set of them) with a "standard" name as a result (using libtool).

Doesn't need to use libtool. Static libraries are just fine. The problem is that ar doesn't work well with constructors, which we use for module.c. It is what QEMU used to use, but Andreas moved away a couple of years ago and I think it is an improvement.

Quoted 2 lines

But I'm not sure how well would that work when building in Windows (is libtool available there?).

Yes.

Paolo

#6 lore raw
Quoted 6 lines · Paolo Bonzini
Quoted 6 lines
Quoted 5 lines

Yeah, make it

oslib-obj-y += trace/

and get rid of trace-obj-y.

Quoted 7 lines
Quoted 3 lines

Mmm, but according to Makefile.objs:

oslib-obj-y is code depending on the OS (win32 vs posix)

True... I'd like to simplify this jungle sooner or later though.

We can keep trace-obj-y, but please do leave out qemu-timer-common.o

Done, I'll send v2 later today.

[...]

Quoted 10 lines
Quoted 10 lines
Quoted 8 lines

I'm sure this has already been previously discussed to the point of extenuation, but what are the reasons for not using autotools?

Autoconf -> no point, but someone needs to do the work.

Automake -> the build system is just too different.

Libtool -> using it already. :)

Quoted 8 lines
Quoted 6 lines

Ok, so it's not something against the suite per-se, but about porting work.

The thing I like about automake is that it provides a clear set of vars to manage the per-dir builds, thanks to using a per-dir $(MAKE); but I'm not sure how the per-target build would be managed (except by having a separate configure+make for each of them).

Yes, that would be it.

I'd certainly love to see something along those lines for the sake of makefile simplicity.

Quoted 2 lines

Even an autoconf conversion probably would have to use separate configure scripts for the global project and for each target.

If you're willing to pay for a complete recompilation for each target you can just have a single configure file.

Quoted 8 lines
Quoted 3 lines

This could also be provided by having the QEMU build infrastructure use $(MAKE) to enter into each directory, and having it produce an ar file (or a set of them) with a "standard" name as a result (using libtool).

Doesn't need to use libtool. Static libraries are just fine. The problem is that ar doesn't work well with constructors, which we use for module.c. It is what QEMU used to use, but Andreas moved away a couple of years ago and I think it is an improvement.

Ah, I know that one in gcc :)

-Wl,--whole-archive foo.a -Wl,--no-whole-archive

Thanks,
Lluis

Signature · 4 lines
 "And it's much the same thing with knowledge, for whenever you learn
 something new, the whole world becomes that much richer."
 -- The Princess of Pure Reason, as told by Norton Juster in The Phantom
 Tollbooth
#7 lore raw

Il 14/12/2012 14:46, Lluís Vilanova ha scritto:

Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

The thing I like about automake is that it provides a clear set of vars to manage the per-dir builds, thanks to using a per-dir $(MAKE); but I'm not sure how the per-target build would be managed (except by having a separate configure+make for each of them).
Yes, that would be it.

I'd certainly love to see something along those lines for the sake of makefile simplicity.

QEMU is complex enough that I'm not really sure what Automake would buy.

Quoted 4 lines
Quoted 2 lines
Quoted 2 lines

Even an autoconf conversion probably would have to use separate configure scripts for the global project and for each target.

If you're willing to pay for a complete recompilation for each target you can just have a single configure file.

That's not the problem. The problem is that Autoconf does not lend well to the style of the QEMU build system, with many subparts that are enabled/disabled at configure time.

Quoted 3 lines

Ah, I know that one in gcc

-Wl,--whole-archive foo.a -Wl,--no-whole-archive

Really in ld (that's what -Wl does) and not very portable...

Paolo

#8 lore raw
Quoted 11 lines · Paolo Bonzini

Il 14/12/2012 14:46, Lluís Vilanova ha scritto:

Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

The thing I like about automake is that it provides a clear set of vars to manage the per-dir builds, thanks to using a per-dir $(MAKE); but I'm not sure how the per-target build would be managed (except by having a separate configure+make for each of them).
Yes, that would be it.

I'd certainly love to see something along those lines for the sake of makefile simplicity.

QEMU is complex enough that I'm not really sure what Automake would buy.

I'm just talking about having a build system (automake or not) that uses some "standard" set of vars to establish what to do, plus per-directory make to simplify management of per-directory vars (if ever needed).

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines

Even an autoconf conversion probably would have to use separate configure scripts for the global project and for each target.

If you're willing to pay for a complete recompilation for each target you can just have a single configure file.

That's not the problem. The problem is that Autoconf does not lend well to the style of the QEMU build system, with many subparts that are enabled/disabled at configure time.

Well, for that you have conditional compilation. The linux style (obj-y) is easier to understand, but AFAIR automake provided broader features.

Quoted 5 lines
Quoted 3 lines

Ah, I know that one in gcc

-Wl,--whole-archive foo.a -Wl,--no-whole-archive

Really in ld (that's what -Wl does) and not very portable...

I know, but I had no idea about the portability issues.

Again, don't take it as an intent to start some autotools flame, I was just curious :)

Lluis

Signature · 4 lines
 "And it's much the same thing with knowledge, for whenever you learn
 something new, the whole world becomes that much richer."
 -- The Princess of Pure Reason, as told by Norton Juster in The Phantom
 Tollbooth