#!/usr/bin/make -f

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


%:
	dh $@

override_dh_auto_configure:
	rm -rf build; mkdir build
	cd build; cmake \
	    -DCMAKE_INSTALL_PREFIX=/usr \
	    -DPKGCONFIGDIR=/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig \
	    ..
override_dh_auto_build:
	make -C build

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	make -C build tests
	cd build; ./devel/lib/*/*-serial-test
endif

override_dh_auto_install:
	make -C build DESTDIR=../debian/tmp install

override_dh_missing:
	dh_missing --fail-missing
