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

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

include /usr/share/dpkg/architecture.mk

export DEB_BUILD_MAINT_OPTIONS=hardening=+all

%:
	dh $@

override_dh_auto_clean:
	dh_auto_clean
	rm -f config.sub config.guess

override_dh_auto_configure:
	# Add here commands to configure the package.
ifneq "$(wildcard /usr/share/misc/config.sub)" ""
	cp -f /usr/share/misc/config.sub config.sub
endif
ifneq "$(wildcard /usr/share/misc/config.guess)" ""
	cp -f /usr/share/misc/config.guess config.guess
endif
	dh_auto_configure ## -- --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs"

override_dh_auto_build:
	dh_auto_build -- pam_barada_sodir=/usr/lib/$(DEB_HOST_MULTIARCH)/security

override_dh_auto_install:
	dh_auto_install -- pam_barada_sodir=/usr/lib/$(DEB_HOST_MULTIARCH)/security DESTDIR=$(CURDIR)/debian/tmp
	# barada-add goes and makes /etc/barada.d 0600 because the keys
	# to the castle are stored there
	chmod 600 $(CURDIR)/debian/libpam-barada/etc/barada.d

override_dh_fixperms:
	dh_fixperms -X etc/barada.d
