forked from dOpensource/app_swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.in
155 lines (125 loc) · 4.57 KB
/
Makefile.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# app_swift -- A Cepstral Swift TTS engine interface
#
# Copyright (C) 2006 - 2011, Darren Sessions
# Portions Copyright (C) 2013 - 2016 Jeremy Kister
#
# Darren Sessions <[email protected]>
#
# http://www.twitter.com/darrensessions
# http://www.linkedin.com/in/dsessions
#
# This program is free software, distributed under the
# terms of the GNU General Public License Version 2. See
# the LICENSE file at the top of the source tree for more
# information.
### BELOW MADE BY CONFIGURE ###
CC=%%CC%%
SWIFT_DIR=%%SWIFT_DIR%%
SWIFT_VER=%%SWIFT_VER%%
SYS_LIB_DIR=%%LIB_DIR%%
SYS_INC_DIR=%%INC_DIR%%
VAR_LIB_DIR=%%VAR_DIR%%
SYS_CNF_DIR=%%CNF_DIR%%
AST_FULL_VER=%%AST_FULL_VER%%
AST_MAJOR_VER=%%AST_MAJOR_VER%%
SOLINK=%%SOLINK%%
### END CONFIGURE ###
NAME=app_swift
CONF=swift.conf
AST_CFG_DIR=$(SYS_CNF_DIR)/asterisk
AST_VAR_DIR=$(VAR_LIB_DIR)/asterisk
AST_MOD_DIR=$(SYS_LIB_DIR)/asterisk/modules
AST_INC_DIR=$(SYS_INC_DIR)/asterisk
CFLAGS=-I$(SWIFT_DIR)/include -I$(SYS_INC_DIR) -g -Wall -fPIC
LDFLAGS=-L$(SWIFT_DIR)/lib -L$(SYS_LIB_DIR) -lswift \
$(patsubst $(SWIFT_DIR)/lib/lib%.so,-l%,$(wildcard $(SWIFT_DIR)/lib/libcep*.so))
CFLAGS+=-D_SWIFT_VER_$(SWIFT_VER)
AST_INC_CHECK=$(shell if ! [ -f $(AST_INC_DIR)/channel.h ]; then echo "ast_inc_fail"; fi)
PRE = built
BUILD = built/$(NAME).o built/$(NAME).so built/$(NAME)-en_US.xml built/$(CONF)
CLEAN = $(BUILD) Makefile
ifeq ($(AST_MAJOR_VER),)
AST_VER_CHECK=ast_ver_fail
else
AST_VER_CHECK=
CFLAGS+=-D_AST_VER_$(AST_MAJOR_VER)
CFLAGS+=-D_AST_MAJ_VER=$(AST_MAJOR_VER)
endif
all: banner $(AST_INC_CHECK) $(AST_VER_CHECK) built $(BUILD) made-msg
built:
-mkdir built
built/$(CONF) : $(PRE) $(CONF).in
cp $(CONF).in built/$(CONF)
built/$(NAME)-en_US.xml : $(PRE) $(NAME).c
-echo '<?xml version="1.0" encoding="UTF-8"?>' > $@
-echo '<!DOCTYPE docs SYSTEM "appdocsxml.dtd">' >> $@
-echo '<docs xmlns:xi="http://www.w3.org/2001/XInclude">' >> $@
cat $(NAME).c | awk '/\/\*\*\* DOCUMENTATION/ {p=1; next} \
/\*\*\*\// {if (p) exit} \
{if (p) print}' \
>> $@
-echo '</docs>' >> $@
built/$(NAME).so : built/$(NAME).o
$(CC) $(SOLINK) -o $@ $< $(LDFLAGS)
built/$(NAME).o : $(NAME).c
$(CC) $(CFLAGS) -c -o $@ $<
banner:
@echo ""
@echo ""
@echo " _ ___ "
@echo " (_) / __) _ "
@echo " _____ ____ ____ ___ _ _ _ _ _| |__ _| |_ "
@echo " (____ | _ \| _ \ /___) | | | (_ __|_ _) "
@echo " / ___ | |_| | |_| | ____ |___ | | | | | | | | |_ "
@echo " \_____| __/| __/ (____) |___/ \___/|_| |_| \__) "
@echo " |_| |_| "
@echo ""
made-msg:
@echo ""
@echo " ********************************************************"
@echo " * Run 'make install' to install the app_swift module. *"
@echo " ********************************************************"
@echo ""
ast_ver_fail:
@echo " An unsupported version of Asterisk has been detected. $(AST_FULL_VER)"
@echo ""
@exit 1
ast_inc_fail:
@echo " Could not locate Asterisk include files."
@echo ""
@echo " Retry with './configure --includedir=/include/directory'"
@echo ""
@exit 1
clean:
-rm -f $(BUILD) Makefile
install: all
install -m 755 built/$(NAME).so $(AST_MOD_DIR)
@if [ ! -f $(AST_CFG_DIR)/$(CONF) ] ; then \
echo "installing config file." ; \
install -m 644 built/$(CONF) $(AST_CFG_DIR) ; \
fi
@if [ -d $(AST_VAR_DIR)/documentation/thirdparty ] ; then \
echo "installing documentation." ; \
install -m 644 built/app_swift-en_US.xml $(AST_VAR_DIR)/documentation/thirdparty ; \
echo "" ; \
echo " ********************************************************" ; \
echo " * Documentation has been installed but Asterisk must *" ; \
echo " * be restarted to use 'core show application Swift'. *" ; \
echo " * A restart is not otherwise necessary. *" ; \
echo " ********************************************************" ; \
else \
echo "XML docs not found - no problem, won't install ours." ; \
fi
@if ! grep 'swift' /etc/ld.so.conf 2>&1 >/dev/null ; then \
echo -e "\n$(SWIFT_DIR)/lib\n" >> /etc/ld.so.conf ; \
ldconfig ; \
fi
@ln -sf $(SWIFT_DIR)/include/* $(SYS_INC_DIR)
@echo ""
@echo " ********************************************************"
@echo " * Or, run 'make reload' load app_swift into Asterisk. *"
@echo " ********************************************************"
@echo ""
reload:
asterisk -rx "module unload $(NAME)"
asterisk -rx "module load $(NAME)"