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