#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

DB2MAN=/usr/share/sgml/docbook/stylesheet/xsl/nwalsh/manpages/docbook.xsl
XP=xsltproc -''-nonet

gaphor.1: debian/gaphor.xml
	$(XP) $(DB2MAN) $<

build: build-stamp

build-stamp: gaphor.1
	dh_testdir

	# Add here commands to compile the package.
	python setup.py build
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp

	# Add here commands to clean up after the build process.
	python setup.py clean
	-find gaphor utils -name \*.pyc -exec rm -f {} \;
	-rm -f gaphor.1
	-rm -fr build setuptools_git-0.3.4-py2.6.egg
	-rm -f ez_setup.pyc
	dh_clean 

install: build
	dh_testdir
	dh_testroot
	dh_clean -k 
	dh_installdirs
	mkdir -p debian/gaphor/usr/share/applications
	cp debian/gaphor.desktop debian/gaphor/usr/share/applications
	mkdir -p debian/gaphor/usr/share/pixmaps
	cp debian/gaphor.xpm debian/gaphor/usr/share/pixmaps

	python setup.py install \
		--root=$(CURDIR)/debian/gaphor --install-layout=deb

	#Comment zope requirement because zope3 package does not provide a
	#egg-info directory
	find debian/ -wholename '*/gaphor-*.egg-info/requires.txt' \
		| xargs sed -i 's/^zope/# zope/'

# Build architecture-dependent files here.
binary-indep: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs 
	dh_installdocs
	dh_installmenu
	dh_installman gaphor.1
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	dh_pysupport
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install
