#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.

# get the various DEB_BUILD/DEB_HOST variables
include /usr/share/dpkg/architecture.mk

#export DH_VERBOSE = 1


# see FEATURE AREAS in dpkg-buildflags(1)
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all

export DEB_BUILD_MAINT_OPTIONS=hardening=+all

# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append CFLAGS
#export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
# package maintainers to append LDFLAGS
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

export DEB_LDFLAGS_MAINT_APPEND=-Wl,-z,defs -Wl,--as-needed -Wl,-O1

%:
	dh $@ --with autotools_dev


# dh_make generated override targets
# This is example for Cmake (See https://bugs.debian.org/641051 )
#override_dh_auto_configure:
#	dh_auto_configure -- #	-DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)

override_dh_install:
	chmod 755 debian/xfce4-session/etc/xdg/xfce4/xinitrc
	find debian/xfce4-session/usr/lib -name '*.la' -delete
	install -m 644 -D debian/startxfce4.user-session.upstart debian/xfce4-session/usr/share/upstart/sessions/startxfce4.conf
	dh_install

override_dh_strip:
	dh_strip --dbgsym-migration='xfce4-session-dbg (<< 4.12.1-6~)'

# default backend for Linux and Hurd
BACKEND=linux
ifeq ($(DEB_BUILD_ARCH_OS),kfreebsd)
	BACKEND=freebsd
endif

override_dh_auto_configure:
	dh_auto_configure -- --disable-legacy-sm --with-backend=$(BACKEND)