#!/usr/bin/make -f

%:
	dh $@ --buildsystem R

override_dh_auto_clean:
	dh_auto_clean
	if [ -d tmp_config ] ; then \
	    mv tmp_config/configure* . ; \
	    rm -rf tmp_config ; \
	fi
	rm -f R/hegy-test.R

override_dh_autoreconf:
	echo "Do nothing since R packages do not need this"
	mkdir tmp_config
	mv configure* tmp_config
	# Provide hegy.test for the case we have no CUDA installed (cuda is only available in non-free)
	sed 's/@HAS_CUDA@/FALSE/g' $(CURDIR)/R/hegy-test.R.in > $(CURDIR)/R/hegy-test.R

override_dh_fixperms:
	dh_fixperms
	find debian -name "*.Rnw" -exec chmod -x \{\} \;
