Patchwork [RFC,1/4] build-sys: strip leading ./ from $(obj)

login
register
mail settings
Submitter Michael Tokarev
Date June 18, 2013, 5:34 p.m.
Message ID <1371576844-28743-2-git-send-email-mjt@msgid.tls.msk.ru>
Download mbox | patch
Permalink /patch/252391/
State New
Headers show

Comments

Michael Tokarev - June 18, 2013, 5:34 p.m.
This change modifies the way how subdir objects are handled.
Previously, $(obj) make variable were starting with `.' (current
directory), and were appended `/subdir' when recursing into subdirs,
so that actual objects in top level dir were named ./obj and in
subdirs - ./subdir/obj.  Remove the `./' suffix and make it plain,
so that file names in variables will match those in objects/flags.

This allows to have, for example, per-object link flags
(to be added in subsequent patches).

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 audio/Makefile.objs    |    4 ++--
 backends/Makefile.objs |    2 +-
 block/Makefile.objs    |    2 +-
 hw/audio/Makefile.objs |    2 +-
 rules.mak              |    6 +++---
 trace/Makefile.objs    |   26 +++++++++++++-------------
 ui/Makefile.objs       |    6 +++---
 7 files changed, 24 insertions(+), 24 deletions(-)

Patch

diff --git a/audio/Makefile.objs b/audio/Makefile.objs
index d71a877..6ce7409 100644
--- a/audio/Makefile.objs
+++ b/audio/Makefile.objs
@@ -13,5 +13,5 @@  common-obj-$(CONFIG_AUDIO_PT_INT) += audio_pt_int.o
 common-obj-$(CONFIG_AUDIO_WIN_INT) += audio_win_int.o
 common-obj-y += wavcapture.o
 
-$(obj)/audio.o $(obj)/fmodaudio.o: QEMU_CFLAGS += $(FMOD_CFLAGS)
-$(obj)/sdlaudio.o: QEMU_CFLAGS += $(SDL_CFLAGS)
+$(obj)audio.o $(obj)fmodaudio.o: QEMU_CFLAGS += $(FMOD_CFLAGS)
+$(obj)sdlaudio.o: QEMU_CFLAGS += $(SDL_CFLAGS)
diff --git a/backends/Makefile.objs b/backends/Makefile.objs
index 42557d5..5a172d9 100644
--- a/backends/Makefile.objs
+++ b/backends/Makefile.objs
@@ -3,6 +3,6 @@  common-obj-$(CONFIG_POSIX) += rng-random.o
 
 common-obj-y += msmouse.o
 common-obj-$(CONFIG_BRLAPI) += baum.o
-$(obj)/baum.o: QEMU_CFLAGS += $(SDL_CFLAGS) 
+$(obj)baum.o: QEMU_CFLAGS += $(SDL_CFLAGS) 
 
 common-obj-$(CONFIG_TPM) += tpm.o
diff --git a/block/Makefile.objs b/block/Makefile.objs
index 2981654..7b7189c 100644
--- a/block/Makefile.objs
+++ b/block/Makefile.objs
@@ -22,4 +22,4 @@  common-obj-y += stream.o
 common-obj-y += commit.o
 common-obj-y += mirror.o
 
-$(obj)/curl.o: QEMU_CFLAGS+=$(CURL_CFLAGS)
+$(obj)curl.o: QEMU_CFLAGS+=$(CURL_CFLAGS)
diff --git a/hw/audio/Makefile.objs b/hw/audio/Makefile.objs
index 7ce85a2..8dd9827 100644
--- a/hw/audio/Makefile.objs
+++ b/hw/audio/Makefile.objs
@@ -15,4 +15,4 @@  common-obj-$(CONFIG_CS4231) += cs4231.o
 common-obj-$(CONFIG_MARVELL_88W8618) += marvell_88w8618.o
 common-obj-$(CONFIG_MILKYMIST) += milkymist-ac97.o
 
-$(obj)/adlib.o $(obj)/fmopl.o: QEMU_CFLAGS += -DBUILD_Y8950=0
+$(obj)adlib.o $(obj)fmopl.o: QEMU_CFLAGS += -DBUILD_Y8950=0
diff --git a/rules.mak b/rules.mak
index 4499745..a6bb4f1 100644
--- a/rules.mak
+++ b/rules.mak
@@ -103,7 +103,7 @@  clean: clean-timestamp
 
 # magic to descend into other directories
 
-obj := .
+obj :=
 old-nested-dirs :=
 
 define push-var
@@ -119,9 +119,9 @@  endef
 
 define unnest-dir
 $(foreach var,$(nested-vars),$(call push-var,$(var),$1/))
-$(eval obj := $(obj)/$1)
+$(eval obj := $(obj)$1/)
 $(eval include $(SRC_PATH)/$1/Makefile.objs)
-$(eval obj := $(patsubst %/$1,%,$(obj)))
+$(eval obj := $(patsubst %$1/,%,$(obj)))
 $(foreach var,$(nested-vars),$(call pop-var,$(var),$1/))
 endef
 
diff --git a/trace/Makefile.objs b/trace/Makefile.objs
index 3b88e49..5588506 100644
--- a/trace/Makefile.objs
+++ b/trace/Makefile.objs
@@ -3,16 +3,16 @@ 
 ######################################################################
 # Auto-generated event descriptions
 
-$(obj)/generated-events.h: $(obj)/generated-events.h-timestamp
-$(obj)/generated-events.h-timestamp: $(SRC_PATH)/trace-events
+$(obj)generated-events.h: $(obj)generated-events.h-timestamp
+$(obj)generated-events.h-timestamp: $(SRC_PATH)/trace-events
 	$(call quiet-command,$(TRACETOOL) \
 		--format=events-h \
 		--backend=events \
 		< $< > $@,"  GEN   $(patsubst %-timestamp,%,$@)")
 	@cmp -s $@ $(patsubst %-timestamp,%,$@) || cp $@ $(patsubst %-timestamp,%,$@)
 
-$(obj)/generated-events.c: $(obj)/generated-events.c-timestamp $(BUILD_DIR)/config-host.mak
-$(obj)/generated-events.c-timestamp: $(SRC_PATH)/trace-events
+$(obj)generated-events.c: $(obj)generated-events.c-timestamp $(BUILD_DIR)/config-host.mak
+$(obj)generated-events.c-timestamp: $(SRC_PATH)/trace-events
 	$(call quiet-command,$(TRACETOOL) \
 		--format=events-c \
 		--backend=events \
@@ -25,9 +25,9 @@  util-obj-y += generated-events.o
 ######################################################################
 # Auto-generated tracing routines
 
-$(obj)/generated-tracers.h: $(obj)/generated-tracers.h-timestamp
+$(obj)generated-tracers.h: $(obj)generated-tracers.h-timestamp
 	@cmp -s $< $@ || cp $< $@
-$(obj)/generated-tracers.h-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
+$(obj)generated-tracers.h-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
 	$(call quiet-command,$(TRACETOOL) \
 		--format=h \
 		--backend=$(TRACE_BACKEND) \
@@ -37,15 +37,15 @@  $(obj)/generated-tracers.h-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/conf
 # Auto-generated tracing routines (non-DTrace)
 
 ifneq ($(TRACE_BACKEND),dtrace)
-$(obj)/generated-tracers.c: $(obj)/generated-tracers.c-timestamp
+$(obj)generated-tracers.c: $(obj)generated-tracers.c-timestamp
 	@cmp -s $< $@ || cp $< $@
-$(obj)/generated-tracers.c-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
+$(obj)generated-tracers.c-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
 	$(call quiet-command,$(TRACETOOL) \
 		--format=c \
 		--backend=$(TRACE_BACKEND) \
 		< $< > $@,"  GEN   $(patsubst %-timestamp,%,$@)")
 
-$(obj)/generated-tracers.o: $(obj)/generated-tracers.c $(obj)/generated-tracers.h
+$(obj)generated-tracers.o: $(obj)generated-tracers.c $(obj)generated-tracers.h
 endif
 
 
@@ -56,18 +56,18 @@  endif
 # but that gets picked up by QEMU's Makefile as an external dependency
 # rule file. So we use '.dtrace' instead
 ifeq ($(TRACE_BACKEND),dtrace)
-$(obj)/generated-tracers.dtrace: $(obj)/generated-tracers.dtrace-timestamp
-$(obj)/generated-tracers.dtrace-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
+$(obj)generated-tracers.dtrace: $(obj)generated-tracers.dtrace-timestamp
+$(obj)generated-tracers.dtrace-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
 	$(call quiet-command,$(TRACETOOL) \
 		--format=d \
 		--backend=$(TRACE_BACKEND) \
 		< $< > $@,"  GEN   $(patsubst %-timestamp,%,$@)")
 	@cmp -s $@ $(patsubst %-timestamp,%,$@) || cp $@ $(patsubst %-timestamp,%,$@)
 
-$(obj)/generated-tracers-dtrace.h: $(obj)/generated-tracers.dtrace
+$(obj)generated-tracers-dtrace.h: $(obj)generated-tracers.dtrace
 	$(call quiet-command,dtrace -o $@ -h -s $<, "  GEN   $@")
 
-$(obj)/generated-tracers.o: $(obj)/generated-tracers.dtrace
+$(obj)generated-tracers.o: $(obj)generated-tracers.dtrace
 endif
 
 ######################################################################
diff --git a/ui/Makefile.objs b/ui/Makefile.objs
index 6ddc0de..7265c42 100644
--- a/ui/Makefile.objs
+++ b/ui/Makefile.objs
@@ -15,8 +15,8 @@  common-obj-$(CONFIG_CURSES) += curses.o
 common-obj-$(CONFIG_VNC) += $(vnc-obj-y)
 common-obj-$(CONFIG_GTK) += gtk.o x_keymap.o
 
-$(obj)/sdl.o $(obj)/sdl_zoom.o: QEMU_CFLAGS += $(SDL_CFLAGS) 
+$(obj)sdl.o $(obj)sdl_zoom.o: QEMU_CFLAGS += $(SDL_CFLAGS) 
 
-$(obj)/cocoa.o: $(SRC_PATH)/$(obj)/cocoa.m
+$(obj)cocoa.o: $(SRC_PATH)/$(obj)cocoa.m
 
-$(obj)/gtk.o: QEMU_CFLAGS += $(GTK_CFLAGS) $(VTE_CFLAGS)
+$(obj)gtk.o: QEMU_CFLAGS += $(GTK_CFLAGS) $(VTE_CFLAGS)