webdir ?= 1.2.0
version ?= $(webdir)
year ?= $(shell date +%Y)
home ?= mfranz@gorilla.math.uwo.ca:public_html/convex

mintinfo ?= 2

convex.mla : *.mt
	rm -f convex.mla
	maple -s -D 'VERSION="$(version)"' -D 'YEAR="$(year)"' -D 'convexrep="convex.mla"'\
	  $(if $(verbose), -D VERBOSE) <convex.mt >convex.log
	! grep '^> quit$$' convex.log || (tail convex.log ; exit 1)
	ls -l convex.mla
	grep '^Warning' convex.log || exit 0
	rm -f convex.log

convex.lib : *.mt
	rm -f convex.lib convex.ind
	maple -s -D 'VERSION="$(version)"' -D 'YEAR="$(year)"' -D 'convexrep="convex.lib"'\
	  $(if $(verbose), -D VERBOSE) <convex.mt >convex.log
	! grep '^> quit$$' convex.log || (tail convex.log ; exit 1)
	chmod a+r convex.lib convex.ind
	ls -l convex.lib convex.ind
	grep '^Warning' convex.log || exit 0
	rm -f convex.log

mint:
	-mint -t 9 -i $(mintinfo) -s -q -l -w 999 \
	  -D MINT -D 'VERSION="$(version)"' -D 'YEAR="$(year)"' <convex.mt

anames :
	./mapleanames <convex.m | grep -v /

convex.tar.gz : *.mt Makefile 00README Changelog
	chmod a+r *.mt Makefile 00README LICENSE Changelog
	tar cf convex.tar ./00README ./LICENSE ./Changelog ./Makefile ./*.mt
	chmod a+r convex.tar
	gzip -f -9 convex.tar

web : convex.lib convex.mla 00README Changelog convex.tar.gz
	scp -p convex.lib convex.ind convex.mla convex.tar.gz 00README Changelog \
	  $(home)/files/$(webdir)
