[texhax] Makefile dependencies for complex documents
Robin Fairbairns
Robin.Fairbairns at cl.cam.ac.uk
Tue Mar 23 00:52:27 CET 2004
> I think, the better way would be to redefine \input so that it would
> write the name of the file-to-be-included to a special auxiliary file,
> say \jobname.dep. This file would then be processed by another
> program, which would resolve all file names and produce a proper
> Makefile entry.
>
> So far, I haven't found anything like this, so I've written a couple
> of tex macros and a very crude filename resolution program. Because
> this program currently looks for files only in the current directory,
> I haven't redefined \input yet. Instead, macro \dep used in front of
> \input causes the latter command to log the filename into
> \jobname.dep:
>
> \expandafter\ifx\csname dep\endcsname\relax
> \newwrite\dependfile
> \openout\dependfile=\jobname.dep\relax
> \def\depends#1{\write\dependfile{#1}}%
> \def\dep#1#2{\depends{#2}#1{#2}}%
> \fi
note, of course, that your \dep macro won't work with an unadulterated
("primitive") \input command (which is distinguished by an almost
unparseable syntax); but then, the same is true of almost any
mechanism. since the primitive command is so awful, people typically
hack on the latex-sanitised version.
anyway, what's wrong with getting into the \listfiles mechanism? you
may care to look at
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=filesused (on a computer
near you) which discusses the issue somewhat. the packages it mentions
may repay analysis: i've not looked at them since i wrote the faq
answer.
robin
More information about the texhax
mailing list