From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46249) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WnpbG-00032x-FL for qemu-devel@nongnu.org; Fri, 23 May 2014 09:33:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wnpb8-0004FJ-Cl for qemu-devel@nongnu.org; Fri, 23 May 2014 09:33:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45270) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wnpb8-0004FA-4M for qemu-devel@nongnu.org; Fri, 23 May 2014 09:33:22 -0400 Date: Fri, 23 May 2014 21:33:28 +0800 From: Fam Zheng Message-ID: <20140523133328.GA12112@T430.nay.redhat.com> References: <1399987445-6042-1-git-send-email-famz@redhat.com> <537F4B81.4050702@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <537F4B81.4050702@redhat.com> Subject: Re: [Qemu-devel] [PATCH v2] rules.mak: Rewrite unnest-vars List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Peter Maydell , Richard Henderson , mjt@tls.msk.ru, qemu-devel@nongnu.org, Micael Roth On Fri, 05/23 15:22, Paolo Bonzini wrote: > Just one question: > > >+# fix-paths > >+# Usage: $(call fix-paths, obj_path, src_path, vars) > >+# Add prefix @obj_path to all objects in @vars, and add prefix @src_path to all > >+# directories in @vars. > >+define fix-paths > >+ $(foreach v,$3, > >+ $(foreach o,$($v), > >+ $(if $($o-libs), > >+ $(eval $1$o-libs := $(value $o-libs))) > >+ $(if $($o-cflags), > >+ $(eval $1$o-cflags := $(value $o-cflags))) > >+ $(if $($o-objs), > >+ $(eval $1$o-objs := $(addprefix $1,$(value $o-objs))))) > >+ $(eval $v := $(addprefix $1,$(filter-out %/,$(value $v))) \ > >+ $(addprefix $2,$(filter %/,$(value $v))))) > > Why $(value $v) here in? I think you need to expand the variable, > especially in the last assignment but possibly also in the others. For > example if you have > > OBJECTS = foo1.o foo2.o > foo.mo-objs = $(OBJECTS) > > the addprefix would set > > foo.mo-objs = dir/$(OBJECTS) > > which is wrong. Good catch! I'll fix this. Thanks for reviewing! Fam