#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

DPKG_EXPORT_BUILDFLAGS = 1

include /usr/share/dpkg/default.mk

ifneq ($(SOURCE_DATE_EPOCH),)
faketime := faketime -f "$(shell date --date='@$(SOURCE_DATE_EPOCH)' '+%Y-%m-%d %H:%M:%S')"
endif

%:
	dh $@

override_dh_clean:
	dh_clean
	rm -rf pdf html

override_dh_auto_build:
	dh_auto_build
	install -d pdf html
ifeq ($(filter nodoc,$(DEB_BUILD_PROFILES)),)
	cd pdf && $(faketime) pdflatex ../doc/theory.tex
	cd html && $(faketime) htlatex ../doc/theory.tex
endif

override_dh_strip:
	dh_strip --dbgsym-migration='libgfshare-dbg (<< 2.0.0-2)'

override_dh_auto_install:
	dh_auto_install
	rm -f debian/tmp/usr/lib/*/*.la

override_dh_missing:
	dh_missing --list-missing

override_dh_makeshlibs:
	dh_makeshlibs -V

override_dh_installdocs:
	dh_installdocs --link-doc=libgfshare2 -Nlibgfshare-bin
	dh_installdocs -plibgfshare-bin
