Makefile.m4: Clean up the `.pdf' and `.ps' files.
[mdwtools] / Makefile.m4
index 9ca06e4..91062fa 100644 (file)
@@ -41,6 +41,7 @@ PDF = addsuffix(BASE, `.pdf') mdwtools.pdf
 OBJ = \
        at.sty \
        cmtt.sty mttcmtt.fd mttenc.def \
+       centre.sty \
        colour.sty \
        crypto.sty \
        doafter.sty \
@@ -62,29 +63,32 @@ pkglatex_DATA = $(OBJ) mdwtools.tex
 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 $<"')
-
-.dtx.dvi:
-       run_latex
-.tex.dvi:
-       run_latex
-.dvi.ps:
-       dvips -e0 -o $@ $<
-.ps.pdf:
-       ps2pdf $< $@
-
-$(DVI): gpl.tex $(OBJ) mdwtools.tex
+define(`run_latex', `rm -rf t.$`'@/ && mkdir t.$`'@/ && \
+       cd t.$`'@/ && \
+       TEXINPUTS=..:$$TEXINPUTS && export TEXINPUTS && \
+       $1 "\def\indexing{n} \nonstopmode \input $<" && \
+       $1 "\def\indexing{y} \nonstopmode \input $<" && \
+       makeindex -s gind.ist $`'*.idx && \
+       $1 "\def\indexing{n} \nonstopmode \input $<" && \
+       mv $`'@ ../ && cd ../ && rm -rf t.$`'@/')
+
+.dtx.dvi:; run_latex(`latex')
+.tex.dvi:; run_latex(`latex')
+.dtx.pdf:; run_latex(`pdflatex')
+.tex.pdf:; run_latex(`pdflatex')
+.dvi.ps:; dvips -e0 -o $@ $<
+clean-local::; rm -rf t.*/
+
+$(DVI) $(PDF): gpl.tex $(OBJ) mdwtools.tex
 
 $(wordlist 2,$(words $(OBJ)),$(OBJ)): $(firstword $(OBJ))
 $(firstword $(OBJ)): $(SRC) mdwtools.ins
        tex mdwtools.ins
 
-EXTRA_DIST = $(SRC) $(AUX) $(DVI) $(OBJ) $(PS) mdwtools.ins Makefile.m4
+EXTRA_DIST = $(SRC) $(AUX) $(DVI) $(OBJ) $(PS) $(PDF) \
+       mdwtools.ins Makefile.m4
 
-MAINTAINERCLEANFILES = $(OBJ) $(DVI)
+MAINTAINERCLEANFILES = $(OBJ) $(DVI) $(PS) $(PDF)
 CLEANFILES = *.tmp *.aux *.idx *.ilg *.log *.toc *.ind *.lot *.ans
 
 Makefile.am: Makefile.m4