#!/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=latd

build:
	$(checkdir)
	./configure  \
		$(shell dpkg-buildflags --export=configure) \
	  	--prefix=/usr --sysconfdir=/etc 
	make
	touch build

clean:
	$(checkdir)
	-rm -f build
	-make clean
	-rm -f `find . -name "*~"`
	-rm -rf debian/latd `find debian/* -type d ! -name CVS ! -name source ` debian/files* core
	-rm -f debian/*substvars
	-rm -f debian/latd.debhelper.log
	-rm -rf BUILD RPMS .deps
	-rm -f config.status
	dh_prep

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.

binary-arch: checkroot build
	$(checkdir)
	install -d debian/latd/etc
	install -d debian/latd/usr/share
	make install DESTDIR=`pwd`/debian/latd
	cp latd.conf.sample debian/latd/etc/latd.conf
	dh_installdirs
	dh_installchangelogs
	dh_installdocs
	dh_link
	dh_installinit
	dh_strip
	dh_movefiles -platd --sourcedir=debian/latd
	dh_compress
	dh_fixperms
	dh_shlibdeps
	dh_gencontrol
	dh_installdeb
	dh_md5sums
	dh_builddeb


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
