#!/usr/bin/make -f
#------------------------------------------------------------------------------
# vim: syntax=make
#
# $Sendmail: rules,v 8.12.10 2003-07-13 21:46:03 cowboy Exp $
#
# Copyright (c) 1998-2003 Richard Nelson.  All Rights Reserved.
#
# ./rules.	Generated from rules.in by configure.
#
# Rules file for Sendmail 8.12.10-6(527370)
#			 on  Debian testing/unstable
#			 via Debhelper V4.1
#
# Note: the .in file supports Sendmail 8.7.6 - 8.12.10
#		on Debian slink, potato, woody, testing, sid, ...
#		but the generated file is customized to the version noted above.
#
# The only thing to watch for is to make sure the changelog correctly
# reflects the appropriate version and distribution!
#
# To support private builds:
#	1) use the environment variables (defaults shown first):
#			CC=gcc|gcc-3.0..........-- choose compiler
#			CFLAGS='-O2 -Wall [-g]'.-- choose compile options
#			DEFINES=''..............-- additional -Dxxx
#			SM_CONF_OPT=''..........-- additional configure options
#			SM_BUILD_OPT=''.........-- additional build options
#	2) Build the package using your normal setup:
#		A) [fakeroot] debian/rules binary
#		B) debuild -rfakeroot
#		C) dpkg-buildpackage -rfakeroot -uc -us
#
# DEB_BUILD_OPTIONS (global Debian package build options)
#	Debian specific, and common across package options
#		noopt	- Do *NOT* compile with optimization (force -O0)
#		nostrip - Do *NOT* strip binaries (for debugging)
#		
#
# SM_CONF_OPT
#	Additional configure options and/or overrides may be specified thusly:
#		1) export SM_CONF_OPT='--enable-shm=no'
#		   dpkg-buildpackage -rfakeroot -uc -us
#		2) SM_CONF_OPT='--enable-shm=no' dpkg-buildpackage
#		3) debuild -e SM_CONF_OPT='--enable-shm=no'
#		etc...
#
# SM_BUILD_OPT
#	1) export SM_BUILD_OPT='notls'
#	   dpkg-buildpackage -rfakeroot -uc -us
#	2) SM_BUILD_OPT='notls' dpkg-buildpackage -rfakeroot -uc -us
#	3) debuild -e SM_BUILD_OPT='notls' -e CLFAGS='-O3 Wall'
#	etc...
#
#	Supported options values for SM_BUILD_OPT:
#		notls		Disable STARTTLS (OpenSSL) support
#		noauth		Disable SMTP AUTH (sasl) support
#		nodev		Disable generation of libmilter-dev package
#		nodoc		Disable generation of sendmail-doc package
#
# This make file uses scripts from the DBS (0.8) package!
#
# Richard Nelson <cowboy@debian.org> 2003-07-13 21:46:03 (-0700)
#------------------------------------------------------------------------------
#SHELL := /bin/sh -x

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

# This is the debhelper compatibility version to use. (we'll set it later)
#export DH_COMPAT=4

# This has to be exported to make some magic below work.
export DH_OPTIONS

# Support separate debian directory
ifeq (yes, $(shell test -d debian && echo 'yes'))
	debian_dir := ./debian
	pwd_dir := ${PWD}
else
	debian_dir := .
	pwd_dir := ${PWD}/..
	SM_CONF_OPT += --enable-maintainer-mode
	endif

# Determine build,host architectures (via dpkg-architecture)
ifeq (, ${DEB_BUILD_ARCH})
	ifeq (yes, $(shell test -x /usr/bin/dpkg-architecture && echo 'yes'))
		include ${debian_dir}/scripts/dpkg-arch.mk
		endif
	endif

# Check for cross-compilation
ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
	ifneq (, $(DEB_BUILD_GNU_TYPE))
		endif
	endif

# will want path info for some things... Like patches/changelogs...
pwd_string := $(shell expr "${pwd_dir}" : '.*-\([0-9.].*\)')
ifeq (, $(findstring +,${pwd_string}))
	pwd_version := ${pwd_string}
else
	pwd_version := $(shell expr "${pwd_string}" : '.*+\([0-9.].*\)')
	endif
ifneq (, $(findstring Final,${pwd_version}))
	pwd_version := $(shell expr "${pwd_version}" : '\(.*\)\.Final')
	endif
pwd_major  := $(shell expr "${pwd_version}" : '\([0-9]*\.[0-9]*\)')

# get package/version information from the changelog
package		   := $(shell (cd ${debian_dir}/.. >/dev/null && \
		dpkg-parsechangelog 2>/dev/null) | awk '/^Source:/ {print $$2}')
version_string := $(shell (cd ${debian_dir}/.. >/dev/null && \
		dpkg-parsechangelog 2>/dev/null) | awk '/^Version:/ {print $$2}')
version_full   := $(shell expr "${version_string}" : '\([^-]*\)')
ifneq (, $(findstring Final,${version_full}))
	version_full	:= $(shell expr "${version_full}" : '\(.*\)\.Final')
	endif
version_debian := $(shell expr "${version_string}" : '[^-]*\(-.*\)')
version		   := ${version_full}
version_major  := $(shell expr "${version_full}" : '\([0-9]*\.[0-9]*\)')
version_minor  := $(shell expr "${version_full}" : '[0-9]*\.[0-9]*\.\(.*\)')
ifneq (, $(findstring +,${version_minor}))
	beta_version := $(shell expr "${version_full}" : '.*+\([0-9.].*\)')
	beta_major := $(shell expr "${beta_version}" : '\([0-9]*\.[0-9]*\)')
	beta_minor := $(shell expr "${beta_version}" : '[0-9]*\.[0-9]*\.\(.*\)')
	ifneq (, $(beta_version))
		version		   := ${beta_version}
		version_major  := ${beta_major}
		version_minor  := ${beta_minor}
		endif
	endif

# Many things depend upon which release (slink, potato, woody, etc.)
PKG_DIR  := ${debian_dir}/${package}
DATA_DIR := /usr/share
ifeq (v4, $(shell (cd ${debian_dir}/.. >/dev/null && dh_testversion 4.0.0 2>/dev/null && echo 'v4')))
	DH_COMPAT := 4
else
	ifeq (v3, $(shell (cd ${debian_dir}/.. >/dev/null && dh_testversion 3.0.0 2>/dev/null && echo 'v3')))
		DH_COMPAT := 3
	else
		ifeq (v2, $(shell (cd ${debian_dir}/.. >/dev/null && dh_testversion 2.0.40 2>/dev/null && echo 'v2')))
			DH_COMPAT := 2
		else
			DH_COMPAT := 1
			PKG_DIR   := ${debian_dir}/tmp
			DATA_DIR  := /usr
			endif
		endif
	endif
export DH_COMPAT

# the dbs rules
TAR_DIR := ${package}-${version}
# Handle the case where the changelog is newer that what we're building
ifneq (yes, $(shell test -e ${debian_dir}/../${TAR_DIR}.tar.gz && echo 'yes'))
	TAR_DIR := ${package}-${pwd_version}
	endif
SOURCE_DIR := build-tree
BUILD_TREE := ${SOURCE_DIR}/${TAR_DIR}
PATCH_DIR  := ${debian_dir}/patches/${version_major}/${version}
SCRIPT_DIR := ${debian_dir}/scripts
STAMP_DIR  := ${debian_dir}/build/stampdir

# Include Debian Autoconf settings
ifeq (yes, $(shell test -e ${debian_dir}/build/autoconf.mk && echo 'yes'))
	include ${debian_dir}/build/autoconf.mk
else
	include ${debian_dir}/build/autoconf.mk.in
	endif

# these are strictly for my own consuption
PKG_DOC		 := ${debian_dir}/${package}-doc${docdir}/${package}-doc
PACKAGES	 := sendmail sendmail-doc libmilter-dev
SM_SUBDIRS	 := editmap libmilter mail.local mailstats \
		makemap praliases rmail sendmail smrsh vacation
#
# We want delayed interpretation of the options !
ifeq (yes, $(shell test -x /usr/bin/debuild && echo 'yes'))
	DEB_BUILD = \
		SM_CONF_OPT="${SM_CONF_OPT}" \
		SM_BUILD_OPT="${SM_BUILD_OPT}" \
		DEB_BUILD_OPTIONS="${DEB_BUILD_OPTIONS}" \
		debuild -e SM_CONF_OPT -e SM_BUILD_OPT
else
	DEB_BUILD = \
		SM_CONF_OPT="${SM_CONF_OPT}" \
		SM_BUILD_OPT="${SM_BUILD_OPT}" \
		DEB_BUILD_OPTIONS="${DEB_BUILD_OPTIONS}" \
		dpkg-buildpackage
	endif

# Process build-time options:
#	1) options from SM_BUILD_OPT (Prior to configure)
#	2) defaults (Prior to configure)
ENABLE_INDEP := yes
ENABLE_ARCH  := yes
ENABLE_LIB	 := no
ENABLE_BIN	 := yes
ifneq (, $(findstring notls,${SM_BUILD_OPT}))
	ENABLE_TLS := no
else
	ENABLE_TLS := auto
	endif
ifneq (, $(findstring noauth,${SM_BUILD_OPT}))
	ENABLE_AUTH := no
else	
	ENABLE_AUTH := yes
	endif
ifneq (, $(findstring nodev,${SM_BUILD_OPT}))
	ENABLE_DEV := no
else
	ENABLE_DEV := yes
	endif
ifneq (, $(findstring nodoc,${SM_BUILD_OPT}))
	ENABLE_DOC := no
else
	ENABLE_DOC := yes
	endif
#
# Summarize above options into -INDEP and -ARCH for this Makefile
ENABLE_INDEP := ${ENABLE_DOC}
ifeq (no, ${ENABLE_BIN})
	ifeq (no, ${ENABLE_LIB})
		ifeq (no, ${ENABLE_DEV})
			ENABLE_ARCH := no
			endif
		endif
	endif

all:
	@echo 'Please specify a real target in the future...';
	$(MAKE) -f ${debian_dir}/rules \
		version_string=${pwd_string} \
		SM_CONF_OPT="${SM_CONF_OPT}" SM_BUILD_OPT="${SM_BUILD_OPT}" \
		DEB_BUILD_OPTIONS="${DEB_BUILD_OPTIONS}" \
		binary;
	

#------------------------------------------------------------------------------
#	Rules to maintain the external Debian directory
#------------------------------------------------------------------------------
#-------------
refresh-dbs:
	@echo 'updating debian/scripts directory...';
	cp -af /usr/share/dbs/* ${SCRIPT_DIR}/;
	chmod a-w ${SCRIPT_DIR}/*;

#-------------
refresh-debian:
	@dh_testdir;
	@echo 'updating debian directory ...';
	sudo $(RM) -r debian;
	sudo cp -a ../debian ./;
	$(RM) -rf ${SOURCE_DIR} ${STAMP_DIR};
	# Make sure directories are writeable by the owner (mine aren't)
	chmod -R u+w debian;
	# Can't do the following two as it breaks downlevel autotools
	#-(cd ${debian_dir} && aclocal);
	#-(cd ${debian_dir} && automake);
	# Force a configure here, using $${PWD} so the changelog, etc.
	# wind up with the right version numbers
	$(MAKE) -f ${debian_dir}/rules \
		version_string=${pwd_string} \
		SM_CONF_OPT="${SM_CONF_OPT}" SM_BUILD_OPT="${SM_BUILD_OPT}" \
		DEB_BUILD_OPTIONS="${DEB_BUILD_OPTIONS}" \
		configure;
	# Remove pieces not needed for further building
	find ${debian_dir}/patches -type d -a ! -name 'patches' \
		-a ! -name 'contrib' \
		-a ! -name "${pwd_major}" \
		-a ! -name "${pwd_version}" \
		| xargs -r $(RM) -r;
	$(RM) -r ${debian_dir}/bugs ${debian_dir}/private ${debian_dir}/watch;
	$(RM) ${debian_dir}/build/acinclude.m4 \
		${debian_dir}/build/aclocal.m4 \
		${debian_dir}/build/sendmail.m4 \
		${debian_dir}/build/ndbm.m4;
	$(MAKE) -f ${debian_dir}/rules clean-debian;


#-------------
clean-debian:
	@echo 'cleaning debian directory...';
	-(cd ${debian_dir} && $(MAKE) -f Makefile maintainer-clean;)
	find ${debian_dir} -name '*~' -o -name '\.*\.swp' \
			| xargs -r rm;
	$(RM) ${debian_dir}/*.sav ${debian_dir}/build/*.sav;
	$(RM) ${STAMP_DIR}/autotools ${STAMP_DIR}/configure;

#-------------
refresh-faq:
	@echo 'Refreshing FAQ'
	@chmod u+w ${debian_dir}/faq.txt;
	(cd ${debian_dir} && wget --passive-ftp --timestamping \
		--cache=off http://www.sendmail.org/faq/faq.txt;);
	@chmod a-w ${debian_dir}/faq.txt;
	@echo 'Refreshing Misc'
	@chmod u+w ${debian_dir}/cf/feature/rhsbl.m4;
	(cd ${debian_dir}/cf/feature && wget --passive-ftp --timestamping \
		--cache=off http://www.rfc-ignorant.org/rhsbl.m4;);
	@chmod u-w ${debian_dir}/cf/feature/rhsbl.m4;


#-------------
world:
	# Debian build daemons don't (for the nonce) support build-indep,
	# so this rule allows *me* to build both arch and indep portions
	# of sendmail in one go (so I don't forget).
	@dh_testdir;
	$(MAKE) -f ${debian_dir}/rules info;
	time ${DEB_BUILD} -rfakeroot

test:
	@dh_testdir;
	$(MAKE) -f ${debian_dir}/rules clean-debian;
	fakeroot $(MAKE) -f ${debian_dir}/rules clean;
	$(MAKE) -f ${debian_dir}/rules \
		ENABLE_TLS=auto ENABLE_DEV=no ENABLE_DOC=no \
		CFLAGS='-O2 -Wall' DEB_BUILD_OPTIONS='nostrip' configure;
	#time ${DEB_BUILD} -rfakeroot -d -us -uc;
	time $(MAKE) -f ${debian_dir}/rules build-arch;

print:
	@dh_testdir;
	-(cd ${BUILD_TREE}/.. && \
		for file in `find . -name 'README'`; do \
			lpr $$file; \
			done; );
	-(cd ${BUILD_TREE}/.. && \
		lpr */KNOWNBUGS; \
		lpr */RELEASE_NOTES; \
		lpr */sendmail/SECURITY; \
		lpr */sendmail/TUNING; \
		lpr */sendmail/TRACEFLAGS; \
		lpr */doc/op/op.ps; \
		lpr */cf/feature/nullclient.m4; \
		lpr */cf/feature/msp.m4; \
		);
	-(cd ${debian_dir} && \
		lpr ../../${debian_dir}/configure.ac; \
		lpr ../../${debian_dir}/build/rules.in; \
		lpr build/site.config.m4.in; \
		lpr cf/hack/msp_nullclient.m4; \
		);


#------------------------------------------------------------------------------
# Misc rules
#------------------------------------------------------------------------------
#-------------
${STAMP_DIR}:
	mkdir -p ${STAMP_DIR};


#------------------------------------------------------------------------------
# Autoconf rules
#------------------------------------------------------------------------------
#-------------
${debian_dir}/config.status: ${debian_dir}/configure
	# *** *** *** configure changed ?!? *** *** ***
	if [ -e ${debian_dir}/config.status ]; then \
		chmod ug+x ${debian_dir}/config.status; \
		(cd ${debian_dir} && ./config.status --recheck;) \
		fi;

#-------------
${debian_dir}/configure: ${debian_dir}/configure.ac
	# *** *** *** configure.ac changed ?!? *** *** ***
	cp -af ${debian_dir}/configure.ac \
		${debian_dir}/configure.in;
	(cd ${debian_dir} && autoconf;);
	$(RM) ${debian_dir}/configure.in;
	chmod ug+x ${debian_dir}/configure;

#-------------
autotools: ${STAMP_DIR} ${STAMP_DIR}/autotools
${STAMP_DIR}/autotools:

	#Add here commands to setup the autotools environment

	# Make sure we have the latest available config.{guess,sub}
	# Allow the package to override either by faking the date...
	if [ -e /usr/share/misc/config.guess -a \
		-e ${debian_dir}/build/config.guess ]; then \
		OLDDATEGUESS=`${debian_dir}/build/config.guess -t | tr -d - `; \
		NEWDATEGUESS=`/usr/share/misc/config.guess -t | tr -d - `; \
		if [ "$$OLDDATEGUESS" -lt "$$NEWDATEGUESS" ]; then \
			if [ ! -e ${debian_dir}/build/config.guess.sav ]; then \
				cp -pf ${debian_dir}/build/config.guess \
					${debian_dir}/build/config.guess.sav;\
				fi; \
			if [ -e ${debian_dir}/build/config.guess.sav ]; then \
				cp -pf /usr/share/misc/config.guess \
					${debian_dir}/build/config.guess; \
				fi; \
			fi; \
		fi;
	if [ -e /usr/share/misc/config.sub -a \
		-e ${debian_dir}/build/config.sub ]; then \
		OLDDATESUB=`${debian_dir}/build/config.sub -t | tr -d - `; \
		NEWDATESUB=`/usr/share/misc/config.sub -t | tr -d - `; \
		if [ "$$OLDDATESUB" -lt "$$NEWDATESUB" ]; then \
			if [ ! -e ${debian_dir}/build/config.sub.sav ]; then \
				cp -pf ${debian_dir}/build/config.sub \
					${debian_dir}/build/config.sub.sav; \
				fi; \
			if [ -e ${debian_dir}/build/config.sub.sav ]; then \
				cp -pf /usr/share/misc/config.sub \
					${debian_dir}/build/config.sub; \
				fi; \
			fi; \
		fi;

	# Make sure that some autotools stuff is executable.
	chmod ug+x ${debian_dir}/build/depcomp;
	chmod ug+x ${debian_dir}/build/install-sh;
	chmod ug+x ${debian_dir}/build/missing;
	chmod ug+x ${debian_dir}/build/mkinstalldirs;

	touch ${STAMP_DIR}/autotools;



#------------------------------------------------------------------------------
# Build/Package check rules
#------------------------------------------------------------------------------
#-------------
info:

	#--------------------------------------------------------------------
	# The following information will be used for this run:
	#	Source	   = ${package} ${pwd_string}
	#	Package    = ${package} ${version_string}
	#	Version    = ${version_major}.${version_minor}${version_debian}
	#	BuildTree  = ${BUILD_TREE}
	#	PatchDir   = ${PATCH_DIR}
	#	Arch	   = ${DEB_BUILD_ARCH} on ${DEB_HOST_ARCH}
	#	Options
	#	  config opt  = ${SM_CONF_OPT}
	#	  build opt   = ${SM_BUILD_OPT}
	#	  ENABLE_TLS  = ${ENABLE_TLS}
	#	  ENABLUE_AUTH= ${ENABLE_AUTH}
	#	  ENABLE_DEV  = ${ENABLE_DEV}
	#	  ENABLE_DOC  = ${ENABLE_DOC}
	#	  compile opt = ${CC} ${CFLAGS} ${DEFINES}
	#	DEB_BUILD_OPTIONS = ${DEB_BUILD_OPTIONS}
	#	DH_VERBOSE = ${DH_VERBOSE}
	#	DH_OPTIONS = ${DH_OPTIONS}
	#	DH_COMPAT  = ${DH_COMPAT}
	#--------------------------------------------------------------------

#-------------
buildinfo:
	@echo '';
	@dpkg -l \
		debhelper \
		dpkg-dev \
		gcc \
		'libc6*' \
		binutils \
		ldso \
		make \
		m4 \
		libdb3			libdb3-dev \
		libdb2			libdb2-dev \
		libwrap0		libwrap0-dev \
		libldap2		libldap2-dev \
		libopenldap1	libopenldap-dev \
		umich-libldap	umich-libldap-dev \
		libsasl7		libsasl-dev \
		openssl			libssl-dev		   'libssl0*' \
		${BUILD_INFO} \
		2> /dev/null \
		| awk '$$1 == "ii" { printf("%s-%s\n", $$2, $$3) }' \
		| tee ${debian_dir}/${package}.buildinfo.Debian;
	@echo '';
	@chmod 644 ${debian_dir}/${package}.buildinfo.Debian;

#-------------
pristine:
	@dh_testdir;
	#$(MAKE) -f ${debian_dir}/rules info;
	#
	# Fail if there are any modifications to the original
	# tarball, other than the debian directory
	if [ -f ../${package}_${version_string}.diff.gz ]; then \
		zgrep -e "^\+\+\+ " ../${package}_${version_string}.diff.gz \
		| sed -e "/^\+\+\+ ${package}-${version}\/debian\/.*$$/d" - \
		| [ ! -z - ]; \
		fi;

	# Check for presence of TLS (crypto) enablement and bitch if found
	@if (grep -qEe '^#TLS:[[:space:]]*yes' \
		${debian_dir}/build/site.config.m4); then \
		echo '** ** --------------------------------------------------- ** **';\
		echo '** ** This package contains crypto support ! Be careful ! ** **';\
		echo '** ** --------------------------------------------------- ** **';\
		fi;

#-------------
verify:
	@dh_testdir;
	# Verifying the md5 summs and signed files
	@for file in $$(find . -maxdepth 1 -name '*.md5'); do \
		echo "Checking MD5 source: $$file."; \
		cat $$file; \
		md5sum -c $$file; \
		done;
	@for file in $$(find . -maxdepth 1 -name '*.sig'); do \
		echo "Checking signature file $$file."; \
		part=$$(echo "$$file" | sed -e 's/\.sig$$//'); \
		if [ -f $$part ]; then \
			gpg --verify $$part.sig $$part || true; \
		elif [ -f $$part.gz ]; then \
			gunzip -c $$part.gz > $$part; \
			gpg --verify $$part.sig $$part || true; \
			rm $$part; \
			fi; \
		done;


#------------------------------------------------------------------------------
# User callable rules
#------------------------------------------------------------------------------
#-------------
clean:
	@dh_testdir;
	@dh_testroot;

	# Add here commands to clean up after the build process.
	#-$(MAKE) clean;
	#-$(MAKE) distclean;

	# First, remove any patches, and source directories
	#$(MAKE) -f ${debian_dir}/sys-build.mk source.clean;

	# Debian stuff
	$(RM) -r ${SOURCE_DIR} ${STAMP_DIR};
	$(RM)	${debian_dir}/*.buildinfo.Debian;
	for file in tmp ${PACKAGES};do \
		$(RM) -r ${debian_dir}/$$file; \
		done;

	# Local stuff
	-if [ -f ${debian_dir}/Makefile ]; then \
		(cd ${debian_dir} && $(MAKE) -f Makefile clean;) \
		fi;

ifeq (3, $(shell test ${DH_COMPAT} -ge 3 && echo '3'))
	# Debhelper V3 conffile handling - prevent duplicates
	for file in $$(find ${debian_dir} -maxdepth 1 -type f \
		-name '*\.conffiles\.sav'); do \
		mv $$file $$(echo "$$file" | sed -e 's?\.sav$$??'); \
		done;
endif
	# Restore pre-existing config.{guess,sub}
	-if [ -e ${debian_dir}/build/config.sub.sav ]; then \
		cp -pf ${debian_dir}/build/config.sub.sav \
			${debian_dir}/build/config.sub \
		&& $(RM) ${debian_dir}/build/config.sub.sav; \
		fi;
	-if [ -e ${debian_dir}/build/config.guess.sav ]; then \
		cp -pf ${debian_dir}/build/config.guess.sav \
			${debian_dir}/build/config.guess \
		&& $(RM) ${debian_dir}/build/config.guess.sav; \
		fi;

	# Cleanup after build (for pristine source, smaller diffs)
	#find .. -name ${package}*.asc -size 0 -maxdepth 1 -exec rm {} ';';
	dh_clean;


#-------------
setup: ${STAMP_DIR}/setup
${STAMP_DIR}/setup:
# Support separate debian directory
ifeq (yes, $(shell test -d debian && echo 'yes'))
	@dh_testdir;
	# unpack and patch source
	$(MAKE) -f ${SCRIPT_DIR}/dbs-build.mk \
		BUILD_TREE="${BUILD_TREE}" TAR_DIR="${TAR_DIR}" \
		STAMP_DIR="${STAMP_DIR}"   PATCH_DIR="${PATCH_DIR}" \
		SCRIPT_DIR="${SCRIPT_DIR}" \
		${STAMP_DIR}/unpack ${STAMP_DIR}/patch;
	touch ${STAMP_DIR}/setup;
endif


#-------------
configure: ${STAMP_DIR}/configure
${STAMP_DIR}/configure: ${STAMP_DIR}/setup ${STAMP_DIR}/autotools
	$(MAKE) -f ${debian_dir}/rules info;
	#Add here commands to configure the package.
	#./configure --prefix=/usr
	# Use autoconf to handle varying degrees of library support
	# NOTE: options values are Yes/No/Auto, but auto isn't always
	# used herein, as it can cause problems to be ignored
	# so it is only used on items of lesser importance
	chmod ug+x ${debian_dir}/configure;
	(cd ${debian_dir} && \
	./configure \
		--build=${DEB_BUILD_GNU_TYPE} \
		--host=${DEB_HOST_GNU_TYPE} \
		--prefix=/usr \
		--libexecdir=/usr/lib/sm.bin \
		--datadir=${DATA_DIR} \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--infodir=${DATA_DIR}/info \
		--mandir=${DATA_DIR}/man \
		--srcdir=${pwd_dir}/debian \
		--with-buildtree=${BUILD_TREE} \
		--with-docdir=${DATA_DIR}/doc \
		--with-revision=${version_debian} \
		--enable-regex=yes \
		--enable-ndbm=no \
		--enable-newdb=yes \
		--enable-nis=auto \
		--enable-nisplus=auto \
		--enable-ldap=yes \
		--enable-hesiod=no \
		--enable-tcpd=yes \
		--enable-bind=no \
		--enable-ipv6=auto \
		--enable-maillock=yes \
		--enable-sfio=no \
		--enable-auth=${ENABLE_AUTH} \
		--enable-tls=${ENABLE_TLS} \
		--enable-shm=auto \
		--enable-doc=${ENABLE_DOC} \
		--enable-dev=${ENABLE_DEV} \
		${SM_CONF_OPT} \
		;);
		# CC="${CC}" CFLAGS="${CFLAGS}
ifeq (3, $(shell test ${DH_COMPAT} -ge 3 && echo '3'))
	# Debhelper V3 conffile handling - prevent duplicates
	for file in $$(find ${debian_dir} -maxdepth 1 -type f \
		-name '*.conffiles'); do \
		mv $$file $$file.sav; \
		done;
endif
	touch ${STAMP_DIR}/configure;


#-------------
build-indep: ${STAMP_DIR}/build-indep
${STAMP_DIR}/build-indep: ${STAMP_DIR}/configure
# Skip work if nothing to do...
ifeq (yes, ${ENABLE_INDEP})
	@dh_testdir;
	# Add here commands to build/compile the documentation/package.
	#$(MAKE) doc;
	# Only valid on newer (8.11+) Sendmails
	#(cd ${BUILD_TREE}/doc/op/ && make op.txt);
	# So we'll do it by hand...
	$(RM) ${BUILD_TREE}/doc/op/op.txt;
	pic -C ${BUILD_TREE}/doc/op/op.me | eqn -C -Tascii \
		| GROFF_NO_SGR=1 groff -Tascii -me | ul -t dumb > ${BUILD_TREE}/doc/op/op.txt;
	# Debian stuff
	(cd ${debian_dir} && $(MAKE) -f Makefile build-indep;)
endif
	touch ${STAMP_DIR}/build-indep;


#-------------
build-arch: ${STAMP_DIR}/build-arch
${STAMP_DIR}/build-arch: ${STAMP_DIR}/configure
# Skip work if nothing to do...
ifeq (yes, ${ENABLE_ARCH})
	@dh_testdir;
	# Add here commands to compile the package.
	#$(MAKE);
	# Place our m4 configuration files for the sendmail build to use
	if [ -d ${BUILD_TREE}/devtools/Site ]; then \
		cp -f ${debian_dir}/build/site.config.m4 \
			${BUILD_TREE}/devtools/Site/; \
		fi;
	# Finally, build the whole enchilada (we'll let sendmail figure
	# which, if any of the dependant libraries each component needs)
	for subdir in ${SM_SUBDIRS}; do \
		if [ -d  ${BUILD_TREE}/$${subdir} ]; then \
			(cd ${BUILD_TREE}/$${subdir} && ./Build -S;); \
			fi; \
		done;
	# Debian stuff
	(cd ${debian_dir} && $(MAKE) -f Makefile build-arch;)
	# Remove our config m4 files
	$(RM) ${BUILD_TREE}/devtools/Site/site.config.m4;
endif
	touch ${STAMP_DIR}/build-arch;


#-------------
install-indep: ${STAMP_DIR}/install-indep
${STAMP_DIR}/install-indep: DH_OPTIONS=-i
${STAMP_DIR}/install-indep: ${STAMP_DIR}/build-indep
# Skip work if nothing to do...
ifeq (yes, ${ENABLE_INDEP})
	@dh_testdir;
	@dh_testroot;
	dh_clean -k;
	dh_installdirs;
	if [ -x /usr/bin/dh_link ]; then dh_link; fi;
	# Document what we've building against
	if [ -x /usr/bin/dh_buildinfo ]; then \
		dh_buildinfo; \
	else \
		$(MAKE) -f ${debian_dir}/rules buildinfo; \
		fi;
	# Add here commands to install the documentation/package.
	#$(MAKE) prefix=`pwd`/${PKG_DIR}/usr install;
	# sendmail operations guide and other documentation
	$(INSTALL_DATA) ${BUILD_TREE}/doc/op/op.ps	${PKG_DOC}/op;
	$(INSTALL_DATA) ${BUILD_TREE}/doc/op/op.txt ${PKG_DOC}/op;
	$(INSTALL_DATA) ${BUILD_TREE}/README		${PKG_DOC}/;
	$(INSTALL_DATA) ${BUILD_TREE}/KNOWNBUGS	${PKG_DOC}/;
	$(INSTALL_DATA) ${BUILD_TREE}/cf/README	${PKG_DOC}/cf.README;
	$(INSTALL_DATA) debian/README.Debian.sendmail \
		${PKG_DOC}/sendmail/README.Debian;
	$(INSTALL_DATA) ${BUILD_TREE}/sendmail/README \
		${PKG_DOC}/sendmail/;
	if [ -f ${BUILD_TREE}/sendmail/SECURITY ]; then \
		$(INSTALL_DATA) ${BUILD_TREE}/sendmail/SECURITY \
			${PKG_DOC}/sendmail/SECURITY; \
		fi;
	$(INSTALL_DATA) ${BUILD_TREE}/sendmail/TRACEFLAGS \
		${PKG_DOC}/sendmail/TRACEFLAGS;
	if [ -f ${BUILD_TREE}/sendmail/TUNING ]; then \
		$(INSTALL_DATA) ${BUILD_TREE}/sendmail/TUNING \
			${PKG_DOC}/sendmail/TUNING; \
		fi;
	sed -e "s?/usr/libexec?${libexecdir}?g" \
		-e "s?/usr/ucb/vacation?${libexecdir}/vacation.sendmail?g" \
		-e "s?/usr/adm/sm.bin?/etc/mail/smrsh?g" \
		${BUILD_TREE}/smrsh/README \
		> ${PKG_DOC}/smrsh.README;
	$(INSTALL_DATA) debian/faq.txt		${PKG_DOC}/;
	# libmilter-dev package
	if [ -d ${BUILD_TREE}/libmilter ]; then \
		$(INSTALL_DATA) debian/README.Debian.libmilter-dev \
			${PKG_DOC}/libmilter/README.Debian; \
		$(INSTALL_DATA) ${BUILD_TREE}/libmilter/README \
			${PKG_DOC}/libmilter/README; \
		if [ -d  ${BUILD_TREE}/libmilter/docs ]; then \
			cp -a ${BUILD_TREE}/libmilter/docs/* \
				${PKG_DOC}/libmilter/html; \
			fi; \
		fi;
	# Debian stuff
	(cd ${debian_dir} && \
		$(MAKE) -f Makefile install-indep \
			DESTDIR="${top_srcdir}/${PKG_DOC}";);
	# Multiple package fixup
	#dh_movefiles -i --sourcedir debian/${package};
	# Actions from binary-common
	#
	dh_fixperms;
	#
	# Cleanup misc permissions, etc... (fakeroot, dh_fixperms, etc.)
endif
	touch ${STAMP_DIR}/install-indep;


#-------------
install-arch: ${STAMP_DIR}/install-arch
${STAMP_DIR}/install-arch: DH_OPTIONS=-a
${STAMP_DIR}/install-arch: ${STAMP_DIR}/build-arch
# Skip work if nothing to do...
ifeq (yes, ${ENABLE_ARCH})
	@dh_testdir;
	@dh_testroot;
	dh_clean -k;
	dh_installdirs;
	if [ -x /usr/bin/dh_link ]; then dh_link; fi;

	# Document what we've building against
	if [ -x /usr/bin/dh_buildinfo ]; then \
		dh_buildinfo; \
	else \
		$(MAKE) -f ${debian_dir}/rules buildinfo; \
		fi;
	# Add here commands to install the package into ${PKG_DIR}.
	#$(MAKE) prefix=`pwd`/${PKG_DIR}/usr install;
	# sendmail install proper... with a little help ;-}
	#$(MAKE) install DESTDIR="$${pwd}/${PKG_DIR}";
	# Finally, install the whole enchilada
	for subdir in ${SM_SUBDIRS}; do \
		if [ -d  ${BUILD_TREE}/$${subdir} ]; then \
			if [ "$${subdir}" = 'libmilter' ]; then \
				:; \
			elif [ "$${subdir}" = 'mail.local' -o \
				 "$${subdir}" = 'rmail' ]; then \
				(cd ${BUILD_TREE}/obj*/$${subdir} && \
					$(MAKE) force-install \
					DESTDIR="../../../../${PKG_DIR}";); \
			else \
				(cd ${BUILD_TREE}/obj*/$${subdir} && \
					$(MAKE) install \
					DESTDIR="../../../../${PKG_DIR}";); \
				fi; \
			fi; \
		done;
	# Support older Sendmail (below 8.10.0)
	if [ -f ${PKG_DIR}${sysconfdir}/mail/sendmail.hf ]; then \
		mv -f ${PKG_DIR}${sysconfdir}/mail/sendmail.hf \
			${PKG_DIR}${sysconfdir}/mail/helpfile; \
		$(RM) ${PKG_DIR}${localstatedir}/lib/sendmail/sendmail.st; \
		fi;
	# FHS says that rmail belongs in ${sbindir} - and we now put
	# it there, but in the rmail package !
	mv ${PKG_DIR}${bindir}/rmail ${debian_dir}/rmail/${sbindir}/;
	mv ${PKG_DIR}${mandir}/man8/rmail.8 ${debian_dir}/rmail/${mandir}/man8/;
	# Sendmail alias handling...
	# NOTE: whilst smptd is a valid alias for sendmail, we don't create
	# one so that we can co-exists with smtpd (a firewall frontend)
	# NOTE: newscache package also contains ${sbindir}/hoststat
	# NOTE: newalias, purgestat, etc. aren't for the general user..
	#		yeah, yeah, I know... these can be done with -b<flag>!
	(cd ${PKG_DIR}${bindir} && \
		$(RM) hoststat mailq newaliases purgestat smtpd;)
	ln -sf ../sbin/sendmail ${PKG_DIR}${libdir}/sendmail;
	(cd ${PKG_DIR}${sbindir} && for file in \
		newaliases hoststat purgestat \
		; do \
			ln -sf sendmail $$file; \
			done;);
	# Handle man pages for these aliases
	(cd ${PKG_DIR}${mandir}/man8 && for file in \
		hoststat.8.gz purgestat.8.gz \
		; do \
			ln -sf sendmail.8.gz $$file; \
			done;);
	# Place those removed aliases in ${libexecdir} (mostly for me)
	(cd ${PKG_DIR}${libexecdir} && for file in \
		hoststat mailq newaliases purgestat smtpd; do \
		ln -sf ../../sbin/sendmail $$file; \
		done;);
	# NOTE: with the MSP/MTA split, we'll provide our own mailstats (keep orig)
	mv ${PKG_DIR}${sbindir}/mailstats \
		${PKG_DIR}${libexecdir}/mailstats;
	# Special handling of vacation - Debian has a seperate package
	# with a different version (sigh) keep our copy just in case...
	if [ -d ${BUILD_TREE}/vacation ]; then \
		mv ${PKG_DIR}${bindir}/vacation \
			${PKG_DIR}${libexecdir}/vacation.sendmail; \
		mv ${PKG_DIR}${mandir}/man1/vacation.1 \
			${PKG_DIR}${mandir}/man1/vacation.sendmail.1; \
		fi;
	# Correct some paths in upstream man pages
	sed -e "s?/usr/adm/sm.bin?${sysconfdir}/mail/smrsh?g" \
		-e "s?sm.bin?${sysconfdir}/mail/smrsh?g" \
		${BUILD_TREE}/smrsh/smrsh.8 \
		> ${BUILD_TREE}/smrsh/smrsh.8.new;
	mv ${BUILD_TREE}/smrsh/smrsh.8.new ${BUILD_TREE}/smrsh/smrsh.8;
	sed -e "s?/etc/mail/statistics?${localstatedir}/lib/sendmail/sendmail.st?g"\
		${BUILD_TREE}/sendmail/sendmail.8 \
		> ${BUILD_TREE}/sendmail/sendmail.8.new;
	mv ${BUILD_TREE}/sendmail/sendmail.8.new \
		${BUILD_TREE}/sendmail/sendmail.8;
	# m4 configuration directories
	cp -a ${BUILD_TREE}/cf/* ${PKG_DIR}${datadir}/sendmail/cf;
	$(RM) ${PKG_DIR}${datadir}/sendmail/cf/README;
	$(RM) ${PKG_DIR}${datadir}/sendmail/cf/sendmail.schema;
	$(RM) ${PKG_DIR}${datadir}/sendmail/cf/cf/Build;
	$(RM) ${PKG_DIR}${datadir}/sendmail/cf/cf/Makefile;
	$(RM) ${PKG_DIR}${datadir}/sendmail/cf/cf/*.cf;
	# contributed stuff - scripts
	sed -e 's?/usr/local/bin/perl?/usr/bin/perl?g' \
		-e "s?/etc/sendmail.cf?${sysconfdir}/mail/sendmail.cf?g" \
		${BUILD_TREE}/contrib/etrn.pl \
		> ${PKG_DIR}${sbindir}/etrn;
	chmod 0755 ${PKG_DIR}${sbindir}/etrn;
	if [ -f ${BUILD_TREE}/contrib/etrn.0 ]; then \
		sed 's?/usr/local/bin/perl?/usr/bin/perl?g' \
			${BUILD_TREE}/contrib/etrn.0 \
			> ${PKG_DIR}${mandir}/man8/etrn.8; \
	else \
		sed 's?/usr/local/bin/perl?/usr/bin/perl?g' \
			${BUILD_TREE}/contrib/etrn.pl \
			> ${PKG_DIR}${mandir}/man8/etrn.8; \
		fi;
	sed -e 's?/usr/local/bin/perl?/usr/bin/perl?g' \
		${BUILD_TREE}/contrib/expn.pl \
		> ${PKG_DIR}${bindir}/expn;
	chmod 0755 ${PKG_DIR}${bindir}/expn;
	sed 's?/usr/local/bin/perl?/usr/bin/perl?g' \
		${BUILD_TREE}/contrib/expn.pl \
		> ${PKG_DIR}${mandir}/man8/expn.8;
	sed -e "s?/etc/sendmail.cf?${sysconfdir}/mail/sendmail.cf?g" \
		debian/examples/checksendmail/checksendmail \
		> ${PKG_DIR}${sbindir}/checksendmail;
	chmod 0755 ${PKG_DIR}${sbindir}/checksendmail;
	$(INSTALL_DATA) debian/examples/checksendmail/checksendmail.8 \
		${PKG_DIR}${mandir}/man8/;
	sed -e 's?/usr/local/bin/perl?/usr/bin/perl?g' \
		-e 's?/usr/sbin/sendmail -q30m -bd?/etc/init.d/sendmail start?g' \
		${BUILD_TREE}/contrib/smcontrol.pl \
		> ${PKG_DIR}${datadir}/sendmail/smcontrol.pl;
	chmod 0755 ${PKG_DIR}${datadir}/sendmail/smcontrol.pl;
	$(INSTALL_SCRIPT) ${BUILD_TREE}/contrib/doublebounce.pl \
		${PKG_DIR}${datadir}/sendmail;
	if [ -f ${BUILD_TREE}/contrib/qtool.pl ]; then \
		sed -e 's?/usr/bin/env perl?/usr/bin/perl?g' \
			${BUILD_TREE}/contrib/qtool.pl \
			> ${PKG_DIR}${datadir}/sendmail/qtool.pl; \
		chmod 0755 ${PKG_DIR}${datadir}/sendmail/qtool.pl; \
		$(INSTALL_DATA) ${BUILD_TREE}/contrib/qtool.8 \
			${PKG_DIR}${mandir}/man8/; \
		fi;
	if [ -f ${BUILD_TREE}/contrib/buildvirtuser ]; then \
		$(INSTALL_SCRIPT) ${BUILD_TREE}/contrib/buildvirtuser \
			${PKG_DIR}${datadir}/sendmail/; \
		fi;
	# contributed stuff - examples
	sed 's?/bin/perl?/usr/bin/perl?g' \
		${BUILD_TREE}/contrib/passwd-to-alias.pl \
		> ${PKG_DIR}${datadir}/sendmail/examples/passwd-to-alias;
	chmod 0755 ${PKG_DIR}${datadir}/sendmail/examples/passwd-to-alias;
	# contributed stuff - m4 scripts
	if [ -f ${BUILD_TREE}/contrib/domainmap.m4 ]; then \
		$(INSTALL_DATA) ${BUILD_TREE}/contrib/domainmap.m4 \
			${PKG_DIR}${datadir}/sendmail/cf/feature; \
		fi;
	if [ -f ${BUILD_TREE}/contrib/dnsblaccess.m4 ]; then \
		$(INSTALL_DATA) ${BUILD_TREE}/contrib/dnsblaccess.m4 \
			${PKG_DIR}${datadir}/sendmail/cf/hack; \
		fi;
	# Debian stuff
	(cd ${debian_dir} && \
		$(MAKE) -f Makefile install-arch \
			DESTDIR="${top_srcdir}/${package}";);
	# Sensible-mda is now in its own package
	mv ${PKG_DIR}${sbindir}/sensible-mda ${debian_dir}/sensible-mda/${sbindir}/;
	mv ${PKG_DIR}${mandir}/man8/sensible-mda.8 ${debian_dir}/sensible-mda/${mandir}/man8/;
	# Debian stuff - m4 scripts
	(cd debian && \
	for file in $$(find cf -type f -name '*.m4' -o -name '*.mc'); do \
		$(INSTALL_DATA) $$file \
			../${PKG_DIR}${datadir}/sendmail/$$file; \
		done;);
	# libmilter-dev package
ifeq (yes, ${ENABLE_DEV})
	if [ -d ${BUILD_TREE}/libmilter ]; then \
		(cd ${BUILD_TREE}/obj*/libmilter && \
			$(MAKE) install \
			DESTDIR="../../../../debian/libmilter-dev";); \
		$(INSTALL_PROGRAM) ${BUILD_TREE}/obj.*/libmilter/libmilter.a \
			debian/libmilter-dev${libdir}/libmilter/; \
		$(INSTALL_DATA) ${BUILD_TREE}/include/libmilter/mfapi.h \
			debian/libmilter-dev${includedir}/libmilter/; \
		if [ -f ${BUILD_TREE}/include/libmilter/mfdef.h ]; then \
			$(INSTALL_DATA) ${BUILD_TREE}/include/libmilter/mfdef.h \
				debian/libmilter-dev${includedir}/libmilter/; \
			fi; \
		$(INSTALL_PROGRAM) ${BUILD_TREE}/obj.*/libsmutil/libsmutil.a \
			debian/libmilter-dev${libdir}/libmilter/; \
		if [ -d ${BUILD_TREE}/libsm ]; then \
			$(INSTALL_PROGRAM) ${BUILD_TREE}/obj.*/libsm/libsm.a \
				debian/libmilter-dev${libdir}/libmilter/; \
			fi; \
		fi;
endif
	# Multiple package fixup
	#dh_movefiles -a --sourcedir debian/${package};
	# Actions from binary-common
	#dh_installcron;
	$(INSTALL_SCRIPT) debian/${package}.cron.daily \
		${PKG_DIR}${sysconfdir}/cron.daily/sendmail;
	dh_installlogrotate;
	#$(INSTALL_DATA) debian/${package}.logrotate \
	#	${PKG_DIR}${sysconfdir}/logrotate.d/sendmail;
	#
	dh_fixperms;
	#
	# Cleanup misc permissions, etc... (fakeroot, dh_fixperms, etc.)
	chmod a+x	${PKG_DIR}${datadir}/sendmail/cf/sh/makeinfo.sh;
	#
	# You may want to make some executables suid here.
	chown root:mail	${PKG_DIR}${sbindir}/sendmail;
	chmod 02755 ${PKG_DIR}${sbindir}/sendmail;
	chown root:mail	${PKG_DIR}${libexecdir}/mailstats;
	chmod 02755 ${PKG_DIR}${libexecdir}/mailstats;
	# Special case Perl for Debian Slink (2.1), debhelper v1
	if [ ! -x /usr/bin/dh_perl ]; then \
		echo 'perl:Depends=perl5|perl' >> debian/substvars; fi;
	# Install Lintian overrides
	$(INSTALL_DATA) -d -g root -m 755 ${PKG_DIR}${datadir}/lintian/overrides
	$(INSTALL_DATA) -g root -m 644 debian/${package}.lintian-overrides \
		${PKG_DIR}${datadir}/lintian/overrides/${package}
endif
	touch ${STAMP_DIR}/install-arch;


#-------------
# This single target is used to build all the packages, all at once, or
# one at a time. So keep in mind: any options passed to commands here will
# affect _all_ packages. Anything you want to only affect one package
# should be put in another target, such as the install target.
#
# Must not depend on anything. This is to be called by
# binary-arch/binary-indep in another 'make' thread.
binary-common:
	# Need this version of debhelper for DH_OPTIONS to work.
	@dh_testversion 1.1.17;
	@dh_testdir;
	@dh_testroot;
	# Done in install-xxx, but still need to get rid of *.debhelper !!!
	#dh_clean -k;
	$(RM) debian/*.debhelper;
	dh_installchangelogs -k ${BUILD_TREE}/RELEASE_NOTES;
	#-------- needs script name ala installinit ----
	# Done in install-xxx
	#dh_installcron;
	if [ -x /usr/bin/dh_installdebconf ]; then dh_installdebconf; fi;
	dh_installdocs;
	#dh_installemacsen;
	#dh_installexamples;
	#if [ -x /usr/bin/dh_installinfo ]; then dh_installinfo; fi;
	dh_installinit --init-script=sendmail --update-rcd-params="defaults 21";
	#-------- needs script name ala installinit ----
	# Done in install-xxx
	#if [ -x /usr/bin/dh_installlogrotate ]; then dh_installlogrotate; fi;
	if [ -x /usr/bin/dh_installman ]; then dh_installman; fi;
	#dh_installmenu;
	#dh_installmime;
	#dh_undocumented;
	if [ -x /usr/bin/dh_installpam ]; then dh_installpam; fi;
	# Done in install-xxx
	#if [ -x /usr/bin/dh_link ]; then dh_link; fi;
ifeq (, $(findstring nostrip,${DEB_BUILD_OPTIONS}))
	dh_strip;
else
	#dh_strip;
endif
	dh_compress;
	# Done in install-xxx
	#dh_fixperms;
	# Need to special case this now that we're using dynamic uid/gid
	#if [ -x /usr/sbin/suidregister -a -s /etc/suid.conf ]; then
	#	dh_suidregister; fi;
	#
	# Cleanup misc permissions, etc... (fakeroot, dh_fixperms, etc.)
	# Done in install-xxx
	#
	# You may want to make some executables suid here.
	# Done in install-xxx
	#
	dh_makeshlibs -V;
	dh_installdeb;
	dh_shlibdeps;
	if [ -x /usr/bin/dh_perl ]; then dh_perl; fi
	dh_gencontrol;
	dh_md5sums;
	dh_builddeb;
	$(MAKE) -f ${debian_dir}/rules pristine;


#-------------
# Build architecture independant packages using the common target.
# (Uncomment this next line if you have such packages.)
binary-indep: ${STAMP_DIR}/build-indep ${STAMP_DIR}/install-indep

# Skip work if nothing to do...
ifeq (yes, ${ENABLE_INDEP})
	$(MAKE) -f ${debian_dir}/rules DH_OPTIONS=-i binary-common;
endif


#-------------
# Build architecture dependant packages using the common target.
binary-arch: ${STAMP_DIR}/build-arch ${STAMP_DIR}/install-arch

# Skip work if nothing to do...
ifeq (yes, ${ENABLE_ARCH})
	$(MAKE) -f ${debian_dir}/rules DH_OPTIONS=-a binary-common;
endif


#-------------
# Any other binary targets build just one binary package at a time.
binary-%:
	$(MAKE) -f ${debian_dir}/rules binary-common DH_OPTIONS=-p$*;


#-------------
# Below here is fairly generic really

.PHONY: FORCE
FORCE: ;

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

# Due to buildd not (for the nonce) supporting build-arch, kluge next rule
build: build-arch
install: install-indep install-arch
binary: binary-indep binary-arch
.PHONY: refresh-dbs refresh-debian update-debian refresh-faq
.PHONY: pristine
.PHONY: info buildinfo
.PHONY: setup autotools configure
.PHONY: clean build build-indep build-arch
.PHONY: install install-indep install-arch
.PHONY: binary binary-indep binary-arch
.SUFFIXES:
.PRECIOUS: ${debian_dir}/rule
