#!/usr/bin/make -f

export DH_QUIET=1
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

%:
	dh $@

override_dh_autoreconf:
	dh_autoreconf ./autogen.sh

override_dh_auto_configure:
	dh_auto_configure -- --enable-mil

override_dh_fixperms:
	dh_fixperms
	chmod 755  $(CURDIR)/debian/moxa-power-manager/etc/moxa/moxa-power-manager/scripts/*

override_dh_installsystemd:
	dh_installsystemd --no-start --no-restart-on-upgrade

override_dh_auto_test:
ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
	CMOCKA_MESSAGE_OUTPUT=TAP dh_auto_test
	$(MAKE) -C tests valgrind
endif

override_dh_strip:
	dh_strip --no-automatic-dbgsym

override_dh_installdeb:
	dh_installdeb
	install -m 0755 debian/migrate-uc3400a-conf.sh \
	    debian/moxa-power-manager/DEBIAN/migrate-uc3400a-conf.sh

override_dh_dwz:
