Makefile.m4: Fix rules to be parallel-make safe.
[mdwfonts] / Makefile.m4
index dff61c0..e3db7b3 100644 (file)
@@ -1,4 +1,4 @@
-## -*-makefile-*-
+## -*-m4-*-
 ##
 ## Build system for mdwfonts
 ##
 ## 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.
-## 
+##
 ## mdwfonts 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 mdwfonts; 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}
-pkgtfmdir = ${texmfpath}/fonts/tfm/${PACKAGE}
-pkgvfdir = ${texmfpath}/fonts/vf/${PACKAGE}
-pkgetxdir = ${texmfpath}/tex/fontinst/${PACKAGE}
-pkmapdir = ${texmfpath}/dvips/${PACKAGE}
+pkglatexdir = ${texmfdir}/tex/latex/${PACKAGE}
+pkgdocdir = ${texmfdir}/doc/latex/${PACKAGE}
+pkgtfmdir = ${texmfdir}/fonts/tfm/${PACKAGE}
+pkgvfdir = ${texmfdir}/fonts/vf/${PACKAGE}
+pkgetxdir = ${texmfdir}/tex/fontinst/${PACKAGE}
+pkmapdir = ${texmfdir}/fonts/map/${PACKAGE}
 
 FONTINST = @FONTINST@
 
@@ -46,6 +45,8 @@ define(`VFBASE', `\
 AUX = gpl.tex
 SRC = addsuffix(BASE, `.dtx')
 DVI = addsuffix(BASE, `.dvi')
+PS = addsuffix(BASE, `.ps')
+PDF = addsuffix(BASE, `.pdf')
 ETX = ot1tt.etx ot1ctt.etx
 INS = mdwfonts.sty mdwfonts.tex mttpcr.fd
 MAP = mdwfonts.map
@@ -56,41 +57,61 @@ TFM = addsuffix(TFMBASE, `.tfm') addsuffix(VFBASE, `.tfm')
 VF = addsuffix(VFBASE, `.vf')
 
 pkglatex_DATA = $(INS) $(FD)
-pkgdoc_DATA = $(DVI)
+pkgdoc_DATA = $(DVI) $(PS) $(PDF)
 pkgtfm_DATA = $(TFM)
 pkgvf_DATA = $(VF)
 pkgetx_DATA = $(ETX)
 pkmap_DATA = $(MAP)
 
-SUFFIXES = .dtx .dvi .vf .tfm .pl .vpl
-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 $<"')
+SUFFIXES = .dtx .dvi .vf .tfm .pl .vpl .ps .pdf
+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.$`'@/')
 
-$(DVI): $(AUX) $(INS)
-.dtx.dvi: run_latex
+$(DVI) $(PDF): $(AUX) $(INS)
+.dtx.dvi:; run_latex(`latex')
+.dtx.pdf:; run_latex(`pdflatex')
+.dvi.ps:; dvips $<
 .vpl.tfm:; vptovf $<
 .pl.tfm:; pltotf $<
 .vpl.vf:; vptovf $<
+clean-local::; rm -rf t.*/
 
-$(ETX) $(INS): $(SRC) mdwfonts.ins
+$(wordlist 2,$(words $(ETX)),$(ETX)) $(MAP) $(INS): $(firstword $(ETX))
+$(firstword $(ETX)): $(SRC) mdwfonts.ins
        tex "\nonstopmode \input mdwfonts.ins"
-$(FD) $(VF) $(PL) $(VPL): mdwfonts.tex $(ETX)
+$(wordlist 2,$(words $(FD)),$(FD)) $(VF) $(PL) $(VPL): $(firstword $(FD))
+$(firstword $(FD)): mdwfonts.tex $(ETX)
        $(FONTINST) "\nonstopmode \input mdwfonts.tex"
 
 EXTRA_DIST = \
        $(SRC) $(AUX) $(INS) $(ETX) $(FD) $(TFM) $(VF) $(PL) $(VPL) $(DVI) \
+       $(MAP) \
        mdwfonts.ins Makefile.m4
 
 MAINTAINERCLEANFILES = $(INS) $(ETX) $(TFM) $(VF) $(DVI) *.fd
 CLEANFILES = \
        *.tmp *.aux *.idx *.ilg *.log *.toc *.ind *.lot *.ans *.vpl \
-       p*.pl p*.mtx c*.mtx
+       p*.pl p*.mtx c*.mtx *.ps *.pdf
 
 Makefile.am: Makefile.m4
        cd $(srcdir) && m4 Makefile.m4 >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
+
+EXTRA_DIST += debian/mdwfonts.install
+EXTRA_DIST += debian/mdwfonts.docs debian/mdwfonts.maps
+
 .PHONY: dvi
 
 ##----- That's all, folks ---------------------------------------------------