#!/usr/bin/make -f

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

export DEB_BUILD_HARDENING = 1
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

export CFLAGS = $(shell dpkg-buildflags --get CFLAGS)
export LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS) -Wl,-z,now
export CFLAGS += -Wall -D_FORTIFY_SOURCE=2

%:
	dh $@

override_dh_auto_clean:
	rm -rf tmp
	dh_auto_clean

override_dh_auto_build-arch:
	# compile the package.
	./icm_prepare   /
	./icm_bootstrap /
	dh_auto_build -a

override_dh_auto_install-arch:
	# Add here commands to install the package into debian/icmake
	./icm_install strip progs debian/icmake
	./icm_install scripts debian/icmake
	./icm_install skel debian/icmake
	./icm_install man debian/icmake
	./icm_install doc debian/icmake
	./icm_install etc debian/icmake
	dh_auto_install -a

override_dh_auto_install-indep: override_dh_auto_build-arch
	./icm_install docdoc  debian/icmake-doc
	dh_auto_install -i

override_dh_link-arch:
	dh_link usr/share/man/man1/icmake.1.gz usr/share/man/man1/icmun.1.gz
