#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk

# resolve if release is experimental
EXP_RELEASE = $(filter experimental% UNRELEASED,$(DEB_DISTRIBUTION))

# relax symbols check when targeting experimental
export DPKG_GENSYMBOLS_CHECK_LEVEL=$(if $(EXP_RELEASE),0,1)

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# This variable is the part of the "upstream" version number before the +
UPSTREAM_VERSION = $(shell echo $(DEB_VERSION_UPSTREAM) | cut -d+ -f1)

# https://launchpad.net/bugs/2124947
%:
	dh $@ --no-parallel

override_dh_auto_configure:
	dh_auto_configure -- \
		-DINSTALL_HTML_DOC=ON \
		-DCMAKE_INSTALL_DOCDIR=/usr/share/doc/editorconfig-doc \
		-DCMAKE_BUILD_RPATH_USE_ORIGIN=ON
	

execute_after_dh_shlibdeps:
	d-devlibdeps \
		--override s/libeditorconfig0-dev/libeditorconfig-dev/ \
		debian/libeditorconfig-dev.substvars \
		debian/tmp/usr/lib/*/*.so

execute_after_dh_link:
	dh_link -peditorconfig usr/share/man/man1/editorconfig.1.gz usr/share/man/man1/editorconfig-$(UPSTREAM_VERSION).gz
