#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

export PYBUILD_NAME=opentsne

# this flag deal with the -cpu=native flag
export CONDA_BUILD=1

# Make does not offer a recursive wildcard function, so here's one:
rwildcard=$(wildcard $1$2) $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2))

# How to recursively find all files with the same name in a given folder
ALL_PYX := $(call rwildcard,openTSNE/,*.pyx)
#NOTA: No space before *

%:
	dh $@ --buildsystem=pybuild

execute_after_dh_clean:
	# remove the cython generated file to force rebuild
	rm -f $(patsubst %.pyx,%.cpp,${ALL_PYX})
