1########################################################-*-mode:Makefile-*-
2##                                                                       ##
3##                  Language Technologies Institute                      ##
4##                     Carnegie Mellon University                        ##
5##                      Copyright (c) 2000-2015                          ##
6##                        All Rights Reserved.                           ##
7##                                                                       ##
8##  Permission is hereby granted, free of charge, to use and distribute  ##
9##  this software and its documentation without restriction, including   ##
10##  without limitation the rights to use, copy, modify, merge, publish,  ##
11##  distribute, sublicense, and/or sell copies of this work, and to      ##
12##  permit persons to whom this work is furnished to do so, subject to   ##
13##  the following conditions:                                            ##
14##   1. The code must retain the above copyright notice, this list of    ##
15##      conditions and the following disclaimer.                         ##
16##   2. Any modifications must be clearly marked as such.                ##
17##   3. Original authors' names are not deleted.                         ##
18##   4. The authors' names are not used to endorse or promote products   ##
19##      derived from this software without specific prior written        ##
20##      permission.                                                      ##
21##                                                                       ##
22##  CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK         ##
23##  DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING      ##
24##  ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT   ##
25##  SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE      ##
26##  FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES    ##
27##  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN   ##
28##  AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,          ##
29##  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF       ##
30##  THIS SOFTWARE.                                                       ##
31##                                                                       ##
32###########################################################################
33FLITEDIR=__FLITEDIR__
34TOP=$(FLITEDIR)
35DIRNAME=flite
36VOICENAME=__VOICENAME__
37VOICETYPE=__VOICETYPE__
38
39FLITE_LANG=__FLITELANG__
40FLITE_LEX=__FLITELEX__
41LOCAL_INCLUDES = -I$(TOP)/lang/$(FLITE_LANG) -I$(TOP)/lang/$(FLITE_LEX)
42LOCAL_LANGLEX_LIBS = -lflite_$(FLITE_LANG) -lflite_$(FLITE_LEX)
43LOCAL_LIBS = -L . -l$(VOICENAME)
44H =
45
46CSRCS = $(VOICENAME).c
47
48VOICES=$(VOICENAME)
49
50ifeq ($(VOICETYPE),diphone)
51## Diphone
52CSRCS +=$(VOICENAME)_$(VOICETYPE).c
53CSRCS +=$(VOICENAME)_lpc.c
54CSRCS +=$(VOICENAME)_res.c
55CSRCS +=$(VOICENAME)_residx.c
56else
57ifeq ($(VOICETYPE),cg)
58## Clustergen
59CSRCS += $(VOICENAME)_cg.c
60CSRCS += $(VOICENAME)_cg_phonestate.c
61# Identify which .c param files are used single or multi-rfs
62include paramfiles.mak
63CSRCS += $(shell ls $(VOICENAME)_cg_*_f0_trees.c)
64CSRCS += $(shell ls $(VOICENAME)_cg_*_mcep_trees.c)
65CSRCS += $(shell ls $(VOICENAME)_cg_*_params.c)
66CSRCS += $(shell ls $(VOICENAME)_cg_*_durmodel.c)
67ifeq ($(SPAMF0),true)
68CSRCS += $(VOICENAME)_spamf0_phrase.c $(VOICENAME)_spamf0_accent.c $(VOICENAME)_spamf0_accent_params.c
69endif
70MCEPOBJS =
71LPCOBJS =
72else
73## Clunits/ldom
74CSRCS += $(VOICENAME)_clunits.c
75CSRCS += $(VOICENAME)_cltrees.c $(VOICENAME)_lpc.c $(VOICENAME)_mcep.c
76CSRCS += $(VOICENAME)_cl_durmodel.c
77MCEPSRCS = $(shell if [ -f $(VOICENAME)_mcep_000.c ]; then ls $(VOICENAME)_mcep_*.c ; fi)
78MCEPOBJS = $(MCEPSRCS:.c=.o)
79LPCSRCS= $(shell if [ -f $(VOICENAME)_lpc_000.c ] ; then ls $(VOICENAME)_lpc_*.c; fi )
80LPCOBJS = $(LPCSRCS:.c=.o)
81RESSRCS= $(shell if [ -f $(VOICENAME)_res_000.c ] ; then ls $(VOICENAME)_res_*.c; fi )
82RESOBJS = $(RESSRCS:.c=.o)
83endif
84endif
85
86OBJS = $(CSRCS:.c=.o) $(LPCOBJS) $(MCEPOBJS) $(RESOBJS)
87
88ALL = lib$(VOICENAME).a flite_$(VOICENAME)
89
90include $(FLITEDIR)/config/common_make_rules
91
92LIBDIR=.
93ifdef SHFLAGS
94ALL += lib$(VOICENAME).so
95endif
96
97$(VOICENAME)_lpc.o: $(VOICENAME)_lpc.c
98	$(CC) $(CFLAGS) -I. -I$(FLITEDIR)/include -c -o $@ $<
99
100$(VOICENAME)_mcep.o: $(VOICENAME)_mcep.c
101	$(CC) $(CFLAGS) -I. -I$(FLITEDIR)/include -c -o $@ $<
102
103flite_$(VOICENAME): flite_main.o flite_voice_list.o flite_lang_list.o $(FLITELIBS) lib$(VOICENAME).a
104	$(CC) $(CFLAGS) -o $@ flite_main.o flite_voice_list.o flite_lang_list.o $(LOCAL_LIBS)  $(LOCAL_LANGLEX_LIBS) $(FLITELIBFLAGS) $(LDFLAGS)
105
106lib$(VOICENAME).a: $(OBJS)
107	@ $(AR) cruv lib$(VOICENAME).a $(OBJS)
108	@ $(RANLIB) lib$(VOICENAME).a
109	@ touch .build_lib
110
111flite_voice_list.c:
112	$(TOP)/tools/make_voice_list $(VOICES)
113
114flite_lang_list.c:
115	$(TOP)/tools/make_lang_list $(FLITE_LANG) $(FLITE_LEX)
116
117# Dump cg voice as single file
118voicedump : flite_$(VOICENAME)
119	./flite_$(VOICENAME) -voicedump $(VOICENAME).flitevox
120# Add build date to the flitevox file
121	$(FLITEDIR)/bin/flitevox_info -set build_date -val "`date`" -voice $(VOICENAME).flitevox
122
123# Run front end tests
124flitecheck:
125	$(FLITEDIR)/bin/run_flitecheck $(VOICENAME).flitevox
126
127