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