# Object files not needed that interfere with DLL making
# ------------------------------------------------------
#
# All objects in ./speech_tools/stats/wagon/
#
# ./speech_tools/grammar/lattice.o
# ./speech_tools/grammar/lattice_io.o
#
# All objects under the subdirs of ./speech_tools/asr/decoder *but*
# ./speech_tools/asr/decoder/EST_viterbi.o *is* needed.
#
# You'll probably get multiple definition warnings, but ILINK seems to
# link fine anyway.
#
# Notes
# -----
#
# This makefile is to be used in ./festival/src/lib
#
# Later, if you need to add further modules to libFestival.a, rename
# BIGlibFestival.a to libFestival.a BEFORE adding them, as libFestival.a
# is remade to link executables with the DLL and will not contain any more
# code.  The one with the code is renamed to BIGlibFestival.a.
#
# Furthermore, be sure you do not link programs with libestools.a and
# libeststring.a as those are now included in festival.dll.  Only link with
# the created libFestival.a.
#
TOP=../..

SHELL=cmd.exe

all: festival.dll

BIGlibFestival.a:
	ren libFestival.a BIGlibFestival.a

festival.def : BIGlibFestival.a $(TOP)/../speech_tools/lib/libeststring.a $(TOP)/../speech_tools/lib/libestools.a
	echo LIBRARY $* INITINSTANCE TERMINSTANCE > $@
	echo DESCRIPTION ' $^' >> $@
	echo PROTMODE >> $@
	echo DATA MULTIPLE NONSHARED LOADONCALL >> $@
	echo EXPORTS >> $@
	emxexp $^ >> $@

%.lib : %.a
	rem makes .LIB file for OMF linking
	emxomf $^

festival.dll: festival.def BIGlibFestival.lib $(TOP)/../speech_tools/lib/libeststring.lib $(TOP)/../speech_tools/lib/libestools.lib
	gcc -Zdll -Zmt -Zcrtdll -Zomf -s -O3 $^ -o $@ -los2me -lreadline -ltermcap -lsocket -lstdcpp
	rem to link with further A.OUT stuff
	emximp -o libFestival.a $<
	rem to link with further OMF stuff
	emximp -o libFestival.lib $<
