#!/usr/bin/make -f

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

ORIGFILES = PyRRD.egg-info/SOURCES.txt

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

build-stamp:
	dh_testdir

	for f in $(ORIGFILES) ; do [ -e $$f.d-r-orig ] || cp -p $$f $$f.d-r-orig ; done

	python setup.py build

	touch $@

clean: 
	dh_testdir
	dh_testroot
	[ ! -d build ] || rm -rf build
	
	python setup.py clean
	for f in $(ORIGFILES) ; do [ ! -e $$f.d-r-orig ] || mv $$f.d-r-orig $$f ; done
	dh_clean ez_setup.pyc build-stamp

	rm pyrrd/*.pyc
	rm pyrrd/util/*.pyc
	rm CHECK_THIS_BEFORE_UPLOAD.txt

install: build
	dh_testdir
	dh_testroot
	dh_clean -k 

	python setup.py install --single-version-externally-managed --root=$(CURDIR)/debian/python-pyrrd
	- PYTHONPATH=build/lib/ python test/test_all.py


# Build architecture-dependent files here.
binary-arch: build install

# Build architecture-independent files here.
binary-indep: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs docs/HISTORY.txt
	dh_installdocs README docs/*
	dh_installexamples examples/* -Xpng
	dh_python2
	dh_compress -X.py
	dh_fixperms
	dh_gencontrol
	dh_installdeb
	dh_md5sums
	dh_builddeb

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