#!/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

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

# 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,-O1

%:
	dh $@


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

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

override_dh_install:
	chmod 755 debian/xfce4-session/etc/xdg/xfce4/xinitrc
	find debian/xfce4-session/usr/lib -name '*.la' -delete
ifeq ($(shell dpkg-vendor --derives-from ubuntu && echo 1),1)
	dh_install debian/systemd/xfce4-session.service /usr/lib/systemd/user/
	dh_install debian/systemd/run-systemd-session /usr/share/xfce4/scripts/
endif
	dh_install

override_dh_installchangelogs:
	DEB_BUILD_OPTIONS=notrimdch dh_installchangelogs NEWS