Sun Mar 16 07:00:01 CET 2003
[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 CFLAGS+=$(shell [ -f /usr/include/linux/zaptel.h ] && echo "-DIAX_TRUNKING")
37
38 ALSA_SRC=chan_alsa.c
39 ALSA_SRC+=$(shell [ -f alsa-monitor.h ] && echo "alsa-monitor.h")
40
41 CFLAGS+=-DCRYPTO
42
43 CFLAGS+=#-DVOFRDUMPER
44
45 ZAPDIR=/usr/lib
46
47 CHANNEL_LIBS+=$(shell [ -f /usr/include/linux/zaptel.h ] && echo "chan_zap.so")
48
49 CHANNEL_LIBS+=$(shell [ -f /usr/include/nbs.h ] && echo "chan_nbs.so" )
50
51 #CFLAGS+=$(shell [ -f $(ZAPDIR)/libzap.a ] && echo "-I$(ZAPDIR)")
52
53 all: $(CHANNEL_LIBS) 
54
55 clean:
56         rm -f *.so *.o
57         rm -f busy.h ringtone.h gentone gentone-ulaw
58
59 %.so : %.o
60         $(CC) -shared -Xlinker -x -o $@ $<
61
62 gentone: gentone.c
63         $(CC) -o gentone gentone.c -lm
64
65 gentone-ulaw: gentone-ulaw.c
66         $(CC) -o gentone-ulaw gentone-ulaw.c -lm
67
68 busy.h: gentone
69         ./gentone busy 480 620
70
71 ringtone.h: gentone
72         ./gentone ringtone 440 480
73
74 chan_oss.o: chan_oss.c  busy.h ringtone.h
75
76 chan_zap.o: $(CHANZAP)
77         $(CC) -c $(CFLAGS) -o chan_zap.o $(CHANZAP)
78
79 chan_zap.so: chan_zap.o
80         $(CC) -shared -Xlinker -x -o $@ $<  $(ZAPPRI) $(ZAPR2) -ltonezone $(ZAPLIB)
81
82 chan_alsa.o: $(ALSA_SRC)
83
84 chan_alsa.so: chan_alsa.o
85         $(CC) -shared -Xlinker -x -o $@ $< -lasound -lm -ldl
86
87 chan_nbs.so: chan_nbs.o
88         $(CC) -shared -Xlinker -x -o $@ $< -lnbs
89
90 #chan_modem.so : chan_modem.o
91 #       $(CC) -rdynamic -shared -Xlinker -x -o $@ $<
92
93 install: all
94         for x in $(CHANNEL_LIBS); do $(INSTALL) -m 755 $$x $(MODULES_DIR) ; done