179a90072fd0a7437c16e0f944008bb40cd2ac2d
[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 CHANNEL_LIBS=chan_modem.so chan_iax.so chan_sip.so \
15              chan_modem_aopen.so chan_oss.so \
16              chan_modem_bestdata.so chan_modem_i4l.so \
17              chan_agent.so chan_mgcp.so chan_iax2.so \
18              chan_local.so
19
20 #
21 # If you really want VoFR you can have it :-P
22 #
23 #CHANNEL_LIBS+=chan_vofr
24
25 CHANNEL_LIBS+=$(shell [ -f /usr/include/linux/ixjuser.h ] && echo chan_phone.so)
26
27 CFLAGS+=-Wno-missing-prototypes -Wno-missing-declarations
28 CFLAGS+=$(shell [ ! -f /usr/include/linux/if_wanpipe.h ] && echo " -DOLD_SANGOMA_API")
29 CHANNEL_LIBS+=$(shell [ -f /usr/include/alsa/asoundlib.h ] && echo "chan_alsa.so")
30 CFLAGS+=$(shell [ -f /usr/lib/libpri.so.1 ] && echo " -DZAPATA_PRI")
31 CFLAGS+=$(shell [ -f /usr/lib/libmfcr2.so.1 ] && echo " -DZAPATA_R2")
32 CFLAGS+=$(shell [ -f alsa-monitor.h ] && echo " -DALSA_MONITOR")
33 ZAPPRI=$(shell [ -f /usr/lib/libpri.so.1 ] && echo "-lpri")
34 ZAPR2=$(shell [ -f /usr/lib/libmfcr2.so.1 ] && echo "-lmfcr2")
35 CHANZAP=$(shell if [ -f .oldzap ]; then echo "chan_zap_old.c"; else echo "chan_zap.c"; fi)
36 ZAPLIB=$(shell if [ -f .oldzap ]; then echo "-lzap"; fi)
37 CFLAGS+=$(shell [ -f /usr/include/linux/zaptel.h ] && echo "-DIAX_TRUNKING")
38 CHANNEL_LIBS+=$(shell [ -f /usr/include/vpbapi.h ] && echo "chan_vpb.so" )
39
40 ALSA_SRC=chan_alsa.c
41 ALSA_SRC+=$(shell [ -f alsa-monitor.h ] && echo "alsa-monitor.h")
42
43 CFLAGS+=-DCRYPTO
44
45 CFLAGS+=#-DVOFRDUMPER
46
47 ZAPDIR=/usr/lib
48
49 CHANNEL_LIBS+=$(shell [ -f /usr/include/linux/zaptel.h ] && echo "chan_zap.so")
50
51 CHANNEL_LIBS+=$(shell [ -f /usr/include/nbs.h ] && echo "chan_nbs.so" )
52
53 #CFLAGS+=$(shell [ -f $(ZAPDIR)/libzap.a ] && echo "-I$(ZAPDIR)")
54
55 all: $(CHANNEL_LIBS) 
56
57 clean:
58         rm -f *.so *.o
59         rm -f busy.h ringtone.h gentone gentone-ulaw
60
61 %.so : %.o
62         $(CC) -shared -Xlinker -x -o $@ $<
63
64 gentone: gentone.c
65         $(CC) -o gentone gentone.c -lm
66
67 gentone-ulaw: gentone-ulaw.c
68         $(CC) -o gentone-ulaw gentone-ulaw.c -lm
69
70 busy.h: gentone
71         ./gentone busy 480 620
72
73 ringtone.h: gentone
74         ./gentone ringtone 440 480
75
76 chan_oss.o: chan_oss.c  busy.h ringtone.h
77
78 chan_iax2.so: chan_iax2.o iax2-parser.o
79         $(CC) -shared -Xlinker -x -o $@ chan_iax2.o iax2-parser.o
80
81 chan_zap.o: $(CHANZAP)
82         $(CC) -c $(CFLAGS) -o chan_zap.o $(CHANZAP)
83
84 chan_zap.so: chan_zap.o
85         $(CC) -shared -Xlinker -x -o $@ $<  $(ZAPPRI) $(ZAPR2) -ltonezone $(ZAPLIB)
86
87 chan_alsa.o: $(ALSA_SRC)
88
89
90 chan_alsa.so: chan_alsa.o
91         $(CC) -shared -Xlinker -x -o $@ $< -lasound -lm -ldl
92
93 chan_nbs.so: chan_nbs.o
94         $(CC) -shared -Xlinker -x -o $@ $< -lnbs
95
96 chan_vpb.o: chan_vpb.c
97         $(CXX) -c $(CFLAGS) -o $@ chan_vpb.c
98
99 chan_vpb.so: chan_vpb.o
100          $(CXX) -shared -Xlinker -x -o $@ $< -lvpb -lpthread -lm -ldl
101
102 #chan_modem.so : chan_modem.o
103 #       $(CC) -rdynamic -shared -Xlinker -x -o $@ $<
104
105 install: all
106         for x in $(CHANNEL_LIBS); do $(INSTALL) -m 755 $$x $(MODULES_DIR) ; done