Nested LaTeX dependencies
Status: Beta
Brought to you by:
worden
If manuscript.tex \includes content.tex, and content.tex \includes abstract.tex, then updating abstract.tex or content.tex should make manuscript.tex out of date, but the former does not seem to work. I constructed an example from an existing project at http://lalashan.mcmaster.ca/theobio/circumcision/index.php/Condom_Manuscript/sync, but have not boiled it down to a MRE.
Anonymous
That looks minimal enough to me. Thanks!
The error is clear from looking at CondomManuscript.d:
In order to work right, it needs to have the transitive dependencies on title.tex, abstract.tex, and main.tex listed somewhere.
I could either:
or something, or
Right now the former sounds iffy, and I think I like the latter, but I'm open to ideas.
There might be a good way to do the former using an intermediate target other than the .tex... maybe the .d itself...
see also https://sourceforge.net/p/workingwiki/bugs/48: Making .tex files
Last edit: Lee Worden 2013-03-13
http://lalashan.mcmaster.ca/theobio/projects/index.php/Latex_sync may also relate to this
In the Latex_sync example, there are problems with a .tex file including a .tex file that uses a .bib file, and the .bib file isn't handled right. That may or may not be the same as this ticket. Both cases should work, clearly.
Have built an MRE offline, and confirmed that it doesn't mention abstract.tex in main.d, and doesn't remake main.pdf when abstract.tex is changed.
Wrong filenames there. Fixed: Have built an MRE offline, and confirmed that it doesn't mention abstract.tex in manuscript.d, and doesn't remake manuscript.pdf when abstract.tex is changed.
manuscript.d says:
If I edit manuscript.d by hand:
Then it updates manuscript.pdf correctly when abstract.tex changes.
Jonathan's approach in http://lalashan.mcmaster.ca/theobio/projects/index.php/Latex_sync is different: since we already have
if we add
then the chaining should work when abstract.tex is changed. Apparently it doesn't work unless that latter rule has an explicit rule to touch content.tex. I'm going to try to reproduce this now.
Confirmed that adding
doesn't get it to update manuscript.pdf when abstract.tex is changed. Don't know why.
It may because there is no command it can run to update content.tex from abstract.tex, so it knows there isn't a useful chain there.
Indeed (as Jonathan told me), if I change that to
then it does run ls; but it doesn't remake manuscript.pdf. Jonathan says this is because after running ls, it checks to see if content.tex is actually newer, and sees that it isn't.
Further supporting this is that if I change that line to
then it updates the pdf file as intended.
I noticed using make -d that it updates content.tex from abstract.tex during the early pass where it remakes content.d, and then fails to update from content.tex during the main pass where it tries to make manuscript.pdf.
So it might help with this to remove the early pass by adopting the http://mad-scientist.net/make/autodep.html pattern (as suggested in https://sourceforge.net/p/workingwiki/bugs/48). Presumably I can check this by just taking out the %.d : %.tex rules and leaving the .d files sitting there, to neutralize the early pass.
With the %.d : %.tex taken out, the chaining (with touch command) works in the straightforward way you might expect, and remakes manuscript.pdf when abstract.tex is touched.
With the command removed:
it does not update the pdf. Here's part of the make -d output:
????
OTOH, if I change that to
it does rebuild the pdf.
Regarding the mad scientist thing: if we switch to updating .d files when we run *tex and/or latexml, I think it'll be hard to maintain a chained system of .d files, because (using this discussion's example) we'll update manuscript.d when we run latex to make manuscript.pdf, but when will we update content.d? I think this must be why the mad-scientist recipe for .c files puts all the prerequisites, no matter how distantly chained, in the final .c file's .d (or .P?) file.
I'm thinking our options are:
I'm favoring option no. 1, partly because I'm not so into using touch to update a file that isn't actually changed, but more because I think the pattern for C programs has been tested in the field (I've borrowed and used it before, and I'm surely not alone), and I have more confidence in it.
Hmm, if we use chained rules like
(in manuscript.d)
(in content.d)
together with
(in $(RESOURCES)/makefile-after)
and abstract.tex is to be made from a .dmu file that doesn't work, then what happens? Make won't be able to make abstract.d and content.d, so the whole project will break and be unable to make anything. This is the problem of
We can get make to run by not using content.d and abstract.d (by not including them in $(WW_TEX_D_FILES)), but then the pdf file won't depend on the .dmu. But if we do include them, breaking the DMU code breaks the whole project.
So this is an argument for eliminating the %.d : %.tex, and if we switch to not using chaining:
we'll avoid the can't make problem, but we'll still have it if we try to make manuscript.pdf from manuscript.dmu. This is not actually an argument against or for chaining, but against having make update the .d files automatically. So it belongs in bug #48, not here. I'll copy it over there.
Related
Bugs:
#48Ticket #48 is closed now: the makefiles have been rewritten using the mad-scientist pattern, and the new .d files include all the recursively-listed prerequisites. This resolves this bug as well.
Last edit: Lee Worden 2013-04-19