diff mbox

[1/2] build: Always have 'BUILD_DIR' variable pointing to the root of the build tree

Message ID 20110915171658.23325.116.stgit@ginnungagap.bsc.es
State New
Headers show

Commit Message

Lluís Vilanova Sept. 15, 2011, 5:16 p.m. UTC
---
 Makefile |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

Comments

Richard Henderson Sept. 15, 2011, 7:31 p.m. UTC | #1
On 09/15/2011 10:16 AM, Lluís Vilanova wrote:
> 
> ---
>  Makefile |   11 +++++++----
>  1 files changed, 7 insertions(+), 4 deletions(-)

This is going to get bounced back to you because of no Signed-off-by, but:

Acked-by: Richard Henderson <rth@twiddle.net>


r~
Paolo Bonzini Sept. 15, 2011, 8:11 p.m. UTC | #2
On 09/15/2011 07:16 PM, Lluís Vilanova wrote:
>   subdir-%: $(GENERATED_HEADERS)
> -	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,)
> +	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" BUILD_DIR=$(BUILD_DIR) TARGET_DIR="$*/" all,)

Since you have to add the s-o-b line anyway, please add BUILD_DIR to 
SUBDIR_MAKEFLAGS instead.

Paolo
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 7e9382f..97b26c6 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,8 @@ 
 # Makefile for QEMU.
 
+# Always point to the root of the build tree
+BUILD_DIR=$(PWD)
+
 GENERATED_HEADERS = config-host.h trace.h qemu-options.def
 ifeq ($(TRACE_BACKEND),dtrace)
 GENERATED_HEADERS += trace-dtrace.h
@@ -81,7 +84,7 @@  qemu-options.def: $(SRC_PATH)/qemu-options.hx
 SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
 
 subdir-%: $(GENERATED_HEADERS)
-	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,)
+	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" BUILD_DIR=$(BUILD_DIR) TARGET_DIR="$*/" all,)
 
 ifneq ($(wildcard config-host.mak),)
 include $(SRC_PATH)/Makefile.objs
@@ -96,7 +99,7 @@  $(filter %-user,$(SUBDIR_RULES)): $(GENERATED_HEADERS) $(trace-obj-y) subdir-lib
 
 ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS))
 romsubdir-%:
-	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C pc-bios/$* V="$(V)" TARGET_DIR="$*/",)
+	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C pc-bios/$* V="$(V)" BUILD_DIR=$(BUILD_DIR) TARGET_DIR="$*/",)
 
 ALL_SUBDIRS=$(TARGET_DIRS) $(patsubst %,pc-bios/%, $(ROMS))
 
@@ -132,10 +135,10 @@  install-libcacard:
 	@echo "libtool is missing, please install and rerun configure"; exit 1
 else
 libcacard.la: $(GENERATED_HEADERS) $(oslib-obj-y) qemu-timer-common.o $(addsuffix .lo, $(basename $(trace-obj-y)))
-	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C libcacard V="$(V)" TARGET_DIR="$*/" libcacard.la,)
+	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C libcacard V="$(V)" BUILD_DIR=$(BUILD_DIR) TARGET_DIR="$*/" libcacard.la,)
 
 install-libcacard: libcacard.la
-	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C libcacard V="$(V)" TARGET_DIR="$*/" install-libcacard,)
+	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C libcacard V="$(V)" BUILD_DIR=$(BUILD_DIR) TARGET_DIR="$*/" install-libcacard,)
 endif
 ######################################################################