#!/usr/bin/make -f

# This script uses debhelper by Joey Hess
export DH_VERBOSE=1
# enables magic below
export DH_OPTIONS

DESTDIR=debian/resolvconf

clean:
	dh_testdir
	dh_testroot
	dh_clean

build: build-arch build-indep

build-arch: build-stamp

build-indep: build-stamp

build-stamp:
	debian/test-normalization
	dh_testdir

binary-arch:

binary-indep: build
	dh_testroot
	dh_installdirs etc sbin lib/resolvconf usr/share/resolvconf etc/network/if-up.d etc/network/if-down.d var/lib/resolvconf lib/udev/rules.d
	cp -a etc $(DESTDIR)
	install -p --owner=root --group=root --mode=0755 bin/resolvconf $(DESTDIR)/sbin
	install -p --owner=root --group=root --mode=0755 bin/list-records $(DESTDIR)/lib/resolvconf
	install -p --owner=root --group=root --mode=0755 bin/dump-debug-info $(DESTDIR)/usr/share/resolvconf
	install -p --owner=root --group=root --mode=0644 lib/70-resolvconf-initramfs-copy.rules $(DESTDIR)/lib/udev/rules.d
	install -p --owner=root --group=root --mode=0755 lib/net-interface-handler $(DESTDIR)/lib/resolvconf

	dh_installdebconf
	dh_lintian
	dh_installdocs README
	dh_installman
	dh_installchangelogs
	dh_systemd_enable
	dh_installinit --no-start
	dh_systemd_start -r
	dh_installppp --name=000resolvconf
	dh_installifupdown --name=resolvconf
	dh_installifupdown --name=000resolvconf
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

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