9a09208209e93029949b05f633a0995493742172
[latex-mlastyle.git] / Makefile
1 PKG=mlastyle
2 TD=`if id|grep '^uid=0' >/dev/null; then kpsewhich --expand-path='$$TEXMFLOCAL'; else kpsewhich --expand-path='$$HOMETEXMF'; fi | sed -e 's,.$$,&/,'`
3 LTXDIR=tex/latex/mlastyle
4 DOCDIR=doc/latex/mlastyle
5 BSTDIR=bibtex/bst/mlastyle
6 SRCDIR=source/latex/mlastyle
7 #VERSION=`grep '^\\\\def\\\\fileversion' mlastyle.dtx | sed 's/^\\\\def\\\\fileversion{\\(.*\\)\\.\\(.*\\)}/\\1_\\2/'`
8 VERSION=`grep '^%<[a-z]*> *\[[0-9/]* *v' mlastyle.dtx | sed 's/^%<[a-z]*> *\[[0-9/]* *v\([-_.0-9a-z]*\).*/\1/'`
9 LATEX=latex
10 BIBTEX=bibtex
11 MAKEINDEX=/usr/bin/makeindex
12 PDFLATEX=pdflatex
13 DVIPS=dvips
14 FAKEROOT=`[ -x /usr/bin/fakeroot ] && echo /usr/bin/fakeroot`
15
16 .SUFFIXES: .sty .ins .dtx .dvi .ps .pdf .ind .idx .gls .glo
17 .PHONY: clean distclean tar zip install target mlastyle instructions
18
19 %.bbl: %.bib
20         $(BIBTEX) $*.aux
21         $(MAKEINDEX) -s gglo.ist -o $*.gls $*.glo
22         $(MAKEINDEX) -s gind.ist -o $*.ind $*.idx
23
24 %.bib: %.dtx
25         $(LATEX) $<
26
27 %.sty: %.ins %.dtx
28         $(LATEX) $*.ins
29
30 %.dvi: %.sty %.dtx %.bbl
31         $(LATEX) $*.dtx
32         $(LATEX) $*.dtx
33
34 %.ps: %.dvi
35         $(DVIPS) -o $@ $<
36
37 %.pdf: %.sty %.dtx %.bbl
38         $(PDFLATEX) $*.dtx
39         $(PDFLATEX) $*.dtx
40
41 target: mlastyle.sty mlastyle.dvi instructions
42
43 all: mlastyle.sty mlastyle.dvi mlastyle.pdf mlastyle.ps zip tar
44
45 mlastyle: mlastyle.sty
46
47 mlastyle.sty: mlastyle.ins mlastyle.dtx
48
49 mlastyle.dvi: mlastyle.sty
50
51 clean:
52         rm -f *.glo *.gls *.idx *.ilg *.ind *.toc *.log *.aux *.blg *.bib *.bbl *~
53
54 distclean: clean
55         rm -f mlastyle.sty mlastyle.dvi mlastyle.ps mlastyle.pdf
56         rm -rf $(LTXDIR) $(DOCDIR) $(SRCDIR) $(BSTDIR)
57         rmdir `dirname $(LTXDIR)` `dirname $(DOCDIR)`
58         rmdir `dirname $(SRCDIR)` `dirname $(BSTDIR)`
59         rmdir tex doc source bibtex
60
61 tar:    mlastyle.sty mlastyle.dvi clean
62         mkdir mlastyle-$(VERSION)
63         rm -f mlastyle_$(VERSION).tar.gz
64         install -m644 *.dtx *.ins *.bst Makefile README mlastyle-$(VERSION)
65         $(FAKEROOT) tar czf mlastyle_$(VERSION).tar.gz \
66           mlastyle-$(VERSION)
67         rm -rf mlastyle-$(VERSION)
68
69 zip:    mlastyle.sty mlastyle.dvi clean
70         mkdirhier $(LTXDIR)
71         mkdirhier $(DOCDIR)
72         mkdirhier $(SRCDIR)
73         mkdirhier $(BSTDIR)
74         install -m644 *.sty  $(LTXDIR)
75         install -m644 mlastyle.dvi $(DOCDIR)
76         [ ! -f mlastyle.pdf ] ||install -m644 mlastyle.pdf $(DOCDIR)
77         [ ! -f mlastyle.ps  ] ||install -m644 mlastyle.ps  $(DOCDIR)
78         install -m644 *.dtx *.ins *.bst Makefile README $(SRCDIR)
79         install -m644 *.bst $(BSTDIR)
80         rm -f mlastyle.zip
81         zip -r mlastyle.zip tex doc source bibtex
82         rm -rf tex doc source bibtex
83
84 install: all
85         if [ ! -d $(TD)$(LTXDIR) ]; then mkdirhier $(TD)$(LTXDIR); fi
86         if [ ! -d $(TD)$(DOCDIR) ]; then mkdirhier $(TD)$(DOCDIR); fi
87         if [ ! -d $(TD)$(SRCDIR) ]; then mkdirhier $(TD)$(SRCDIR); fi
88         if [ ! -d $(TD)$(BSTDIR) ]; then mkdirhier $(TD)$(BSTDIR); fi
89         install -m644 *.sty $(TD)$(LTXDIR)
90         install -m644 *.ins *.dtx *.bst Makefile README $(TD)$(SRCDIR)
91         install -m644 mlastyle.dvi $(TD)$(DOCDIR)
92         [ ! -f mlastyle.pdf ] ||install -m644 mlastyle.pdf $(TD)$(DOCDIR)
93         [ ! -f mlastyle.ps  ] ||install -m644 mlastyle.ps  $(TD)$(DOCDIR)
94         install -m644 *.bst $(TD)$(BSTDIR)
95         texhash
96
97 instructions:
98         @echo "Now run make install, or copy mlastyle.sty to a directory"
99         @echo "in the LaTeX search path and mlastyle.bst to a directory."
100         @echo "in the BibTeX search path."
101