#!/usr/bin/make -f
export DEB_BUILD_MAINT_OPTIONS=hardening=+all future=+lfs

D := $(CURDIR)/debian/openbgpd

%:
	dh $@

# explicitly delete the generated files contained in the upstream source
# (that are also deleted by make distclean) to be sure that they will be
# regenerated the first time that the package is built
execute_after_dh_clean:
	rm -f \
		$(shell find . -name '*.m4') \
		$(shell find . -name Makefile.in) \
		configure ltmain.sh \
		src/bgpd/parse.c

override_dh_auto_configure:
	dh_auto_configure -- \
		--runstatedir=/run/openbgpd \
		--with-wwwrunstatedir=/run \
		--with-www-user=www-data \
		--with-privsep-user=_openbgpd

# do not install a default configuration, since no sensible one is possible
execute_after_dh_auto_install:
	rm -rf $D/etc/ $D/run/

execute_after_dh_installsystemd:
	dh_installsystemd --name=bgplgd --no-start --no-enable