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