#!/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
major=1.0.0
unittmp=`ls ./unittests/*.py`

%:
	dh  $@ --with python2

override_dh_auto_build:
	python setup.py build --build-lib ./build/lib/

override_dh_auto_clean:
	python setup.py clean -a
	-rm -rf ./build
	find . -name \*.pyc -exec rm {} \;
	find . -name \*.cache -exec rm {} \;

override_dh_installchangelogs:
	dh_installchangelogs docs/history/history.rest

override_dh_auto_test:
	export PYTHONPATH=$${PYTHONPATH}:build/lib/ ; for test in ${unittmp}; do python $${test}; done

get-orig-source:
	mkdir ../repack
	uscan --force-download --destdir ../repack --download-current-version
	( \
		cd ../repack ;\
		unzip pygccxml-*.zip ;\
		GZIP="--best" tar -czf pygccxml_$(major).orig.tar.gz pygccxml-$(major) ;\
		mv pygccxml_$(major).orig.tar.gz .. ;\
	)
	rm -rf ../repack
