|
From: | Krzysztof Cieniuch |
Subject: | Re: variable parameter list |
Date: | Fri, 12 Nov 2010 13:29:41 +0000 |
User-agent: | Thunderbird 2.0.0.22 (X11/20090625) |
Warlich, Christof wrote:
Don't know if that's what you want but the simplest solution would be to treat list of files a third parameter instead as separate arguments i.e.Hi, consider this makefile: .PHONY: all all: sorted.tgt header.tgt reverse.tgt footer.tgt # The lines below are supposed to do this: #sorted.tgt: list1.lst list2.lst # cat $^ | sort >$@ #header.tgt: list1.lst list2.lst list3.lst # cat $^ | head >$@ #reverse.tgt: list1.lst # cat $^ | tac >$@ #footer.tgt: list1.lst list2.lst list3.lst list4.lst list5.lst list6.lst list7.lst list8.lst # cat $^ | tac >$@ define FILTER_RULE ${2}: ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10} cat $$^ | ${1} >$$@ endef $(eval $(call FILTER_RULE, sort, sorted.tgt, list1.lst, list2.lst)) $(eval $(call FILTER_RULE, head -n1, header.tgt, list1.lst, list2.lst, list3.lst)) $(eval $(call FILTER_RULE, tac, reverse.tgt, list1.lst)) $(eval $(call FILTER_RULE, tail -n1, footer.tgt, list1.lst, list2.lst, list3.lst, list4.lst, list5.lst, list6.lst, list7.lst, list8.lst))
define FILTER_RULE ${2}: ${3} cat $$^ | ${1} >$$@ endef all: sorted.tgt header.tgt reverse.tgt footer.tgt $(eval $(call FILTER_RULE, sort, sorted.tgt, list1.lst list2.lst))$(eval $(call FILTER_RULE, head -n1, header.tgt, list1.lst list2.lst list3.lst))
$(eval $(call FILTER_RULE, tac, reverse.tgt, list1.lst))$(eval $(call FILTER_RULE, tail -n1, footer.tgt, list1.lst list2.lst list3.lst list4.lst list5.lst list6.lst list7.lst list8.lst))
Note no commas between list*.lst files. Krzysztof
[Prev in Thread] | Current Thread | [Next in Thread] |