#!/usr/bin/make -f
# Sample debian/rules that uses debhelper. 
# GNU copyright 1997 by Joey Hess.
#
# This version is for a hypothetical package that builds an
# architecture-dependant package, as well as an architecture-independent
# package.

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

PYVERS := $(shell pyversions -r)

include /usr/share/python/python.mk

ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -g
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	INSTALL_PROGRAM += -s
endif

build: build-stamp
build-stamp:
	dh_testdir
	set -e; \
	for py in $(PYVERS); do \
	    $$py setup.py build; done

	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-arch-stamp build-indep-stamp configure-stamp

	-for py in $(PYVERS); do \
	    $$py setup.py clean --all; done
	# Add here commands to clean up after the build process.
	#--build-lib build2.3
	-rm -fr build

	dh_clean

install: DH_OPTIONS=
install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	# Add here commands to install the package into debian/python-biggles.
	set -e; \
	for py in $(PYVERS); do \
	    $$py setup.py install --root=debian/python-pybiggles --no-compile $(py_setup_install_args); \
	done

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir -a
	dh_testroot -a
	dh_installdocs -a -A
	dh_installexamples -A -a examples/*
	dh_installchangelogs -a ChangeLog
	dh_strip -a
	dh_link -a
	dh_compress -a
	dh_fixperms -a
	dh_pysupport -a
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

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

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