fea205ebfccef177005e8755a11db064d6ce4587
[asterisk/asterisk.git] / channels / Makefile
1 #
2 # Asterisk -- A telephony toolkit for Linux.
3
4 # Makefile for Channel backends (dynamically loaded)
5 #
6 # Copyright (C) 1999, Mark Spencer
7 #
8 # Mark Spencer <markster@linux-support.net>
9 #
10 # This program is free software, distributed under the terms of
11 # the GNU General Public License
12 #
13
14 OSARCH=$(shell uname -s)
15
16 USE_MYSQL_FRIENDS=0
17 USE_SIP_MYSQL_FRIENDS=0
18
19 CHANNEL_LIBS=chan_modem.so chan_sip.so \
20              chan_modem_aopen.so \
21              chan_modem_bestdata.so chan_modem_i4l.so \
22              chan_agent.so chan_mgcp.so chan_iax2.so \
23              chan_local.so chan_skinny.so
24
25 #
26 # If you really want IAX1 uncomment the following, but it is
27 # unmaintained
28 #
29 #CHANNEL_LIBS+=chan_iax.so
30
31 #
32 # If you really want VoFR you can have it :-P
33 #
34 #CHANNEL_LIBS+=chan_vofr
35
36 ifneq (${OSARCH},Darwin)
37 CHANNEL_LIBS+=chan_oss.so
38 endif
39
40 CHANNEL_LIBS+=$(shell [ -f /usr/include/linux/ixjuser.h ] && echo chan_phone.so)
41 CHANNEL_LIBS+=$(shell [ -f h323/libchanh323.a ] && echo chan_h323.so)
42
43 CFLAGS+=-Wno-missing-prototypes -Wno-missing-declarations
44 CFLAGS+=$(shell [ ! -f /usr/include/linux/if_wanpipe.h ] && echo " -DOLD_SANGOMA_API")
45 CHANNEL_LIBS+=$(shell [ -f /usr/include/alsa/asoundlib.h ] && echo "chan_alsa.so")
46 CFLAGS+=$(shell [ -f /usr/lib/libpri.so.1 ] && echo " -DZAPATA_PRI")
47 CFLAGS+=$(shell [ -f /usr/lib/libmfcr2.so.1 ] && echo " -DZAPATA_R2")
48 CFLAGS+=$(shell [ -f alsa-monitor.h ] && echo " -DALSA_MONITOR")
49 ZAPPRI=$(shell [ -f /usr/lib/libpri.so.1 ] && echo "-lpri")
50 ZAPR2=$(shell [ -f /usr/lib/libmfcr2.so.1 ] && echo "-lmfcr2")
51 CFLAGS+=$(shell [ -f /usr/include/linux/zaptel.h ] && echo "-DIAX_TRUNKING")
52 CHANNEL_LIBS+=$(shell [ -f /usr/include/vpbapi.h ] && echo "chan_vpb.so" )
53 CFLAGS+=$(shell [ -f /usr/include/vpbapi.h ] && echo " -DLINUX")
54
55 ALSA_SRC=chan_alsa.c
56 ALSA_SRC+=$(shell [ -f alsa-monitor.h ] && echo "alsa-monitor.h")
57
58 CFLAGS+=-DCRYPTO
59 CFLAGS+=-fPIC
60
61 ifeq ($(USE_MYSQL_FRIENDS),1)
62 CFLAGS+=-DMYSQL_FRIENDS
63 endif
64 ifeq ($(USE_SIP_MYSQL_FRIENDS),1)
65 CFLAGS+=-DSIP_MYSQL_FRIENDS
66 endif
67
68 CFLAGS+=#-DVOFRDUMPER
69
70 ZAPDIR=/usr/lib
71
72 CHANNEL_LIBS+=$(shell [ -f /usr/include/linux/zaptel.h ] && echo "chan_zap.so")
73
74 CHANNEL_LIBS+=$(shell [ -f /usr/include/nbs.h ] && echo "chan_nbs.so" )
75
76 ifndef OPENH323DIR
77 OPENH323DIR=$(HOME)/openh323
78 endif
79
80 ifndef PWLIBDIR
81 PWLIBDIR=$(HOME)/pwlib
82 endif
83
84 #CFLAGS+=$(shell [ -f $(ZAPDIR)/libzap.a ] && echo "-I$(ZAPDIR)")
85
86 all: depend $(CHANNEL_LIBS) 
87
88 clean:
89         rm -f *.so *.o .depend
90         rm -f busy.h ringtone.h gentone gentone-ulaw
91
92 %.so : %.o
93         $(CC) $(SOLINK) -o $@ $<
94
95 ifneq ($(wildcard .depend),)
96 include .depend
97 endif
98
99 gentone: gentone.c
100         $(CC) -o gentone gentone.c -lm
101
102 gentone-ulaw: gentone-ulaw.c
103         $(CC) -o gentone-ulaw gentone-ulaw.c -lm
104
105 busy.h: gentone
106         ./gentone busy 480 620
107
108 ringtone.h: gentone
109         ./gentone ringtone 440 480
110
111 chan_oss.o: chan_oss.c  busy.h ringtone.h
112
113 ifeq (${OSARCH},OpenBSD)
114 chan_oss.so: chan_oss.o
115         $(CC) $(SOLINK) -o $@ chan_oss.o -lossaudio
116 endif
117
118 chan_iax2.so: chan_iax2.o iax2-parser.o
119 ifeq ($(USE_MYSQL_FRIENDS),1)
120         $(CC) $(SOLINK) -o $@ chan_iax2.o iax2-parser.o -L/usr/lib/mysql -lmysqlclient -lz
121 else
122         $(CC) $(SOLINK) -o $@ chan_iax2.o iax2-parser.o
123 endif
124
125 chan_iax.so: chan_iax.o
126 ifeq ($(USE_MYSQL_FRIENDS),1)
127         $(CC) $(SOLINK) -o $@ chan_iax.o -L/usr/lib/mysql -lmysqlclient -lz
128 else
129         $(CC) $(SOLINK) -o $@ chan_iax.o
130 endif
131
132 chan_zap.o: chan_zap.c
133         $(CC) -c $(CFLAGS) -o chan_zap.o chan_zap.c
134
135 chan_zap.so: chan_zap.o
136         $(CC) $(SOLINK) -o $@ $<  $(ZAPPRI) $(ZAPR2) -ltonezone
137
138 chan_sip.so: chan_sip.o
139 ifeq ($(USE_MYSQL_FRIENDS),1)
140         $(CC) $(SOLINK) -o $@ chan_sip.o -L/usr/lib/mysql -lmysqlclient -lz
141 else
142         $(CC) $(SOLINK) -o $@ chan_sip.o
143 endif
144
145 chan_alsa.o: $(ALSA_SRC)
146
147
148 chan_alsa.so: chan_alsa.o
149         $(CC) $(SOLINK) -o $@ $< -lasound -lm -ldl
150
151 chan_nbs.so: chan_nbs.o
152         $(CC) $(SOLINK) -o $@ $< -lnbs
153
154 chan_vpb.o: chan_vpb.c
155         $(CXX) -c $(CFLAGS) -o $@ chan_vpb.c
156
157 chan_vpb.so: chan_vpb.o
158          $(CXX) $(SOLINK) -o $@ $< -lvpb -lpthread -lm -ldl
159
160 chan_h323.so: chan_h323.o h323/libchanh323.a
161         $(CC) $(SOLINK) -o $@ $< h323/libchanh323.a -L$(PWLIBDIR)/lib  -lpt_linux_x86_r -L$(OPENH323DIR)/lib -lh323_linux_x86_r -L/usr/lib -lpthread -ldl -lcrypto -lssl -lexpat
162
163
164 #chan_modem.so : chan_modem.o
165 #       $(CC) -rdynamic -shared -Xlinker -x -o $@ $<
166
167 install: all
168         for x in $(CHANNEL_LIBS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
169         if ! [ -f chan_iax.so ]; then rm -f $(DESTDIR)$(MODULES_DIR)/chan_iax.so ; fi
170
171 depend: .depend
172
173 .depend:
174         ../mkdep $(CFLAGS) `ls *.c`
175
176 env:
177         /bin/env
178