#!/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-arch: build
build-indep: build
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_prep -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

	install -D -m 755 debian/ddclient.NetworkManager \
	  $(DESTDIR)/etc/NetworkManager/dispatcher.d/50-ddclient

%.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
	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
