#!/usr/bin/make -f
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/makefile.mk

IS_FREMANTLE=$(shell if grep Fremantle /etc/maemo_version &> /dev/null; then echo Y; else echo N; fi)

# Make sure we get properly optimized
DEB_OPT_FLAG_armel:=-O2 -fomit-frame-pointer -pipe -mcpu=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp
DEB_OPT_FLAG_i386:=-O2 -fomit-frame-pointer -pipe -march=i686 -mtune=pentium2
DEB_OPT_FLAG:=$(DEB_OPT_FLAG_$(DEB_HOST_ARCH))

DEB_TAR_SRCDIR:=espeak-1.41.01-source/src
DEB_DESTDIR=$(CURDIR)/debian/tmp
#DEB_MAKE_BUILD_TARGET:=all AUDIO=none
#DEB_MAKE_INSTALL_TARGET=install DESTDIR=$(DEB_DESTDIR) AUDIO=none

# Pulseaudio for Fremantle, portaudio for the rest, deal with harmatan and such later...
ifeq ($(IS_FREMANTLE),Y)
DEB_MAKE_BUILD_TARGET:=all AUDIO=pulseaudio
DEB_MAKE_INSTALL_TARGET=install DESTDIR=$(DEB_DESTDIR) AUDIO=pulseaudio
else
DEB_MAKE_BUILD_TARGET:=all AUDIO=portaudio
DEB_MAKE_INSTALL_TARGET=install DESTDIR=$(DEB_DESTDIR) AUDIO=portaudio
endif

include /usr/share/cdbs/1/rules/tarball.mk

configure/espeak::
	cp build-tree/$(DEB_TAR_SRCDIR)/portaudio19.h build-tree/$(DEB_TAR_SRCDIR)/portaudio.h
