[clug] Playing funny with make..
Andrew Janke
a.janke at gmail.com
Sun Sep 13 20:24:28 MDT 2009
> Probably. Do you need to keep the intermediate files?
Definitely.
> Think about that,
> because by default the chained rules don't, but you can instruct make to.
you mean via:
.SECONDARY: ...
?
> Anyway, the better way is almost certainly to use the "chained rules" stuff
> that can string together groups of transformations.
This is what I _thought_ I was doing... :)
> # This tells me what the expected output is.
> all: whatever.doc
>
> # Build the Word DOC file
> %.doc: %.rtf
> unoconv -v -d document -f doc $< || \
> unoconv -v -d document -f doc $< || \
> unoconv -v -d document -f doc $< || \
> unoconv -v -d document -f doc $<
>
> %.rtf: %.mdwn style/header.rtf
> pandoc $(PANOPT) -C style/header.rtf -s -t rtf -o $@ $<
>
> That gives me a generic rule for converting *any* mdwn file into RTF, and any
> RTF into DOC, which means that make will map a path from whatever.mdwn to
> whatever.doc to satisfy my requests.
Although in my case I would have to expand "whatever.doc" to 1000+
files. Thus my question about at what point should I expect make to
break down with such games?
> ...then, once you have generic rules to produce your output from the input you
> can use one single "source to target" transformation and let make figure out
> the bits in the middle.
Hrm, perhaps I am doing it wrong in other ways then. Currently the
rough overview of dependencies is this: (main.html is a summary output
file, and this is simplified in which there are only three processing
stages).
all: main.html
main.html: 01-aaa.chk 02-bbb.chk 03-ccc.chk ...
[dostuff]
all.01-aaa: $(addsuffix .01-aaa.chk, $(files))
touch $@
all.02-bbb: $(addsuffix .01-aaa.chk, $(files))
touch $@
all.03-ccc: $(addsuffix .02-bbb.chk, $(files))
touch $@
%.01-aaa.chk: %.native.chk
[dostuff]
%.02-bbb.chk: %.01-aaa.chk
[dostuff]
%.03-ccc.chk: %.02-bbb.chk
[dostuff]
And the chaining is not happening. Is this then because main.html
should instead only depend on the last stage? ie:
main.html: 03-ccc.chk ...
[dostuff]
and I should ignore the all.02-bbb and 03-ccc 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