[GSM_BS] Added DTMF support.
[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 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=$(DESTDIR)$(pkgsysconfdir)
29 #SHAREdir=$(DESTDIR)$(pkgdatadir)
30 #LOGdir=$(DESTDIR)$(pkglogdir)
31 #EXTENSIONdir=$(DESTDIR)$(localstatedir)/lib/lcr
32
33 CONFIGdir=$(INSTALLdir)
34 SHAREdir=$(INSTALLdir)
35 LOGdir=$(INSTALLdir)
36 EXTENSIONdir=$(INSTALLdir)/extensions
37
38 astmoddir = $(DESTDIR)/usr/lib/asterisk/modules
39
40 INSTALLATION_DEFINES = \
41  -DCONFIG_DATA="\"$(CONFIGdir)\"" \
42  -DSHARE_DATA="\"$(SHAREdir)\"" \
43  -DLOG_DIR="\"$(LOGdir)\"" \
44  -DEXTENSION_DATA="\"$(EXTENSIONdir)\""
45
46 GSM_INCLUDE =
47 GSM_SOURCE =
48 GSM_LIB =
49
50 if ENABLE_GSM
51
52 GSM_INCLUDE +=
53
54 GSM_SOURCE += gsm_audio.c gsm.cpp gsm_conf.c
55   
56 GSM_LIB += /usr/lib/libgsm.a
57
58 #gsm_audio.po: gsm_audio.c gsm_audio.h
59 #       $(CC) -D_GNU_SOURCE -fPIC -c gsm_audio.c -o gsm_audio.po
60
61 endif
62
63 if ENABLE_GSM_BS
64
65 GSM_INCLUDE += -DWITH_GSM_BS -I./openbsc/include -I./libosmocore/include -I./openbsc
66
67 GSM_SOURCE += gsm_bs.cpp openbsc/src/bsc_init.c openbsc/src/bsc_vty.c openbsc/src/vty_interface_layer3.c openbsc/src/bsc_api.c openbsc/src/bsc_version.c
68
69 GSM_LIB +=  ./openbsc/src/libbsc.a ./openbsc/src/libmsc.a ./openbsc/src/libvty.a -losmovty -losmocore -ldbi -lcrypt
70
71 endif
72
73 if ENABLE_GSM_MS
74
75 GSM_INCLUDE += -DPACKAGE_VERSION=0 -DWITH_GSM_MS -I./layer23/include -I./libosmocore/include
76
77 GSM_SOURCE += gsm_ms.cpp layer23/src/mobile/app_mobile.c
78
79 GSM_LIB += ./layer23/src/mobile/libmobile.a \
80         ./layer23/src/common/liblayer23.a \
81         ./libosmocore/build-host/src/.libs/libosmocore.a \
82         ./libosmocore/build-host/src/vty/.libs/libosmovty.a \
83         ./libosmocore/build-host/src/codec/.libs/libosmocodec.a
84
85 endif
86
87 if ENABLE_SS5
88
89 SS5_INCLUDE = -DWITH_SS5
90
91 SS5_SOURCE = ss5.cpp ss5_encode.c ss5_decode.c
92
93 endif
94
95 bin_PROGRAMS = lcradmin gentones genwave
96
97 sbin_PROGRAMS = lcr genrc genextension
98
99 if ENABLE_ASTERISK_CHANNEL_DRIVER
100 noinst_PROGRAMS = chan_lcr.so
101 chan_lcr_so_SOURCES =
102 chan_lcr_so_LDFLAGS = -shared
103 chan_lcr_so_LDADD = chan_lcr.po bchannel.po options.po callerid.po select.po
104
105 chan_lcr.po: chan_lcr.c chan_lcr.h
106         $(CC) $(INCLUDES) $(AST_CFLAGS) $(CPPFLAGS) $(CFLAGS) -D_GNU_SOURCE -fPIC -c chan_lcr.c -o chan_lcr.po
107
108 bchannel.po: bchannel.c bchannel.h
109         $(CC) $(INCLUDES) -D_GNU_SOURCE $(CPPFLAGS) $(CFLAGS) -fPIC -c bchannel.c -o bchannel.po
110
111 callerid.po: callerid.c callerid.h
112         $(CC) $(INCLUDES) -D_GNU_SOURCE $(CPPFLAGS) $(CFLAGS) -fPIC -c callerid.c -o callerid.po
113
114 options.po: options.c options.h
115         $(CC) $(INCLUDES) -D_GNU_SOURCE $(CPPFLAGS) $(CFLAGS) -fPIC -c options.c -o options.po
116
117 select.po: select.c select.h
118         $(CC) $(INCLUDES) -D_GNU_SOURCE $(CPPFLAGS) $(CFLAGS) -fPIC -c select.c -o select.po
119
120 install-exec-hook:
121         mkdir -p $(astmoddir)
122         $(INSTALL) -d $(astmoddir)
123         $(INSTALL) chan_lcr.so $(astmoddir)
124 endif
125
126 INCLUDES = $(all_includes) $(GSM_INCLUDE) $(SS5_INCLUDE) -Wall $(INSTALLATION_DEFINES)
127
128 lcr_SOURCES = $(GSM_SOURCE) $(SS5_SOURCE) select.c action.cpp       mISDN.cpp        tones.c \
129         action_efi.cpp   crypt.cpp        mail.c           trace.c \
130         action_vbox.cpp  dss1.cpp         main.c           \
131         vbox.cpp alawulaw.c       endpoint.cpp     interface.c     message.c \
132         apppbx.cpp       endpointapp.cpp  join.cpp        options.c       \
133         extension.c      joinpbx.cpp     port.cpp \
134         callerid.c       joinremote.cpp  route.c \
135         cause.c          socket_server.c
136
137 lcr_LDADD = $(LIBCRYPTO) -lmisdn -lpthread $(GSM_LIB)
138
139
140 lcradmin_SOURCES = lcradmin.c cause.c options.c
141 genextension_SOURCES = genext.c options.c extension.c
142
143 # Special install function to preserve existing configs.
144 # Optimization with equivalen results are welcome
145
146 install-data-hook:
147         @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'
148         @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'
149         @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'
150         @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'
151         @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'
152         @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'
153         mkdir -p $(CONFIGdir)
154         mkdir -p $(SHAREdir)
155         mkdir -p $(LOGdir)
156         mkdir -p $(EXTENSIONdir)
157         @if test -a $(CONFIGdir)/options.conf ; then \
158                 echo "NOTE: options.conf already exists, not changed." ; else \
159                 cp -v default/options.conf $(CONFIGdir) ; fi
160         @if test -a $(CONFIGdir)/interface.conf ; then \
161                 echo "NOTE: interface.conf already exists, not changed." ; else \
162                 cp -v default/interface.conf $(CONFIGdir) ; fi
163         @if test -a $(CONFIGdir)/routing.conf ; then \
164                 echo "NOTE: routing.conf already exists, not changed." ; else \
165                 cp -v default/routing.conf $(CONFIGdir) ; fi
166 if ENABLE_GSM
167         @if test -a $(CONFIGdir)/gsm.conf ; then \
168                 echo "NOTE: gsm.conf already exists, not changed." ; else \
169                 cp -v default/gsm.conf $(CONFIGdir) ; fi
170         @if test -a $(CONFIGdir)/openbsc.cfg ; then \
171                 echo "NOTE: openbsc.cfg already exists, not changed." ; else \
172                 cp -v default/openbsc.cfg $(CONFIGdir) ; fi
173 endif
174         @if test -a $(CONFIGdir)/numbering_int.conf ; then \
175                 echo "NOTE: numbering_int.conf is obsolete, please use routing." ; fi
176         @if test -a $(CONFIGdir)/numbering_ext.conf ; then \
177                 echo "NOTE: numbering_ext.conf is obsolete, please use routing." ; fi
178         @if test -a $(CONFIGdir)/directory.list ; then \
179                 echo "NOTE: directory.list already exists, not changed." ; else \
180                 cp -v default/directory.list $(CONFIGdir) ; fi
181         @if test -a $(SHAREdir)/tones_american ; then \
182                 echo "NOTE: american tones already exists, not overwritten." ; else \
183                 cp -a tones_american $(SHAREdir) ; fi
184         @if test -a $(SHAREdir)/tones_german ; then \
185                 echo "NOTE: german tones already exists, not overwritten." ; else \
186                 cp -a tones_german $(SHAREdir) ; fi
187         @if test -a $(SHAREdir)/vbox_german ; then \
188                 echo "NOTE: german vbox tones already exists, not overwritten." ; else \
189                 cp -a vbox_german $(SHAREdir) ; fi
190         @if test -a $(SHAREdir)/vbox_english ; then \
191                 echo "NOTE: english vbox tones already exists, not overwritten." ; else \
192                 cp -a vbox_english $(SHAREdir) ; fi
193         @if test -a $(SHAREdir)/tones_efi ; then \
194                 echo "NOTE: special efi tones already exists, not overwritten." ; else \
195                 cp -a tones_efi $(SHAREdir) ; fi
196
197 clean-generic:
198         rm -f *.po
199
200 # test rule, nothing important
201 #echo:
202 #       -echo $(all_libraries) >&2
203
204 # CAUTION: CRUDE CRUDE HACK !!
205 # This transforms all compiling and linking calls from gcc into g++
206 # This should better be removed and all .c files renamed to .cpp
207 COMPILE=$(CXXCOMPILE)
208 LINK=$(CXXLINK)
209
210