From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56171) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WnpyF-0007ML-UL for qemu-devel@nongnu.org; Fri, 23 May 2014 09:57:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wnpy7-0006RE-8A for qemu-devel@nongnu.org; Fri, 23 May 2014 09:57:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:14368) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wnpy6-0006Qk-UR for qemu-devel@nongnu.org; Fri, 23 May 2014 09:57:07 -0400 Message-ID: <537F53AB.1040202@redhat.com> Date: Fri, 23 May 2014 15:56:59 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1399987445-6042-1-git-send-email-famz@redhat.com> <537F4B81.4050702@redhat.com> <20140523133328.GA12112@T430.nay.redhat.com> In-Reply-To: <20140523133328.GA12112@T430.nay.redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2] rules.mak: Rewrite unnest-vars List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: Peter Maydell , Richard Henderson , mjt@tls.msk.ru, qemu-devel@nongnu.org, Micael Roth Il 23/05/2014 15:33, Fam Zheng ha scritto: > 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! Since you'll send v2, please indent with 4 spaces too! Paolo