#!/usr/bin/make -f

# one ring to rule them all ...
%:
	dh $@ --buildsystem=makefile

override_dh_auto_configure:
	# disable warning about unused results (necessary because warning is error
	# is ON)
	CFLAGS="$(CFLAGS) -Wno-unused-result" ./configure --with-globus-path /usr --with-mysql-path /usr \
		--with-krb5-path /usr --with-readline-path /usr \
		--with-fuse-path /usr --with-zlib-path /usr --with-python-path /usr

override_dh_auto_install:
	dh_auto_install -- CCTOOLS_INSTALL_DIR=$(CURDIR)/debian/tmp
	# remove undesired pieces
	-rm debian/tmp/doc/COPYING
	# upstream says it should not go into the page
	-rm debian/tmp/bin/watchdog
	# HDFS helpers are useless without HDFS in Debian
	-rm debian/tmp/bin/*_hdfs
	# newer doxygen puts jquery copy
	-rm debian/tmp/doc/api/html/jquery.js

override_dh_auto_clean:
	[ -e Makefile.config ] && dh_auto_clean || true
	-rm Makefile.config configure.rerun
	-rm -rf api hdfs-setup.template python/python-workqueue/setup.cfg
	# remove testrun left-overs
	-rm dttools/src/microbench dttools/src/work_queue_example
	-find $(CURDIR) -name '*.test.log' -delete
	-find $(CURDIR) -name '*_test' -delete
	-rm -rf sand/test/filter_verification/random.cand.filter.tmp/
	-rm -rf sand/test/test_20.cand.filter.tmp/
	-rm -f sand/test/test_20.cand sand/test/test_20.cfa sand/test/*.log
	-rm -rf makeflow/test/input/ makeflow/test/worker.pid
	-rm -rf makeflow/test/dirs/testcase.subdir.01.makeflow.makeflowlog
	-rm -rf makeflow/test/dirs/testcase.subdir.01.makeflow.wqlog
	-rm dttools/src/multirun sand/test/banded.log
