help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Macro expansion


From: MD.Mahbubur Rahman
Subject: Macro expansion
Date: Wed, 21 Sep 2011 02:14:36 -0700 (PDT)

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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]