#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# This file is public domain software, originally written by Joey Hess. 

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# This is the debhelper compatibility version to use.
export DH_COMPAT=3

build: build-stamp
build-stamp:
	dh_testdir
	$(MAKE)
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp
	-$(MAKE) clean
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	make install PREFIX=debian/sleepd

# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installdocs TODO
	dh_installinit
	dh_installchangelogs
	dh_strip
	dh_compress
	dh_fixperms -X sleepctl
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

VERSION=$(shell expr "`dpkg-parsechangelog 2>/dev/null |grep Version:`" : '.*Version: \(.*\)')

# Update the web page. Not intended for use by anyone except the
# author.
installhook:
	cp debian/changelog /home/pub/programs/sleepd/CHANGES
	cp TODO /home/pub/programs/sleepd/TODO
	echo -n $(VERSION) > /home/pub/programs/sleepd/LATEST-VERSION-IS
	cd /home/ftp/pub/code/sleepd && \
		ln -sf ../debian/sleepd_$(VERSION).tar.gz sleepd_$(VERSION).tar.gz && \
		ln -sf ../debian/sleepd_$(VERSION).tar.gz sleepd.tar.gz

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install
