Adding TX-dejitter feature for briged data to mISDN
[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=$(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
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
66
67 GSM_SOURCE += gsm_bs.cpp
68
69 endif
70
71 if ENABLE_GSM_MS
72
73 GSM_INCLUDE += -DWITH_GSM_MS
74
75 GSM_SOURCE += gsm_ms.cpp
76
77 endif
78
79 if ENABLE_SS5
80
81 SS5_INCLUDE = -DWITH_SS5
82
83 SS5_SOURCE = ss5.cpp ss5_encode.c ss5_decode.c
84
85 endif
86
87 SIP_LIB =
88
89 if ENABLE_SIP
90
91 # FIXME: remove that
92 #pkgconfigdir = $(libdir)/pkgconfig
93 #pkgconfig_DATA = sofia-sip-ua.pc
94
95 SIP_INCLUDE = -DWITH_SIP $(SOFIA_CFLAGS)
96
97 SIP_SOURCE = sip.cpp
98
99 SIP_LIB += $(SOFIA_LIBS)
100
101 endif
102
103 bin_PROGRAMS = lcradmin gentones genwave
104
105 sbin_PROGRAMS = lcr genrc genextension
106
107 if ENABLE_ASTERISK_CHANNEL_DRIVER
108 noinst_PROGRAMS = chan_lcr.so
109 chan_lcr_so_SOURCES =
110 chan_lcr_so_LDFLAGS = -shared
111 chan_lcr_so_LDADD = chan_lcr.po bchannel.po options.po callerid.po select.po
112
113 chan_lcr.po: chan_lcr.c chan_lcr.h
114         $(CC) $(INCLUDES) $(AST_CFLAGS) $(CPPFLAGS) $(CFLAGS) -D_GNU_SOURCE -fPIC -c chan_lcr.c -o chan_lcr.po
115
116 bchannel.po: bchannel.c bchannel.h
117         $(CC) $(INCLUDES) -D_GNU_SOURCE $(CPPFLAGS) $(CFLAGS) -fPIC -c bchannel.c -o bchannel.po
118
119 callerid.po: callerid.c callerid.h
120         $(CC) $(INCLUDES) -D_GNU_SOURCE $(CPPFLAGS) $(CFLAGS) -fPIC -c callerid.c -o callerid.po
121
122 options.po: options.c options.h
123         $(CC) $(INCLUDES) -D_GNU_SOURCE $(CPPFLAGS) $(CFLAGS) -fPIC -c options.c -o options.po
124
125 select.po: select.c select.h
126         $(CC) $(INCLUDES) -D_GNU_SOURCE $(CPPFLAGS) $(CFLAGS) -fPIC -c select.c -o select.po
127
128 install-exec-hook:
129         mkdir -p $(astmoddir)
130         $(INSTALL) -d $(astmoddir)
131         $(INSTALL) chan_lcr.so $(astmoddir)
132 endif
133
134 INCLUDES = $(all_includes) $(GSM_INCLUDE) $(SS5_INCLUDE) $(SIP_INCLUDE) -Wall $(INSTALLATION_DEFINES)
135
136 lcr_SOURCES = \
137         main.c select.c trace.c options.c tones.c alawulaw.c cause.c interface.c message.c callerid.c socket_server.c \
138         port.cpp vbox.cpp mISDN.cpp dss1.cpp loop.c remote.cpp \
139         $(GSM_SOURCE) $(SS5_SOURCE) $(SIP_SOURCE) \
140         endpoint.cpp endpointapp.cpp \
141         appbridge.cpp apppbx.cpp route.c action.cpp action_efi.cpp action_vbox.cpp extension.c crypt.cpp mail.c \
142         join.cpp joinpbx.cpp joinremote.cpp
143
144 lcr_LDADD = $(LIBCRYPTO) -lmisdn -lpthread $(GSM_LIB) $(SIP_LIB)
145
146
147 lcradmin_SOURCES = lcradmin.c cause.c options.c
148 genextension_SOURCES = genext.c options.c extension.c
149
150 # Special install function to preserve existing configs.
151 # Optimization with equivalen results are welcome
152
153 install-data-hook:
154         @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'
155         @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'
156         @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'
157         @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'
158         @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'
159         @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'
160         mkdir -p $(CONFIGdir)
161         mkdir -p $(SHAREdir)
162         mkdir -p $(LOGdir)
163         mkdir -p $(EXTENSIONdir)
164         @if test -a $(CONFIGdir)/options.conf ; then \
165                 echo "NOTE: options.conf already exists, not changed." ; else \
166                 cp -v default/options.conf $(CONFIGdir) ; fi
167         @if test -a $(CONFIGdir)/interface.conf ; then \
168                 echo "NOTE: interface.conf already exists, not changed." ; else \
169                 cp -v default/interface.conf $(CONFIGdir) ; fi
170         @if test -a $(CONFIGdir)/routing.conf ; then \
171                 echo "NOTE: routing.conf already exists, not changed." ; else \
172                 cp -v default/routing.conf $(CONFIGdir) ; fi
173         @if test -a $(CONFIGdir)/numbering_int.conf ; then \
174                 echo "NOTE: numbering_int.conf is obsolete, please use routing." ; fi
175         @if test -a $(CONFIGdir)/numbering_ext.conf ; then \
176                 echo "NOTE: numbering_ext.conf is obsolete, please use routing." ; fi
177         @if test -a $(CONFIGdir)/directory.list ; then \
178                 echo "NOTE: directory.list already exists, not changed." ; else \
179                 cp -v default/directory.list $(CONFIGdir) ; fi
180         @if test -a $(SHAREdir)/tones_american ; then \
181                 echo "NOTE: american tones already exists, not overwritten." ; else \
182                 cp -a tones_american $(SHAREdir) ; fi
183         @if test -a $(SHAREdir)/tones_german ; then \
184                 echo "NOTE: german tones already exists, not overwritten." ; else \
185                 cp -a tones_german $(SHAREdir) ; fi
186         @if test -a $(SHAREdir)/vbox_german ; then \
187                 echo "NOTE: german vbox tones already exists, not overwritten." ; else \
188                 cp -a vbox_german $(SHAREdir) ; fi
189         @if test -a $(SHAREdir)/vbox_english ; then \
190                 echo "NOTE: english vbox tones already exists, not overwritten." ; else \
191                 cp -a vbox_english $(SHAREdir) ; fi
192         @if test -a $(SHAREdir)/tones_efi ; then \
193                 echo "NOTE: special efi tones already exists, not overwritten." ; else \
194                 cp -a tones_efi $(SHAREdir) ; fi
195
196 clean-generic:
197         rm -f *.po
198
199 # test rule, nothing important
200 #echo:
201 #       -echo $(all_libraries) >&2
202
203 # CAUTION: CRUDE CRUDE HACK !!
204 # This transforms all compiling and linking calls from gcc into g++
205 # This should better be removed and all .c files renamed to .cpp
206 COMPILE=$(CXXCOMPILE)
207 LINK=$(CXXLINK)
208
209