Don't do reinvite if both parties talk diffrent codecs
[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
18 CHANNEL_LIBS=chan_modem.so chan_iax.so chan_sip.so \
19              chan_modem_aopen.so \
20              chan_modem_bestdata.so chan_modem_i4l.so \
21              chan_agent.so chan_mgcp.so chan_iax2.so \
22              chan_local.so chan_skinny.so
23
24 #
25 # If you really want VoFR you can have it :-P
26 #
27 #CHANNEL_LIBS+=chan_vofr
28
29 ifneq (${OSARCH},Darwin)
30 CHANNEL_LIBS+=chan_oss.so
31 endif
32
33 CHANNEL_LIBS+=$(shell [ -f /usr/include/linux/ixjuser.h ] && echo chan_phone.so)
34 CHANNEL_LIBS+=$(shell [ -f h323/libchanh323.a ] && echo chan_h323.so)
35
36 CFLAGS+=-Wno-missing-prototypes -Wno-missing-declarations
37 CFLAGS+=$(shell [ ! -f /usr/include/linux/if_wanpipe.h ] && echo " -DOLD_SANGOMA_API")
38 CHANNEL_LIBS+=$(shell [ -f /usr/include/alsa/asoundlib.h ] && echo "chan_alsa.so")
39 CFLAGS+=$(shell [ -f /usr/lib/libpri.so.1 ] && echo " -DZAPATA_PRI")
40 CFLAGS+=$(shell [ -f /usr/lib/libmfcr2.so.1 ] && echo " -DZAPATA_R2")
41 CFLAGS+=$(shell [ -f alsa-monitor.h ] && echo " -DALSA_MONITOR")
42 ZAPPRI=$(shell [ -f /usr/lib/libpri.so.1 ] && echo "-lpri")
43 ZAPR2=$(shell [ -f /usr/lib/libmfcr2.so.1 ] && echo "-lmfcr2")
44 CHANZAP=$(shell if [ -f .oldzap ]; then echo "chan_zap_old.c"; else echo "chan_zap.c"; fi)
45 ZAPLIB=$(shell if [ -f .oldzap ]; then echo "-lzap"; fi)
46 CFLAGS+=$(shell [ -f /usr/include/linux/zaptel.h ] && echo "-DIAX_TRUNKING")
47 CHANNEL_LIBS+=$(shell [ -f /usr/include/vpbapi.h ] && echo "chan_vpb.so" )
48
49 ALSA_SRC=chan_alsa.c
50 ALSA_SRC+=$(shell [ -f alsa-monitor.h ] && echo "alsa-monitor.h")
51
52 CFLAGS+=-DCRYPTO
53 CFLAGS+=-fPIC
54
55 ifeq ($(USE_MYSQL_FRIENDS),1)
56 CFLAGS+=-DMYSQL_FRIENDS
57 endif
58
59 CFLAGS+=#-DVOFRDUMPER
60
61 ZAPDIR=/usr/lib
62
63 CHANNEL_LIBS+=$(shell [ -f /usr/include/linux/zaptel.h ] && echo "chan_zap.so")
64
65 CHANNEL_LIBS+=$(shell [ -f /usr/include/nbs.h ] && echo "chan_nbs.so" )
66
67 ifndef OPENH323DIR
68 OPENH323DIR=$(HOME)/openh323
69 endif
70
71 ifndef PWLIBDIR
72 PWLIBDIR=$(HOME)/pwlib
73 endif
74
75 #CFLAGS+=$(shell [ -f $(ZAPDIR)/libzap.a ] && echo "-I$(ZAPDIR)")
76
77 all: depend $(CHANNEL_LIBS) 
78
79 clean:
80         rm -f *.so *.o .depend
81         rm -f busy.h ringtone.h gentone gentone-ulaw
82
83 %.so : %.o
84         $(CC) $(SOLINK) -o $@ $<
85
86 ifneq ($(wildcard .depend),)
87 include .depend
88 endif
89
90 gentone: gentone.c
91         $(CC) -o gentone gentone.c -lm
92
93 gentone-ulaw: gentone-ulaw.c
94         $(CC) -o gentone-ulaw gentone-ulaw.c -lm
95
96 busy.h: gentone
97         ./gentone busy 480 620
98
99 ringtone.h: gentone
100         ./gentone ringtone 440 480
101
102 chan_oss.o: chan_oss.c  busy.h ringtone.h
103
104 ifeq (${OSARCH},OpenBSD)
105 chan_oss.so: chan_oss.o
106         $(CC) $(SOLINK) -o $@ chan_oss.o -lossaudio
107 endif
108
109 chan_iax2.so: chan_iax2.o iax2-parser.o
110 ifeq ($(USE_MYSQL_FRIENDS),1)
111         $(CC) $(SOLINK) -o $@ chan_iax2.o iax2-parser.o -lmysqlclient -lz
112 else
113         $(CC) $(SOLINK) -o $@ chan_iax2.o iax2-parser.o
114 endif
115
116 chan_iax.so: chan_iax.o
117 ifeq ($(USE_MYSQL_FRIENDS),1)
118         $(CC) $(SOLINK) -o $@ chan_iax.o -lmysqlclient -lz
119 else
120         $(CC) $(SOLINK) -o $@ chan_iax.o
121 endif
122
123 chan_zap.o: $(CHANZAP)
124         $(CC) -c $(CFLAGS) -o chan_zap.o $(CHANZAP)
125
126 chan_zap.so: chan_zap.o
127         $(CC) $(SOLINK) -o $@ $<  $(ZAPPRI) $(ZAPR2) -ltonezone $(ZAPLIB)
128
129 chan_alsa.o: $(ALSA_SRC)
130
131
132 chan_alsa.so: chan_alsa.o
133         $(CC) $(SOLINK) -o $@ $< -lasound -lm -ldl
134
135 chan_nbs.so: chan_nbs.o
136         $(CC) $(SOLINK) -o $@ $< -lnbs
137
138 chan_vpb.o: chan_vpb.c
139         $(CXX) -c $(CFLAGS) -o $@ chan_vpb.c
140
141 chan_vpb.so: chan_vpb.o
142          $(CXX) $(SOLINK) -o $@ $< -lvpb -lpthread -lm -ldl
143
144 chan_h323.so: chan_h323.o h323/libchanh323.a
145         $(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
146
147
148 #chan_modem.so : chan_modem.o
149 #       $(CC) -rdynamic -shared -Xlinker -x -o $@ $<
150
151 install: all
152         for x in $(CHANNEL_LIBS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
153
154 depend: .depend
155
156 .depend:
157         ../mkdep $(CFLAGS) `ls *.c`
158