#!/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.

build:
	$(checkdir)
	
	make -j4 #CFLAGS="-O2 -g -Wall"

	touch build

clean:
	$(checkdir)
	-rm -f build
	-make clean
	-rm -rf debian/tmp debian/files* core debian/substvars

#binary-indep: checkroot build
#	$(checkdir)
# There are no architecture-independent files to be uploaded
# generated by this package.  If there were any they would be
# made here.
#	-rm -rf debian/tmp debian/files* core debian/substvars

binary-arch:	checkroot build
	$(checkdir)
	-rm -rf debian/tmp
	install -d debian/tmp
	cd debian/tmp && install -d \
		usr/doc/ifcico-cm \
		usr/lib/ifmail \
		usr/man/man8

	install --strip ifcico/{ifcico,ifindex,ifinfo,ifstat,nlpatch} \
				 debian/tmp/usr/lib/ifmail/

	cp ifcico/{ifcico,ifindex,ifinfo,ifstat,nlpatch}.8 \
				 debian/tmp/usr/man/man8/

	debstd -m
	dpkg-gencontrol
	chown -R root.root debian/tmp
	chmod -R go=rX debian/tmp
	dpkg --build debian/tmp ..

define checkdir
	test -f debian/rules
endef

binary:		binary-arch #binary-indep

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

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