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=$(DESTDIR)$(pkgsysconfdir)
29 #SHAREdir=$(DESTDIR)$(pkgdatadir)
30 #LOGdir=$(DESTDIR)$(pkglogdir)
31 #EXTENSIONdir=$(DESTDIR)$(localstatedir)/lib/lcr
33 CONFIGdir=$(INSTALLdir)
34 SHAREdir=$(INSTALLdir)
36 EXTENSIONdir=$(INSTALLdir)/extensions
38 astmoddir = $(DESTDIR)/usr/lib/asterisk/modules
40 INSTALLATION_DEFINES = \
41 -DCONFIG_DATA="\"$(CONFIGdir)\"" \
42 -DSHARE_DATA="\"$(SHAREdir)\"" \
43 -DLOG_DIR="\"$(LOGdir)\"" \
44 -DEXTENSION_DATA="\"$(EXTENSIONdir)\""
48 MISDN_INCLUDE = -DWITH_MISDN -DWITH_CRYPT
49 MISDN_SOURCE = mISDN.cpp dss1.cpp loop.c crypt.cpp remote.cpp joinremote.cpp
62 GSM_SOURCE += gsm_audio.c gsm.cpp
64 GSM_LIB += /usr/lib/libgsm.a
66 #gsm_audio.po: gsm_audio.c gsm_audio.h
67 # $(CC) -D_GNU_SOURCE -fPIC -c gsm_audio.c -o gsm_audio.po
73 GSM_INCLUDE += -DWITH_GSM_BS
75 GSM_SOURCE += gsm_bs.cpp
81 GSM_INCLUDE += -DWITH_GSM_MS
83 GSM_SOURCE += gsm_ms.cpp
89 SS5_INCLUDE = -DWITH_SS5
91 SS5_SOURCE = ss5.cpp ss5_encode.c ss5_decode.c
100 #pkgconfigdir = $(libdir)/pkgconfig
101 #pkgconfig_DATA = sofia-sip-ua.pc
103 SIP_INCLUDE = -DWITH_SIP $(SOFIA_CFLAGS)
107 SIP_LIB += $(SOFIA_LIBS)
111 bin_PROGRAMS = lcradmin gentones genwave
113 sbin_PROGRAMS = lcr genrc genextension
115 if ENABLE_ASTERISK_CHANNEL_DRIVER
116 noinst_PROGRAMS = chan_lcr.so
117 chan_lcr_so_SOURCES =
118 chan_lcr_so_LDFLAGS = -shared
119 chan_lcr_so_LDADD = chan_lcr.po bchannel.po options.po callerid.po select.po
121 chan_lcr.po: chan_lcr.c chan_lcr.h
122 $(CC) $(INCLUDES) $(AST_CFLAGS) $(CPPFLAGS) $(CFLAGS) -D_GNU_SOURCE -fPIC -c chan_lcr.c -o chan_lcr.po
124 bchannel.po: bchannel.c bchannel.h
125 $(CC) $(INCLUDES) -D_GNU_SOURCE $(CPPFLAGS) $(CFLAGS) -fPIC -c bchannel.c -o bchannel.po
127 callerid.po: callerid.c callerid.h
128 $(CC) $(INCLUDES) -D_GNU_SOURCE $(CPPFLAGS) $(CFLAGS) -fPIC -c callerid.c -o callerid.po
130 options.po: options.c options.h
131 $(CC) $(INCLUDES) -D_GNU_SOURCE $(CPPFLAGS) $(CFLAGS) -fPIC -c options.c -o options.po
133 select.po: select.c select.h
134 $(CC) $(INCLUDES) -D_GNU_SOURCE $(CPPFLAGS) $(CFLAGS) -fPIC -c select.c -o select.po
137 mkdir -p $(astmoddir)
138 $(INSTALL) -d $(astmoddir)
139 $(INSTALL) chan_lcr.so $(astmoddir)
142 INCLUDES = $(all_includes) $(MISDN_INCLUDE) $(GSM_INCLUDE) $(SS5_INCLUDE) $(SIP_INCLUDE) -Wall $(INSTALLATION_DEFINES)
145 main.c select.c trace.c options.c tones.c alawulaw.c cause.c interface.c message.c callerid.c socket_server.c \
147 $(MISDN_SOURCE) $(GSM_SOURCE) $(SS5_SOURCE) $(SIP_SOURCE) \
148 endpoint.cpp endpointapp.cpp \
149 appbridge.cpp apppbx.cpp route.c action.cpp action_efi.cpp action_vbox.cpp extension.c mail.c \
152 lcr_LDADD = $(LIBCRYPTO) $(MISDN_LIB) -lpthread $(GSM_LIB) $(SIP_LIB)
155 lcradmin_SOURCES = lcradmin.c cause.c options.c
156 genextension_SOURCES = genext.c options.c extension.c
158 # Special install function to preserve existing configs.
159 # Optimization with equivalen results are welcome
162 @sh -c 'grep -n strcpy *.c* --exclude chan_lcr.c --exclude bchannel.c --exclude callerid.c ; if test $$''? = 0 ; then echo "dont use strcpy, use makro instead." ; exit -1 ; fi'
163 @sh -c 'grep -n strncpy *.c* --exclude chan_lcr.c --exclude bchannel.c --exclude callerid.c ; if test $$''? = 0 ; then echo "dont use strncpy, use makro instead." ; exit -1 ; fi'
164 @sh -c 'grep -n strcat *.c* --exclude chan_lcr.c --exclude bchannel.c --exclude callerid.c ; if test $$''? = 0 ; then echo "dont use strcat, use makro instead." ; exit -1 ; fi'
165 @sh -c 'grep -n strncat *.c* --exclude chan_lcr.c --exclude bchannel.c --exclude callerid.c ; if test $$''? = 0 ; then echo "dont use strncat, use makro instead." ; exit -1 ; fi'
166 @sh -c 'grep -n sprintf *.c* --exclude chan_lcr.c --exclude bchannel.c --exclude callerid.c ; if test $$''? = 0 ; then echo "dont use sprintf, use makro instead." ; exit -1 ; fi'
167 @sh -c 'grep -n snprintf *.c* --exclude chan_lcr.c --exclude bchannel.c --exclude callerid.c ; if test $$''? = 0 ; then echo "dont use snprintf, use makro instead." ; exit -1 ; fi'
168 mkdir -p $(CONFIGdir)
171 mkdir -p $(EXTENSIONdir)
172 @if test -a $(CONFIGdir)/options.conf ; then \
173 echo "NOTE: options.conf already exists, not changed." ; else \
174 cp -v default/options.conf $(CONFIGdir) ; fi
175 @if test -a $(CONFIGdir)/interface.conf ; then \
176 echo "NOTE: interface.conf already exists, not changed." ; else \
177 cp -v default/interface.conf $(CONFIGdir) ; fi
178 @if test -a $(CONFIGdir)/routing.conf ; then \
179 echo "NOTE: routing.conf already exists, not changed." ; else \
180 cp -v default/routing.conf $(CONFIGdir) ; fi
181 @if test -a $(CONFIGdir)/numbering_int.conf ; then \
182 echo "NOTE: numbering_int.conf is obsolete, please use routing." ; fi
183 @if test -a $(CONFIGdir)/numbering_ext.conf ; then \
184 echo "NOTE: numbering_ext.conf is obsolete, please use routing." ; fi
185 @if test -a $(CONFIGdir)/directory.list ; then \
186 echo "NOTE: directory.list already exists, not changed." ; else \
187 cp -v default/directory.list $(CONFIGdir) ; fi
188 @if test -a $(SHAREdir)/tones_american ; then \
189 echo "NOTE: american tones already exists, not overwritten." ; else \
190 cp -a tones_american $(SHAREdir) ; fi
191 @if test -a $(SHAREdir)/tones_german ; then \
192 echo "NOTE: german tones already exists, not overwritten." ; else \
193 cp -a tones_german $(SHAREdir) ; fi
194 @if test -a $(SHAREdir)/vbox_german ; then \
195 echo "NOTE: german vbox tones already exists, not overwritten." ; else \
196 cp -a vbox_german $(SHAREdir) ; fi
197 @if test -a $(SHAREdir)/vbox_english ; then \
198 echo "NOTE: english vbox tones already exists, not overwritten." ; else \
199 cp -a vbox_english $(SHAREdir) ; fi
200 @if test -a $(SHAREdir)/tones_efi ; then \
201 echo "NOTE: special efi tones already exists, not overwritten." ; else \
202 cp -a tones_efi $(SHAREdir) ; fi
207 # test rule, nothing important
209 # -echo $(all_libraries) >&2
211 # CAUTION: CRUDE CRUDE HACK !!
212 # This transforms all compiling and linking calls from gcc into g++
213 # This should better be removed and all .c files renamed to .cpp
214 COMPILE=$(CXXCOMPILE)