
SRCDIR=contour
INSTALLDIR=`kpsewhich --expand-path='$$TEXMFLOCAL'`/tex/latex/contour
DOCDIR=`kpsewhich --expand-path='$$TEXMFLOCAL'`/doc/latex/contour
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: contour contour.pdf 


contour: contour.sty


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

distclean: clean
	@-rm -f contour.sty contour.pdf

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

zip:	all clean
	-@rm -f contour-$(VERSION).zip
	mkdirhier tex/latex/contour
	mkdirhier doc/latex/contour
	mkdirhier source/latex/contour
	mv contour.sty tex/latex/contour
	cp contour.dtx contour.ins contour.xml source/latex/contour
	cp Makefile source/latex/contour
	cp README contour.pdf doc/latex/contour
	zip -r contour-$(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 contour.sty $(INSTALLDIR)
	install -m644 contour.pdf $(DOCDIR)
	texhash

contour.sty: contour.ins contour.dtx
