#!/usr/bin/make -f

BUILDARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH)

FAIL_ON_I386_TESTS := check-gc

%:
	dh $@ --with autoreconf

override_dh_auto_install:
	dh_auto_install

	sed -i "s/^dependency_libs.*/dependency_libs=''/" \
	   $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/elk/*.la
	rm -f $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/*.la

override_dh_auto_test:
	# exclude tests known to fail
ifeq ($(BUILDARCH),$(filter $(BUILDARCH), i386 kfreebsd-i386))
	for tst in $(FAIL_ON_I386_TESTS) ; do sed -i "/^native_tests = /s/$${tst}//" test/Makefile ; echo "skipping test $${tst} which is known to fail in i386" ; done
endif
