#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

export DEB_BUILD_MAINT_OPTIONS=hardening=+all,-pie

%:
	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
