From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40292) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHqT9-0002YR-LD for qemu-devel@nongnu.org; Fri, 06 Sep 2013 03:28:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VHqT3-0008VS-3W for qemu-devel@nongnu.org; Fri, 06 Sep 2013 03:28:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:15379) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHqT2-0008V7-JT for qemu-devel@nongnu.org; Fri, 06 Sep 2013 03:28:32 -0400 From: Fam Zheng Date: Fri, 6 Sep 2013 15:28:06 +0800 Message-Id: <1378452491-20467-2-git-send-email-famz@redhat.com> In-Reply-To: <1378452491-20467-1-git-send-email-famz@redhat.com> References: <1378452491-20467-1-git-send-email-famz@redhat.com> Subject: [Qemu-devel] [RFC PATCH v2 1/6] make.rule: fix $(obj) to a real relative path List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, famz@redhat.com, mjt@tls.msk.ru, stefanha@redhat.com, pbonzini@redhat.com, vilanova@ac.upc.edu, rth@twiddle.net Makefile.target includes rule.mak and unnested common-obj-y, then prefix them with '../', this will ignore object specific QEMU_CFLAGS in subdir Makefile.objs: $(obj)/curl.o: QEMU_CFLAGS += $(CURL_CFLAGS) Because $(obj) here is './block', instead of '../block'. This doesn't hurt compiling because we basically build all .o from top Makefile, before entering Makefile.target, but it will affact arriving per-object libs support. The starting point of $(obj) is fixed in $(obj-base) before including ./Makefile.objs, to get consistency with nested Makefile rules in target rule and variable definition. Signed-off-by: Fam Zheng --- Makefile.target | 3 ++- rules.mak | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Makefile.target b/Makefile.target index 9a49852..0ab60bd 100644 --- a/Makefile.target +++ b/Makefile.target @@ -144,12 +144,13 @@ endif # CONFIG_SOFTMMU %/translate.o: QEMU_CFLAGS += $(TRANSLATE_OPT_CFLAGS) nested-vars += obj-y +obj-base := .. # This resolves all nested paths, so it must come last include $(SRC_PATH)/Makefile.objs all-obj-y = $(obj-y) -all-obj-y += $(addprefix ../, $(common-obj-y)) +all-obj-y += $(addprefix $(obj)/, $(common-obj-y)) ifndef CONFIG_HAIKU LIBS+=-lm diff --git a/rules.mak b/rules.mak index 4499745..eef1b71 100644 --- a/rules.mak +++ b/rules.mak @@ -103,7 +103,7 @@ clean: clean-timestamp # magic to descend into other directories -obj := . +obj = $(obj-base) old-nested-dirs := define push-var @@ -119,9 +119,10 @@ endef define unnest-dir $(foreach var,$(nested-vars),$(call push-var,$(var),$1/)) -$(eval obj := $(obj)/$1) +$(eval old-obj := $(obj)) +$(eval obj := $(if $(obj),$(obj)/$1,$1)) $(eval include $(SRC_PATH)/$1/Makefile.objs) -$(eval obj := $(patsubst %/$1,%,$(obj))) +$(eval obj := $(old-obj)) $(foreach var,$(nested-vars),$(call pop-var,$(var),$1/)) endef -- 1.8.3.1