[tex-eplain] Indexing and how to determine file dependencies

Ed L Cashin ecashin@coe.uga.edu
21 Feb 2001 10:56:44 -0500

john@wexfordpress.net writes:

> I don't doubt you have used make . What I question is whether you
> acheved significantly better results than you could have with a simple
> script.  If you can educate me on the advantages of make over
> scripting in your products I would be grateful. 

Make builds a dependency graph in memory based on dependencies you
define in your makefile.  Since it knows what parts of your project
depend on what other parts, it can rebuild exactly and only what needs
to be rebuilt.  

> If I can create a large document with three indexes in less than
> half a minute then the script approach is certainly feasable. The
> make aproach would be advantageous if and only if you could skip
> certain steps safely after changing certan bits and pieces.

Right, but since a makefile is generally about as easy to create as a
script, always using make is no bad thing.

> Ultimately you must rerun everything anyhow. The make protocol, which
> selectively process bits and pieces based on date/time stamps has no
> special virtue that I can divine.

You are not taking into account the thing that makes the make tool
useful and distinct: the dependency graph.

> Perhaps you can describe a situation where make would save time or
> labor versus a simple script. If so I would be glad to be enlightened.

This one shows how test-static.pdf depends on its tex source and also
the test-static.1 figure.  The figure depends on its metapost source.
If I change the metapost source for the figure, make will rebuild the
figure and then the tex document; but if I just change the tex source,
there's no need to rebuild the figure:

DOC	 = test-static
FIGS	 = $(DOC).1

$(DOC).pdf : $(DOC).tex $(FIGS)
	pdftex $(DOC).tex < /dev/null
$(DOC).ps : $(DOC).dvi
	dvips -o $(DOC).ps $(DOC)
$(DOC).dvi : $(DOC).tex
	tex $(DOC) < /dev/null

# (you can generate these rules like this)
# perl -e 'for(1..40){print "%.$_\t: %.mp\n\tmpost \$<\n";}'

%.1	: %.mp 
	mpost $< < /dev/null

--Ed Cashin                    integrit file verification system
  ecashin@coe.uga.edu          http://integrit.sourceforge.net/