#!/usr/bin/make -f
# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
# This version is for packages that are architecture independent.

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

export USERNAME="Debian-console-log"

build: build-stamp
build-stamp:
	dh_testdir

	# Add here commands to compile the package.

	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp install-stamp

	# Add here commands to clean up after the build process.

	dh_clean
	rm -rf debian/console-log.conf.5

install: build
	dh_testdir
	dh_testroot
	dh_clean
	dh_installdirs

	# Add here commands to install the package into debian/$package

	install -D -m 644 debian/console-log.conf debian/console-log/etc/console-log.conf
	install -D -m 755 scripts/logpager debian/console-log/usr/share/console-log/logpager

	# manpages
	/usr/bin/pod2man --section=5 --release="console-log $(PKG_VER)" --lax \
	--center="Debian GNU/Linux" debian/console-log.conf.pod > debian/console-log.conf.5

	# maintainer scripts
	-for script in console-log.postinst console-log.postrm console-log.init.d; do \
	  perl -pi -e '! $$state && ($$state = s/^USERNAME=.*$$/USERNAME=$(USERNAME)/)' debian/$$script; \
	done

	touch install-stamp

# Build architecture-dependent .debs here.
binary-arch: build install
# we have nothing to do here

# Build architecture-dependent .debs here.
binary-indep: build install
	dh_testdir
	dh_testroot
	dh_install
	dh_installdocs
	dh_installinit defaults 99
	dh_installexamples
	dh_installman
#	dh_undocumented
	dh_installchangelogs
	dh_link
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

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
