#!/usr/bin/make -f
# -*- makefile -*-
# debian/rules for Qiime
# Tim Booth <tbooth@ceh.ac.uk>, Andreas Tille <tille@debian.org>
# GPL

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

pkg := $(shell dpkg-parsechangelog | sed -n 's/^Source: //p')

#Allowing this to be overridden by environemnt helps with backports
DEB_PYTHON_SUPPORT?=python2

%:
	dh $@ --with $(DEB_PYTHON_SUPPORT)

override_dh_compress:
	dh_compress \
	    --exclude=.js \
	    --exclude=.sff \
	    --exclude=.qual \
	    --exclude=.fna \
	    --exclude=.fna.txt

override_dh_clean:
	dh_clean
	rm -rf doc/_build
	( cd $(pkg)/support_files/denoiser/FlowgramAlignment && make clean ) || true
	rm -f $(pkg)/support_files/denoiser/bin/*

export ROOTDIR=debian/$(pkg)

#Lots of shuffling to be done...
# Python scripts go into /usr/lib/$(pkg)/bin (not /usr/bin)
# Helper script goes into /usr/bin
# Setup scripts go into /usr/lib/$(pkg)/shell
# Default configuration goes into /etc/$(pkg)/default_qiime_config
# ...or maybe it should be copied to $HOME/.qiime_config on 1st run?
override_dh_install:
	dh_install
	chmod a+x $(ROOTDIR)/usr/lib/$(pkg)/bin/uclust
	chmod -R a+rX $(ROOTDIR)/usr/lib/$(pkg)/shell

override_dh_installchangelogs:
	dh_installchangelogs ChangeLog
