added chan_lcr and Makefile.am fixes by Matthias
[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)/extensions\""
45
46 INCLUDES = $(all_includes) -I/usr/include/mISDNuser $(INSTALLATION_DEFINES) 
47
48
49 bin_PROGRAMS = lcradmin gentones genwave
50
51 sbin_PROGRAMS = lcr genrc genextension
52
53 if ENABLE_ASTERISK_CHANNEL_DRIVER
54 noinst_PROGRAMS = chan_lcr.so
55 chan_lcr_so_SOURCES =
56 chan_lcr_so_LDFLAGS = -shared
57 chan_lcr_so_LDADD = chan_lcr.po bchannel.po options.po callerid.po
58
59 chan_lcr.po: chan_lcr.c chan_lcr.h
60         $(CC) $(INCLUDES) -D_GNU_SOURCE -fPIC -c chan_lcr.c -o chan_lcr.po
61
62 bchannel.po: bchannel.c bchannel.h
63         $(CC) $(INCLUDES) -D_GNU_SOURCE -fPIC -c bchannel.c -o bchannel.po
64
65 callerid.po: callerid.c callerid.h
66         $(CC) $(INCLUDES) -D_GNU_SOURCE -fPIC -c callerid.c -o callerid.po
67
68 options.po: options.c options.h
69         $(CC) $(INCLUDES) -D_GNU_SOURCE -fPIC -c options.c -o options.po
70
71 install-exec-hook:
72         mkdir -p $(astmoddir)
73         $(INSTALL) -d $(astmoddir)
74         $(INSTALL) chan_lcr.so $(astmoddir)
75 endif
76
77 lcr_SOURCES = action.cpp       mISDN.cpp        tones.c \
78         action_efi.cpp   crypt.cpp        mail.c           trace.c \
79         action_vbox.cpp  dss1.cpp         main.c           \
80         vbox.cpp alawulaw.c       endpoint.cpp     interface.c     message.c \
81         apppbx.cpp       endpointapp.cpp  join.cpp        options.c       \
82         extension.c      joinpbx.cpp     port.cpp \
83         callerid.c       joinremote.cpp  route.c \
84         cause.c          socket_server.c
85
86 lcr_LDADD = $(LIBCRYPTO) -lmisdn -lpthread
87
88 lcradmin_SOURCES = lcradmin.c cause.c options.c
89 genextension_SOURCES = genext.c options.c extension.c
90
91 # Special install function to preserve existing configs.
92 # Optimization with equivalen results are welcome
93
94 install-data-hook:
95         @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'
96         @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'
97         @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'
98         @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'
99         @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'
100         @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'
101         mkdir -p $(CONFIGdir)
102         mkdir -p $(SHAREdir)
103         mkdir -p $(LOGdir)
104         mkdir -p $(EXTENSIONdir)
105         @if test -a $(CONFIGdir)/options.conf ; then \
106                 echo "NOTE: options.conf already exists, not changed." ; else \
107                 cp -v default/options.conf $(CONFIGdir) ; fi
108         @if test -a $(CONFIGdir)/interface.conf ; then \
109                 echo "NOTE: interface.conf already exists, not changed." ; else \
110                 cp -v default/interface.conf $(CONFIGdir) ; fi
111         @if test -a $(CONFIGdir)/routing.conf ; then \
112                 echo "NOTE: routing.conf already exists, not changed." ; else \
113                 cp -v default/routing.conf $(CONFIGdir) ; fi
114         @if test -a $(CONFIGdir)/numbering_int.conf ; then \
115                 echo "NOTE: numbering_int.conf is obsolete, please use routing." ; fi
116         @if test -a $(CONFIGdir)/numbering_ext.conf ; then \
117                 echo "NOTE: numbering_ext.conf is obsolete, please use routing." ; fi
118         @if test -a $(CONFIGdir)/directory.list ; then \
119                 echo "NOTE: directory.list already exists, not changed." ; else \
120                 cp -v default/directory.list $(CONFIGdir) ; fi
121         @if test -a $(SHAREdir)/tones_american ; then \
122                 echo "NOTE: american tones already exists, not overwritten." ; else \
123                 cp -a tones_american $(SHAREdir) ; fi
124         @if test -a $(SHAREdir)/tones_german ; then \
125                 echo "NOTE: german tones already exists, not overwritten." ; else \
126                 cp -a tones_german $(SHAREdir) ; fi
127         @if test -a $(SHAREdir)/vbox_german ; then \
128                 echo "NOTE: german vbox tones already exists, not overwritten." ; else \
129                 cp -a vbox_german $(SHAREdir) ; fi
130         @if test -a $(SHAREdir)/vbox_english ; then \
131                 echo "NOTE: english vbox tones already exists, not overwritten." ; else \
132                 cp -a vbox_english $(SHAREdir) ; fi
133         @if test -a $(SHAREdir)/tones_efi ; then \
134                 echo "NOTE: special efi tones already exists, not overwritten." ; else \
135                 cp -a tones_efi $(SHAREdir) ; fi
136
137 # test rule, nothing important
138 #echo:
139 #       -echo $(all_libraries) >&2
140
141 # CAUTION: CRUDE CRUDE HACK !!
142 # This transforms all compiling and linking calls from gcc into g++
143 # This should better be removed and all .c files renamed to .cpp
144 COMPILE=$(CXXCOMPILE)
145 LINK=$(CXXLINK)
146
147