#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# This has to be exported to make some magic below work.
export DH_OPTIONS

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

export CFLAGS += -flto
export LDFLAGS += -flto

%:
	dh $@

override_dh_install:
	rm debian/tmp/etc/opennds/opennds.uci
	mkdir -p debian/tmp/lib/systemd/system/
	mv debian/tmp/etc/systemd/system/opennds.service debian/tmp/lib/systemd/system/
	dh_install

override_dh_missing:
	dh_missing --fail-missing

override_dh_fixperms:
	dh_fixperms
	if [ -x debian/opennds/etc/opennds/fas-hid.php ]; then \
	    chmod a-x debian/opennds/etc/opennds/fas-hid.php; \
	fi

get-orig-source:
	uscan --noconf --force-download --rename --download-current-version --destdir=..
