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

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

fixlinks:
	ln -sf templates debian/debconf-tiny.templates
	ln -sf config debian/debconf-tiny.config 
	ln -sf postinst debian/debconf-tiny.postinst         
	ln -sf postrm debian/debconf-tiny.postrm

build: fixlinks
	$(MAKE)
	dh_testdir

clean:
	dh_testdir
	dh_testroot
	$(MAKE) clean
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs
	$(MAKE) prefix=debian/tmp install
	$(MAKE) prefix=debian/debconf-tiny tiny-install

# Build architecture-independent files here.
binary-indep: install
	# Make sure debhelper is going to install the config and templates.
	dh_testversion 2.0.49
	dh_testdir
	dh_testroot
	# Don't modify postrm, I purge differently than normal packages
	# using me.
	dh_installdebconf -n
	dh_installdocs doc/CREDITS doc/*.txt doc/*.html \
		doc/spec/*.txt doc/spec/*.html \
		README TODO
	dh_installexamples samples/*
	dh_installmenu
	dh_installcron
	dh_installmanpages -p debconf
	dh_installchangelogs
	dh_compress
	dh_fixperms
	dh_suidregister
	dh_installdeb
	# Hack to make sure debconf-tiny has the same version.
	mv debian/debconf-tiny.changelog debian/debconf-tiny.changelog.bak
	dh_gencontrol
	mv debian/debconf-tiny.changelog.bak debian/debconf-tiny.changelog
	dh_md5sums -p debconf
	dh_builddeb

# Build architecture-dependent files here.
binary-arch: build install
# Nothing to do.

source diff:
	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false

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