#!/usr/bin/make -f

include /usr/share/dpkg/architecture.mk

%:
	dh $@ --buildsystem=autoconf

execute_before_dh_auto_build:
	touch src/austin.1  # needed by make, will be overwritten by doc/gen.sh

override_dh_auto_build:
# Passing --enable-debug-symbols would also -DDEBUG.
	dh_auto_build -- STRIP_FLAGS=

ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
execute_after_dh_auto_build:
	mkdir -p debian/doc-home
	HOME=$(CURDIR)/debian/doc-home ./doc/gen.sh
else
execute_after_dh_link:
	rm -Rf debian/austin/usr/share/man
endif

override_dh_auto_test:
# This is not testing austin, but it's better than nothing.
# pycparser fails parsing __float128 on 32bit architectures.
ifneq ($(DEB_HOST_ARCH_BITS),32)
	pytest -sv test/cunit
endif
# We would also like to run functional and integration tests, but those require
# austin-python.
