now chan_lcr.so is moved to asterisk' modules directory when installing.
[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 #INSTALLATION_DEFINES = \
24 # -DCONFIG_DATA="\"$(pkgsysconfdir)\"" \
25 # -DSHARE_DATA="\"$(pkgdatadir)\"" \
26 # -DLOG_DIR="\"$(pkglogdir)\"" \
27 # -DEXTENSION_DATA="\"$(localstatedir)/lib/lcr\""
28
29 INSTALLdir = /usr/local/lcr
30
31 astmoddir = /usr/lib/asterisk/modules
32
33 INSTALLATION_DEFINES = \
34  -DCONFIG_DATA="\"$(INSTALLdir)\"" \
35  -DSHARE_DATA="\"$(INSTALLdir)\"" \
36  -DLOG_DIR="\"$(INSTALLdir)\"" \
37  -DEXTENSION_DATA="\"$(INSTALLdir)/extensions\""
38
39 INCLUDES = $(all_includes) -I/usr/include/mISDNuser $(INSTALLATION_DEFINES) 
40
41
42 bin_PROGRAMS = lcradmin gentones genwave
43
44 if ENABLE_ASTERISK_CHANNEL_DRIVER
45 sbin_PROGRAMS = lcr genrc genextension chan_lcr.so
46 chan_lcr_so_SOURCES = 
47 chan_lcr_so_LDFLAGS = -shared
48 chan_lcr_so_LDADD = chan_lcr.o bchannel.o options.o
49
50 chan_lcr.o: chan_lcr.c chan_lcr.h
51         $(CC) $(INCLUDES) -D_GNU_SOURCE -c chan_lcr.c
52
53 bchannel.o: bchannel.c bchannel.h
54         $(CC) $(INCLUDES) -D_GNU_SOURCE -c bchannel.c
55
56 else
57 sbin_PROGRAMS = lcr genrc genextension 
58 endif
59
60 lcr_SOURCES = action.cpp       mISDN.cpp        tones.c \
61         action_efi.cpp   crypt.cpp        mail.c           trace.c \
62         action_vbox.cpp  dss1.cpp         main.c           \
63         vbox.cpp alawulaw.c       endpoint.cpp     interface.c     message.c \
64         apppbx.cpp       endpointapp.cpp  join.cpp        options.c       \
65         extension.c      joinpbx.cpp     port.cpp \
66         callerid.c       joinremote.cpp  route.c \
67         cause.c          socket_server.c
68
69 lcr_LDADD = $(LIBCRYPTO) -lmisdn -lpthread
70
71 lcradmin_SOURCES = lcradmin.c cause.c options.c
72 genextension_SOURCES = genext.c options.c extension.c
73
74 # Special install function to preserve existing configs.
75 # Optimization with equivalen results are welcome
76
77 install-data-hook:
78         @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'
79         @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'
80         @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'
81         @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'
82         @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'
83         @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'
84         mkdir -p $(INSTALLdir)
85         mkdir -p $(INSTALLdir)/extensions
86         @if test -a $(INSTALLdir)/options.conf ; then \
87                 echo "NOTE: options.conf already exists, not changed." ; else \
88                 cp -v default/options.conf $(INSTALLdir) ; fi
89         @if test -a $(INSTALLdir)/interface.conf ; then \
90                 echo "NOTE: interface.conf already exists, not changed." ; else \
91                 cp -v default/interface.conf $(INSTALLdir) ; fi
92         @if test -a $(INSTALLdir)/routing.conf ; then \
93                 echo "NOTE: routing.conf already exists, not changed." ; else \
94                 cp -v default/routing.conf $(INSTALLdir) ; fi
95         @if test -a $(INSTALLdir)/numbering_int.conf ; then \
96                 echo "NOTE: numbering_int.conf is obsolete, please use routing." ; fi
97         @if test -a $(INSTALLdir)/numbering_ext.conf ; then \
98                 echo "NOTE: numbering_ext.conf is obsolete, please use routing." ; fi
99         @if test -a $(INSTALLdir)/directory.list ; then \
100                 echo "NOTE: directory.list already exists, not changed." ; else \
101                 cp -v default/directory.list $(INSTALLdir) ; fi
102         @if test -a $(INSTALLdir)/tones_american ; then \
103                 echo "NOTE: american tones already exists, not overwritten." ; else \
104                 cp -a tones_american $(INSTALLdir) ; fi
105         @if test -a $(INSTALLdir)/tones_german ; then \
106                 echo "NOTE: german tones already exists, not overwritten." ; else \
107                 cp -a tones_german $(INSTALLdir) ; fi
108         @if test -a $(INSTALLdir)/vbox_german ; then \
109                 echo "NOTE: german vbox tones already exists, not overwritten." ; else \
110                 cp -a vbox_german $(INSTALLdir) ; fi
111         @if test -a $(INSTALLdir)/vbox_english ; then \
112                 echo "NOTE: english vbox tones already exists, not overwritten." ; else \
113                 cp -a vbox_english $(INSTALLdir) ; fi
114         @if test -a $(INSTALLdir)/tones_efi ; then \
115                 echo "NOTE: special efi tones already exists, not overwritten." ; else \
116                 cp -a tones_efi $(INSTALLdir) ; fi
117 if ENABLE_ASTERISK_CHANNEL_DRIVER
118         @echo "Moving chan_lcr.so (if it fails, do it manually)"
119         mv $(sbindir)/chan_lcr.so $(astmoddir)
120 endif
121
122 # test rule, nothing important
123 #echo:
124 #       -echo $(all_libraries) >&2
125
126 # CAUTION: CRUDE CRUDE HACK !!
127 # This transforms all compiling and linking calls from gcc into g++
128 # This should better be removed and all .c files renamed to .cpp
129 COMPILE=$(CXXCOMPILE)
130 LINK=$(CXXLINK)
131
132 pkglogdir=$(localstatedir)/log/@PACKAGE@
133 pkgsysconfdir=$(sysconfdir)/@PACKAGE@
134
135