#!/usr/bin/make -f
export DH_VERBOSE = 1

export SALMON=/usr/bin/salmon
export STAR=/usr/bin/STAR
export FASTQC=/usr/bin/fastqc
export TRIMGALORE=/usr/bin/trim_galore
export GNUBASH=/bin/bash
export HOME=/tmp

%:
	dh $@

execute_before_dh_autoreconf:
	mkdir -p ${CURDIR}/pigx-common
	cp -a debian/common ${CURDIR}/pigx-common

override_dh_auto_configure:
	dh_auto_configure -- GUNZIP=/bin/gunzip SED=/bin/sed

override_dh_auto_clean:
	dh_auto_clean
	rm -rf pigx-common
	rm -f config.log test.sh
	rm -rf tests/output
	rm -f Makefile.in aclocal.m4 build-aux/install-sh build-aux/missing build-aux/test-driver
	rm -f scripts/jquery.min.js
	rm -f conftest.tar confdefs.h

override_dh_fixperms:
	dh_fixperms
	find debian/pigx-rnaseq/usr/libexec/pigx_rnaseq -name "*.R" | xargs -r chmod -x
	find debian/pigx-rnaseq/usr/libexec/pigx_rnaseq -name "*.Rmd" | xargs -r chmod -x
	find debian/pigx-rnaseq/usr/libexec/pigx_rnaseq -name "*.py" | xargs -r chmod -x

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	ln -sf /usr/share/javascript/jquery/jquery.min.js scripts/
	#$(MAKE) -j2 check VERBOSE=1
	./test.sh
endif
