#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

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

PKG=hubackup
DEBVER=$(shell dpkg-parsechangelog |sed -n -e '/^Version:/s/^Version: //p')
DEB_BUILD_PROG:=debuild --preserve-envvar PATH --preserve-envvar CCACHE_DIR -us -uc $(DEB_BUILD_PROG_OPTS)

build: build-stamp

build-stamp: 
	dh_testdir
	python ./setup.py build
	touch build-stamp

clean: 
	dh_testdir
	dh_testroot
	rm -f build-stamp

	python ./setup.py clean --all
	find . -name "*.so" -exec rm {} \;
	find . -name "*.o" -exec rm {} \;
	find . -name "*.pyc" -exec rm {} \;

	dh_clean 

install: build
	dh_testdir
	dh_testroot
	dh_clean -k 
	dh_installdirs

	python ./setup.py install --prefix=$(CURDIR)/debian/hubackup/usr
	chmod +x $(CURDIR)/debian/hubackup/usr/lib/python2.4/site-packages/HUBackup/backend/BackupEngine.py
	chmod +x $(CURDIR)/debian/hubackup/usr/lib/python2.4/site-packages/HUBackup/backend/CDBurner.py
	chmod +x $(CURDIR)/debian/hubackup/usr/lib/python2.4/site-packages/HUBackup/backend/ConffileParser.py
	chmod +x $(CURDIR)/debian/hubackup/usr/lib/python2.4/site-packages/HUBackup/backend/DeviceInfo.py
	chmod +x $(CURDIR)/debian/hubackup/usr/lib/python2.4/site-packages/HUBackup/backend/fsInfo.py
	chmod +x $(CURDIR)/debian/hubackup/usr/lib/python2.4/site-packages/HUBackup/backend/fsMisc.py
	chmod +x $(CURDIR)/debian/hubackup/usr/lib/python2.4/site-packages/HUBackup/backend/ISOBuilder.py
	chmod +x $(CURDIR)/debian/hubackup/usr/lib/python2.4/site-packages/HUBackup/backend/RestoreEngine.py
	chmod +x $(CURDIR)/debian/hubackup/usr/lib/python2.4/site-packages/HUBackup/backend/TestEngine.py

binary-indep: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs 
	dh_installdocs
	dh_installexamples
	dh_installmime
	dh_desktop
	dh_installman
	dh_link
	dh_compress
	dh_fixperms
	dh_python
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary-arch:


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