Add GSM HR reference codec that is automatically downloaded from 3gpp.org
[lcr.git] / Makefile.am
1 ##    Makefile.am -- Process this file with automake to produce Makefile.in
2
3 ##    This file is part of linux-call-router
4 ##    Copyright (C) 2007 Joerg Habenicht (j.habenicht@gmx.de)
5 ##    Copyright (C) 2008 Peter Schlaile (peter -at- schlaile.de)
6 ##    Copyright (C) 2008-2012 Andreas Eversberg (andreas@eversberg.eu)
7
8 ##    This program is free software; you can redistribute it and/or
9 ##    modify it under the terms of the GNU General Public License as
10 ##    published by the Free Software Foundation; either
11 ##    version 2 of the License, or (at your option) any later version.
12
13 ##    This program is distributed in the hope that it will be useful,
14 ##    but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ##    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 ##    GNU General Public License for more details.
17
18 ##    You should have received a copy of the GNU General Public License
19 ##    along with this library; see the file COPYING.  If not, write to
20 ##    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 ##    Boston, MA 02110-1301, USA.
22
23 #INSTALLdir = $(DESTDIR)/usr/local/lcr
24
25 pkglogdir=$(localstatedir)/log/@PACKAGE@
26 pkgsysconfdir=$(sysconfdir)/@PACKAGE@
27
28 CONFIGdir=$(pkgsysconfdir)
29 SHAREdir=$(pkgdatadir)
30 LOGdir=$(pkglogdir)
31 EXTENSIONdir=$(localstatedir)/lib/@PACKAGE@/extensions
32
33 #CONFIGdir=$(INSTALLdir)
34 #SHAREdir=$(INSTALLdir)
35 #LOGdir=$(INSTALLdir)
36 #EXTENSIONdir=$(INSTALLdir)/extensions
37
38 astmoddir = $(libdir)/asterisk/modules
39
40 INSTALLATION_DEFINES = \
41  -DCONFIG_DATA="\"$(CONFIGdir)\"" \
42  -DSHARE_DATA="\"$(SHAREdir)\"" \
43  -DLOG_DIR="\"$(LOGdir)\"" \
44  -DEXTENSION_DATA="\"$(EXTENSIONdir)\""
45
46 SUBDIRS = include
47
48 if ENABLE_GSMHR
49 SUBDIRS += libgsmhr
50 endif
51
52 if ENABLE_MISDN
53
54 MISDN_INCLUDE = -DWITH_MISDN -DWITH_CRYPT
55 MISDN_SOURCE = mISDN.cpp fxs.cpp dss1.cpp crypt.cpp
56 MISDN_LIB = -lmisdn
57
58 endif
59
60 SUBDIRS =
61
62 GSM_INCLUDE =
63 GSM_SOURCE =
64 GSM_LIB =
65
66 if ENABLE_GSM
67
68 #if ENABLE_GSMFR
69
70 GSM_INCLUDE += -DWITH_GSMFR
71
72 GSM_LIB += libgsmfr/lib/libgsm.a
73
74 SUBDIRS += libgsmfr
75
76 #endif
77
78 if ENABLE_GSMHR
79
80 GSM_INCLUDE += -DWITH_GSMHR
81
82 GSM_LIB += libgsmhr/libgsmhr.a
83
84 SUBDIRS += libgsmhr
85
86 endif
87
88 if ENABLE_GSMAMR
89
90 GSM_INCLUDE += -DWITH_GSMAMR
91
92 GSM_LIB += -lopencore-amrnb
93
94 endif
95
96 GSM_SOURCE += gsm_audio.c gsm.cpp
97
98 if ENABLE_GSM_BS
99
100 GSM_INCLUDE += -DWITH_GSM_BS
101
102 GSM_SOURCE += gsm_bs.cpp
103
104 endif
105
106 if ENABLE_GSM_MS
107
108 GSM_INCLUDE += -DWITH_GSM_MS
109
110 GSM_SOURCE += gsm_ms.cpp
111
112 endif
113
114 endif
115
116
117 if ENABLE_SS5
118
119 SS5_INCLUDE = -DWITH_SS5
120
121 SS5_SOURCE = ss5.cpp ss5_encode.c ss5_decode.c
122
123 endif
124
125 SIP_LIB =
126
127 if ENABLE_SIP
128
129 # FIXME: remove that
130 #pkgconfigdir = $(libdir)/pkgconfig
131 #pkgconfig_DATA = sofia-sip-ua.pc
132
133 SIP_INCLUDE = -DWITH_SIP $(SOFIA_CFLAGS)
134
135 SIP_SOURCE = sip.cpp
136
137 SIP_LIB += $(SOFIA_LIBS)
138
139 endif
140
141 bin_PROGRAMS = lcradmin gentones genwave
142
143 sbin_PROGRAMS = lcr genrc genextension
144
145 if ENABLE_ASTERISK_CHANNEL_DRIVER
146 noinst_PROGRAMS = chan_lcr.so
147 chan_lcr_so_SOURCES =
148 chan_lcr_so_LDFLAGS = -shared
149 chan_lcr_so_LDADD = chan_lcr.po options.po callerid.po select.po
150
151 # List chan_lcr specific sources for make dist
152 EXTRA_chan_lcr_so_SOURCES = chan_lcr.c chan_lcr.h
153
154
155 chan_lcr.po: chan_lcr.c chan_lcr.h
156         $(CC) $(INCLUDES) $(AST_CFLAGS) $(CPPFLAGS) $(CFLAGS) -D_GNU_SOURCE -fPIC -c $< -o $@
157
158 callerid.po: callerid.c callerid.h
159         $(CC) $(INCLUDES) -D_GNU_SOURCE $(CPPFLAGS) $(CFLAGS) -fPIC -c $< -o $@
160
161 options.po: options.c options.h
162         $(CC) $(INCLUDES) -D_GNU_SOURCE $(CPPFLAGS) $(CFLAGS) -fPIC -c $< -o $@
163
164 select.po: select.c select.h
165         $(CC) $(INCLUDES) -D_GNU_SOURCE $(CPPFLAGS) $(CFLAGS) -fPIC -c $< -o $@
166
167 install-exec-hook: chan_lcr.so
168         $(INSTALL) -d '$(DESTDIR)$(astmoddir)'
169         $(INSTALL) chan_lcr.so '$(DESTDIR)$(astmoddir)'
170
171 uninstall-hook:
172         cd '$(DESTDIR)$(astmoddir)' && rm -f chan_lcr.so
173 endif
174
175 INCLUDES = $(all_includes) $(MISDN_INCLUDE) $(GSM_INCLUDE) $(SS5_INCLUDE) $(SIP_INCLUDE) -Wall $(INSTALLATION_DEFINES)
176
177 lcr_SOURCES = \
178         main.c select.c trace.c options.c tones.c alawulaw.c cause.c interface.c message.c callerid.c socket_server.c \
179         port.cpp vbox.cpp remote.cpp \
180         $(MISDN_SOURCE) $(GSM_SOURCE) $(SS5_SOURCE) $(SIP_SOURCE) \
181         endpoint.cpp endpointapp.cpp \
182         appbridge.cpp apppbx.cpp route.c action.cpp action_efi.cpp action_vbox.cpp extension.c mail.c \
183         join.cpp joinpbx.cpp
184
185 lcr_LDADD = $(LIBCRYPTO) $(MISDN_LIB) -lpthread $(GSM_LIB) $(SIP_LIB)
186
187
188 lcradmin_SOURCES = lcradmin.c cause.c options.c
189 genextension_SOURCES = genext.c options.c extension.c
190
191
192 # List all headers for make dist
193 noinst_HEADERS = \
194         main.h macro.h select.h trace.h options.h tones.h alawulaw.h cause.h interface.h \
195         message.h callerid.h socket_server.h port.h vbox.h endpoint.h endpointapp.h \
196         appbridge.h apppbx.h route.h extension.h join.h joinpbx.h lcrsocket.h
197
198 noinst_HEADERS += myisdn.h mISDN.h dss1.h crypt.h remote.h
199 noinst_HEADERS += ss5.h ss5_encode.h ss5_decode.h
200 noinst_HEADERS += mncc.h gsm.h gsm_audio.h gsm_bs.h gsm_ms.h
201 noinst_HEADERS += ie.cpp sip.h
202
203
204 # Special install function to preserve existing configs.
205 # Optimization with equivalen results are welcome
206 CONFIGFILES = options.conf interface.conf routing.conf directory.list
207 TONEDIRS = tones_american tones_efi tones_german vbox_english vbox_german
208
209 EXTRA_DIST = default debian $(TONEDIRS)
210
211 install-data-hook:
212         @fns='strcpy strncpy strcat strncat sprintf snprintf' ; \
213         files=$$( find $(srcdir) -type f -name "*.c*" \
214           | $(GREP) -v -e chan_lcr.c -e callerid.c ) ; \
215         test -z "$$files" || { for fn in $$fns ; do \
216           $(GREP) -n $$fn $$files ; if test $$? = 0 ; then \
217             ( echo "dont use $$fn, use makro instead." ; exit -1 ) ; \
218           fi ; \
219         done ; }
220         mkdir -p '$(DESTDIR)$(CONFIGdir)'
221         mkdir -p '$(DESTDIR)$(SHAREdir)'
222         mkdir -p '$(DESTDIR)$(LOGdir)'
223         mkdir -p '$(DESTDIR)$(EXTENSIONdir)'
224         @fs='$(CONFIGFILES)' ; for f in $$fs ; do \
225           if test -a "$(DESTDIR)$(CONFIGdir)/$$f" ; then \
226             echo "NOTE: $$f already exists, not changed." ; \
227           else $(INSTALL) -m 644 $(srcdir)/default/$$f "$(DESTDIR)$(CONFIGdir)/" ; fi ; \
228         done
229         @if test -a "$(DESTDIR)$(CONFIGdir)/numbering_int.conf" ; then \
230                 echo "NOTE: numbering_int.conf is obsolete, please use routing." ; fi
231         @if test -a "$(DESTDIR)$(CONFIGdir)/numbering_ext.conf" ; then \
232                 echo "NOTE: numbering_ext.conf is obsolete, please use routing." ; fi
233         @ds='$(TONEDIRS)' ; for d in $$ds ; do \
234           destdir="$(DESTDIR)$(SHAREdir)/$$d" ; \
235           if test -a "$$destdir" ; then \
236             echo "NOTE: $$d already exists, not overwritten." ; \
237           else mkdir -p "$$destdir" ; cp -a $(srcdir)/$$d/* "$$destdir/" ; fi ; \
238         done
239
240
241 # Because distuninstallcheck expects relative filenames, we cannot
242 # replace './' with $(prefix) in _listfiles. Therefore we do it the
243 # other way around to filter out configuration files and tones.
244 distcheck_CONFIGdir = echo $(CONFIGdir) | sed 's|^$(prefix)/|./|'
245 distcheck_SHAREdir  = echo $(SHAREdir)  | sed 's|^$(prefix)/|./|'
246
247 distuninstallcheck_listfiles = find . -type f -print \
248         | $(GREP) -v "$$( $(distcheck_CONFIGdir) )" \
249         | $(GREP) -v "$$( $(distcheck_SHAREdir) )"
250
251
252 clean-generic:
253         rm -f *.po
254
255 # test rule, nothing important
256 #echo:
257 #       -echo $(all_libraries) >&2
258
259 # CAUTION: CRUDE CRUDE HACK !!
260 # This transforms all compiling and linking calls from gcc into g++
261 # This should better be removed and all .c files renamed to .cpp
262 COMPILE=$(CXXCOMPILE)
263 LINK=$(CXXLINK)
264
265