help-make
[Top][All Lists]
Advanced

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

Can I generate multiple recipe commands dynamically in makefile


From:
Subject: Can I generate multiple recipe commands dynamically in makefile
Date: Sun, 15 May 2011 18:06:52 +0800

Please check my makefile:

================
define show
    echo "[$1]"
endef

filelist = 1.c 2.c 3.c

all:
    @$(call show,1.c)
    @$(call show,2.c)
    @$(call show,3.c)

# That code below cannot work!
#all2:
#    @$(foreach f,$(filelist),$(call show,$p))
================

I'd like to dynamically generate N shell commands under "all" targets when
filelist has N words. How can I do it? Without the ultimate solution,
everytime I add a word to filelist, I have to manually add one command line
under "all". Quite boring, right?

Thank you in advance.


reply via email to

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