#!/usr/bin/make -f
# Original version Copyright by Ian Jackson.

SHELL+= -e

#export DH_VERBOSE=1
export DH_COMPAT=4

D := $(CURDIR)/debian/gup

build:
	$(checkdir)
	make
	touch build

clean:
	$(checkdir)
	-rm -f build
	make clean
	dh_clean

binary-arch: checkroot build
	$(checkdir)
	dh_clean -k

	dh_installdirs usr/lib/gup
	install --mode=755 gup scripts/* $D/usr/lib/gup
	dh_installlogrotate
	dh_installmanpages
	dh_installdocs README INSTALL
	dh_installchangelogs
	dh_installcron
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_builddeb

define checkdir
	test -f debian/rules
endef

binary: binary-arch

checkroot:
	test root = "`whoami`"

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