remove deprecated chan_modem drivers
[asterisk/asterisk.git] / channels / Makefile
1 #
2 # Asterisk -- A telephony toolkit for Linux.
3
4 # Makefile for channel drivers
5 #
6 # Copyright (C) 1999-2005, Mark Spencer
7 #
8 # Mark Spencer <markster@digium.com>
9 #
10 # Edited By Belgarath <> Aug 28 2004
11 # Added bare bones ultrasparc-linux support.
12 #
13 # This program is free software, distributed under the terms of
14 # the GNU General Public License
15 #
16
17 CHANNEL_LIBS=chan_sip.so chan_agent.so chan_mgcp.so chan_iax2.so chan_local.so chan_skinny.so chan_features.so
18
19 ifeq ($(findstring BSD,${OSARCH}),BSD)
20  CFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include -L$(CROSS_COMPILE_TARGET)/usr/local/lib
21 endif
22
23 ifeq (${OSARCH},OpenBSD)
24   PTLIB=-lpt_OpenBSD_x86_r
25   H323LIB=-lh323_OpenBSD_x86_r
26 endif
27
28 ifeq (${OSARCH},Linux)
29   PTLIB=-lpt_linux_x86_r
30   H323LIB=-lh323_linux_x86_r
31   CHANH323LIB=-ldl
32 endif
33
34 ifeq (${OSARCH},CYGWIN)
35 CYGSOLINK=-Wl,--out-implib=lib$@.a -Wl,--export-all-symbols
36 CYGSOLIB=-L.. -L. -L../res -lasterisk.dll -lres_features.so
37 CYG_CHAN_AGENT=-lres_monitor.so
38 endif
39
40 ifeq ($(PROC),sparc64)
41   PROC=ultrasparc
42   CFLAGS += -mtune=$(PROC) -O3 -pipe -fomit-frame-pointer -mcpu=v8
43 endif
44
45 ifeq (${OSARCH},FreeBSD)
46   PTLIB=-lpt_FreeBSD_x86_r
47   H323LIB=-lh323_FreeBSD_x86_r
48   CHANH323LIB=-pthread
49 endif
50
51 ifeq (${OSARCH},NetBSD)
52   PTLIB=-lpt_NetBSD_x86_r
53   H323LIB=-lh323_NetBSD_x86_r
54 endif
55
56 ifneq (${OSARCH},Darwin)
57   ifneq (${OSARCH},SunOS)
58     ifneq (${OSARCH},CYGWIN)
59        CHANNEL_LIBS+=chan_oss.so
60     endif
61   endif
62 endif
63
64 ifeq (${OSARCH},SunOS)
65   SOLINK+=-lrt
66 endif
67
68 ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/linux/ixjuser.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/ixjuser.h),)
69   CHANNEL_LIBS+=chan_phone.so
70 endif
71
72 ifneq ($(wildcard h323/libchanh323.a),)
73   CHANNEL_LIBS+=chan_h323.so
74 endif
75
76 ifneq ($(wildcard misdn/chan_misdn_lib.a),)
77   CHANNEL_LIBS+=chan_misdn.so
78   CFLAGS+=-Imisdn 
79 endif
80
81 CFLAGS+=-Wno-missing-prototypes -Wno-missing-declarations
82
83 ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/alsa/asoundlib.h),)
84   CHANNEL_LIBS+=chan_alsa.so
85 endif
86
87 ifndef WITHOUT_PRI
88 ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/lib/libpri.so.1)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/lib/libpri.so.1),)
89   CFLAGS+=-DZAPATA_PRI
90   ZAPPRI=-lpri
91 endif
92 endif # WITHOUT_PRI
93
94 ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/lib/libmfcr2.so.1)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/lib/libmfcr2.so.1),)
95   CFLAGS+=-DZAPATA_R2
96   ZAPR2=-lmfcr2
97 endif
98
99 ALSA_SRC=chan_alsa.c
100
101 ifneq ($(wildcard alsa-monitor.h),)
102   CFLAGS+=-DALSA_MONITOR
103   ALSA_SRC+=alsa-monitor.h
104 endif
105
106 ifndef WITHOUT_ZAPTEL
107 ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/linux/zaptel.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/zaptel.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/pkg/include/zaptel.h),)
108   ifeq (${OSARCH},NetBSD)
109     SOLINK+=-L$(CROSS_COMPILE_TARGET)/usr/pkg/lib
110   endif
111   ifeq (${OSARCH},FreeBSD)
112     SOLINK+=-L$(CROSS_COMPILE_TARGET)/usr/local/lib
113   endif
114   CFLAGS+=-DIAX_TRUNKING
115   CHANNEL_LIBS+=chan_zap.so
116 endif
117 endif # WITHOUT_ZAPTEL
118
119 ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/vpbapi.h),)
120   CHANNEL_LIBS+=chan_vpb.so
121   CFLAGS+=-DLINUX
122 endif
123
124 CFLAGS+=-DCRYPTO
125
126 ifneq ($(OSARCH),CYGWIN)
127 CFLAGS+=-fPIC
128 endif
129
130 CFLAGS+=#-DVOFRDUMPER
131
132 ZAPDIR=/usr/lib
133
134 ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/nbs.h),)
135   CHANNEL_LIBS+=chan_nbs.so
136 endif
137
138 ifndef OPENH323DIR
139   OPENH323DIR=$(HOME)/openh323
140 endif
141
142 ifndef PWLIBDIR
143   PWLIBDIR=$(HOME)/pwlib
144 endif
145
146 #CFLAGS+=$(shell [ -f $(ZAPDIR)/libzap.a ] && echo "-I$(ZAPDIR)")
147
148 all: depend $(CHANNEL_LIBS) 
149
150 clean:
151         rm -f *.so *.o .depend
152         rm -f busy.h ringtone.h gentone gentone-ulaw
153
154 %.so : %.o
155         $(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} ${LIBS}
156
157 ifneq ($(wildcard .depend),)
158   include .depend
159 endif
160
161 ifneq ($(wildcard h323/Makefile.ast),)
162   include h323/Makefile.ast
163 endif
164
165 ifneq ($(wildcard misdn/Makefile.ast),)
166   include misdn/Makefile.ast
167 endif
168
169 gentone: gentone.c
170         $(HOST_CC) -o gentone gentone.c -lm
171
172 gentone-ulaw: gentone-ulaw.c
173         $(HOST_CC) -o gentone-ulaw gentone-ulaw.c -lm
174
175 busy.h: gentone
176         ./gentone busy 480 620
177
178 ringtone.h: gentone
179         ./gentone ringtone 440 480
180
181 chan_oss.o: chan_oss.c busy.h ringtone.h
182
183 chan_alsa.o: chan_alsa.c busy.h ringtone.h
184
185 ifeq (${OSARCH},OpenBSD)
186 chan_oss.so: chan_oss.o
187         $(CC) $(SOLINK) -o $@ chan_oss.o -lossaudio
188 endif
189 ifeq (${OSARCH},NetBSD)
190 chan_oss.so: chan_oss.o
191         $(CC) $(SOLINK) -o $@ chan_oss.o -lossaudio
192 endif
193
194 chan_iax2.so: chan_iax2.o iax2-parser.o iax2-provision.o
195         $(CC) $(SOLINK) -o $@ ${CYGSOLINK} chan_iax2.o iax2-parser.o iax2-provision.o ${CYGSOLIB}
196
197 chan_zap.o: chan_zap.c
198         $(CC) -c $(CFLAGS) -o chan_zap.o chan_zap.c
199
200 chan_zap.so: chan_zap.o
201         $(CC) $(SOLINK) -o $@ $<  $(ZAPPRI) $(ZAPR2) -ltonezone
202
203 chan_sip.so: chan_sip.o
204         $(CC) $(SOLINK) -o $@ ${CYGSOLINK} chan_sip.o ${CYGSOLIB}
205
206 chan_agent.so: chan_agent.o
207         $(CC) $(SOLINK) -o $@ ${CYGSOLINK} chan_agent.o ${CYGSOLIB} ${CYG_CHAN_AGENT}
208
209 chan_alsa.o: $(ALSA_SRC)
210
211 chan_alsa.so: chan_alsa.o
212         $(CC) $(SOLINK) -o $@ $< -lasound -lm -ldl
213
214 chan_nbs.so: chan_nbs.o
215         $(CC) $(SOLINK) -o $@ $< -lnbs
216
217 chan_vpb.o: chan_vpb.c
218         $(CXX) -c $(CFLAGS) -o $@ chan_vpb.c
219
220 chan_vpb.so: chan_vpb.o
221          $(CXX) $(SOLINK) -o $@ $< -lvpb -lpthread -lm -ldl
222
223 ifeq (${OSARCH},Linux)
224 chan_h323.so: chan_h323.o h323/libchanh323.a h323/Makefile.ast
225         $(CC) $(SOLINK) $(H323LDFLAGS) -o $@ $< h323/libchanh323.a $(H323LDLIBS) -lstdc++
226 else
227 chan_h323.so: chan_h323.o h323/libchanh323.a
228         $(CC) $(SOLINK) -o $@ $< h323/libchanh323.a $(CHANH323LIB) -L$(PWLIBDIR)/lib $(PTLIB) -L$(OPENH323DIR)/lib $(H323LIB) -L/usr/lib -lcrypto -lssl -lexpat
229 endif
230
231 chan_misdn.so: chan_misdn.o chan_misdn_config.o misdn/chan_misdn_lib.a
232         $(CC) -shared -Xlinker -x -L/usr/lib -o $@ $^ -lisdnnet -lmISDN
233
234 chan_misdn.o: chan_misdn.c
235         $(CC) $(CFLAGS) -DCHAN_MISDN_VERSION=\"0.2.1\" -c $< -o $@
236
237 install: all
238         for x in $(CHANNEL_LIBS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
239         if ! [ -f chan_iax.so ]; then rm -f $(DESTDIR)$(MODULES_DIR)/chan_iax.so ; fi
240
241 depend: .depend
242
243 .depend:
244         ../build_tools/mkdep $(CFLAGS) `ls *.c`
245
246 env:
247         env
248