
SRCDIR=numprint
INSTALLDIR=`kpsewhich --expand-path='$$TEXMFLOCAL'`/tex/latex/numprint
DOCDIR=`kpsewhich --expand-path='$$TEXMFLOCAL'`/doc/latex/numprint
VERSION=`latex getversion | grep '^VERSION' | sed 's/^VERSION \\(.*\\)\\.\\(.*\\)/\\1_\\2/'`


.SUFFIXES: .sty .ins .dtx .dvi .ps .pdf

.ins.sty:
	latex $<

.dtx.pdf:
	pdflatex $<
	pdflatex $<
	makeindex -s gind.ist $(*D)/$(*F)
	makeindex -s gglo.ist -o $(*D)/$(*F).gls $(*D)/$(*F).glo
	pdflatex $<

.dvi.ps:
	dvips -o $(*D)/$(*F).ps $(*D)/$(*F)


all: numprint numprint.pdf numprinttest.dvi ausgabe 

numprinttest.dvi: numprinttest.tex numprint.sty
	latex numprinttest


numprint: numprint.sty



clean:
	@-rm -f numprint.glo numprint.gls numprint.idx numprint.ilg
	@-rm -f numprint.ind numprint.aux numprint.log numprint.toc
	@-rm -f numprinttest.log numprinttest.aux
	@-rm -f *~

distclean: clean
	@-rm -f numprint.sty numprint.pdf numprint.ps numprint032.sty
	@-rm -f numprinttest.dvi numprinttest.ps

tar:	all clean
	echo Lege numprint-$(VERSION).tar.gz an
	-rm -f numprint-$(VERSION).tar.gz
	tar czCf .. numprint-$(VERSION).tar.gz \
	  $(SRCDIR)/README \
	  $(SRCDIR)/Makefile \
	  $(SRCDIR)/numprint.dtx \
	  $(SRCDIR)/numprint.ins \
	  $(SRCDIR)/numprint.pdf \
	  $(SRCDIR)/numprint032.dtx \
	  $(SRCDIR)/numprinttest.tex \
	  $(SRCDIR)/getversion.tex \
	  $(SRCDIR)/numprint.xml
	rm -f getversion.log

zip:	all clean
	-@rm -f numprint-$(VERSION).zip
	mkdirhier tex/latex/numprint
	mkdirhier doc/latex/numprint
	mkdirhier source/latex/numprint
	mv numprint.sty numprint032.sty tex/latex/numprint
	cp numprint.dtx numprint.ins numprint.xml source/latex/numprint
	cp numprint032.dtx Makefile source/latex/numprint
	cp numprinttest.tex README numprint.pdf doc/latex/numprint
	zip -r numprint-$(VERSION).zip tex doc source
	rm -r tex/ doc/ source/
	rm -f getversion.log

install: all
	if [ ! -d $(INSTALLDIR) ]; then mkdirhier $(INSTALLDIR); fi
	if [ ! -d $(DOCDIR) ]; then mkdirhier $(DOCDIR); fi
	install -m644 numprint.sty numprint032.sty $(INSTALLDIR)
	install -m644 numprint.pdf $(DOCDIR)
	texhash

ausgabe:
	@echo "Please copy numprint.sty and numprint032.sty to a directory"
	@echo "in the LaTeX search path"


numprint.sty: numprint.ins numprint.dtx

