#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-


#export DH_VERBOSE=1
export DH_ALWAYS_EXCLUDE=_darcs

configure: configure-stamp

configure-stamp:
	dh_testdir
	touch configure-stamp

build-arch: build-stamp
build-indep: build-stamp
build: build-stamp

build-stamp: configure-stamp
	dh_testdir
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	dh_clean
	rm -f build-stamp configure-stamp

install: build
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs
	cp -a doc debian/cdrtool/usr/share/doc/cdrtool/
	cp -a setup/*sample debian/cdrtool/etc/cdrtool/
	cp -a debian/copyright debian/cdrtool/usr/share/doc/cdrtool/
	cp -a setup/csv debian/cdrtool/usr/share/doc/cdrtool/rating-sample-files
	cp -a images debian/cdrtool/var/www/CDRTool/
	cp -a library debian/cdrtool/var/www/CDRTool/
	cp -a templates debian/cdrtool/var/www/CDRTool/
	cp -a contrib debian/cdrtool/var/www/CDRTool/
	cp -a doc debian/cdrtool/var/www/CDRTool/
	cp -a phplib debian/cdrtool/var/www/CDRTool/
	cp -a scripts debian/cdrtool/var/www/CDRTool/
	cp -a setup debian/cdrtool/var/www/CDRTool/
	cp -a status debian/cdrtool/var/www/CDRTool/
	cp -a po debian/cdrtool/var/www/CDRTool/
	cp -a *.js debian/cdrtool/var/www/CDRTool/
	cp -a timezones debian/cdrtool/var/www/CDRTool/
	cp -a version debian/cdrtool/var/www/CDRTool/
	cp -a .htaccess debian/cdrtool/var/www/CDRTool/
	cp *.phtml debian/cdrtool/var/www/CDRTool/
	cp *.css debian/cdrtool/var/www/CDRTool/
	cp debian/changelog debian/cdrtool/var/www/CDRTool/doc/
	cp -a bootstrap debian/cdrtool/var/www/CDRTool/

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

# Build architecture-independent files here.
binary-indep: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs
	dh_lintian
#	dh_installdocs
	dh_installexamples
#	dh_install
#	dh_installmenu
#	dh_installdebconf
#	dh_installlogrotate
#	dh_installemacsen
#	dh_installpam
#	dh_installmime
#	dh_python
	dh_installinit
	dh_installsystemd
	dh_installsystemd --no-start --name=buildStatistics buildStatistics.service
	dh_installsystemd --name=buildStatistics buildStatistics.timer
	dh_installsystemd --no-start --name=importRatingTables importRatingTables.service
	dh_installsystemd --name=importRatingTables importRatingTables.timer
	dh_installsystemd --no-start --name=normalize normalize.service
	dh_installsystemd --name=normalize normalize.timer
	dh_installsystemd --no-start --name=quotaCheck quotaCheck.service
	dh_installsystemd --name=quotaCheck quotaCheck.timer
	dh_installsystemd --no-start --name=quotaDailyReset quotaDailyReset.service
	dh_installsystemd --name=quotaDailyReset quotaDailyReset.timer
	dh_installsystemd --no-start --name=quotaDeblock quotaDeblock.service
	dh_installsystemd --name=quotaDeblock quotaDeblock.timer
	dh_installsystemd --no-start --name=quotaReset quotaReset.service
	dh_installsystemd --name=quotaReset quotaReset.timer
	dh_installsystemd --no-start --name=notifyLastSessions notifyLastSessions.service
	dh_installsystemd --no-enable --no-start --name=notifyLastSessions notifyLastSessions.timer
	dh_installsystemd --no-start --name=purgeSIPTrace purgeSIPTrace.service
	dh_installsystemd --no-enable --no-start --name=purgeSIPTrace purgeSIPTrace.timer
	dh_installsystemd --no-start --name=purgeTables purgeTables.service
	dh_installsystemd --no-enable --no-start --name=purgeTables purgeTables.timer
	dh_installsystemd --no-start --name=rotateTables rotateTables.service
	dh_installsystemd --no-enable --no-start --name=rotateTables rotateTables.timer
	dh_installcron
#	dh_installinfo
#	dh_installman
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
#	dh_perl
#	dh_makeshlibs
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

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