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

Guy Worthington guyw@multiline.com.au
20 Feb 2001 11:04:28 +0800


--text follows this line--
Up until now I have been using the following procedure to generate an
index and table of contents:

1. Run "tex master" on the master file to generate a `master.idx' file
   and a `master.toc' file

2. Run "makeindex master" to generate a `master.ind' file

3. Run "tex master" to incorporate the `master.ind' file into the
   `master.dvi' file

>From this procedure I extracted the following pseudocode:

1. if `master.tex' is more recent than `master.idx' then run 
   "tex master" to generate `master.toc' and `master.idx'

2. if `master.idx' is more recent than `master.ind' then run
   "makeindex master" to generate `master.ind'

3. if `master.ind' is more recent than `master.dvi' then run 
   "tex master" to generate `master.dvi'

And from this pseudocode wrote the following makefile, which should
compile and open up my dvi viewer with the command "make -k master.view"

-snip-----------------------------------------------------------
# gnu make rules for processing TeX files

.PRECIOUS : %.dvi

%.idx : %.tex
	tex $<

%.ind : %.idx
	makeindex $<

%.dvi : %.tex %.ind
	tex $<

%.view : %.tex %.dvi
	tex $<   # why the ?@!* is this required?
	windvi $*.dvi

clean ::
	rm -f *.log *.toc *.idx *.ilg *.ind

# end of file
-snip-----------------------------------------------------------

This makefile only works because of the extra "tex $<" line in the
view target (line 15 of the makefile).  This line forces a tex
compilation, a makefile run, and another tex compilation---all in my
logic superfluous.

What wrong assumptions have I made about how the toc and index files
are generated?