#!/usr/bin/make -f

include /usr/share/dpkg/architecture.mk

export DEB_CFLAGS_MAINT_APPEND := -Wno-error=discarded-qualifiers

%:
	dh $@ --buildsystem=autoconf

override_dh_auto_configure:
	dh_auto_configure -- --enable-debug-symbols

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

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.
