#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#DH_VERBOSE = 1

# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk

# see FEATURE AREAS in dpkg-buildflags(1)
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append CFLAGS
#export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
# package maintainers to append LDFLAGS
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

%:
	dh $@

override_dh_auto_install:
	echo "Do not use upstream install procedure which requires root permission"

override_dh_strip:
	dh_strip
	# @echo "Size before strip:"
	# stat -c "%s" debian/compartment/usr/sbin/compartment
	# strip --strip-unneeded debian/compartment/usr/sbin/compartment
	# @echo "Size after strip:"
	# stat -c "%s" debian/compartment/usr/sbin/compartment
	## Check if debug sections are actually gone
	# objdump -h debian/compartment/usr/sbin/compartment | grep debug || echo "No debug sections found"
	# Force stripping all since somehow lintian claims non-stripped binary
	strip --strip-all --remove-section=.comment --remove-section=.note debian/compartment/usr/sbin/compartment
