Build fix for H.323 (bug #127)
[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 CHANNEL_LIBS+=$(shell [ -f h323/libchanh323.a ] && echo chan_h323.so)
29
30 CFLAGS+=-Wno-missing-prototypes -Wno-missing-declarations
31 CFLAGS+=$(shell [ ! -f /usr/include/linux/if_wanpipe.h ] && echo " -DOLD_SANGOMA_API")
32 CHANNEL_LIBS+=$(shell [ -f /usr/include/alsa/asoundlib.h ] && echo "chan_alsa.so")
33 CFLAGS+=$(shell [ -f /usr/lib/libpri.so.1 ] && echo " -DZAPATA_PRI")
34 CFLAGS+=$(shell [ -f /usr/lib/libmfcr2.so.1 ] && echo " -DZAPATA_R2")
35 CFLAGS+=$(shell [ -f alsa-monitor.h ] && echo " -DALSA_MONITOR")
36 ZAPPRI=$(shell [ -f /usr/lib/libpri.so.1 ] && echo "-lpri")
37 ZAPR2=$(shell [ -f /usr/lib/libmfcr2.so.1 ] && echo "-lmfcr2")
38 CHANZAP=$(shell if [ -f .oldzap ]; then echo "chan_zap_old.c"; else echo "chan_zap.c"; fi)
39 ZAPLIB=$(shell if [ -f .oldzap ]; then echo "-lzap"; fi)
40 CFLAGS+=$(shell [ -f /usr/include/linux/zaptel.h ] && echo "-DIAX_TRUNKING")
41 CHANNEL_LIBS+=$(shell [ -f /usr/include/vpbapi.h ] && echo "chan_vpb.so" )
42
43 ALSA_SRC=chan_alsa.c
44 ALSA_SRC+=$(shell [ -f alsa-monitor.h ] && echo "alsa-monitor.h")
45
46 CFLAGS+=-DCRYPTO
47 CFLAGS+=-fPIC
48
49 CFLAGS+=#-DVOFRDUMPER
50
51 ZAPDIR=/usr/lib
52
53 CHANNEL_LIBS+=$(shell [ -f /usr/include/linux/zaptel.h ] && echo "chan_zap.so")
54
55 CHANNEL_LIBS+=$(shell [ -f /usr/include/nbs.h ] && echo "chan_nbs.so" )
56
57 ifndef OPENH323DIR
58 OPENH323DIR=$(HOME)/openh323
59 endif
60
61 ifndef PWLIBDIR
62 PWLIBDIR=$(HOME)/pwlib
63 endif
64
65 #CFLAGS+=$(shell [ -f $(ZAPDIR)/libzap.a ] && echo "-I$(ZAPDIR)")
66
67 all: depend $(CHANNEL_LIBS) 
68
69 clean:
70         rm -f *.so *.o .depend
71         rm -f busy.h ringtone.h gentone gentone-ulaw
72
73 %.so : %.o
74         $(CC) -shared -Xlinker -x -o $@ $<
75
76 include .depend
77
78 gentone: gentone.c
79         $(CC) -o gentone gentone.c -lm
80
81 gentone-ulaw: gentone-ulaw.c
82         $(CC) -o gentone-ulaw gentone-ulaw.c -lm
83
84 busy.h: gentone
85         ./gentone busy 480 620
86
87 ringtone.h: gentone
88         ./gentone ringtone 440 480
89
90 chan_oss.o: chan_oss.c  busy.h ringtone.h
91
92 chan_iax2.so: chan_iax2.o iax2-parser.o
93 ifeq (${OSARCH},Linux)
94         $(CC) -shared -Xlinker -x -o $@ chan_iax2.o iax2-parser.o
95 else
96         $(CC) -shared -Xlinker -x -o $@ chan_iax2.o iax2-parser.o -lossaudio
97 endif
98
99 chan_zap.o: $(CHANZAP)
100         $(CC) -c $(CFLAGS) -o chan_zap.o $(CHANZAP)
101
102 chan_zap.so: chan_zap.o
103         $(CC) -shared -Xlinker -x -o $@ $<  $(ZAPPRI) $(ZAPR2) -ltonezone $(ZAPLIB)
104
105 chan_alsa.o: $(ALSA_SRC)
106
107
108 chan_alsa.so: chan_alsa.o
109         $(CC) -shared -Xlinker -x -o $@ $< -lasound -lm -ldl
110
111 chan_nbs.so: chan_nbs.o
112         $(CC) -shared -Xlinker -x -o $@ $< -lnbs
113
114 chan_vpb.o: chan_vpb.c
115         $(CXX) -c $(CFLAGS) -o $@ chan_vpb.c
116
117 chan_vpb.so: chan_vpb.o
118          $(CXX) -shared -Xlinker -x -o $@ $< -lvpb -lpthread -lm -ldl
119
120 chan_h323.so: chan_h323.o h323/libchanh323.a
121         $(CC) -shared -Xlinker -x -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
122
123
124 #chan_modem.so : chan_modem.o
125 #       $(CC) -rdynamic -shared -Xlinker -x -o $@ $<
126
127 install: all
128         for x in $(CHANNEL_LIBS); do $(INSTALL) -m 755 $$x $(MODULES_DIR) ; done
129
130 depend: .depend
131
132 .depend:
133         ../mkdep $(CFLAGS) `ls *.c`
134