# build tools:
CC = gcc
AR = ar
RANLIB = ranlib

ARFLAGS = cru
CFLAGS = -I. -Wall -Wwrite-strings
CPPFLAGS =
ifeq ($(WIN32),1)
#just in case
CFLAGS+= -m32
endif
ifeq ($(WIN64),1)
#just in case
CFLAGS+= -m64
endif
ifeq ($(DEBUG),1)
CFLAGS+= -g -ggdb
else
CPPFLAGS+= -DNDEBUG
CFLAGS+= -O2
CFLAGS+= -ffast-math
endif

SPEECH_LIB = libspeech.a

OBJECTS = ascii.o \
	darray.o \
	def_pars.o \
	elements.o \
	english.o \
	getarg.o \
	holmes.o \
	nsynth.o \
	phones.o \
	phtoelm.o \
	say.o \
	saynum.o \
	text.o \
	trie.o


.PHONY: clean

all: $(SPEECH_LIB)

$(SPEECH_LIB): $(OBJECTS)
	$(AR) $(ARFLAGS) $(SPEECH_LIB) $(OBJECTS)
	$(RANLIB) $(SPEECH_LIB)

clean:
	rm -f *.o
	rm -f *.a

%.o : %.c
	$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
