#!/usr/bin/make -f
# based on the sample debian/rules file for GNU hello by Ian Jackson.

package=qico

build: debian/build
debian/build:
	$(checkdir)
	./configure --prefix=/usr --sysconfdir=/etc/ftn
	$(MAKE)
	touch debian/build

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

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

binary-arch: checkroot debian/build
	$(checkdir)
	-rm -rf debian/tmp `find debian/* -type d ! -name CVS`
	install -d debian/tmp
	cd debian/tmp && install -d `cat ../dirs`
	$(MAKE) install prefix=`pwd`/debian/tmp/usr
	cp qico.conf.sample `pwd`/debian/tmp/etc/ftn
	debstd ChangeLog Changes README
	dpkg-gencontrol -isp -pqico
	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-indep binary-arch

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

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