#!/usr/bin/make -f

SHELL := sh -e

DATE=$(shell date +%Y%m%d)
VERSION=$(word 1,$(shell cat version))

unexport LDFLAGS

%:
	dh ${@}

dfsg:
	rm -f doc/rfc5071.txt

override_dh_auto_build:
	dh_auto_build -- DATE="$(DATE)" VERSION="$(VERSION)"

override_dh_auto_clean:
	dh_auto_clean

	rm -f core/.depend memdisk/.depend
	rm -f com32/lib*/*.a com32/*/*.c32 core/*.0 core/*.bin core/*.bss core/*.sys dos/*.com gpxe/*.0 memdisk/memdisk memdump/*.com

override_dh_auto_install:
	dh_auto_install -- INSTALLROOT=$(CURDIR)/debian/tmp

	# Removing useless files
	rm -f debian/tmp/usr/bin/keytab-lilo # already part of the lilo package
	rm -f debian/tmp/usr/share/syslinux/*.com # ms-dos executables
	rm -rf debian/tmp/usr/share/syslinux/dosutil # ms-dos executables

override_dh_builddeb:
	dh_builddeb -- -Zgzip -z9

override_dh_install:
	dh_install --fail-missing

override_dh_installchangelogs:
	dh_installchangelogs NEWS
