From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35618) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yq0rY-0004oD-Cc for qemu-devel@nongnu.org; Wed, 06 May 2015 11:03:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yq0rU-000879-KS for qemu-devel@nongnu.org; Wed, 06 May 2015 11:03:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39263) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yq0rU-00086s-9v for qemu-devel@nongnu.org; Wed, 06 May 2015 11:03:48 -0400 Message-ID: <554A2D4B.1050605@redhat.com> Date: Wed, 06 May 2015 17:03:39 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1430920000-31229-1-git-send-email-famz@redhat.com> <554A2012.2080109@redhat.com> <20150506142315.GA1535@ad.nay.redhat.com> <554A26EE.7050108@redhat.com> <20150506150149.GC1535@ad.nay.redhat.com> In-Reply-To: <20150506150149.GC1535@ad.nay.redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] rules.mak: Force CFLAGS for all objects in DSO List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: Peter Maydell , agraf@suse.de, Michael Tokarev , qemu-devel@nongnu.org, Stefan Weil On 06/05/2015 17:01, Fam Zheng wrote: >> > -%$(DSOSUF): CFLAGS += -fPIC -DBUILD_DSO >> > +%.mo: CFLAGS += -fPIC -DBUILD_DSO > I believe this will propagate the flags correctly. However that will affect > non-module build, so I didn't want to do it unconditionally. You're right. You'd need something like $(call lif $(CONFIG_MODULES), -fPIC -DBUILD_DSO) instead. >> > (and if so move the rule down, above "%.mo:")? If you cannot use >> > foo.mo, foo.mo also doesn't use CFLAGS in its rules, and you should be >> > able to remove foo.mo too. >> > >> > - so the other possibility is to just use $(foreach o,$($v),$($o-objs)). >> > In this case there's already a convenient $(foreach) just above, and >> > you can just add another $(eval) inside it. >> > >> > - and if that is true, you do not need .PHONY either because you have >> > $(foreach ... $(eval)) instead of $(eval $(foreach)). >> > > OK. > > It's been a long day for me, so you can see that I'm going defensive with the > code I'm writing, but yes, your last "if" looks about right, except we still > need the "$(if $(CONFIG_MODULES),...)". Understood entirely. But there's no hurry, sleep over it and take your time to test it tomorrow. > Sanity check: is -fPIC only ever needed in compiling, but not in (partial) > linking, right? Yes. It's LDFLAGS_SHARED that is used in linking (and nothing in partial linking). Paolo