#!/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=greylistd
tmp=$(CURDIR)/debian/tmp

build:
	$(checkdir)
	touch build

clean:
	$(checkdir)
	rm -f build
	-$(MAKE) clean
	rm -f `find . -name "*~"`
	rm -rf $(tmp) debian/files* core debian/substvars

binary-indep: checkroot build
	$(checkdir)
	rm -rf $(tmp)
	install -D program/greylistd $(tmp)/usr/sbin/greylistd
	install -D program/greylist $(tmp)/usr/bin/greylist
	install -D -m 644 config/config $(tmp)/etc/greylistd/config
	install -D -m 644 debian/defaults $(tmp)/etc/default/greylistd
	mkdir -p -m 755 $(tmp)/var/run/greylistd
	mkdir -p -m 755 $(tmp)/var/lib/greylistd
	debstd
	dpkg-gencontrol -isp
	chown -R root:root $(tmp)
	chown -R mail:mail $(tmp)/var/run/greylistd
	chown -R mail:mail $(tmp)/var/lib/greylistd
	chmod -R go=rX $(tmp)
	dpkg --build $(tmp) ..

binary-arch: 

define checkdir
	test -f debian/rules
endef

binary: binary-indep binary-arch

checkroot:
	$(checkdir)
	test root = "`whoami`"

.PHONY: binary binary-arch binary-indep clean checkroot
