#!/usr/bin/make -f

include /usr/share/hardening-includes/hardening.make

CFLAGS=$(shell dpkg-buildflags --get CFLAGS)
LDFLAGS=$(shell dpkg-buildflags --get LDFLAGS)
LDFLAGS+=$(HARDENING_LDFLAGS) -Wl,-z,defs -Wl,--as-needed -Wl,-O1
CFLAGS+=$(HARDENING_CFLAGS)

export CFLAGS LDFLAGS

override_dh_auto_configure:
	dh_auto_configure -- --enable-thunarx --enable-exo \
	 	--docdir=\$${prefix}/share/doc/xfdesktop4-data
		--enable-desktop-menu-dir-monitor

override_dh_install:
	chrpath -d -k $(CURDIR)/debian/tmp/usr/bin/*
	
	dh_install --sourcedir=debian/tmp --fail-missing
	# why oh why is this necessary?
	rm -rf $(CURDIR)/debian/xfdesktop4-data/usr/share/man

override_dh_link:
	rm -rf $(CURDIR)/debian/xfdesktop4/usr/share/doc/xfdesktop4
	ln -s xfdesktop4-data $(CURDIR)/debian/xfdesktop4/usr/share/doc/xfdesktop4
	dh_link

override_dh_strip:
	dh_strip --dbg-package=xfdesktop4-dbg

%:
	dh $@
