209f348f1c6164b603c2a17a078cbc11602fc1d2
[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 PDFLATEX=pdflatex
11 DVIPS=dvips
12 MAKEINDEX=/usr/bin/makeindex
13 FAKEROOT=`[ -x /usr/bin/fakeroot ] && echo /usr/bin/fakeroot`
14
15 .SUFFIXES: .sty .ins .dtx .dvi .ps .pdf .ind .idx .gls .glo
16 .PHONY: clean distclean tar zip install target mlastyle instructions
17
18 %.ind: %.idx
19         $(MAKEINDEX) -s gglo.ist -o $*.gls $*.glo
20         $(MAKEINDEX) -s gind.ist -o $*.ind $*.idx
21
22 %.idx: %.dtx
23         $(LATEX) $<
24
25 %.dvi: %.sty %.dtx %.ind
26         $(LATEX) $*.dtx
27         $(LATEX) $*.dtx
28
29 %.sty: %.ins %.dtx
30         $(LATEX) $*.ins
31
32 %.ps: %.dvi
33         $(DVIPS) -o $@ $<
34
35 %.pdf: %.dtx %.ind
36         $(PDFLATEX) $*.dtx
37         $(PDFLATEX) $*.dtx
38
39 target: mlastyle.sty mlastyle.dvi instructions
40
41 all: mlastyle.sty mlastyle.dvi mlastyle.pdf mlastyle.ps zip tar
42
43 mlastyle: mlastyle.sty
44
45 mlastyle.sty: mlastyle.ins mlastyle.dtx
46
47 mlastyle.dvi: mlastyle.sty
48
49 clean:
50         rm -f *.glo *.gls *.idx *.ilg *.ind *.toc *.log *.aux *.blg *.bbl *~
51
52 distclean: clean
53         rm -f mlastyle.sty mlastyle.dvi mlastyle.ps mlastyle.pdf
54         rm -rf tex doc source bibtex
55
56 tar:    mlastyle.sty mlastyle.dvi clean
57         mkdir mlastyle-$(VERSION)
58         rm -f mlastyle_$(VERSION).tar.gz
59         install -m644 *.dtx *.ins *.bst Makefile README mlastyle-$(VERSION)
60         $(FAKEROOT) tar czf mlastyle_$(VERSION).tar.gz \
61           mlastyle-$(VERSION)
62         rm -rf mlastyle-$(VERSION)
63
64 zip:    mlastyle.sty mlastyle.dvi clean
65         mkdirhier $(LTXDIR)
66         mkdirhier $(DOCDIR)
67         mkdirhier $(SRCDIR)
68         mkdirhier $(BSTDIR)
69         install -m644 *.sty  $(LTXDIR)
70         install -m644 mlastyle.dvi $(DOCDIR)
71         [ ! -f mlastyle.pdf ] ||install -m644 mlastyle.pdf $(DOCDIR)
72         [ ! -f mlastyle.ps  ] ||install -m644 mlastyle.ps  $(DOCDIR)
73         install -m644 *.dtx *.ins *.bst Makefile README $(SRCDIR)
74         install -m644 *.bst $(BSTDIR)
75         rm -f mlastyle.zip
76         zip -r mlastyle.zip tex doc source bibtex
77         rm -rf tex doc source bibtex
78
79 install: all
80         if [ ! -d $(TD)$(LTXDIR) ]; then mkdirhier $(TD)$(LTXDIR); fi
81         if [ ! -d $(TD)$(DOCDIR) ]; then mkdirhier $(TD)$(DOCDIR); fi
82         if [ ! -d $(TD)$(SRCDIR) ]; then mkdirhier $(TD)$(SRCDIR); fi
83         if [ ! -d $(TD)$(BSTDIR) ]; then mkdirhier $(TD)$(BSTDIR); fi
84         install -m644 *.sty $(TD)$(LTXDIR)
85         install -m644 *.ins *.dtx *.bst Makefile README $(TD)$(SRCDIR)
86         install -m644 mlastyle.dvi $(TD)$(DOCDIR)
87         [ ! -f mlastyle.pdf ] ||install -m644 mlastyle.pdf $(TD)$(DOCDIR)
88         [ ! -f mlastyle.ps  ] ||install -m644 mlastyle.ps  $(TD)$(DOCDIR)
89         install -m644 *.bst $(TD)$(BSTDIR)
90         texhash
91
92 instructions:
93         @echo "Now run make install, or copy mlastyle.sty to a directory"
94         @echo "in the LaTeX search path."
95