#!/usr/bin/make -f
# debian/rules for osm2pgsql  
#
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)

# Verbose test output
export VERBOSE=1

CFLAGS += $(CPPFLAGS)
CXXFLAGS += $(CPPFLAGS)

ifneq (,$(findstring $(DEB_HOST_ARCH),"arm64 armel mips mipsel powerpc ppc64el s390x sparc alpha hppa ppc64"))
        CONFIGURE_OPTS += --without-lockfree
endif

%:
	dh $@ \
		--with autoreconf \
		--parallel

override_dh_auto_configure:
	dh_auto_configure -- $(CONFIGURE_OPTS) CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" CXXFLAGS="$(CXXFLAGS)"

override_dh_auto_test:
	dh_auto_test || echo "Ignoring test failures"

override_dh_compress:
	# clean up some naive file permissions
	dh_compress -X.php -X.sql -X.js -X.c -X.h

