all:	Pub/.copied

VERNUM=6.5
PREVNUM=6.4
VER=v${VERNUM}
PREV=v${PREVNUM}

PYSRCS=hilbert.py_txt         hilbert_test.py_txt     hilbert_pic.py_txt
PYDSTS=Pub/hilbert.py_txt Pub/hilbert_test.py_txt Pub/hilbert_pic.py_txt

Pub/hilbert.py_txt:	hilbert.py_txt
	cp hilbert.py_txt Pub/hilbert.py_txt
Pub/hilbert_test.py_txt:	hilbert_test.py_txt
	cp hilbert_test.py_txt Pub/hilbert_test.py_txt
Pub/hilbert_pic.py_txt:	hilbert_pic.py_txt
	cp hilbert_pic.py_txt Pub/hilbert_pic.py_txt

DIRECT_SOURCES=makeindex.php_txt Makefile

SOURCES=${PYSRCS} ${DIRECT_SOURCES}

MOORE=moore/index.html moore/hilbert.c moore/hilbert.h

DIFFS=old/v4_${VER}_diff.txt old/${PREV}_${VER}_diff.txt

OLDPUB=${DIFFS} old/makeindex.php_txt old/index.html

DIRECT_PUBFILES=${DIRECT_SOURCES} index.html hilbert_thumb.gif hilbert_pic.pdf

old/v4_${VER}_diff.txt:	old/${VER}/.copied
	(cd old; diff -rc v4 ${VER} >v4_${VER}_diff.txt; true)

old/${PREV}_${VER}_diff.txt:	old/${VER}/.copied
	(cd old; diff -rc ${PREV} ${VER} >${PREV}_${VER}_diff.txt; true)

old/${VER}/.copied:	${SOURCES}
	mkdir old/${VER} || true
	cp ${SOURCES} old/${VER}
	touch old/${VER}/.copied

old/index.html: ${DIFFS} old/makeindex.php_txt
	(cd old; chmod u+w index.html; php makeindex.php_txt ${VER} >index.html )
	chmod a-w old/index.html


Pub/.copied:	${PYDSTS} ${DIRECT_PUBFILES} ${OLDPUB} ${MOORE}
	chmod u+w Pub/index.html Pub/old/index.html
	cp ${DIRECT_PUBFILES} Pub
	cp ${OLDPUB} Pub/old
	cp ${MOORE} Pub/moore
	chmod a-w Pub/index.html Pub/old/index.html
	touch Pub/.copied

index.html:	${SOURCES} ${DIFFS}
	chmod u+w index.html
	touch .lastchange # sensed by makeindex.php_txt
	php makeindex.php_txt ${VERNUM} >index.html
	chmod a-w index.html

hilbert_pic.pdf:	hilbert.py hilbert_pic.py
	python2 hilbert_pic.py >hilbert_pic.pdf
