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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -