#!/usr/bin/make -f
# Made with the aid of debmake, by Christoph Lameter,
# based on the sample debian/rules file for GNU hello by Ian Jackson.

package=smtpfeed

build: build-stamp
build-stamp:
	dh_testdir
	./configure --prefix=/usr --libexecdir=/usr/sbin --enable-ipv6=yes
	$(MAKE) CFLAGS="-O2 -g -Wall"
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	-rm -f build-stamp install-stamp
	# Add here commands to clean up after the build process.
	[ ! -f Makefile ] || $(MAKE) clean
	-rm -f `find . -name "*~"`
	# cleanup automatically generated file by configure
	-rm -f config.log compat.h config.cache config.status \
		Makefile
	-rm -rf debian/smtpfeed debian/files* core debian/substvars
	dh_clean

install: install-stamp

install-stamp: build-stamp
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs
	# Add here commands to install the package into debian/smtpfeed.
	$(MAKE) install DEST=`pwd`/debian/smtpfeed/usr/sbin
	touch install-stamp

binary-indep: build install

binary-arch: build install
	dh_testdir
	dh_testroot
	cp debian/smtpfeed*localhack \
	   debian/smtpfeed/usr/share/doc/smtpfeed/localhack/
	cp stat/* debian/smtpfeed/usr/share/doc/smtpfeed/examples/stat/
	cp debian/smtpfeed*m4 \
	   debian/smtpfeed/usr/share/sendmail/sendmail.cf/mailer/
	install -m 755 debian/*.sh \
	        debian/smtpfeed/usr/share/sendmail/sendmail.cf/sh/
	dh_installdocs README README.j TODO FYI FYI.j FEATURES FEATURES.j \
		OPTIONS OPTIONS.j \
		SIGNAL SIGNAL.j TEST.in ML-ADMIN ML-ADMIN.j smtpfeed.html
	dh_installinit --update-rcd-params="defaults 21 19"
	dh_installcron
	cp debian/logrotate debian/smtpfeed/etc/logrotate.d/smtpfeed
	dh_installman smtpfeed.8
	dh_installchangelogs RELEASE.NOTE
	dh_strip
	dh_compress
	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: binary clean binary-arch binary-indep
