#!/usr/bin/make -f
# -*- makefile -*-

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

# This is a bit hacky.
override_dh_auto_configure:
	NOCONFIGURE=y ./autogen.sh
	dh_auto_configure -- --enable-maintainer-mode

override_dh_auto_install:
	for py in $(shell pyversions -r); do \
		PYTHON=$$py dh_auto_configure -Dpython/; \
		dh_auto_build -Dpython/; \
		dh_auto_install -Dpython/; \
		dh_auto_clean -Dpython/; \
	done
	dh_auto_install

override_dh_auto_clean:
	dh_auto_clean
	find . \( -name "*.o" -o -name "*.lo" -o -name "*.la" \) -delete
	find . \( -name "*.in" -a -not -name "osmgpsmap.pc.in" \) -delete
	find . \( -name ".deps" -o -name ".libs" -o -name "autom4te.cache" \) -type d | xargs rm -rf

	find . -name "Makefile" -delete
	find . \( -name "config.guess" -o -name "config.h" -o -name "config.log" \
		-o -name "config.sub" -o -name "config.status" -o -name "configure" \) -delete
	find . \( -name "install-sh" -o -name "libtool" -o -name "ltmain.sh" \
		-o -name "missing" -o -name "INSTALL" \
		-o -name "aclocal.m4" -o -name "depcomp" \) -delete

	dh_clean compile osmgpsmap.pc python/osmgpsmap.c \
		src/openstreetmap-gps-map stamp-h1

%:
	dh $@
