#!/usr/bin/make -f

#DH_VERBOSE = 1
#include /usr/share/dpkg/default.mk

export LC_ALL=C.UTF-8
export PYBUILD_NAME=pbconsensuscore

export DEB_BUILD_MAINT_OPTIONS=hardening=+all
export DEB_CFLAGS_MAINT_APPEND=-fopenmp-simd -DSIMDE_ENABLE_OPENMP -Wno-psabi -O3
export DEB_CXXFLAGS_MAINT_APPEND=-fopenmp-simd -DSIMDE_ENABLE_OPENMP -Wno-psabi -O3

%:
	dh $@ --buildsystem=pybuild

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	$(MAKE) test
	$(MAKE) test-python
endif

execute_before_dh_auto_build:
	test -f src/SWIG/numpy.i.orig || mv -v src/SWIG/numpy.i src/SWIG/numpy.i.orig
	cp $(shell python3 -c 'import numpy;print(numpy.get_include())')/numpy/numpy.i src/SWIG/numpy.i

execute_before_dh_auto_clean:
	! test -f src/SWIG/numpy.i.orig || mv -v src/SWIG/numpy.i.orig src/SWIG/numpy.i

execute_after_dh_python3:
	dh_numpy3

execute_after_dh_install:
	find debian -name meson.build -delete
