#!/usr/bin/make -f

PKG_FILES = $(wildcard ocroscript/*.pkg)
AUTOGENERATED_FILES = $(PKG_FILES:.pkg=.cc)

export CFLAGS = $(shell dpkg-buildflags --get CFLAGS)
export CXXFLAGS = $(shell dpkg-buildflags --get CXXFLAGS)
export CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS)
export LDLAGS = $(shell dpkg-buildflags --get LDFLAGS)

%:
	dh $@

override_dh_auto_configure:
	AUTOMAKE=automake-1.9 ACLOCAL=aclocal-1.9 autoreconf -ivf
	./configure --prefix=/usr --with-iulib=/usr --without-fst --without-leptonica --with-tesseract=/usr

override_dh_auto_clean:
	AUTOMAKE=automake-1.9 ACLOCAL=aclocal-1.9 autoreconf -ivf
	printf '#!/bin/sh\n' > config.status # we don't want configure to be run now
	dh_auto_clean
	rm -f $(AUTOGENERATED_FILES)
