#!/usr/bin/make -f
# Made with the aid of dh_make, by Craig Small
# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
# Some lines taken from debmake, by Cristoph Lameter.

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

# This is the debhelper compatibility version to use.
export DH_COMPAT=1

build: build-stamp
build-stamp:
	dh_testversion 2.0.40
	dh_testdir
# Add here commands to compile the package.
	./configure --prefix=$(shell pwd)/debian/tmp/usr --fhs
	$(MAKE)
	touch build-stamp


clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp
# Heh, for cleaning we need to run the configure script in order to create the makefile that cleans! :-)))
	./configure
	$(MAKE) clean
	dh_clean


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


install: build
	dh_testdir
	dh_testroot
	dh_clean
#   dh_installdirs
# Add here commands to install the package into debian/tmp.
	$(MAKE) install
	mv debian/tmp/usr/share/doc/setedit/change.log.gz debian/tmp/usr/share/doc/setedit/changelog.gz
	dh_link usr/share/man/man1/setedit.1.gz usr/share/man/man1/e.1.gz
# We need to move files for other packages than the first one in the control file:
	dh_movefiles -p infview usr/bin/infview usr/share/doc/infview usr/share/infview usr/share/man/man1/infview.1.gz
	mkdir debian/infview/usr/share/info
	cp debian/tmp/usr/share/info/infview.info.gz debian/infview/usr/share/info/infview.info.gz


# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installdocs
#	dh_installexamples
	dh_installmenu
#	dh_installemacsen
#	dh_installinit
#	dh_installcron
#	dh_installmanpages
#	dh_undocumented e.1 setedit.1
	dh_installchangelogs 
	dh_strip
	dh_compress
	dh_fixperms
	chmod 4755 debian/tmp/usr/bin/setedit
	chmod 4755 debian/infview/usr/bin/infview
	dh_suidregister /usr/bin/setedit /usr/bin/infview
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
#	dh_makeshlibs  This is for libraries.
	dh_md5sums
	dh_builddeb


# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.

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
