#!/usr/bin/make -f
#
# l2tpd debian package. Jean-Francois Dive.
#
# template by Joey Hess. 

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

export DH_COMPAT := 3

b := $(CURDIR)/debian/l2tpd

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
	dh_installdirs

	#$(MAKE) prefix=`pwd`/debian/`dh_listpackages`/usr install
	install -m 0755 l2tpd $(CURDIR)/debian/l2tpd/usr/sbin/
	cp $(CURDIR)/doc/l2tpd.conf.sample $(CURDIR)/debian/l2tpd/etc/l2tpd/l2tpd.conf
	cp $(CURDIR)/doc/l2tp-secrets.sample $(CURDIR)/debian/l2tpd/etc/l2tpd/l2tp-secrets


# 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_installchangelogs CHANGELOG
	dh_installdocs BUGS CREDITS README TODO doc/origREADME doc/rfc2661.txt doc/l2tp-control.txt
	dh_installexamples
#	dh_install
#	dh_installmenu
#	dh_installdebconf	
#	dh_installlogrotate
#	dh_installemacsen
#	dh_installcatalogs
#	dh_installpam
#	dh_installmime
	dh_installinit
#	dh_installcron
#	dh_installinfo
#	dh_undocumented
	dh_installman $(CURDIR)/doc/l2tpd.8 $(CURDIR)/doc/l2tpd.conf.5 $(CURDIR)/doc/l2tp-secrets.5
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	chmod 600 $(b)/etc/l2tpd/l2tp-secrets
#	dh_perl
#	dh_python
#	dh_makeshlibs
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

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