#!/usr/bin/make -f

VERSION=$(shell dpkg-parsechangelog | grep ^Version | sed "s/.*: //")

DEB_LDFLAGS_MAINT_APPEND=-Wl,--no-add-needed,--as-needed,--no-undefined

include /usr/share/dpkg/buildflags.mk

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- -DCMAKE_C_FLAGS="$(CFLAGS)" -DCMAKE_CXX_FLAGS="$(CFLAGS)" \
				-DCMAKE_SHARED_LINKER_FLAGS="$(LDFLAGS)" \
				-DCMAKE_MODULE_LINKER_FLAGS="$(LDFLAGS)" \
				-DCMAKE_EXE_LINKER_FLAGS="$(LDFLAGS)" \
				-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
				-DCMAKE_SKIP_RPATH:BOOL=ON -DHAS_FLTO_FLAG:BOOL=OFF

override_dh_install:
	dh_install
	# Generate manpage
	help2man --no-info --version-string="$(VERSION)" \
		--name='System monitor that can react to user chosen conditions' \
		debian/sentinella/usr/bin/sentinella > sentinella.1

