#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

include /usr/share/dpkg/buildflags.mk
include /usr/share/dpkg/pkg-info.mk

%:
	dh $@ -Dsoftware

override_dh_auto_clean:
	dh_auto_clean -Dsoftware
	dh_auto_clean -Dsoftware/tools

override_dh_auto_build:
	dh_auto_build -Dsoftware -- CFLAGS="$(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -IKeccak -DGIT_VERSION=\\\"$(DEB_VERSION_UPSTREAM)\\\" -DGIT_COMMIT=\\\"Debian\\\" -DGIT_DATE=\\\"$(shell date +%FT%T%:z -d @$(SOURCE_DATE_EPOCH))\\\""
	dh_auto_build -Dsoftware/tools -- CFLAGS="$(CPPFLAGS) $(CFLAGS) $(LDFLAGS)"

override_dh_auto_configure:
# Copy various files so that debhelper tools can process them
	cp software/init_scripts/infnoise.conf.systemd debian/infnoise.conf
	cp software/init_scripts/75-infnoise.rules debian/infnoise.udev
	cp software/init_scripts/infnoise.service.sbin debian/infnoise.service

override_dh_auto_install:
	for file in passgen dice entcheck healthcheck hex2bin bin2hex findlongest flipbits; do mv software/tools/$${file} software/tools/infnoise-$${file}; done
