1 ## Makefile.am -- Process this file with automake to produce Makefile.in
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)
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.
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.
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.
23 #INSTALLdir = $(DESTDIR)/usr/local/lcr
25 pkglogdir=$(localstatedir)/log/@PACKAGE@
26 pkgsysconfdir=$(sysconfdir)/@PACKAGE@
28 CONFIGdir=$(pkgsysconfdir)
29 SHAREdir=$(pkgdatadir)
31 EXTENSIONdir=$(localstatedir)/lib/@PACKAGE@/extensions
33 #CONFIGdir=$(INSTALLdir)
34 #SHAREdir=$(INSTALLdir)
36 #EXTENSIONdir=$(INSTALLdir)/extensions
38 astmoddir = $(libdir)/asterisk/modules
40 INSTALLATION_DEFINES = \
41 -DCONFIG_DATA="\"$(CONFIGdir)\"" \
42 -DSHARE_DATA="\"$(SHAREdir)\"" \
43 -DLOG_DIR="\"$(LOGdir)\"" \
44 -DEXTENSION_DATA="\"$(EXTENSIONdir)\""
50 MISDN_INCLUDE = -DWITH_MISDN -DWITH_CRYPT
51 MISDN_SOURCE = mISDN.cpp fxs.cpp dss1.cpp crypt.cpp
64 GSM_INCLUDE += -DWITH_GSMFR
66 GSM_LIB += libgsmfr/lib/libgsm.a
74 GSM_INCLUDE += -DWITH_GSMHR
76 GSM_LIB += libgsmhr/libgsmhr.la
84 GSM_INCLUDE += -DWITH_GSMAMR
86 GSM_LIB += -lopencore-amrnb
90 GSM_SOURCE += gsm_audio.c gsm.cpp
94 GSM_INCLUDE += -DWITH_GSM_BS
96 GSM_SOURCE += gsm_bs.cpp
102 GSM_INCLUDE += -DWITH_GSM_MS
104 GSM_SOURCE += gsm_ms.cpp
113 SS5_INCLUDE = -DWITH_SS5
115 SS5_SOURCE = ss5.cpp ss5_encode.c ss5_decode.c
124 #pkgconfigdir = $(libdir)/pkgconfig
125 #pkgconfig_DATA = sofia-sip-ua.pc
127 SIP_INCLUDE = -DWITH_SIP $(SOFIA_CFLAGS)
131 SIP_LIB += $(SOFIA_LIBS)
139 VOOTP_INCLUDE = -DWITH_VOOTP $(VOOTP_CFLAGS)
143 VOOTP_LIB += $(VOOTP_LIBS)
147 bin_PROGRAMS = lcradmin gentones genwave
149 sbin_PROGRAMS = lcr genrc genextension
151 if ENABLE_ASTERISK_CHANNEL_DRIVER
152 noinst_PROGRAMS = chan_lcr.so
153 chan_lcr_so_SOURCES =
154 chan_lcr_so_LDFLAGS = --shared
155 chan_lcr_so_LDADD = chan_lcr.po options.po callerid.po select.po
157 # List chan_lcr specific sources for make dist
158 EXTRA_chan_lcr_so_SOURCES = chan_lcr.c chan_lcr.h
161 chan_lcr.po: chan_lcr.c chan_lcr.h
162 $(CC) $(AM_CPPFLAGS) $(AST_CFLAGS) $(CPPFLAGS) $(CFLAGS) -D_GNU_SOURCE -fPIC -c $< -o $@
164 callerid.po: callerid.c callerid.h
165 $(CC) $(AM_CPPFLAGS) -D_GNU_SOURCE $(CPPFLAGS) $(CFLAGS) -fPIC -c $< -o $@
167 options.po: options.c options.h
168 $(CC) $(AM_CPPFLAGS) -D_GNU_SOURCE $(CPPFLAGS) $(CFLAGS) -fPIC -c $< -o $@
170 select.po: select.c select.h
171 $(CC) $(AM_CPPFLAGS) -D_GNU_SOURCE $(CPPFLAGS) $(CFLAGS) -fPIC -c $< -o $@
173 install-exec-hook: chan_lcr.so
174 $(INSTALL) -d '$(DESTDIR)$(astmoddir)'
175 $(INSTALL) chan_lcr.so '$(DESTDIR)$(astmoddir)'
178 cd '$(DESTDIR)$(astmoddir)' && rm -f chan_lcr.so
181 AM_CPPFLAGS = $(all_includes) $(MISDN_INCLUDE) $(GSM_INCLUDE) $(SS5_INCLUDE) $(SIP_INCLUDE) $(VOOTP_INCLUDE) -Wall $(INSTALLATION_DEFINES)
184 main.c select.c trace.c options.c tones.c alawulaw.c cause.c interface.c message.c callerid.c socket_server.c \
185 port.cpp vbox.cpp remote.cpp \
186 $(MISDN_SOURCE) $(GSM_SOURCE) $(SS5_SOURCE) $(SIP_SOURCE) $(VOOTP_SOURCE) \
187 endpoint.cpp endpointapp.cpp \
188 appbridge.cpp apppbx.cpp route.c action.cpp action_efi.cpp action_vbox.cpp extension.c mail.c \
189 join.cpp joinpbx.cpp dov.cpp
191 lcr_LDADD = $(LIBCRYPTO) $(MISDN_LIB) -lpthread $(GSM_LIB) $(SIP_LIB) $(VOOTP_LIB)
194 lcradmin_SOURCES = lcradmin.c cause.c options.c
195 lcradmin_LDADD = -lncurses
197 genextension_SOURCES = genext.c options.c extension.c
200 # List all headers for make dist
202 main.h macro.h select.h trace.h options.h tones.h alawulaw.h cause.h interface.h \
203 message.h callerid.h socket_server.h port.h vbox.h endpoint.h endpointapp.h \
204 appbridge.h apppbx.h route.h extension.h join.h joinpbx.h lcrsocket.h
206 noinst_HEADERS += myisdn.h mISDN.h dss1.h crypt.h remote.h fxs.h
207 noinst_HEADERS += ss5.h ss5_encode.h ss5_decode.h
208 noinst_HEADERS += mncc.h gsm.h gsm_audio.h gsm_bs.h gsm_ms.h
209 noinst_HEADERS += ie.cpp sip.h
212 # Special install function to preserve existing configs.
213 # Optimization with equivalen results are welcome
214 CONFIGFILES = options.conf interface.conf routing.conf directory.list
215 TONEDIRS = tones_american tones_efi tones_german vbox_english vbox_german
217 EXTRA_DIST = default debian $(TONEDIRS)
220 @fns='strcpy strncpy strcat strncat sprintf snprintf' ; \
221 files=$$( find $(srcdir) -type f -name "*.c*" \
222 | $(GREP) -v -e chan_lcr.c -e callerid.c ) ; \
223 test -z "$$files" || { for fn in $$fns ; do \
224 $(GREP) -n $$fn $$files ; if test $$? = 0 ; then \
225 ( echo "dont use $$fn, use makro instead." ; exit -1 ) ; \
228 mkdir -p '$(DESTDIR)$(CONFIGdir)'
229 mkdir -p '$(DESTDIR)$(SHAREdir)'
230 mkdir -p '$(DESTDIR)$(LOGdir)'
231 mkdir -p '$(DESTDIR)$(EXTENSIONdir)'
232 @fs='$(CONFIGFILES)' ; for f in $$fs ; do \
233 if test -a "$(DESTDIR)$(CONFIGdir)/$$f" ; then \
234 echo "NOTE: $$f already exists, not changed." ; \
235 else $(INSTALL) -m 644 $(srcdir)/default/$$f "$(DESTDIR)$(CONFIGdir)/" ; fi ; \
237 @if test -a "$(DESTDIR)$(CONFIGdir)/numbering_int.conf" ; then \
238 echo "NOTE: numbering_int.conf is obsolete, please use routing." ; fi
239 @if test -a "$(DESTDIR)$(CONFIGdir)/numbering_ext.conf" ; then \
240 echo "NOTE: numbering_ext.conf is obsolete, please use routing." ; fi
241 @ds='$(TONEDIRS)' ; for d in $$ds ; do \
242 destdir="$(DESTDIR)$(SHAREdir)/$$d" ; \
243 if test -a "$$destdir" ; then \
244 echo "NOTE: $$d already exists, not overwritten." ; \
245 else mkdir -p "$$destdir" ; cp -a $(srcdir)/$$d/* "$$destdir/" ; fi ; \
249 # Because distuninstallcheck expects relative filenames, we cannot
250 # replace './' with $(prefix) in _listfiles. Therefore we do it the
251 # other way around to filter out configuration files and tones.
252 distcheck_CONFIGdir = echo $(CONFIGdir) | sed 's|^$(prefix)/|./|'
253 distcheck_SHAREdir = echo $(SHAREdir) | sed 's|^$(prefix)/|./|'
255 distuninstallcheck_listfiles = find . -type f -print \
256 | $(GREP) -v "$$( $(distcheck_CONFIGdir) )" \
257 | $(GREP) -v "$$( $(distcheck_SHAREdir) )"
263 # test rule, nothing important
265 # -echo $(all_libraries) >&2
267 # CAUTION: CRUDE CRUDE HACK !!
268 # This transforms all compiling and linking calls from gcc into g++
269 # This should better be removed and all .c files renamed to .cpp
270 COMPILE=$(CXXCOMPILE)