[clug] Playing funny with make..
Andrew Janke
a.janke at gmail.com
Sun Sep 13 19:06:30 MDT 2009
Hi all,
Now that I have found most of the answers to doing weird things in
/bin/sh it's makes turn.
If I have the following in a makefile (I am not compiling things, just
abusing it to run some batch processing for me).
The data starts in ./native and then each file in there works its way
though various stages (01-res, 02-nrm, 03-nuc ...).
# Rule for native -> 01-res
$(chkdir)/%.01-res.chk: native/%.native.mnc
@echo " +++ STAGE: 01-res (native)"
@echo " +++ SUBJECT: $(*F)"
rm -f 01-res/$(*F).* $@
bin/01-res $(*F)
# Rule for 01-res -> 02-nrm
$(chkdir)/%.02-nrm.chk: 01-res/%.01-res.mnc
@echo " +++ STAGE: 02-nrm (01-res)"
@echo " +++ SUBJECT: $(*F)"
rm -f 02-nrm/$(*F).* $@
bin/02-nrm $(*F)
native/%.native.mnc
# Rule for 02-nrm -> 03-nuc
$(chkdir)/%.03-nuc.chk: 02-nrm/%.02-nrm.mnc
@echo " +++ STAGE: 03-nuc (02-nrm)"
@echo " +++ SUBJECT: $(*F)"
rm -f 03-nuc/$(*F).* $@
bin/03-nuc $(*F)
Now of course if I run make, on the first run only everything in
01-res will be made as the % (in native/%.native.mnc ) will only
expand for files that exist. On the second run of make then everything
in 02-nrm will be made an so on.. so
1) Is there a better way? (there are about 1000 *.native.mnc files in
native/ so expanding all the names would seem a bit daft). I could use
a monster foreach/addsuffix/addprefix stanza but I am unsure at what
stage make might start to break down with these sorts of games.
2) Is there are way to make call itself again or re-expand rules?
Thanks
--
Andrew Janke
(a.janke at gmail.com || http://a.janke.googlepages.com/)
Canberra->Australia +61 (402) 700 883
More information about the linux
mailing list