Modified tar and zip targets
authorTim Pope <code@tpope.net>
Sat, 15 Nov 2003 18:43:29 +0000 (18:43 +0000)
committerTim Pope <code@tpope.net>
Sat, 15 Nov 2003 18:43:29 +0000 (18:43 +0000)
Makefile

index a09258a737cac13db33de68a1d2023c77f2f2df6..209f348f1c6164b603c2a17a078cbc11602fc1d2 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,17 +1,19 @@
-SRCDIR=mlastyle
-TEXMFDIR=`if id|grep '^uid=0' >/dev/null; then kpsewhich --expand-path='$$TEXMFLOCAL'; else kpsewhich --expand-path='$$HOMETEXMF'; fi`
-INSTALLDIR=$(TEXMFDIR)/tex/latex/mlastyle
-DOCDIR=$(TEXMFDIR)/doc/latex/mlastyle
-BSTDIR=$(TEXMFDIR)/bst/mlastyle
-VERSION=`grep '^\\\\def\\\\fileversion' mlastyle.dtx | sed 's/^\\\\def\\\\fileversion{\\(.*\\)\\.\\(.*\\)}/\\1_\\2/'`
+PKG=mlastyle
+TD=`if id|grep '^uid=0' >/dev/null; then kpsewhich --expand-path='$$TEXMFLOCAL'; else kpsewhich --expand-path='$$HOMETEXMF'; fi | sed -e 's,.$$,&/,'`
+LTXDIR=tex/latex/mlastyle
+DOCDIR=doc/latex/mlastyle
+BSTDIR=bibtex/bst/mlastyle
+SRCDIR=source/latex/mlastyle
+#VERSION=`grep '^\\\\def\\\\fileversion' mlastyle.dtx | sed 's/^\\\\def\\\\fileversion{\\(.*\\)\\.\\(.*\\)}/\\1_\\2/'`
+VERSION=`grep '^%<[a-z]*> *\[[0-9/]* *v' mlastyle.dtx | sed 's/^%<[a-z]*> *\[[0-9/]* *v\([-_.0-9a-z]*\).*/\1/'`
 LATEX=latex
 PDFLATEX=pdflatex
 DVIPS=dvips
 MAKEINDEX=/usr/bin/makeindex
 LATEX=latex
 PDFLATEX=pdflatex
 DVIPS=dvips
 MAKEINDEX=/usr/bin/makeindex
-
+FAKEROOT=`[ -x /usr/bin/fakeroot ] && echo /usr/bin/fakeroot`
 
 .SUFFIXES: .sty .ins .dtx .dvi .ps .pdf .ind .idx .gls .glo
 
 .SUFFIXES: .sty .ins .dtx .dvi .ps .pdf .ind .idx .gls .glo
-.PHONY: clean distclean tar zip install target
+.PHONY: clean distclean tar zip install target mlastyle instructions
 
 %.ind: %.idx
        $(MAKEINDEX) -s gglo.ist -o $*.gls $*.glo
 
 %.ind: %.idx
        $(MAKEINDEX) -s gglo.ist -o $*.gls $*.glo
@@ -27,13 +29,6 @@ MAKEINDEX=/usr/bin/makeindex
 %.sty: %.ins %.dtx
        $(LATEX) $*.ins
 
 %.sty: %.ins %.dtx
        $(LATEX) $*.ins
 
-#.dtx.dvi:
-#      $(LATEX) $<
-#      $(LATEX) $<
-#      $(MAKEINDEX) -s gind.ist $(*D)/$(*F)
-#      $(MAKEINDEX) -s gglo.ist -o $(*D)/$(*F).gls $(*D)/$(*F).glo
-#      $(LATEX) $<
-
 %.ps: %.dvi
        $(DVIPS) -o $@ $<
 
 %.ps: %.dvi
        $(DVIPS) -o $@ $<
 
@@ -47,50 +42,54 @@ all: mlastyle.sty mlastyle.dvi mlastyle.pdf mlastyle.ps zip tar
 
 mlastyle: mlastyle.sty
 
 
 mlastyle: mlastyle.sty
 
+mlastyle.sty: mlastyle.ins mlastyle.dtx
+
+mlastyle.dvi: mlastyle.sty
+
 clean:
        rm -f *.glo *.gls *.idx *.ilg *.ind *.toc *.log *.aux *.blg *.bbl *~
 
 distclean: clean
        rm -f mlastyle.sty mlastyle.dvi mlastyle.ps mlastyle.pdf
 clean:
        rm -f *.glo *.gls *.idx *.ilg *.ind *.toc *.log *.aux *.blg *.bbl *~
 
 distclean: clean
        rm -f mlastyle.sty mlastyle.dvi mlastyle.ps mlastyle.pdf
+       rm -rf tex doc source bibtex
 
 tar:   mlastyle.sty mlastyle.dvi clean
 
 tar:   mlastyle.sty mlastyle.dvi clean
-       rm -f mlastyle.tar.gz
-       tar czCf .. mlastyle.tar.gz \
-         $(SRCDIR)/README $(SRCDIR)/Makefile \
-         $(SRCDIR)/mlastyle.dtx \
-         $(SRCDIR)/mlastyle.ins \
-         $(SRCDIR)/mlastyle.dvi
-
+       mkdir mlastyle-$(VERSION)
+       rm -f mlastyle_$(VERSION).tar.gz
+       install -m644 *.dtx *.ins *.bst Makefile README mlastyle-$(VERSION)
+       $(FAKEROOT) tar czf mlastyle_$(VERSION).tar.gz \
+         mlastyle-$(VERSION)
+       rm -rf mlastyle-$(VERSION)
 
 zip:   mlastyle.sty mlastyle.dvi clean
 
 zip:   mlastyle.sty mlastyle.dvi clean
-       mkdirhier tex/latex/mlastyle/
-       mkdirhier doc/latex/mlastyle/
-       mkdirhier source/latex/mlastyle/
-       mkdirhier bibtex/bst/mlastyle/
-       cp *.sty tex/latex/mlastyle/
-       cp mlastyle.dvi README doc/latex/mlastyle/
-       cp mlastyle.dtx mlastyle.ins Makefile source/latex/mlastyle/
-       cp *.bst bibtex/bst/mlastyle/
+       mkdirhier $(LTXDIR)
+       mkdirhier $(DOCDIR)
+       mkdirhier $(SRCDIR)
+       mkdirhier $(BSTDIR)
+       install -m644 *.sty  $(LTXDIR)
+       install -m644 mlastyle.dvi $(DOCDIR)
+       [ ! -f mlastyle.pdf ] ||install -m644 mlastyle.pdf $(DOCDIR)
+       [ ! -f mlastyle.ps  ] ||install -m644 mlastyle.ps  $(DOCDIR)
+       install -m644 *.dtx *.ins *.bst Makefile README $(SRCDIR)
+       install -m644 *.bst $(BSTDIR)
        rm -f mlastyle.zip
        zip -r mlastyle.zip tex doc source bibtex
        rm -rf tex doc source bibtex
 
        rm -f mlastyle.zip
        zip -r mlastyle.zip tex doc source bibtex
        rm -rf tex doc source bibtex
 
-
 install: all
 install: all
-       if [ ! -d $(INSTALLDIR) ]; then mkdirhier $(INSTALLDIR); fi
-       if [ ! -d $(DOCDIR) ]; then mkdirhier $(DOCDIR); fi
-       if [ ! -d $(BSTDIR) ]; then mkdirhier $(BSTDIR); fi
-       install -m644 mlastyle.sty $(INSTALLDIR)
-       install -m644 mlastyle.bst $(BSTDIR)
-       install -m644 mlastyle.dvi $(DOCDIR)
+       if [ ! -d $(TD)$(LTXDIR) ]; then mkdirhier $(TD)$(LTXDIR); fi
+       if [ ! -d $(TD)$(DOCDIR) ]; then mkdirhier $(TD)$(DOCDIR); fi
+       if [ ! -d $(TD)$(SRCDIR) ]; then mkdirhier $(TD)$(SRCDIR); fi
+       if [ ! -d $(TD)$(BSTDIR) ]; then mkdirhier $(TD)$(BSTDIR); fi
+       install -m644 *.sty $(TD)$(LTXDIR)
+       install -m644 *.ins *.dtx *.bst Makefile README $(TD)$(SRCDIR)
+       install -m644 mlastyle.dvi $(TD)$(DOCDIR)
+       [ ! -f mlastyle.pdf ] ||install -m644 mlastyle.pdf $(TD)$(DOCDIR)
+       [ ! -f mlastyle.ps  ] ||install -m644 mlastyle.ps  $(TD)$(DOCDIR)
+       install -m644 *.bst $(TD)$(BSTDIR)
        texhash
 
 instructions:
        @echo "Now run make install, or copy mlastyle.sty to a directory"
        texhash
 
 instructions:
        @echo "Now run make install, or copy mlastyle.sty to a directory"
-       @echo "in the LaTeX search path"
-
-
-mlastyle.sty: mlastyle.ins mlastyle.dtx
-
-mlastyle.dvi: mlastyle.sty
+       @echo "in the LaTeX search path."