#!/usr/bin/make -f

# query for the architecture triplet we build for
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

# output every command that modifies files on the build system.
#export DH_VERBOSE = 1
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/architecture.mk
include /usr/share/dpkg/buildflags.mk
DIR = $(shell pwd)/debian/tcl-yajltcl
TCLVERSIONS = 8.6 9.0

%:
	dh $@

override_dh_gencontrol:
	tcltk-depends
	dh_gencontrol

override_dh_auto_configure:
	autoupdate
	for v in $(TCLVERSIONS) ; do \
		dh_auto_configure -B$(CURDIR)/debian/$$v --				\
				     --with-tcl=/usr/lib/tcl$$v	--prefix=/usr		\
				     --libdir=/usr/lib/tcltk/$(DEB_HOST_MULTIARCH) 	\
				     --libexecdir=/usr/lib/tcltk/$(DEB_HOST_MULTIARCH) ; \
	done

override_dh_auto_install:
	for v in $(TCLVERSIONS) ; do \
	    dh_auto_install -B$(CURDIR)/debian/$$v ; \
	done
	find $(DIR) -depth -type d -empty -delete

.PHONY: override_dh_auto_configure override_dh_auto_install
