#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

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

# set installation directory
DESTDIR=$(shell pwd)/debian/ddclient

build: build-stamp
build-stamp:
	dh_testdir
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	debconf-updatepo
	rm -f build-stamp

	# Add here commands to clean up after the build process.
	# Nothing is created or destroyed except the debian stuff

	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	install -m 755 ddclient $(DESTDIR)/usr/sbin/ddclient
	install -m 755 debian/ddclient.dhclient-exit-hook $(DESTDIR)/etc/dhcp/dhclient-exit-hooks.d/ddclient
	mkdir -p $(DESTDIR)/etc/network/if-up.d/
	install -m 755 debian/ddclient.ppp.ip-up $(DESTDIR)/etc/network/if-up.d/ddclient
	install -m 755 sample-etc_ddclient.conf $(DESTDIR)/etc/ddclient.conf.sample

%.8 : %.xml
	xmlto -o $(@D) man $<

# Build architecture-independent files here.
binary-indep: build install debian/ddclient.8
#	dh_testversion
	dh_testdir
	dh_testroot
#	dh_installdebconf
	dh_installdocs
	dh_installexamples
	dh_installman
#	dh_installppp
	dh_installmenu
	dh_installinit -- start 20 2 3 4 5 . stop 20 1 .
	rm -rf $(DESTDIR)/etc/ppp
	dh_installchangelogs 
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	perl -w debian/dh_installscripts-common
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

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

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