Makefile variables using include directive and targe specific variable -
here simple test , cannot understand wrong:
file makefile.inc
msg = myprog: use_foo = 1 ifeq ($(use_foo), 1) msg += using foo else msg += not using foo endif file makefile
include makefile.inc all: myprog myprog: @echo "use_foo = $(use_foo)" @echo $(msg) and obtain:
$> make use_foo = 1 not using foo could tell me please, why message not "i using foo" ?
the ifeq not evaluated in context of target myprog, evaluated false , msg set "i not using foo."
you instead use file makefile.inc:
msg = not using foo myprog: use_foo = 1 myprog: msg=i using foo
Comments
Post a Comment