#!/usr/bin/make -f
#-*- makefile -*-
# Made with the aid of dh_make, by Craig Small
# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
# Some lines taken from debmake, by Christoph Lameter.

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

# This is the debhelper compatability version to use.
export DH_COMPAT=1

build: build-stamp
build-stamp:
	dh_testdir
	/usr/bin/python2.1 setup.py build
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp install-stamp
	rm -rf build
	find . -name "*.pyc" |xargs -r rm
	# Add here commands to clean up after the build process.
	dh_clean

install: install-stamp
install-stamp: build-stamp
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	# Add here commands to install the package into debian/tmp.
	cp -rf build/lib*/twisted debian/tmp/usr/lib/python2.1/site-packages/
	cp twisted/im/instancemessenger.glade debian/tmp/usr/lib/python2.1/site-packages/twisted/im
	cp twisted/plugins.tml debian/tmp/usr/lib/python2.1/site-packages/twisted/
	cp TODO README CREDITS doc/*.html debian/tmp/usr/share/doc/twisted
	cp doc/examples/*.py debian/tmp/usr/share/doc/twisted/examples
	gzip -9 debian/tmp/usr/share/doc/twisted/examples/*.py
	cp debian/copyright debian/tmp/usr/share/doc/twisted/
	cp bin/eco bin/manhole bin/tap2deb bin/mktap bin/gnusto bin/twistd bin/im bin/t-im bin/faucet debian/tmp/usr/bin
	for file in debian/tmp/usr/bin/*;do sed '1s|.*|#!/usr/bin/python2.1|' $$file > $$file.$$$$;cat $$file.$$$$ > $$file;rm $$file.$$$$;done
	cp doc/man/*.1 debian/tmp/usr/share/man/man1/
	gzip -9 debian/tmp/usr/share/man/man1/*
	touch install-stamp

binary-indep: build install

binary-arch: build install
	dh_testdir
	dh_testroot
	dh_strip
	dh_compress
	dh_installchangelogs
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

source diff:                                                                  
	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false

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