[RFC] Update minimum make version to 3.81

Florian Weimer fweimer@redhat.com
Fri Jun 24 20:11:00 GMT 2016


On 06/24/2016 08:46 PM, Mike Frysinger wrote:

>>> what about using target-specific variables and relying on inheritance [1] ?
>>> does this work ?
>>> $(tests): CPPFLAGS += ...
>>
>> It would have to be something like:
>>
>> $(tests:%=$(objpfx)%.o): CPPFLAGS += -DTEST_NO_MALLOPT
>
> did you verify that ?  target-specific variables inherit across targets.
>
> example:
> $ cat Makefile
> tests = a
> check: $(tests)
> $(tests): CPPFLAGS += FOO
> a: a.o
> a.o:
> 	echo $(CPPFLAGS)
> 	false
>
> $ make
> echo FOO
> FOO
> ...

Oh wow.  It does work (even with make 3.81).

But how is this a good idea?  It means that if a target match %.o is 
built not via $(tests), but as a prerequisite of another target, the 
variable is not applied (and the target is not rebuilt for the other 
dependency chain, I assume).

I suppose it's unlikely that developers will try to rebuild individual 
.o files in subdirectories.  But my, what an obscure make feature!

Florian



More information about the Libc-alpha mailing list