This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] Update minimum make version to 3.81

On 06/24/2016 10:50 PM, Mike Frysinger wrote:
On 24 Jun 2016 22:11, Florian Weimer wrote:
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.

$ cat Makefile
tests = a
check: $(tests)
$(tests): CPPFLAGS += FOO
a: a.o
	echo $(CPPFLAGS)

$ make
echo 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).

that might be the case, as well as the other way around: if a lib
is rebuilt via the tests dep, it'll have that flag added.

It turns out that the targets are prefixed with $(objpfx), so I do have to use

$(tests:%=$(objpfx)%): CPPFLAGS += -DTEST_NO_MALLOPT

At this point, I can well add the trailing .o, to cut down the magic somewhat.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]