#!/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.
#
# Modified to make a template file for a multi-binary package with separated
# build-arch and build-indep targets  by Bill Allombert 2001

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

# This has to be exported to make some magic below work.
export DH_OPTIONS

PYTHON2_VERSION:=$(shell python2 2>&1 --version | awk '{split($$2,v,"."); printf("%d.%d",v[1],v[2]);}')

override_dh_auto_install:
	dh_auto_install -- PYTHON=python2
	mv debian/tmp/usr/bin/otestpoint-discover debian/tmp/usr/bin/otestpoint-discover-$(PYTHON2_VERSION)
	mv debian/tmp/usr/bin/otestpoint-dump debian/tmp/usr/bin/otestpoint-dump-$(PYTHON2_VERSION)
	mv debian/tmp/usr/bin/otestpoint-filter debian/tmp/usr/bin/otestpoint-filter-$(PYTHON2_VERSION)
	mv debian/tmp/usr/bin/otestpoint-print debian/tmp/usr/bin/otestpoint-print-$(PYTHON2_VERSION)
	cd debian/tmp/usr/bin; ln -s otestpoint-discover-$(PYTHON2_VERSION) otestpoint-discover-2
	cd debian/tmp/usr/bin; ln -s otestpoint-dump-$(PYTHON2_VERSION) otestpoint-dump-2
	cd debian/tmp/usr/bin; ln -s otestpoint-filter-$(PYTHON2_VERSION) otestpoint-filter-2
	cd debian/tmp/usr/bin; ln -s otestpoint-print-$(PYTHON2_VERSION) otestpoint-print-2
	cd debian/tmp/usr/bin; ln -s otestpoint-discover-2 otestpoint-discover
	cd debian/tmp/usr/bin; ln -s otestpoint-dump-2 otestpoint-dump
	cd debian/tmp/usr/bin; ln -s otestpoint-filter-2 otestpoint-filter
	cd debian/tmp/usr/bin; ln -s otestpoint-print-2 otestpoint-print

%:
	dh $@  --with autotools-dev --with python2
