mdwtools.tex: Partition stuff as front/main/back matter if available.
[mdwtools] / Makefile.m4
index 7712571..91062fa 100644 (file)
 ## it under the terms of the GNU General Public License as published by
 ## the Free Software Foundation; either version 2 of the License, or
 ## (at your option) any later version.
-## 
+##
 ## mdwtools is distributed in the hope that it will be useful,
 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ## GNU General Public License for more details.
-## 
+##
 ## You should have received a copy of the GNU General Public License
 ## along with mdwtools; if not, write to the Free Software Foundation,
 ## Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 AUTOMAKE_OPTIONS = foreign
 
-texmfpath = @texmfpath@
-pkglatexdir = ${texmfpath}/tex/latex/${PACKAGE}
-pkgdocdir = ${texmfpath}/doc/latex/${PACKAGE}
+pkglatexdir = ${texmfdir}/tex/latex/${PACKAGE}
+pkgdocdir = ${texmfdir}/doc/latex/${PACKAGE}
 
 define(`addsuffix', `patsubst(`$1', `\>', `$2')')
 define(`BASE', `\
@@ -38,9 +37,11 @@ AUX = mdwtools.tex gpl.tex
 SRC = addsuffix(BASE, `.dtx')
 DVI = addsuffix(BASE, `.dvi') mdwtools.dvi
 PS = addsuffix(BASE, `.ps') mdwtools.ps
+PDF = addsuffix(BASE, `.pdf') mdwtools.pdf
 OBJ = \
        at.sty \
        cmtt.sty mttcmtt.fd mttenc.def \
+       centre.sty \
        colour.sty \
        crypto.sty \
        doafter.sty \
@@ -59,35 +60,48 @@ OBJ = \
        syntax.sty
 
 pkglatex_DATA = $(OBJ) mdwtools.tex
-pkgdoc_DATA = $(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 && \
+       $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
-.tex.dvi:
-       run_latex
-.dvi.ps:
-       dvips -e0 -o $@ $<
+.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): gpl.tex $(OBJ) mdwtools.tex
+$(DVI) $(PDF): gpl.tex $(OBJ) mdwtools.tex
 
-$(OBJ): $(SRC) mdwtools.ins
+$(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
        m4 $(srcdir)/Makefile.m4 >Makefile.am.new
        mv Makefile.am.new $(srcdir)/Makefile.am
 
+dist-hook::
+       echo $(VERSION) >$(distdir)/RELEASE
+EXTRA_DIST += auto-version
+
+EXTRA_DIST += debian/changelog debian/control debian/copyright debian/compat
+EXTRA_DIST += debian/rules
+
 .PHONY: dvi
 
 ##----- That's all, folks ---------------------------------------------------