#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

export DH_VERBOSE=1

# This has to be exported to make some magic below work.
export DH_OPTIONS

%:
	dh $@ --no-parallel

# Add --with-old-names and --without-old-links, so that
# the dateutils get installed with the "date" prefix
# instead of the new short "d" prefix.
# The tool "dgrep" is already provided by debian-goodies.
# See bug #846074
# no need for this anylonger, upstream renamed the binaries
# override_dh_auto_configure:
#  	dh_auto_configure -- --program-prefix='dateutils.' --with-old-names --without-old-links

override_dh_auto_install:
	dh_auto_install
	find
	# remove some old stuff
	rm $(CURDIR)/debian/dateutils/usr/share/doc/dateutils/LICENSE
	rm $(CURDIR)/debian/dateutils/usr/bin/dadd
	rm $(CURDIR)/debian/dateutils/usr/bin/dconv
	rm $(CURDIR)/debian/dateutils/usr/bin/ddiff
	rm $(CURDIR)/debian/dateutils/usr/bin/dgrep
	rm $(CURDIR)/debian/dateutils/usr/bin/dround
	rm $(CURDIR)/debian/dateutils/usr/bin/dseq
	rm $(CURDIR)/debian/dateutils/usr/bin/dsort
	rm $(CURDIR)/debian/dateutils/usr/bin/dtest
	rm $(CURDIR)/debian/dateutils/usr/bin/dzone

	rm $(CURDIR)/debian/dateutils/usr/share/man/man1/dadd.1
	rm $(CURDIR)/debian/dateutils/usr/share/man/man1/dconv.1
	rm $(CURDIR)/debian/dateutils/usr/share/man/man1/ddiff.1
	rm $(CURDIR)/debian/dateutils/usr/share/man/man1/dgrep.1
	rm $(CURDIR)/debian/dateutils/usr/share/man/man1/dround.1
	rm $(CURDIR)/debian/dateutils/usr/share/man/man1/dseq.1
	rm $(CURDIR)/debian/dateutils/usr/share/man/man1/dsort.1
	rm $(CURDIR)/debian/dateutils/usr/share/man/man1/dtest.1
	rm $(CURDIR)/debian/dateutils/usr/share/man/man1/dzone.1

override_dh_auto_test:
	LC_ALL=C dh_auto_test

override_dh_auto_clean:
	[ -f Makefile ] && dh_auto_clean || true
