
PYTHON=python2.3

all :
	ln -sf ../xmlmp scripts/xmlmp 

clean :
	$(PYTHON) setup.py clean --all
	rm -f scripts/*~ scripts/*.pyc
	rm -f xmlmp/*~ xmlmp/*.pyc
	rm -f xmlmp/semantic.cache
	rm -f doc/*~ doc/\#*\#
	rm -f *~

realclean : clean
	rm -f scripts/xmlmp
	rm -f doc/*.[0-9]
	rm -f doc/*.html
	rm -f doc/*.ps
	rm -f examples/*.[0-9]
	rm -f examples/*.html
	rm -f examples/*.ps

distclean : realclean
	rm -rf dist
	rm -f MANIFEST

sdist: distclean doc
	$(PYTHON) setup.py sdist

doc : doc/xmlmp.1 doc/xmlmp.1.html

examples: examples/xmlmp.1 \
          examples/xmlmp.1.html \
          examples/xmlmp.1.ps \
          examples/picocom.8 \
          examples/picocom.8.html \
          examples/picocom.8.ps

%.1 : %.1.xml
	xmlmp2man < $< > $@

%.1.html : %.1.xml
	xmlmp2html < $< > $@

%.1.ps : %.1
	groff -mandoc -Tps $< > $@

%.8 : %.8.xml
	xmlmp2man < $< > $@

%.8.html : %.8.xml
	xmlmp2html < $< > $@

%.8.ps : %.8
	groff -mandoc -Tps $< > $@
