#!/usr/bin/make -f
# 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

# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

# Include dpatch stuff
#include /usr/share/dpatch/dpatch.make
# Include pkg-gnome stuff.
#include /usr/share/gnome-pkg-tools/1/rules/uploaders.mk
# get-orig-source target
#-include /usr/share/gnome-pkg-tools/1/rules/gnome-get-source.mk

ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -g
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	INSTALL_PROGRAM += -s
endif

PYVERS=2.5

build/configure-stamp: configure
	dh_testdir
	mkdir -p build
	cd build && PYTHON=/usr/bin/python2.5 ../configure    \
		--host=$(DEB_HOST_GNU_TYPE)	     \
		--build=$(DEB_BUILD_GNU_TYPE)	   \
		--prefix=/usr \
		--without-gda \ 
		--with-gtkmozembed=mozilla  \
		--without-egg  \
		--without-gksu  \
		--without-gdl  \
		--without-gtkspell 
	touch $@

build/build-stamp: build/configure-stamp
	dh_testdir
	$(MAKE) -C build
	touch $@

build: build/build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -rf build debian/tmp
	dh_clean

install-clean:
	dh_testdir
	dh_testroot
	dh_clean -k

install: build/build-stamp
	dh_testdir
	dh_testroot
	cd build/gtkhtml2 && $(MAKE) install DESTDIR=$(CURDIR)/debian/python-gtkhtml2
	dh_install --sourcedir=debian/python-gtkhtml2

#install: build install-clean install
#	dh_installdirs

# Build architecture-independent files here.
binary-indep:
	dh_testdir -i
	dh_testroot -i
	dh_installdocs -i
	dh_installexamples -i
	dh_installmenu -i
	dh_installcron -i
	dh_installinfo -i
	dh_installchangelogs -i
	dh_link -i
	dh_compress -i
	dh_fixperms -i
	dh_python -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir -a
	dh_testroot -a
	dh_installdocs -a
	dh_installexamples -a
	dh_installmenu -a
	dh_installman -a
	dh_installinfo -a
	dh_installchangelogs -a
	dh_link -a
	dh_strip -a
	dh_compress -a
	dh_fixperms -a
	dh_python -a
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

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