RM=rm -f
SHELL=sh
VERSION=3.2
FILES=README ChangeLog Makefile geometry.dtx geometry.ins manual.pdf gtest.tex
JUNKS=*.aux *.toc *.idx *.drv *.dvi *.log *.lof *.ist *.ilg *.ind *.out

unpack:
	latex geometry.ins
	@echo '**************************************'
	@echo ' To make geomtery documentation,      '
	@echo ' % make manual                        '
	@echo ' or                                   '
	@echo ' % make doc   (for full documentation)'
	@echo '**************************************'

all: unpack doc manual

geometry.drv: unpack
manual.drv: unpack

doc: geometry.drv
	latex geometry.drv
	latex geometry.drv
	latex geometry.drv

manual: manual.drv
	-$(RM) manual.aux
	pdflatex manual.drv
	pdflatex manual.drv
	pdflatex manual.drv

test: unpack
	-cp geometry.sty geometry.cfg test
	@echo
	@(cd test; for f in gtest*tex; do latex $$f; done)
	@echo
	@echo "--- Summary of Tests ---"
	@(cd test; grep -h Test gtest*.log)
	@echo "-------------------------"

pack: clean
	-(cd ..; tar cvfz geometry-$(VERSION).tgz geometry-$(VERSION))

clean:
	@$(RM) $(JUNKS) geometry.sty geometry.cfg *~ \#*
	@(cd test; $(RM) $(JUNKS) geometry.sty geometry.cfg *~ \#*)
	@echo The current and test directories have been cleaned up.
