[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Parallel make not working the way I expect...
From: |
Paul Smith |
Subject: |
Re: Parallel make not working the way I expect... |
Date: |
Sat, 10 Feb 2007 13:32:45 -0500 |
On Fri, 2007-02-09 at 23:54 +0000, David Wuertele wrote:
> > Choice 2) use a pattern rule with multiple targets so that make knows
> > that one command builds all of them. You should arrange for the files
> > to have names that follow some sort of pattern (all have the same
> > prefix, of suffix, or *something* in common) so that the patterns you
> > give use to match them make some sense.
> Except: maybe I could use the subdirectory as a prefix? I tried this:
>
> LOTS_OF_FILES := dir/one dir/two dir/three dir/four dir/five dir/six
>
> all: $(LOTS_OF_FILES)
>
> COMMAND_WHICH_BUILDS_LOTS_OF_FILES := for file in $(LOTS_OF_FILES); do mkdir
> -p
> `dirname $$file` && echo hello >> $$file; done
>
> $(LOTS_OF_FILES): dir/%: Makefile
> $(COMMAND_WHICH_BUILDS_LOTS_OF_FILES)
> Is that what you mean by a pattern rule?
No. That is a static pattern rule; a static pattern rule (confusingly
enough) is really just a shorthand for writing lots of explicit rules.
You have to use the syntax:
%/one %/two %/three %/four %/five %/six : Makefile
$(COMMAND_WHICH_BUILDS_LOTS_OF_FILES)
to get a pattern rule.
If you don't want to/can't do that, then you have to use a "sentinel
file" model. Something like this:
all: $(LOTS_OF_FILES)
$(LOTS_OF_FILES): .sentinel
.sentinel: Makefile
$(COMMAND_WHICH_BUILDS_LOTS_OF_FILES)
touch $@
--
-------------------------------------------------------------------------------
Paul D. Smith <address@hidden> Find some GNU make tips at:
http://www.gnu.org http://make.paulandlesley.org
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist