#!/usr/bin/make -f

PATH:=/usr/bin/dh7:/usr/bin:$(PATH)
export PATH
SBOX_REDIRECT_IGNORE=/usr/bin/perl
export SBOX_REDIRECT_IGNORE

# This rules attemps to be generic for all packages which
# fill the following: the package uses the autotools, but
# the source package does not include any of the added and
# generated autotools files. Each buildpackgage recreates
# all of them.
#
# If you want a "clean" source package, your Automake.am
# could include something like follows
#
#	distclean-local:
#		-rm aclocal.m4
#		-rm Makefile
#		-rm Makefile.in
#		-rm configure
#		-rm -rf autom4te.cache
#		-rm -rf m4
#		-rm config.*
#		-rm ltmain.sh
#		-rm libtool
#		-rm depcomp
#		-rm install-sh
#		-rm missing
#		... etc
#
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/autotools.mk

INSTALL_TARGETS := $(foreach pkg,$(DEB_ALL_PACKAGES),install/$(pkg))
MAKEBUILDDIR_TARGETS := $(foreach pkg,$(DEB_ALL_PACKAGES),makebuilddir/$(pkg))

# scratchbox currently supports only compat level 5, and
# got this rule file only working on compat 4. This uses
# "debian/*.files" and "dh_movefiles". On compat 7, this
# special target can be removed and package should use
# only "debian/*.install" files (no "debian/*.files"!).
$(INSTALL_TARGETS)::
	dh_movefiles -p$(notdir $@)

clean::
	-rm debian/configure-stamp

$(MAKEBUILDDIR_TARGETS):: debian/configure-stamp


debian/configure-stamp:
	[ ! -f Makefile ] || $(MAKE) distclean
	autoreconf -i -f -s
	touch $@

override_dh_gencontrol:
	dh_gencontrol
	maemo-optify

