Hi friends,
I am facing problem to understand the code.

The below code does not produce correct result:
Code:
# $(call program-variables, variable-prefix, file-list)

define program-variables
$1_sources = $(filter %.c,$2)
$1_headers = $(filter %.h,$2)
$1_objects = $(subst .c,.o,$(filter %.c,$2))
endef

$(call program-variables,ls, ls.c ls.h glob.c glob.h)
show-variables:
# $(ls_sources)
# $(ls_headers)
# $(ls_objects)

Result:
$ make
Makefile:7: *** missing separator. Stop.

But the code works if I change like the following:
$($1_objects): $($1_headers)

Please help me to understand Why/How this kind of change producing correct
result??? 

-- 
View this message in context: 
http://old.nabble.com/Macro-expansion-tp32503727p32503727.html
Sent from the Gnu - Make - Help mailing list archive at Nabble.com.


_______________________________________________
Help-make mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-make

Reply via email to