1# remove -fno-exceptions if it causes problems with stdio library on some platforms (ARM) 2 3DATADIR=/usr/local/share/espeak/espeak-data 4 5PREFIX?=/usr 6BINDIR=$(PREFIX)/bin 7INCDIR=$(PREFIX)/include/espeak 8LIBDIR=$(PREFIX)/lib 9 10RELEASE = 1.48 11BIN_NAME = speak 12BIN2_NAME = espeak 13LIB_NAME = libespeak.so 14STATIC_LIB_NAME = libespeak.a 15LIB_VERSION = 1 16LIBTAG = $(LIB_VERSION).$(RELEASE) 17 18# Use SONAME_OPT=-Wl,h, on Solaris 19SONAME_OPT=-Wl,-soname, 20 21# Use EXTRA_LIBS=-lm on Solaris 22EXTRA_LIBS = 23 24INSTALL = install 25LN_SF = /bin/ln -sf 26MKDIR = mkdir -p 27 28# 'runtime' uses pulseaudio if it is running, else uses portaudio 29#AUDIO = runtime 30AUDIO?= portaudio 31#AUDIO = portaudio0 32#AUDIO = portaudio2 33#AUDIO = pulseaudio 34#AUDIO = sada 35 36ifeq ($(AUDIO),runtime) 37WAVE=wave.cpp wave_pulse.cpp 38LIB_AUDIO=-L$(LOCALBASE)/lib -lpulse -lpulse-simple -lportaudio 39USE_AUDIO=-DUSE_PULSEAUDIO -DUSE_PORTAUDIO 40else 41ifeq ($(AUDIO),pulseaudio) 42WAVE=wave_pulse.cpp 43LIB_AUDIO=-L$(LOCALBASE)/lib -lpulse 44USE_AUDIO=-DUSE_PULSEAUDIO 45else 46ifeq ($(AUDIO),portaudio) 47WAVE=wave.cpp 48LIB_AUDIO=-L$(LOCALBASE)/lib -lportaudio 49USE_AUDIO=-DUSE_PORTAUDIO 50else 51ifeq ($(AUDIO),portaudio0) 52WAVE=wave.cpp 53LIB_AUDIO=/usr/lib/libportaudio.so.0 54USE_AUDIO=-DUSE_PORTAUDIO 55else 56ifeq ($(AUDIO),portaudio2) 57WAVE=wave.cpp 58LIB_AUDIO=/usr/lib/libportaudio.so.2 59USE_AUDIO=-DUSE_PORTAUDIO 60else 61ifeq ($(AUDIO),sada) 62WAVE=wave_sada.cpp 63USE_AUDIO=-DUSE_SADA 64else 65WAVE=wave.cpp 66endif 67endif 68endif 69endif 70endif 71endif 72 73speak_SOURCES = speak.cpp compiledict.cpp dictionary.cpp intonation.cpp \ 74 readclause.cpp setlengths.cpp numbers.cpp synth_mbrola.cpp \ 75 synthdata.cpp synthesize.cpp translate.cpp mbrowrap.cpp \ 76 tr_languages.cpp voices.cpp wavegen.cpp phonemelist.cpp klatt.cpp sonic.cpp 77 78libespeak_SOURCES = speak_lib.cpp compiledict.cpp dictionary.cpp intonation.cpp \ 79 readclause.cpp setlengths.cpp numbers.cpp synth_mbrola.cpp \ 80 synthdata.cpp synthesize.cpp translate.cpp mbrowrap.cpp \ 81 tr_languages.cpp voices.cpp wavegen.cpp phonemelist.cpp \ 82 espeak_command.cpp event.cpp fifo.cpp $(WAVE) debug.cpp klatt.cpp sonic.cpp 83 84SRCS1=$(speak_SOURCES) 85OBJS1=$(patsubst %.cpp,%.o,$(SRCS1)) 86LIBS1=-lstdc++ $(LIB_AUDIO) -lpthread $(EXTRA_LIBS) 87 88SRCS2=$(libespeak_SOURCES) 89OBJS2=$(patsubst %.cpp,x_%.o,$(SRCS2)) 90LIBS2=-lstdc++ $(LIB_AUDIO) -lpthread 91 92SRCS3 = espeak.cpp 93OBJS3=$(patsubst %.cpp,%.o,$(SRCS3)) 94LIBS3=-lstdc++ -L . -lespeak -lpthread 95 96CXXFLAGS?=-O2 97 98 99all: $(BIN_NAME) $(LIB_NAME) $(STATIC_LIB_NAME) $(BIN2_NAME) 100 101.cpp.o: 102 $(CXX) $(CXXFLAGS) $(USE_AUDIO) -D PATH_ESPEAK_DATA=\"$(DATADIR)\" -Wall -pedantic -I. -c -fno-exceptions $< 103 104$(BIN_NAME): $(OBJS1) 105 $(CXX) $(LDFLAGS) -o $@ $(OBJS1) $(LIBS1) 106 107$(BIN2_NAME): $(OBJS3) $(LIB_NAME) 108 $(CXX) $(LDFLAGS) -o $@ $(OBJS3) $(LIBS3) 109 110 111 112x_%.o: %.cpp 113 $(CXX) $(CXXFLAGS) $(USE_AUDIO) -D PATH_ESPEAK_DATA=\"$(DATADIR)\" -Wall -fpic -fvisibility=hidden -pedantic \ 114 -I. -D LIBRARY -c -fno-exceptions $< -o x_$*.o 115 116$(LIB_NAME): $(OBJS2) 117 $(CXX) $(LDFLAGS) -shared $(SONAME_OPT)$(LIB_NAME).$(LIB_VERSION) -o $@ \ 118 $(OBJS2) $(LIBS2) 119 mv $(LIB_NAME) $(LIB_NAME).$(LIBTAG) 120 $(LN_SF) $(LIB_NAME).$(LIBTAG) $(LIB_NAME).$(LIB_VERSION) 121 $(LN_SF) $(LIB_NAME).$(LIB_VERSION) $(LIB_NAME) 122 123$(STATIC_LIB_NAME): $(OBJS2) 124 $(AR) cqs $(STATIC_LIB_NAME) $(OBJS2) 125 126clean: 127 rm -f *.o *.a *~ 128 129distclean: clean 130 rm -f $(BIN_NAME) 131 rm -f $(BIN2_NAME) 132 rm -f $(LIB_NAME)* 133 134install: all 135 # Create directories 136 #rm -rf $(DESTDIR)$(DATADIR) 137 $(MKDIR) $(DESTDIR)$(BINDIR) 138 $(MKDIR) $(DESTDIR)$(LIBDIR) 139 $(MKDIR) $(DESTDIR)$(INCDIR) 140 $(MKDIR) $(DESTDIR)$(DATADIR) 141 # Install espeak executable 142 $(INSTALL) -m 755 $(BIN2_NAME) $(DESTDIR)$(BINDIR) 143 # Install shared library 144 $(INSTALL) -m 755 $(LIB_NAME).$(LIBTAG) $(DESTDIR)$(LIBDIR) 145 # Install static library 146 $(INSTALL) -m 755 $(STATIC_LIB_NAME) $(DESTDIR)$(LIBDIR) 147 $(LN_SF) $(LIB_NAME).$(LIBTAG) $(DESTDIR)$(LIBDIR)/$(LIB_NAME).$(LIB_VERSION) 148 $(LN_SF) $(LIB_NAME).$(LIB_VERSION) $(DESTDIR)$(LIBDIR)/$(LIB_NAME) 149 # Install development headers 150 $(INSTALL) -pm 644 speak_lib.h $(DESTDIR)$(INCDIR) 151 # Install data files 152 cp -pRf ../espeak-data/* $(DESTDIR)$(DATADIR) 153 154