#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

CXXFLAGS += $(CPPFLAGS)

DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)

%:
	dh $@

override_dh_auto_build:
	dh_auto_build
	dh_auto_build -Dosmjs

override_dh_auto_clean:
	dh_auto_clean
	dh_auto_clean -Dosmjs

override_dh_auto_install:
	dh_auto_install
	dh_auto_install -Dosmjs

override_dh_auto_test:
ifneq (,$(findstring $(DEB_BUILD_ARCH),"kfreebsd-amd64 kfreebsd-i386"))
	# The t/osmfile/test_read_and_write.cpp test fails on kFreeBSD because
	# Boost considers an exiting child process a fatal error.
	#
	# To workaround this BOOST_TEST_CATCH_SYSTEM_ERRORS=no prohibits the
	# Boost framework from catching asyncronous system events.
	# 
	# See also: https://github.com/joto/osmium/issues/94

        BOOST_TEST_CATCH_SYSTEM_ERRORS=no dh_auto_test
else
        dh_auto_test
endif

override_dh_install:
	dh_install --list-missing

