#! /usr/bin/make -f
#
# © 2009 Cyril Brulebois <kibi@debian.org>


##### VARIABLES
#

DEB_BUILD_ARCH      ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
NO_MAKE_CHECK_ARCHS := arm

ifeq (,$(filter $(DEB_BUILD_ARCH),alpha))
	export DEB_CFLAGS_MAINT_APPEND=-Wall
	export DEB_CXXFLAGS_MAINT_APPEND=-Wall
else
	export DEB_CFLAGS_MAINT_APPEND=-Wall -mieee
	export DEB_CXXFLAGS_MAINT_APPEND=-Wall -mieee
endif

##### OVERRIDES
#

# Need to set an environment variable to make sure proper linking
# against libphtread happens:
override_dh_auto_configure:
	PTHREAD_LIBS=-lpthread \
		$(shell dpkg-buildflags --export=configure) \
		dh_auto_configure -v

# Need to disable the test suite on some architectures:
override_dh_auto_test:
ifeq (,$(filter $(DEB_BUILD_ARCH),$(NO_MAKE_CHECK_ARCHS)))
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	dh_auto_test
endif
endif

# Need to install those in both packages:
override_dh_installdocs:
	dh_installdocs AUTHORS NEWS README

# Need to pass -V to dh_makeshlibs:
override_dh_makeshlibs:
	dh_makeshlibs -V

# Everything else:
%:
	dh $@ --with autoreconf
