#!/usr/bin/make -f

export ENABLE_NLS=1

CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS)
CFLAGS:=$(shell dpkg-buildflags --get CFLAGS)
LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS)

%:
	dh $@ --with autoreconf

override_dh_auto_configure:
	# dh_auto_configure tries to do /usr/lib/ldm/, which is weird,
	# cause we already add /ldm/ to the end
	CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" dh_auto_configure -- --libexecdir=/usr/lib

override_dh_install:
	dh_install
	rm debian/ldm/usr/lib/ldm/*.la

override_dh_fixperms:
	dh_fixperms
	# ensure ldm-script is executable to avoid lintian warning
	chmod +x debian/ldm/usr/share/ldm/ldm-script

override_dh_autoreconf:
	dh_autoreconf ./autogen.sh
