[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Execute command for each file in list?
From: |
Paul Smith |
Subject: |
Re: Execute command for each file in list? |
Date: |
Wed, 18 Jun 2008 09:40:59 -0400 |
On Wed, 2008-06-18 at 15:36 +0200, Sam Ravnborg wrote:
> > define FILE_Template
> > $(COMPILER) $(FLAGS) $(1)
> > endef
> >
> > all:
> > $(foreach file, $(FILES), $(eval $call( FILE_Template,$(file))))
> >
> > What's happening here that I'm missing? Thanks in advance!
>
> You have some obvious paranthesis bugs.
> But I think the need for double escaping fouls you.
> Please read the chapter on "eval" in info make.
> And consider if you really need to use eval here.
Sam is right; this is one of those cases where, given a hammer (and eval
is a hammer with a particularly slippery grip), everything looks like a
nail.
What's wrong with the tradition, portable, been-in-use-since-the-1970's
method of doing this:
all:
for file in $(FILES); do $(COMPILER) $(FLAGS) $$file || exit 1; done
I mean, besides the fact that is totally wrong given -k and also given
parallelism (-j)?
For that matter, what's wrong with the usual method which works properly
in all situations:
all: $(FILES:.asm=.o)
%.o : %.asm
$(COMPILER) $(FLAGS) $<
--
-------------------------------------------------------------------------------
Paul D. Smith <address@hidden> Find some GNU make tips at:
http://www.gnu.org http://make.mad-scientist.us
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist