#!/usr/bin/make -f
export DH_VERBOSE=1
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
include /usr/share/dpkg/default.mk
export ERL_COMPILER_OPTIONS=deterministic

DESTDIR=$(CURDIR)/debian/erlang-p1-pam


%:
	dh $@ --buildsystem=rebar --with rebar


override_dh_auto_configure:
	./configure
	dh_auto_configure

override_dh_auto_install:
	dh_auto_install
	dh_install priv/bin/* /usr/lib/erlang/p1_pam/bin/
	ln -s /usr/lib/erlang/lib/p1_pam-$(DEB_VERSION_UPSTREAM) $(DESTDIR)/usr/lib/erlang/lib/epam-$(DEB_VERSION_UPSTREAM)

override_dh_gencontrol:
	find $(DESTDIR) -type d -empty -delete
	dh_gencontrol

override_dh_auto_clean:
	rm -rf compile_commands.json config.log config.status vars.config
	dh_auto_clean
