#!/usr/bin/gmake -f

export DEB_CFLAGS_MAINT_APPEND := -Wall
export DEB_CXXFLAGS_MAINT_APPEND := -Wall
export DEB_BUILD_MAINT_OPTIONS := hardening=+all

override_dh_auto_configure:
	CC="/usr/gcc/4.8/bin/gcc -m64" dh_auto_configure --verbose -- \
		--localstatedir=/var/cache/locate \
		--enable-d_type-optimisation \
		--libexecdir='$${prefix}/lib/locate' \
		ac_cv_func_newlocale=no \
		--disable-leaf-optimisation


override_dh_auto_clean:
	[ ! -f Makefile ] || dh_auto_clean --verbose
	rm -fv doc/find.info*
	# needed for
	# debian/patches/11_Fix-bug-48030-find-exec-does-not-pass-all-arguments.patch
	if test -e find/testsuite/sv-48030-exec-plus-bug.sh ; then \
		chmod +x find/testsuite/sv-48030-exec-plus-bug.sh ; \
		fi

override_dh_auto_install:
	dh_auto_install --verbose
	install -m755 $(CURDIR)/debian/tmp/usr/bin/updatedb \
		$(CURDIR)/debian/locate/usr/bin/updatedb.findutils
	install -m755 $(CURDIR)/debian/tmp/usr/bin/locate \
		$(CURDIR)/debian/locate/usr/bin/locate.findutils
	install -m644 $(CURDIR)/debian/tmp/usr/share/man/man1/locate.1 \
		$(CURDIR)/debian/locate/usr/share/man/man1/locate.findutils.1
	install -m644 $(CURDIR)/debian/tmp/usr/share/man/man1/updatedb.1 \
		$(CURDIR)/debian/locate/usr/share/man/man1/updatedb.findutils.1

override_dh_auto_test:

%:
	dh $@ --with autotools_dev
