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