include ../../rules/make.rules

NAME = python

PYTHONFILES = ${wildcard *.py}
SHELLFILES = ${SHELLDIR}/pgml2sql.py ${SHELLDIR}/pgml2dot.py ${SHELLDIR}/pgml2ldb.py ${SHELLDIR}/simplify-pgml.py \
			${SHELLDIR}/pgtml2insert.py ${SHELLDIR}/pgtml2select.py ${SHELLDIR}/pgtml2update.py \
			${SHELLDIR}/pgtml2iphp.py ${SHELLDIR}/pgtml2sphp.py ${SHELLDIR}/pgtml2uphp.py \
			${SHELLDIR}/pgtml2form.py ${SHELLDIR}/pgtml2zope.py ${SHELLDIR}/dtd2pgml.py ${SHELLDIR}/xml2db.py \
			${SHELLDIR}/qmlserv.py ${SHELLDIR}/pgml2ssql.py

all: # doc

doc: doc.ok

doc.ok: ${PYTHONFILES} ${SRCDOCDIR}/python
	@echo "doing $@"
	@for pythonfile in ${PYTHONFILES}; \
	do \
		gendoc -d ${SRCDOCDIR}/python/ ./$${pythonfile}; \
	done
	@date > $@

install: all ${SHELLFILES}

copy.ok: ${PYTHONDIR} ${PYTHONFILES}
	@echo "installing ${NAME} files"
	@if [ -n "${PYTHONFILES}" ]; then cp ${PYTHONFILES} ${PYTHONDIR}; fi
	@date > $@

clean:
	@rm -rf *~ *.pyc *.ok

${PYTHONDIR}:
	@echo "creating $@"
	@mkdir -p ${PYTHONDIR}

${SHELLDIR}:
	@echo "creating $@"
	@mkdir -p ${SHELLDIR}

${SRCDOCDIR}/python:
	@echo "doing $@"
	@mkdir -p $@

${SHELLDIR}/pgml2sql.py: ${SHELLDIR} copy.ok
	@if [ ! -L $@ ] ; \
	then \
		cd ${SHELLDIR};ln -sf ${RELPYTHONSHELLPATH}/pgml2sql.py .; \
	fi

${SHELLDIR}/pgml2ssql.py: ${SHELLDIR} copy.ok
	@if [ ! -L $@ ] ; \
	then \
		cd ${SHELLDIR};ln -sf ${RELPYTHONSHELLPATH}/pgml2ssql.py .; \
	fi

${SHELLDIR}/pgml2dot.py: ${SHELLDIR} copy.ok
	@if [ ! -L $@ ] ; \
	then \
		cd ${SHELLDIR};ln -sf ${RELPYTHONSHELLPATH}/pgml2dot.py .; \
	fi

${SHELLDIR}/pgml2ldb.py: ${SHELLDIR} copy.ok
	@if [ ! -L $@ ] ; \
	then \
		cd ${SHELLDIR};ln -sf ${RELPYTHONSHELLPATH}/pgml2ldb.py .; \
	fi

${SHELLDIR}/simplify-pgml.py: ${SHELLDIR} copy.ok
	@if [ ! -L $@ ] ; \
	then \
		cd ${SHELLDIR};ln -sf ${RELPYTHONSHELLPATH}/simplify-pgml.py .; \
	fi

${SHELLDIR}/pgtml2insert.py: ${SHELLDIR} copy.ok
	@if [ ! -L $@ ] ; \
	then \
		cd ${SHELLDIR};ln -sf ${RELPYTHONSHELLPATH}/pgtml2insert.py .; \
	fi

${SHELLDIR}/pgtml2select.py: ${SHELLDIR} copy.ok
	@if [ ! -L $@ ] ; \
	then \
		cd ${SHELLDIR};ln -sf ${RELPYTHONSHELLPATH}/pgtml2select.py .; \
	fi

${SHELLDIR}/pgtml2update.py: ${SHELLDIR} copy.ok
	@if [ ! -L $@ ] ; \
	then \
		cd ${SHELLDIR};ln -sf ${RELPYTHONSHELLPATH}/pgtml2update.py .; \
	fi

${SHELLDIR}/pgtml2form.py: ${SHELLDIR} copy.ok
	@if [ ! -L $@ ] ; \
	then \
		cd ${SHELLDIR};ln -sf ${RELPYTHONSHELLPATH}/pgtml2form.py .; \
	fi

${SHELLDIR}/pgtml2iphp.py: ${SHELLDIR} copy.ok
	@if [ ! -L $@ ] ; \
	then \
		cd ${SHELLDIR};ln -sf ${RELPYTHONSHELLPATH}/pgtml2iphp.py .; \
	fi

${SHELLDIR}/pgtml2sphp.py: ${SHELLDIR} copy.ok
	@if [ ! -L $@ ] ; \
	then \
		cd ${SHELLDIR};ln -sf ${RELPYTHONSHELLPATH}/pgtml2sphp.py .; \
	fi

${SHELLDIR}/pgtml2uphp.py: ${SHELLDIR} copy.ok
	@if [ ! -L $@ ] ; \
	then \
		cd ${SHELLDIR};ln -sf ${RELPYTHONSHELLPATH}/pgtml2uphp.py .; \
	fi

${SHELLDIR}/pgtml2zope.py: ${SHELLDIR} copy.ok
	@if [ ! -L $@ ] ; \
	then \
		cd ${SHELLDIR};ln -sf ${RELPYTHONSHELLPATH}/pgtml2zope.py .; \
	fi

${SHELLDIR}/dtd2pgml.py: ${SHELLDIR} copy.ok
	@if [ ! -L $@ ] ; \
	then \
		cd ${SHELLDIR};ln -sf ${RELPYTHONSHELLPATH}/dtd2pgml.py .; \
	fi

${SHELLDIR}/xml2db.py: ${SHELLDIR} copy.ok
	@if [ ! -L $@ ] ; \
	then \
		cd ${SHELLDIR};ln -sf ${RELPYTHONSHELLPATH}/xml2db.py .; \
	fi

${SHELLDIR}/xtex2latex.py: ${SHELLDIR} copy.ok
	@if [ ! -L $@ ] ; \
	then \
		cd ${SHELLDIR};ln -sf ${RELPYTHONSHELLPATH}/xtex2latex.py .; \
	fi

${SHELLDIR}/qmlserv.py: ${SHELLDIR} copy.ok
	@if [ ! -L $@ ] ; \
	then \
		cd ${SHELLDIR};ln -sf ${RELPYTHONSHELLPATH}/qmlserv.py .; \
	fi

