Warlich, Christof wrote:
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))

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.

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


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

Reply via email to