#!/usr/bin/make -f

# Enabling ROCm support for AMD GPUs
export HIPCXX=clang-$(shell /usr/bin/hipcc --version | sed -nr 's/.*clang version ([0-9]+).*/\1/p')
ARCH_HIP_CPU := amd64 arm64 ppc64el
ARCH_HIP_GPU := gfx803;gfx900;gfx906;gfx908;gfx90a;gfx1010;gfx1030;gfx1100;gfx1101;gfx1102
HIP := $(if $(filter $(DEB_TARGET_ARCH), $(ARCH_HIP_CPU)), -DSPFFT_GPU_BACKEND=ROCM "-DCMAKE_HIP_ARCHITECTURES=$(ARCH_HIP_GPU)",)

CMAKE_FLAGS = $(HIP)

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- $(CMAKE_FLAGS)

execute_after_dh_auto_install:
	find debian/tmp -name libspfft.so | xargs chrpath --delete
