############################################################################
#
#   Copyright (C) 1996 Alistair Conkie
#
#   You may distribute under the terms of the GNU General Public
#   Licence as specified in the README file.
#
#
############################################################################
#
#
############################################################################
# Select the appropriate Makefile options for your system. then type make.
############################################################################
# Sun users
# CC = gcc
# CFLAGS = -g -Wall -pedantic
# LIBS = -lm
############################################################################
# FreeBSD users
# CC = gcc
# CFLAGS = -O2 -Wall -pedantic
# LIBS = -lm
############################################################################
# Linux users
CC = gcc
CFLAGS = -g -Wall -pedantic
LIBS = -lm -lgdbm
############################################################################


SRC = go.c t2s.c space.c tags.c grammar.c \
	transcribe.c conv1.c conv2.c durpros.c prosody.c \
	syllab.c utils.c buffer.c \
	fw.c broad_cats.c durs.c load_diphs.c spnio.c \
	durations.c pitch.c audio.c \
	phon_rules.c edin2sampa.c
#coeffs.c excitation.c durations.c pitch.c audio.c ulaw.c \

OBJS = go.o t2s.o space.o tags.o grammar.o \
	transcribe.o conv1.o conv2.o durpros.o prosody.o \
	syllab.o utils.o buffer.o \
	fw.o broad_cats.o durs.o load_diphs.o spnio.o \
	durations.o pitch.o audio.o \
	phon_rules.o edin2sampa.o
#coeffs.o excitation.o durations.o pitch.o audio.o ulaw.o \

RULE_SRC = rule_engine.c regerror.c regexp.c regsub.c read_rules.c

RULE_OBJS = rule_engine.o regerror.o regexp.o regsub.o read_rules.o


NRL_SRC = interface.c english.c nrl_edin.c phoneme.c saynum.c spellwor.c

NRL_OBJS = interface.o english.o nrl_edin.o phoneme.o saynum.o spellwor.o


TEST_SRC = test_diphones.c

TEST_OBJS = test_diphones.o

MAIN_SRC = main.c

MAIN = main.o

HEADERS = regexp.h regmagic.h rule_engine.h t2s.h prototypes.h

all: freephone

freephone: $(OBJS) $(NRL_OBJS) $(RULE_OBJS) $(MAIN)
	$(CC) $(CFLAGS) -o $@ $(OBJS) $(NRL_OBJS) $(RULE_OBJS) $(MAIN) $(LIBS)

# /home/awb/src/malloc/libmalloc.a

clean:
	rm -f freephone lpc_synth *.o core gmon.out

distribution:
	/bin/rm -r ../distribution
	mkdir ../distribution
	mkdir ../distribution/src
	mkdir ../distribution/lib
	cp -r ../dist_doc ../distribution/doc
	cp ../dictionaries/Makefile ../distribution/lib
	cp ../dictionaries/dbm_prog.c ../distribution/lib
	cp ../dictionaries/read_ox_dict ../distribution/lib
	cp ../dictionaries/text710.* ../distribution/lib
	# cp ../diphs_donovan/donovan.idx ../distribution/lib
	# cp ../diphs_donovan/donovan.dat ../distribution/lib
	cp $(SRC) $(RULE_SRC) $(NRL_SRC) $(MAIN_SRC) $(HEADERS) Makefile ../distribution/src
	# cp context_rules ../distribution/src
	cp ../ACKNOWLEDGEMENTS ../README ../INSTALLATION ../Copying ../distribution

# dependencies

$(OBJS) : t2s.h
$(TEST_OBJS) : t2s.h
$(MAIN) : t2s.h
$(RULE_OBJS) : regexp.h regmagic.h
rule-engine.c : rule_engine.h
