chiark / gitweb /
Makefile.m4: Format each document in a subdirectory.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 5 Sep 2020 13:41:42 +0000 (14:41 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Mon, 7 Sep 2020 15:46:47 +0000 (16:46 +0100)
The recent change f76fbef37b2af3292764729f496f578037cdc314 to
`sverb.dtx' prevents parallel formatting of /different/ documents from
interfering with each other, but I want to build PDF documents using
PDFTeX rather than going via `dvips' and `ps2pdf', and the two parallel
builds of the /same/ documents will still have the same `\jobname' and
therefore will fight over all kinds of temporary files -- not just the
demo files, but `.aux', `.toc', and everything.

Makefile.m4

index a9b2f9ea7188f50a94ef11f2a03f3df92c3f9634..6df673eab4d92fed4fbb4bb8145c864f56ff4063 100644 (file)
@@ -62,15 +62,20 @@ pkglatex_DATA = $(OBJ) mdwtools.tex
 pkgdoc_DATA = $(DVI) $(PS) $(PDF)
 
 SUFFIXES = .dtx .tex .dvi .ps
 pkgdoc_DATA = $(DVI) $(PS) $(PDF)
 
 SUFFIXES = .dtx .tex .dvi .ps
-define(`run_latex', `latex "\def\indexing{n} \nonstopmode \input $<"
-       latex "\def\indexing{y} \nonstopmode \input $<"
-       makeindex -s gind.ist $`'*.idx
-       latex "\def\indexing{n} \nonstopmode \input $<"')
+define(`run_latex', `rm -rf t.$`'@/ && mkdir t.$`'@/ && \
+       cd t.$`'@/ && \
+       TEXINPUTS=..:$$TEXINPUTS && export TEXINPUTS && \
+       latex "\def\indexing{n} \nonstopmode \input $<" && \
+       latex "\def\indexing{y} \nonstopmode \input $<" && \
+       makeindex -s gind.ist $`'*.idx && \
+       latex "\def\indexing{n} \nonstopmode \input $<" && \
+       mv $`'@ ../ && cd ../ && rm -rf t.$`'@/')
 
 .dtx.dvi:; run_latex
 .tex.dvi:; run_latex
 .dvi.ps:; dvips -e0 -o $@ $<
 .ps.pdf:; ps2pdf $< $@
 
 .dtx.dvi:; run_latex
 .tex.dvi:; run_latex
 .dvi.ps:; dvips -e0 -o $@ $<
 .ps.pdf:; ps2pdf $< $@
+clean-local::; rm -rf t.*/
 
 $(DVI): gpl.tex $(OBJ) mdwtools.tex
 
 
 $(DVI): gpl.tex $(OBJ) mdwtools.tex