b7fbb7a26d44f8bf5bfc41d72dd4416c9f9e254f
[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 CFLAGS+=$(shell [ -f /usr/include/linux/zaptel.h ] && echo "-DIAX_TRUNKING")
45 CHANNEL_LIBS+=$(shell [ -f /usr/include/vpbapi.h ] && echo "chan_vpb.so" )
46
47 ALSA_SRC=chan_alsa.c
48 ALSA_SRC+=$(shell [ -f alsa-monitor.h ] && echo "alsa-monitor.h")
49
50 CFLAGS+=-DCRYPTO
51 CFLAGS+=-fPIC
52
53 ifeq ($(USE_MYSQL_FRIENDS),1)
54 CFLAGS+=-DMYSQL_FRIENDS
55 endif
56
57 CFLAGS+=#-DVOFRDUMPER
58
59 ZAPDIR=/usr/lib
60
61 CHANNEL_LIBS+=$(shell [ -f /usr/include/linux/zaptel.h ] && echo "chan_zap.so")
62
63 CHANNEL_LIBS+=$(shell [ -f /usr/include/nbs.h ] && echo "chan_nbs.so" )
64
65 ifndef OPENH323DIR
66 OPENH323DIR=$(HOME)/openh323
67 endif
68
69 ifndef PWLIBDIR
70 PWLIBDIR=$(HOME)/pwlib
71 endif
72
73 #CFLAGS+=$(shell [ -f $(ZAPDIR)/libzap.a ] && echo "-I$(ZAPDIR)")
74
75 all: depend $(CHANNEL_LIBS) 
76
77 clean:
78         rm -f *.so *.o .depend
79         rm -f busy.h ringtone.h gentone gentone-ulaw
80
81 %.so : %.o
82         $(CC) $(SOLINK) -o $@ $<
83
84 ifneq ($(wildcard .depend),)
85 include .depend
86 endif
87
88 gentone: gentone.c
89         $(CC) -o gentone gentone.c -lm
90
91 gentone-ulaw: gentone-ulaw.c
92         $(CC) -o gentone-ulaw gentone-ulaw.c -lm
93
94 busy.h: gentone
95         ./gentone busy 480 620
96
97 ringtone.h: gentone
98         ./gentone ringtone 440 480
99
100 chan_oss.o: chan_oss.c  busy.h ringtone.h
101
102 ifeq (${OSARCH},OpenBSD)
103 chan_oss.so: chan_oss.o
104         $(CC) $(SOLINK) -o $@ chan_oss.o -lossaudio
105 endif
106
107 chan_iax2.so: chan_iax2.o iax2-parser.o
108 ifeq ($(USE_MYSQL_FRIENDS),1)
109         $(CC) $(SOLINK) -o $@ chan_iax2.o iax2-parser.o -L/usr/lib/mysql -lmysqlclient -lz
110 else
111         $(CC) $(SOLINK) -o $@ chan_iax2.o iax2-parser.o
112 endif
113
114 chan_iax.so: chan_iax.o
115 ifeq ($(USE_MYSQL_FRIENDS),1)
116         $(CC) $(SOLINK) -o $@ chan_iax.o -L/usr/lib/mysql -lmysqlclient -lz
117 else
118         $(CC) $(SOLINK) -o $@ chan_iax.o
119 endif
120
121 chan_zap.o: chan_zap.c
122         $(CC) -c $(CFLAGS) -o chan_zap.o chan_zap.c
123
124 chan_zap.so: chan_zap.o
125         $(CC) $(SOLINK) -o $@ $<  $(ZAPPRI) $(ZAPR2) -ltonezone
126
127 chan_sip.so: chan_sip.o
128 ifeq ($(USE_MYSQL_FRIENDS),1)
129         $(CC) $(SOLINK) -o $@ chan_sip.o -L/usr/lib/mysql -lmysqlclient -lz
130 else
131         $(CC) $(SOLINK) -o $@ chan_sip.o
132 endif
133
134 chan_alsa.o: $(ALSA_SRC)
135
136
137 chan_alsa.so: chan_alsa.o
138         $(CC) $(SOLINK) -o $@ $< -lasound -lm -ldl
139
140 chan_nbs.so: chan_nbs.o
141         $(CC) $(SOLINK) -o $@ $< -lnbs
142
143 chan_vpb.o: chan_vpb.c
144         $(CXX) -c $(CFLAGS) -o $@ chan_vpb.c
145
146 chan_vpb.so: chan_vpb.o
147          $(CXX) $(SOLINK) -o $@ $< -lvpb -lpthread -lm -ldl
148
149 chan_h323.so: chan_h323.o h323/libchanh323.a
150         $(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
151
152
153 #chan_modem.so : chan_modem.o
154 #       $(CC) -rdynamic -shared -Xlinker -x -o $@ $<
155
156 install: all
157         for x in $(CHANNEL_LIBS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
158
159 depend: .depend
160
161 .depend:
162         ../mkdep $(CFLAGS) `ls *.c`
163