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