#!/usr/bin/make -f

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

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- -DCMAKE_C_FLAGS="$(CFLAGS)" -DCMAKE_CXX_FLAGS="$(CFLAGS)" \
				-DCMAKE_SHARED_LINKER_FLAGS="-Wl,--no-undefined" \
				-DCMAKE_MODULE_LINKER_FLAGS="-Wl,--no-undefined" \
				-DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" \
				-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
				-DCMAKE_SKIP_RPATH:BOOL=ON

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

