On Wed, 2008-02-06 at 12:47 -0800, Huan-Chih Tsai wrote:
> define TEST_RULE
> .PHONY: $(1)
> $(1):
> awk '{if (NF > 1) {print $$1 " " $$2} }' < Makefile
> endef
Sorry, but you have to double-escape the "$" in the rule.
When you invoke "call", it will expand the value (it has to, to replace
the arguments like $(1)!) so that undoes one level of $ escaping. Thus
when your rule is defined it will be:
test:
awk '{if (NF > 1) {print $1 " " $2} }' < Makefile
and when make expands it, the $1 and $2 will drop out. You can use
"make -p" to see this.
You need:
define TEST_RULE
.PHONY: $(1)
$(1):
awk '{if (NF > 1) {print $$$$1 " " $$$$2} }' < Makefile
endef
--
-----------------------------------------------------------------------------
Paul D. Smith <[EMAIL PROTECTED]> http://make.mad-scientist.us
"Please remain calm--I may be mad, but I am a professional."--Mad Scientist
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make