#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh $@ --with autoreconf

override_dh_auto_configure:
	dh_auto_configure -- GTEST_PATH=/usr/src/gtest --enable-shared

get-orig-source:
	wget https://github.com/Macaulay2/memtailor/archive/master.tar.gz
	git checkout upstream
	git pull https://github.com/Macaulay2/memtailor
	grep -Po '(?<=AC_INIT\(\[memtailor\], \[).*(?=\]\))' configure.ac \
		> version
	git show HEAD^:configure.ac | \
		grep -Po '(?<=AC_INIT\(\[memtailor\], \[).*(?=\]\))' > oldversion
	if test `cat oldversion` = `cat version` ; then \
		echo "`cat version`~git`date -d @\`git log -1 --pretty=format:%ct\` +%Y%m%d`" > version; \
	fi
	git checkout master
	mv -v master.tar.gz ../memtailor_`cat version`.orig.tar.gz
	rm version oldversion
