variable in Makefile not recognized by make correctly -


here related rules variable:

libad = libadard.a  install: $(crslib)/$(libad)  $(crslib)/$(libad): $(libad)  $(libad): $(objects1)   objects1 = $(libad)(libadardv.o)\     $(libad)(a_delbb.o)     $(libad)(a_getbkm.o)\     ...  $(libad)(a_getbkm.o): a_getbkm.p \     $(kincdir)/dbug.h \     $(priminc)/systypes.h \     $(priminc)/externs.h \     $(priminc)/reserrs.h \     $(kincdir)/ltypes.h \     $(kincdir)/except.h \     $(priminc)/u_pr_bkmsg.h \     $(crsinc)/sqlerrs.h \     $(pdbinc)/systypes.th \     $(priminc)/u_pr_bkmsg.th \     $(informinc)/sqlca.h 

if run "make install", here's got:

make: *** no rule make target `/sqlca.h', needed `libadard.a(a_getbkm.o)'.  stop. 

for testing purpose, added rule in makefile check value of variable $(informinc):

phony: all: ; @echo $(informinc)     

and output correct:

mtang@rv02 release>make /informix-rv02_1/incl/esql 

i checked under directory "/informix-rv02_1/incl/esql", file sqlca.h there. went wrong?

update:

variable $(informinc) not defined in makefile. defined in makerules file sitting @ root level, , makerules included makefile:

include ../../makerules 

update 2:

problem solved. @roland illig clue. in makerules, informinc defined as:

informixdir := $(my_informixdir) informix := $(informixdir) informinc := $(informix)/incl/esql 

i copied last line informinc defined , paste in makefile. , worked. not sure if totally understand reason behind this, gives me experience deal similar problems in future.

in bsd make (and think in many other implementations, too), dependency lines evaluated eagerly, @ time of parsing. when define informinc variable @ later point, not influence dependency rule.

the shell command in all target evaluated lazily, before executing it. therefore see value.

see https://mail-index.netbsd.org/tech-pkg/2016/05/26/msg016900.html, explained topic litle more verbosely.