#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

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




SCONS_OPTIONS= prefix_for_packaging=$(CURDIR)/debian/tmp/usr prefix=/usr xmlbackend=xercesc release=yes double=0 with_fftw3=yes with_fftw=no verbose=1
SCONS= scons


configure: configure-stamp
configure-stamp:
	dh_testdir
	mkdir -p $(CURDIR)/debian/tmp/usr
	cd $(CURDIR); $(SCONS) configure $(SCONS_OPTIONS)
	touch configure-stamp


build: build-stamp
build-stamp: configure-stamp 
	dh_testdir
	cd $(CURDIR); $(SCONS) core processing audioio
	doxygen $(CURDIR)/doxygen.cfg
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp configure-stamp
	-cd $(CURDIR) && $(SCONS) -c
	find $(CURDIR) -name .*sconf_temp* | xargs rm -rf
	find $(CURDIR) -type f -name *.pyc | xargs rm -rf
	find $(CURDIR) -type f -name *.o | xargs rm -rf
	find $(CURDIR) -type f -name *.os | xargs rm -rf
	find $(CURDIR) -type f -name *.a | xargs rm -rf
	find $(CURDIR) -type f -name .*.swp | xargs rm -rf
	find $(CURDIR) -type f -name .sconsign | xargs rm -rf
	find $(CURDIR) -type f -name *.db | xargs rm -rf
	find $(CURDIR) -type f -name flags.conf | xargs rm -rf
	find $(CURDIR) -type d -name generated | xargs rm -rf
	-rm -rf $(CURDIR)/CLAM.tag $(CURDIR)/*.tar.gz $(CURDIR)/doxygen \
	  $(CURDIR)/src/Defines/CLAMVersion.cxx src/Defines/CLAMVersion.hxx \
		$(CURDIR)/.sconsign.dblite config.log \
		$(CURDIR)/*/{*.conf,include,src,*.so*,*.pc,CLAM} \
	dh_clean 

install: build
	dh_testdir
	dh_testroot
	dh_clean -k 
	dh_installdirs
	mkdir -p $(CURDIR)/debian/tmp/usr
	cd $(CURDIR) && $(SCONS) install
	dh_install --sourcedir=debian/tmp --fail-missing

# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs CHANGES
	dh_installdocs
	dh_installexamples
	dh_installman
	dh_link
	dh_strip --dbg-package=libclam1.4-dbg
	dh_pycentral
	dh_compress
	dh_fixperms
	dh_makeshlibs
	dh_installdeb
	dh_shlibdeps -L libclam1.4 -l debian/libclam1.4/usr/lib
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure
