#!/usr/bin/make -f
#export DH_VERBOSE=1

export DEB_BUILD_MAINT_OPTIONS=hardening=+all
DPKG_EXPORT_BUILDTOOLS=1
include /usr/share/dpkg/buildtools.mk

%:
	dh $@

override_dh_auto_build:
	debian/Crack.make
	# this is the crypt version, move it to other place
	mv lib/bin/debian/ lib/bin/debian-crypt
	# To build the MD5 version
	mv src/libdes src/libdes.orig
	cd src/util && cp elcid.c elcid.c.orig && cp elcid.c,bsd elcid.c
	debian/Crack.make
	mv lib/bin/debian/ lib/bin/debian-md5
	# Now restore it to the previous situation
	mv src/libdes.orig src/libdes
	cd src/util && cp elcid.c.orig elcid.c

override_dh_auto_clean:
	# This is done just in case
	if [ -d src/libdes.orig ] ; then \
	 mv src/libdes.orig src/libdes ; \
	 cd src/util && cp elcid.c.orig elcid.c ;\
	fi
	dh_auto_clean -- spotless
