Bug #1222: Fixed
[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 USE_MYSQL_FRIENDS=0
17
18 CHANNEL_LIBS=chan_modem.so chan_iax.so chan_sip.so \
19              chan_modem_aopen.so \
20              chan_modem_bestdata.so chan_modem_i4l.so \
21              chan_agent.so chan_mgcp.so chan_iax2.so \
22              chan_local.so chan_skinny.so
23
24 #
25 # If you really want VoFR you can have it :-P
26 #
27 #CHANNEL_LIBS+=chan_vofr
28
29 ifneq (${OSARCH},Darwin)
30 CHANNEL_LIBS+=chan_oss.so
31 endif
32
33 CHANNEL_LIBS+=$(shell [ -f /usr/include/linux/ixjuser.h ] && echo chan_phone.so)
34 CHANNEL_LIBS+=$(shell [ -f h323/libchanh323.a ] && echo chan_h323.so)
35
36 CFLAGS+=-Wno-missing-prototypes -Wno-missing-declarations
37 CFLAGS+=$(shell [ ! -f /usr/include/linux/if_wanpipe.h ] && echo " -DOLD_SANGOMA_API")
38 CHANNEL_LIBS+=$(shell [ -f /usr/include/alsa/asoundlib.h ] && echo "chan_alsa.so")
39 CFLAGS+=$(shell [ -f /usr/lib/libpri.so.1 ] && echo " -DZAPATA_PRI")
40 CFLAGS+=$(shell [ -f /usr/lib/libmfcr2.so.1 ] && echo " -DZAPATA_R2")
41 CFLAGS+=$(shell [ -f alsa-monitor.h ] && echo " -DALSA_MONITOR")
42 ZAPPRI=$(shell [ -f /usr/lib/libpri.so.1 ] && echo "-lpri")
43 ZAPR2=$(shell [ -f /usr/lib/libmfcr2.so.1 ] && echo "-lmfcr2")
44 CFLAGS+=$(shell [ -f /usr/include/linux/zaptel.h ] && echo "-DIAX_TRUNKING")
45 CHANNEL_LIBS+=$(shell [ -f /usr/include/vpbapi.h ] && echo "chan_vpb.so" )
46 CFLAGS+=$(shell [ -f /usr/include/vpbapi.h] && echo " -DLINUX")
47
48 ALSA_SRC=chan_alsa.c
49 ALSA_SRC+=$(shell [ -f alsa-monitor.h ] && echo "alsa-monitor.h")
50
51 CFLAGS+=-DCRYPTO
52 CFLAGS+=-fPIC
53
54 ifeq ($(USE_MYSQL_FRIENDS),1)
55 CFLAGS+=-DMYSQL_FRIENDS
56 endif
57
58 CFLAGS+=#-DVOFRDUMPER
59
60 ZAPDIR=/usr/lib
61
62 CHANNEL_LIBS+=$(shell [ -f /usr/include/linux/zaptel.h ] && echo "chan_zap.so")
63
64 CHANNEL_LIBS+=$(shell [ -f /usr/include/nbs.h ] && echo "chan_nbs.so" )
65
66 ifndef OPENH323DIR
67 OPENH323DIR=$(HOME)/openh323
68 endif
69
70 ifndef PWLIBDIR
71 PWLIBDIR=$(HOME)/pwlib
72 endif
73
74 #CFLAGS+=$(shell [ -f $(ZAPDIR)/libzap.a ] && echo "-I$(ZAPDIR)")
75
76 all: depend $(CHANNEL_LIBS) 
77
78 clean:
79         rm -f *.so *.o .depend
80         rm -f busy.h ringtone.h gentone gentone-ulaw
81
82 %.so : %.o
83         $(CC) $(SOLINK) -o $@ $<
84
85 ifneq ($(wildcard .depend),)
86 include .depend
87 endif
88
89 gentone: gentone.c
90         $(CC) -o gentone gentone.c -lm
91
92 gentone-ulaw: gentone-ulaw.c
93         $(CC) -o gentone-ulaw gentone-ulaw.c -lm
94
95 busy.h: gentone
96         ./gentone busy 480 620
97
98 ringtone.h: gentone
99         ./gentone ringtone 440 480
100
101 chan_oss.o: chan_oss.c  busy.h ringtone.h
102
103 ifeq (${OSARCH},OpenBSD)
104 chan_oss.so: chan_oss.o
105         $(CC) $(SOLINK) -o $@ chan_oss.o -lossaudio
106 endif
107
108 chan_iax2.so: chan_iax2.o iax2-parser.o
109 ifeq ($(USE_MYSQL_FRIENDS),1)
110         $(CC) $(SOLINK) -o $@ chan_iax2.o iax2-parser.o -L/usr/lib/mysql -lmysqlclient -lz
111 else
112         $(CC) $(SOLINK) -o $@ chan_iax2.o iax2-parser.o
113 endif
114
115 chan_iax.so: chan_iax.o
116 ifeq ($(USE_MYSQL_FRIENDS),1)
117         $(CC) $(SOLINK) -o $@ chan_iax.o -L/usr/lib/mysql -lmysqlclient -lz
118 else
119         $(CC) $(SOLINK) -o $@ chan_iax.o
120 endif
121
122 chan_zap.o: chan_zap.c
123         $(CC) -c $(CFLAGS) -o chan_zap.o chan_zap.c
124
125 chan_zap.so: chan_zap.o
126         $(CC) $(SOLINK) -o $@ $<  $(ZAPPRI) $(ZAPR2) -ltonezone
127
128 chan_sip.so: chan_sip.o
129 ifeq ($(USE_MYSQL_FRIENDS),1)
130         $(CC) $(SOLINK) -o $@ chan_sip.o -L/usr/lib/mysql -lmysqlclient -lz
131 else
132         $(CC) $(SOLINK) -o $@ chan_sip.o
133 endif
134
135 chan_alsa.o: $(ALSA_SRC)
136
137
138 chan_alsa.so: chan_alsa.o
139         $(CC) $(SOLINK) -o $@ $< -lasound -lm -ldl
140
141 chan_nbs.so: chan_nbs.o
142         $(CC) $(SOLINK) -o $@ $< -lnbs
143
144 chan_vpb.o: chan_vpb.c
145         $(CXX) -c $(CFLAGS) -o $@ chan_vpb.c
146
147 chan_vpb.so: chan_vpb.o
148          $(CXX) $(SOLINK) -o $@ $< -lvpb -lpthread -lm -ldl
149
150 chan_h323.so: chan_h323.o h323/libchanh323.a
151         $(CC) $(SOLINK) -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
152
153
154 #chan_modem.so : chan_modem.o
155 #       $(CC) -rdynamic -shared -Xlinker -x -o $@ $<
156
157 install: all
158         for x in $(CHANNEL_LIBS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
159
160 depend: .depend
161
162 .depend:
163         ../mkdep $(CFLAGS) `ls *.c`
164