#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GPL copyright 1997 to 1999 by Joey Hess.
# Adapted for laptop-netconf.
# Changes GPL copyright 2001 by Matt Kern.

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

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

PWD := $(shell pwd)

build: build-stamp
build-stamp:
	dh_testdir
	$(MAKE) FINAL=1
	touch build-stamp

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

install: build install-stamp
install-stamp:
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs
	$(MAKE) FINAL=1 prefix=$(PWD)/debian/laptop-netconf/usr sysconfdir=$(PWD)/debian/laptop-netconf/etc install
	touch install-stamp

# 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_testversion
	dh_testdir
	dh_testroot
	dh_installdebconf	
	dh_installdocs
	dh_installexamples
	dh_installmenu
#	dh_installemacsen
#	dh_installpam
#	dh_installmime
	dh_installinit --no-start -- start 41 S . start 36 0 6 .
	# I think the follow lines can be achieved with --no-start above
	#-#sed '/Automatically added by dh_installinit/,/^fi/s/^/# /' <debian/prerm.debhelper >debian/prerm.debhelper.tmp  &&  mv -f debian/prerm.debhelper.tmp debian/prerm.debhelper
	#-#if grep -q invoke-rc.d debian/postinst.debhelper; then sed '/if.*invoke-rc.d/,/fi/s/^/# /' <debian/postinst.debhelper >debian/postinst.debhelper.tmp  &&  mv -f debian/postinst.debhelper.tmp debian/postinst.debhelper; else sed '/\/etc\/init.d\/laptop-netconf \+start/s/^/# /' <debian/postinst.debhelper >debian/postinst.debhelper.tmp  &&  mv -f debian/postinst.debhelper.tmp debian/postinst.debhelper; fi
	dh_installcron
	dh_installmanpages
	dh_installinfo
#	dh_undocumented
	dh_installchangelogs
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
#	dh_suidregister
#	dh_makeshlibs
	dh_installdeb
#	dh_perl
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

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