2f5945ca20ede0aeaf2a463bdb5716eafaa50abf
[asterisk/asterisk.git] / Makefile
1 #
2 # Asterisk -- A telephony toolkit for Linux.
3
4 # Top level Makefile
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 .EXPORT_ALL_VARIABLES:
15
16 # Create OPTIONS variable
17 OPTIONS=
18
19 OSARCH=$(shell uname -s)
20
21 ifeq (${OSARCH},Linux)
22 PROC=$(shell uname -m)
23 ifeq ($(PROC),x86_64)
24 # You must have GCC 3.4 to use k8, otherwise use athlon
25 PROC=k8
26 #PROC=athlon
27 OPTIONS+=-m64
28 endif
29 endif
30
31 ifeq ($(findstring BSD,${OSARCH}),BSD)
32 PROC=$(shell uname -m)
33 endif
34
35 # Pentium Pro Optimize
36 #PROC=i686
37
38 # Pentium & VIA processors optimize
39 #PROC=i586
40
41 #PROC=k6
42 #PROC=ppc
43
44 PWD=$(shell pwd)
45
46 ######### More GSM codec optimization
47 ######### Uncomment to enable MMXTM optimizations for x86 architecture CPU's
48 ######### which support MMX instructions.  This should be newer pentiums,
49 ######### ppro's, etc, as well as the AMD K6 and K7.  
50 #K6OPT  = -DK6OPT
51
52 #Tell gcc to optimize the asterisk's code
53 OPTIMIZE=-O6
54
55 #Include debug symbols in the executables (-g) and profiling info (-pg)
56 DEBUG=-g #-pg
57
58 # If you are running a radio application, define RADIO_RELAX so that the DTMF
59 # will be received more reliably
60 #OPTIONS += -DRADIO_RELAX
61
62 # If you don't have a lot of memory (e.g. embedded Asterisk), uncomment the
63 # following to reduce the size of certain static buffers
64 #OPTIONS += -DLOW_MEMORY
65
66 # Optional debugging parameters
67 DEBUG_THREADS = #-DDEBUG_THREADS #-DDO_CRASH 
68
69 # Uncomment next one to enable ast_frame tracing (for debugging)
70 TRACE_FRAMES = #-DTRACE_FRAMES
71
72 # Uncomment next one to enable malloc debugging
73 # You can view malloc debugging with:
74 #   *CLI> show memory allocations [filename]
75 #   *CLI> show memory summary [filename]
76 #
77 MALLOC_DEBUG = #-include $(PWD)/include/asterisk/astmm.h
78
79 # Where to install asterisk after compiling
80 # Default -> leave empty
81 INSTALL_PREFIX=
82
83 # Staging directory
84 # Files are copied here temporarily during the install process
85 # For example, make DESTDIR=/tmp/asterisk woud put things in
86 # /tmp/asterisk/etc/asterisk
87 DESTDIR=
88
89 # Original busydetect routine
90 BUSYDETECT = #-DBUSYDETECT
91
92 # Improved busydetect routine, comment the previous one if you use this one
93 BUSYDETECT+= -DBUSYDETECT_MARTIN 
94 # Detect the busy signal looking only at tone lengths
95 # For example if you have 3 beeps 100ms tone, 100ms silence separated by 500 ms of silence
96 BUSYDETECT+= #-DBUSYDETECT_TONEONLY
97 # Inforce the detection of busy singal (get rid of false hangups)
98 # Don't use together with -DBUSYDETECT_TONEONLY
99 BUSYDETECT+= #-DBUSYDETECT_COMPARE_TONE_AND_SILENCE
100
101 ASTLIBDIR=$(INSTALL_PREFIX)/usr/lib/asterisk
102 ASTVARLIBDIR=$(INSTALL_PREFIX)/var/lib/asterisk
103 ASTETCDIR=$(INSTALL_PREFIX)/etc/asterisk
104 ASTSPOOLDIR=$(INSTALL_PREFIX)/var/spool/asterisk
105 ASTLOGDIR=$(INSTALL_PREFIX)/var/log/asterisk
106 ASTHEADERDIR=$(INSTALL_PREFIX)/usr/include/asterisk
107 ASTCONFPATH=$(ASTETCDIR)/asterisk.conf
108 ASTBINDIR=$(INSTALL_PREFIX)/usr/bin
109 ASTSBINDIR=$(INSTALL_PREFIX)/usr/sbin
110 ASTVARRUNDIR=$(INSTALL_PREFIX)/var/run
111 ASTMANDIR=$(INSTALL_PREFIX)/usr/share/man
112
113 MODULES_DIR=$(ASTLIBDIR)/modules
114 AGI_DIR=$(ASTVARLIBDIR)/agi-bin
115
116 INCLUDE=-Iinclude -I../include
117 CFLAGS=-pipe  -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG) $(INCLUDE) -D_REENTRANT -D_GNU_SOURCE #-DMAKE_VALGRIND_HAPPY
118 CFLAGS+=$(OPTIMIZE)
119 CFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
120 CFLAGS+=$(shell if uname -m | grep -q ppc; then echo "-fsigned-char"; fi)
121 CFLAGS+=$(shell if [ -f /usr/include/osp/osp.h ]; then echo "-DOSP_SUPPORT -I/usr/include/osp" ; fi)
122
123 ifeq (${OSARCH},FreeBSD)
124 OSVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk)
125 CFLAGS+=$(if ${OSVERSION}<500016,-D_THREAD_SAFE)
126 LIBS+=$(if ${OSVERSION}<502102,-lc_r,-pthread)
127 INCLUDE+=-I/usr/local/include
128 CFLAGS+=$(shell if [ -d /usr/local/include/spandsp ]; then echo "-I/usr/local/include/spandsp"; fi)
129 endif # FreeBSD
130
131 ifeq (${OSARCH},OpenBSD)
132 CFLAGS+=-pthread
133 endif
134
135 #Uncomment this to use the older DSP routines
136 #CFLAGS+=-DOLD_DSP_ROUTINES
137
138 CFLAGS+=$(shell if [ -f /usr/include/linux/zaptel.h ]; then echo "-DZAPTEL_OPTIMIZATIONS"; fi)
139 CFLAGS+=$(shell if [ -f /usr/local/include/zaptel.h ]; then echo "-DZAPTEL_OPTIMIZATIONS"; fi)
140
141 LIBEDIT=editline/libedit.a
142
143 ASTERISKVERSION=$(shell if [ -f .version ]; then cat .version; else if [ -d CVS ]; then if [ -f CVS/Tag ] ; then echo "CVS-`sed 's/^T//g' CVS/Tag`-`date +"%D-%T"`"; else echo "CVS-HEAD-`date +"%D-%T"`"; fi; fi; fi)
144 HTTPDIR=$(shell if [ -d /var/www ]; then echo "/var/www"; else echo "/home/httpd"; fi)
145 RPMVERSION=$(shell if [ -f .version ]; then sed 's/[-\/:]/_/g' .version; else echo "unknown" ; fi)
146 CFLAGS+=-DASTERISK_VERSION=\"$(ASTERISKVERSION)\"
147 CFLAGS+=-DINSTALL_PREFIX=\"$(INSTALL_PREFIX)\"
148 CFLAGS+=-DASTETCDIR=\"$(ASTETCDIR)\"
149 CFLAGS+=-DASTLIBDIR=\"$(ASTLIBDIR)\"
150 CFLAGS+=-DASTVARLIBDIR=\"$(ASTVARLIBDIR)\"
151 CFLAGS+=-DASTVARRUNDIR=\"$(ASTVARRUNDIR)\"
152 CFLAGS+=-DASTSPOOLDIR=\"$(ASTSPOOLDIR)\"
153 CFLAGS+=-DASTLOGDIR=\"$(ASTLOGDIR)\"
154 CFLAGS+=-DASTCONFPATH=\"$(ASTCONFPATH)\"
155 CFLAGS+=-DASTMODDIR=\"$(MODULES_DIR)\"
156 CFLAGS+=-DASTAGIDIR=\"$(AGI_DIR)\"
157
158 CFLAGS+= $(DEBUG_THREADS)
159 CFLAGS+= $(TRACE_FRAMES)
160 CFLAGS+= $(MALLOC_DEBUG)
161 CFLAGS+= $(BUSYDETECT)
162 CFLAGS+= $(OPTIONS)
163 CFLAGS+=# -fomit-frame-pointer 
164 SUBDIRS=res channels pbx apps codecs formats agi cdr astman stdtime
165 ifeq (${OSARCH},Linux)
166 LIBS=-ldl -lpthread
167 endif
168 LIBS+=-lncurses -lm
169 ifeq (${OSARCH},Linux)
170 LIBS+=-lresolv  #-lnjamd
171 endif
172 ifeq (${OSARCH},Darwin)
173 LIBS+=-lresolv
174 endif
175 ifeq (${OSARCH},FreeBSD)
176 LIBS+=-lcrypto
177 endif
178 ifeq (${OSARCH},OpenBSD)
179 LIBS=-lcrypto -lpthread -lm -lncurses
180 endif
181 LIBS+=-lssl
182 OBJS=io.o sched.o logger.o frame.o loader.o config.o channel.o \
183         translate.o file.o say.o pbx.o cli.o md5.o term.o \
184         ulaw.o alaw.o callerid.o fskmodem.o image.o app.o \
185         cdr.o tdd.o acl.o rtp.o manager.o asterisk.o ast_expr.o \
186         dsp.o chanvars.o indications.o autoservice.o db.o privacy.o \
187         astmm.o enum.o srv.o dns.o aescrypt.o aestab.o aeskey.o \
188         utils.o 
189 ifeq (${OSARCH},Darwin)
190 OBJS+=poll.o dlfcn.o
191 ASTLINK=-Wl,-dynamic
192 SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
193 else
194 ASTLINK=-Wl,-E 
195 SOLINK=-shared -Xlinker -x
196 endif
197
198 CC=gcc
199 INSTALL=install
200
201 _all: all
202         @echo " +--------- Asterisk Build Complete ---------+"  
203         @echo " + Asterisk has successfully been built, but +"  
204         @echo " + cannot be run before being installed by   +"  
205         @echo " + running:                                  +"  
206         @echo " +                                           +"
207         @echo " +               $(MAKE) install                +"  
208         @echo " +-------------------------------------------+"  
209
210 all: depend asterisk subdirs 
211
212 editline/config.h:
213         cd editline && unset CFLAGS LIBS && ./configure ; \
214
215 editline/libedit.a: FORCE
216         cd editline && unset CFLAGS LIBS && test -f config.h || ./configure
217         $(MAKE) -C editline libedit.a
218
219 db1-ast/libdb1.a: FORCE
220         @if [ -d db1-ast ]; then \
221                 $(MAKE) -C db1-ast libdb1.a ; \
222         else \
223                 echo "You need to do a cvs update -d not just cvs update"; \
224                 exit 1; \
225         fi
226
227 ifneq ($(wildcard .depend),)
228 include .depend
229 endif
230
231 .PHONY: _version
232
233 _version: 
234         if [ -d CVS ] && ! [ -f .version ]; then echo $(ASTERISKVERSION) > .version; fi 
235
236 .version: _version
237
238 .y.c:
239         bison $< --name-prefix=ast_yy -o $@
240
241 ast_expr.o: ast_expr.c
242
243 cli.o: cli.c build.h
244
245 asterisk.o: asterisk.c build.h
246
247 manpage: asterisk.8.gz
248
249 asterisk.8.gz: asterisk.sgml
250         rm -f asterisk.8
251         docbook2man asterisk.sgml
252         mv ./*.8 asterisk.8
253         gzip asterisk.8
254
255 ifneq ($(strip $(ASTERISKVERSION)),)
256 build.h: .version
257         ./make_build_h
258 else
259 build.h:
260         ./make_build_h
261 endif
262
263 stdtime/libtime.a: FORCE
264         @if [ -d stdtime ]; then \
265                 $(MAKE) -C stdtime libtime.a ; \
266         else \
267                 echo "You need to do a cvs update -d not just cvs update"; \
268                 exit 1; \
269         fi
270
271 asterisk: editline/libedit.a db1-ast/libdb1.a stdtime/libtime.a $(OBJS)
272         $(CC) $(DEBUG) -o asterisk $(ASTLINK) $(OBJS) $(LIBEDIT) db1-ast/libdb1.a stdtime/libtime.a $(LIBS)
273
274 muted: muted.o
275         $(CC) -o muted muted.o
276
277 subdirs: 
278         for x in $(SUBDIRS); do $(MAKE) -C $$x || exit 1 ; done
279
280 clean:
281         for x in $(SUBDIRS); do $(MAKE) -C $$x clean || exit 1 ; done
282         rm -f *.o *.so asterisk .depend
283         rm -f build.h 
284         rm -f ast_expr.c
285         @if [ -e editline/Makefile ]; then $(MAKE) -C editline distclean ; fi
286         $(MAKE) -C db1-ast clean
287         $(MAKE) -C stdtime clean
288
289 datafiles: all
290         mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/digits
291         for x in sounds/digits/*.gsm; do \
292                 if grep -q "^%`basename $$x`%" sounds.txt; then \
293                         install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds/digits ; \
294                 else \
295                         echo "No description for $$x"; \
296                         exit 1; \
297                 fi; \
298         done
299         mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/letters
300         for x in sounds/letters/*.gsm; do \
301                 if grep -q "^%`basename $$x`%" sounds.txt; then \
302                         install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds/letters ; \
303                 else \
304                         echo "No description for $$x"; \
305                         exit 1; \
306                 fi; \
307         done
308         mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/phonetic
309         for x in sounds/phonetic/*.gsm; do \
310                 if grep -q "^%`basename $$x`%" sounds.txt; then \
311                         install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds/phonetic ; \
312                 else \
313                         echo "No description for $$x"; \
314                         exit 1; \
315                 fi; \
316         done
317         for x in sounds/vm-* sounds/transfer* sounds/pbx-* sounds/ss-* sounds/beep* sounds/dir-* sounds/conf-* sounds/agent-* sounds/invalid* sounds/tt-* sounds/auth-* sounds/privacy-* sounds/queue-*; do \
318                 if grep -q "^%`basename $$x`%" sounds.txt; then \
319                         install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds ; \
320                 else \
321                         echo "No description for $$x"; \
322                         exit 1; \
323                 fi; \
324         done
325         mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/mohmp3
326         mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/images
327         for x in images/*.jpg; do \
328                 install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/images ; \
329         done
330         mkdir -p $(DESTDIR)$(AGI_DIR)
331
332 update: 
333         @if [ -d CVS ]; then \
334                 echo "Updating from CVS..." ; \
335                 cvs -q update -Pd; \
336                 rm -f .version; \
337         else \
338                 echo "Not CVS";  \
339         fi
340
341 bininstall: all
342         mkdir -p $(DESTDIR)$(MODULES_DIR)
343         mkdir -p $(DESTDIR)$(ASTSBINDIR)
344         mkdir -p $(DESTDIR)$(ASTETCDIR)
345         mkdir -p $(DESTDIR)$(ASTBINDIR)
346         mkdir -p $(DESTDIR)$(ASTSBINDIR)
347         mkdir -p $(DESTDIR)$(ASTVARRUNDIR)
348         mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail
349         install -m 755 asterisk $(DESTDIR)$(ASTSBINDIR)/
350         install -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
351         if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \
352                 install -m 755 contrib/scripts/safe_asterisk $(DESTDIR)$(ASTSBINDIR)/ ;\
353         fi
354         for x in $(SUBDIRS); do $(MAKE) -C $$x install || exit 1 ; done
355         install -d $(DESTDIR)$(ASTHEADERDIR)
356         install -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
357         rm -f $(DESTDIR)$(ASTVARLIBDIR)/sounds/vm
358         rm -f $(DESTDIR)$(ASTVARLIBDIR)/sounds/voicemail
359         if [ ! -h $(DESTDIR)$(ASTSPOOLDIR)/vm ] && [ -d $(DESTDIR)$(ASTSPOOLDIR)/vm ]; then \
360                 mv $(DESTDIR)$(ASTSPOOLDIR)/vm $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default; \
361         else \
362                 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default; \
363                 rm -f $(DESTDIR)$(ASTSPOOLDIR)/vm; \
364         fi
365         ln -s $(ASTSPOOLDIR)/voicemail/default $(DESTDIR)$(ASTSPOOLDIR)/vm
366         rm -f $(DESTDIR)$(MODULES_DIR)/chan_ixj.so
367         rm -f $(DESTDIR)$(MODULES_DIR)/chan_tor.so
368         rm -f $(DESTDIR)$(MODULES_DIR)/cdr_mysql.so
369         rm -f $(DESTDIR)$(MODULES_DIR)/cdr_unixodbc.so
370         rm -f $(DESTDIR)$(MODULES_DIR)/codec_mp3_d.so
371         rm -f $(DESTDIR)$(MODULES_DIR)/format_mp3.so
372         rm -f $(DESTDIR)$(MODULES_DIR)/app_voicemail2.so
373         mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds
374         mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
375         mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/keys
376         mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/firmware
377         mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/firmware/iax
378         mkdir -p $(DESTDIR)$(ASTMANDIR)/man8
379         install -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTVARLIBDIR)/keys
380         install -m 644 keys/freeworlddialup.pub $(DESTDIR)$(ASTVARLIBDIR)/keys
381         install -m 644 asterisk.8.gz $(DESTDIR)$(ASTMANDIR)/man8
382         if [ -d contrib/firmware/iax ]; then \
383                 install -m 644 contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTVARLIBDIR)/firmware/iax/iaxy.bin; \
384         else \
385                 echo "You need to do cvs update -d not just cvs update" ; \
386         fi 
387         ( cd $(DESTDIR)$(ASTVARLIBDIR)/sounds  ; ln -s $(ASTSPOOLDIR)/vm . )
388         ( cd $(DESTDIR)$(ASTVARLIBDIR)/sounds  ; ln -s $(ASTSPOOLDIR)/voicemail . )
389         if [ -d mpg123-0.59r ]; then make -C mpg123-0.59r install; fi
390         @echo " +---- Asterisk Installation Complete -------+"  
391         @echo " +                                           +"
392         @echo " +    YOU MUST READ THE SECURITY DOCUMENT    +"
393         @echo " +                                           +"
394         @echo " + Asterisk has successfully been installed. +"  
395         @echo " + If you would like to install the sample   +"  
396         @echo " + configuration files (overwriting any      +"
397         @echo " + existing config files), run:              +"  
398         @echo " +                                           +"
399         @echo " +               $(MAKE) samples                +"
400         @echo " +                                           +"
401         @echo " +-----------------  or ---------------------+"
402         @echo " +                                           +"
403         @echo " + You can go ahead and install the asterisk +"
404         @echo " + program documentation now or later run:   +"
405         @echo " +                                           +"
406         @echo " +              $(MAKE) progdocs                +"
407         @echo " +                                           +"
408         @echo " + **Note** This requires that you have      +"
409         @echo " + doxygen installed on your local system    +"
410         @echo " +-------------------------------------------+"
411
412 install: all datafiles bininstall
413
414 upgrade: all bininstall
415
416 adsi: all
417         mkdir -p $(DESTDIR)$(ASTETCDIR)
418         for x in configs/*.adsi; do \
419                 if ! [ -f $(DESTDIR)$(ASTETCDIRX)/$$x ]; then \
420                         install -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`basename $$x` ; \
421                 fi ; \
422         done
423
424 samples: all datafiles adsi
425         mkdir -p $(DESTDIR)$(ASTETCDIR)
426         for x in configs/*.sample; do \
427                 if [ -f $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` ]; then \
428                         mv -f $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample`.old ; \
429                 fi ; \
430                 install -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` ;\
431         done
432         echo "[directories]" > $(DESTDIR)$(ASTETCDIR)/asterisk.conf
433         echo "astetcdir => $(ASTETCDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
434         echo "astmoddir => $(MODULES_DIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
435         echo "astvarlibdir => $(ASTVARLIBDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
436         echo "astagidir => $(AGI_DIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
437         echo "astspooldir => $(ASTSPOOLDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
438         echo "astrundir => $(ASTVARRUNDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
439         echo "astlogdir => $(ASTLOGDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
440         for x in sounds/demo-*; do \
441                 if grep -q "^%`basename $$x`%" sounds.txt; then \
442                         install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds ; \
443                 else \
444                         echo "No description for $$x"; \
445                         exit 1; \
446                 fi; \
447         done
448         for x in sounds/*.mp3; do \
449                 install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/mohmp3 ; \
450         done
451         rm -f $(DESTDIR)$(ASTVARLIBDIR)/mohmp3/sample-hold.mp3
452         mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
453         :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm
454         for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isunavail; do \
455                 cat $(DESTDIR)$(ASTVARLIBDIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm ; \
456         done
457         :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm
458         for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isonphone; do \
459                 cat $(DESTDIR)$(ASTVARLIBDIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm ; \
460         done
461
462 webvmail:
463         @[ -d $(DESTDIR)$(HTTPDIR) ] || ( echo "No HTTP directory" && exit 1 )
464         @[ -d $(DESTDIR)$(HTTPDIR)/html ] || ( echo "No http directory" && exit 1 )
465         @[ -d $(DESTDIR)$(HTTPDIR)/cgi-bin ] || ( echo "No cgi-bin directory" && exit 1 )
466         install -m 4755 -o root -g root contrib/scripts/vmail.cgi $(DESTDIR)$(HTTPDIR)/cgi-bin/vmail.cgi
467         mkdir -p $(DESTDIR)$(HTTPDIR)/html/_asterisk
468         for x in images/*.gif; do \
469                 install -m 644 $$x $(DESTDIR)$(HTTPDIR)/html/_asterisk/; \
470         done
471         @echo " +--------- Asterisk Web Voicemail ----------+"  
472         @echo " +                                           +"
473         @echo " + Asterisk Web Voicemail is installed in    +"
474         @echo " + your cgi-bin directory.  IT USES A SETUID +"
475         @echo " + ROOT PERL SCRIPT, SO IF YOU DON'T LIKE    +"
476         @echo " + THAT, UNINSTALL IT!                       +"
477         @echo " +                                           +"
478         @echo " +-------------------------------------------+"  
479
480 mailbox:
481         ./contrib/scripts/addmailbox 
482
483 rpm: __rpm
484
485 __rpm: _version
486         rm -rf /tmp/asterisk ; \
487         mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
488         $(MAKE) DESTDIR=/tmp/asterisk install ; \
489         $(MAKE) DESTDIR=/tmp/asterisk samples ; \
490         mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
491         cp -f redhat/asterisk /tmp/asterisk/etc/rc.d/init.d/ ; \
492         sed "s/^Version:.*/Version: $(RPMVERSION)/g" redhat/asterisk.spec > asterisk.spec ; \
493         rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec
494
495 progdocs:
496         doxygen contrib/asterisk-ng-doxygen
497
498 mpg123:
499         @wget -V >/dev/null || (echo "You need wget" ; false )
500         [ -f mpg123-0.59r.tar.gz ] || wget http://www.mpg123.de/mpg123/mpg123-0.59r.tar.gz
501         [ -d mpg123-0.59r ] || tar xfz mpg123-0.59r.tar.gz
502         make -C mpg123-0.59r linux
503         
504
505 config:
506         if [ -d /etc/rc.d/init.d ]; then \
507                 install -m 755 contrib/init.d/rc.redhat.asterisk /etc/rc.d/init.d/asterisk; \
508                 /sbin/chkconfig --add asterisk; \
509         elif [ -d /etc/init.d ]; then \
510                 install -m 755 init.asterisk /etc/init.d/asterisk; \
511         fi 
512
513 dont-optimize:
514         $(MAKE) OPTIMIZE= K6OPT= install
515
516 valgrind: dont-optimize
517
518 depend: .depend
519         for x in $(SUBDIRS); do $(MAKE) -C $$x depend || exit 1 ; done
520
521 .depend:
522         ./mkdep ${CFLAGS} `ls *.c`
523
524 FORCE:
525
526 %_env:
527         make -C $(shell echo $@ | sed "s/_env//g") env
528
529 env:
530         env