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

Reply via email to