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

export DPKG_GENSYMBOLS_CHECK_LEVEL=4

include /usr/share/dpkg/default.mk

# The home directory of user buildd does not exist on the builders
export XDG_DATA_HOME=/tmp

# Enable Hardening
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh $@ --with pkgkde_symbolshelper

override_dh_auto_test:
	dh_auto_test --no-parallel

override_dh_install:
	# Fix installation location of the doc:pkg files
	mv $(CURDIR)/debian/tmp/usr/share/doc/net-cpp \
	     $(CURDIR)/debian/tmp/usr/share/doc/libnet-cpp-doc
	dh_install
	# Get rid of duplicate files and replace them by symlinks
	if [ -d "$(CURDIR)/debian/libnet-cpp-doc/usr/share/doc/libnet-cpp-doc/html/" ]; then \
	    find "$(CURDIR)/debian/libnet-cpp-doc/usr/share/doc/libnet-cpp-doc/html/" -name *.md5 -delete; \
	    rdfind -makesymlinks true "$(CURDIR)/debian/libnet-cpp-doc/usr/share/doc/libnet-cpp-doc/html/"; \
	    symlinks -rc "$(CURDIR)/debian/libnet-cpp-doc/usr/share/doc/libnet-cpp-doc/html/"; \
	fi

override_dh_missing:
	dh_missing --fail-missing

override_dh_clean:
	dh_clean
	rm -f results.txt

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