#!/usr/bin/make -f

# Comment this to turn off verbose mode.
export DH_VERBOSE=1

configure: configure-stamp
configure-stamp:
	dh_testdir
	libtoolize --automake
	aclocal -I ./m4
	autoconf
	autoheader
	automake --add-missing --foreign
	./configure --sysconfdir=/etc prefix=/usr
	touch configure-stamp

build: configure-stamp build-stamp 
build-stamp:
	docbook-to-man moblin-applets.sgml > moblin-applets.man
	$(MAKE)
	touch build-stamp

install: configure-stamp build-stamp install-stamp
install-stamp:
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs
	GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1 $(MAKE) DESTDIR=$(CURDIR)/debian/moblin-applets install

binary-indep: build install

binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installinit
	dh_installman
	dh_installchangelogs
	dh_installdocs
	dh_install
	dh_link
	dh_strip
	dh_compress 
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

clean:
	dh_testdir
	dh_testroot
	[ ! -f Makefile ] || $(MAKE) clean
	[ ! -f Makefile ] || $(MAKE) distclean
	rm -f aclocal.m4 config.sub config.guess configure
	rm -f configure-stamp build-stamp install-stamp
	find . -name Makefile.in | xargs rm -f
	dh_clean 

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