From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47645) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WiO4T-0003lX-8A for qemu-devel@nongnu.org; Thu, 08 May 2014 09:09:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WiO4K-0004m7-32 for qemu-devel@nongnu.org; Thu, 08 May 2014 09:09:09 -0400 Received: from mail-wg0-x229.google.com ([2a00:1450:400c:c00::229]:36328) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WiO4J-0004lx-Ri for qemu-devel@nongnu.org; Thu, 08 May 2014 09:08:59 -0400 Received: by mail-wg0-f41.google.com with SMTP id z12so2440495wgg.0 for ; Thu, 08 May 2014 06:08:58 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Thu, 8 May 2014 15:08:46 +0200 Message-Id: <1399554527-22262-2-git-send-email-pbonzini@redhat.com> In-Reply-To: <1399554527-22262-1-git-send-email-pbonzini@redhat.com> References: <1399554527-22262-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 1/2] build: simplify and fix fix-obj-vars List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: mjt@tls.msk.ru fix-obj-vars has the undesired side effect of breaking -cflags -objs and -libs variables in the toplevel Makefile.objs. The variables in the toplevel Makefile.objs do not need any fix, so fix-obj-vars need not do anything. Since we are touching it, remove the now unnecessary $(if) in the callers. Signed-off-by: Paolo Bonzini --- rules.mak | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/rules.mak b/rules.mak index c0c3d86..26014c5 100644 --- a/rules.mak +++ b/rules.mak @@ -175,16 +175,17 @@ $(eval save-$2-$1 :=) endef define fix-obj-vars -$(foreach v,$($1), \ +$(if $2, + $(foreach v,$($1), \ $(if $($v-cflags), \ - $(eval $2$v-cflags := $($v-cflags)) \ + $(eval $2/$v-cflags := $($v-cflags)) \ $(eval $v-cflags := )) \ $(if $($v-libs), \ - $(eval $2$v-libs := $($v-libs)) \ + $(eval $2/$v-libs := $($v-libs)) \ $(eval $v-libs := )) \ $(if $($v-objs), \ - $(eval $2$v-objs := $(addprefix $2,$($v-objs))) \ - $(eval $v-objs := ))) + $(eval $2/$v-objs := $(addprefix $2/,$($v-objs))) \ + $(eval $v-objs := )))) endef define unnest-dir @@ -192,7 +193,7 @@ $(foreach var,$(nested-vars),$(call push-var,$(var),$1/)) $(eval obj-parent-$1 := $(obj)) $(eval obj := $(if $(obj),$(obj)/$1,$1)) $(eval include $(SRC_PATH)/$1/Makefile.objs) -$(foreach v,$(nested-vars),$(call fix-obj-vars,$v,$(if $(obj),$(obj)/))) +$(foreach v,$(nested-vars),$(call fix-obj-vars,$v,$(obj))) $(eval obj := $(obj-parent-$1)) $(eval obj-parent-$1 := ) $(foreach var,$(nested-vars),$(call pop-var,$(var),$1/)) @@ -228,7 +229,7 @@ endef define unnest-vars $(eval obj := $1) $(eval nested-vars := $2) -$(foreach v,$(nested-vars),$(call fix-obj-vars,$v,$(if $(obj),$(obj)/))) +$(foreach v,$(nested-vars),$(call fix-obj-vars,$v,$(obj))) $(eval old-nested-dirs := ) $(call unnest-vars-1) $(if $1,$(foreach v,$(nested-vars),$(eval \ -- 1.8.3.1