Add some more hold music
[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 LIBS+=-lssl
179 OBJS=io.o sched.o logger.o frame.o loader.o config.o channel.o \
180         translate.o file.o say.o pbx.o cli.o md5.o term.o \
181         ulaw.o alaw.o callerid.o fskmodem.o image.o app.o \
182         cdr.o tdd.o acl.o rtp.o manager.o asterisk.o ast_expr.o \
183         dsp.o chanvars.o indications.o autoservice.o db.o privacy.o \
184         astmm.o enum.o srv.o dns.o aescrypt.o aestab.o aeskey.o \
185         utils.o 
186 ifeq (${OSARCH},Darwin)
187 OBJS+=poll.o dlfcn.o
188 ASTLINK=-Wl,-dynamic
189 SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
190 else
191 ASTLINK=-Wl,-E 
192 SOLINK=-shared -Xlinker -x
193 endif
194
195 CC=gcc
196 INSTALL=install
197
198 _all: all
199         @echo " +--------- Asterisk Build Complete ---------+"  
200         @echo " + Asterisk has successfully been built, but +"  
201         @echo " + cannot be run before being installed by   +"  
202         @echo " + running:                                  +"  
203         @echo " +                                           +"
204         @echo " +               $(MAKE) install                +"  
205         @echo " +-------------------------------------------+"  
206
207 all: depend asterisk subdirs 
208
209 editline/config.h:
210         cd editline && unset CFLAGS LIBS && ./configure ; \
211
212 editline/libedit.a: FORCE
213         cd editline && unset CFLAGS LIBS && test -f config.h || ./configure
214         $(MAKE) -C editline libedit.a
215
216 db1-ast/libdb1.a: FORCE
217         @if [ -d db1-ast ]; then \
218                 $(MAKE) -C db1-ast libdb1.a ; \
219         else \
220                 echo "You need to do a cvs update -d not just cvs update"; \
221                 exit 1; \
222         fi
223
224 ifneq ($(wildcard .depend),)
225 include .depend
226 endif
227
228 .PHONY: _version
229
230 _version: 
231         if [ -d CVS ] && ! [ -f .version ]; then echo $(ASTERISKVERSION) > .version; fi 
232
233 .version: _version
234
235 .y.c:
236         bison $< --name-prefix=ast_yy -o $@
237
238 ast_expr.o: ast_expr.c
239
240 cli.o: cli.c build.h
241
242 asterisk.o: asterisk.c build.h
243
244 manpage: asterisk.8.gz
245
246 asterisk.8.gz: asterisk.sgml
247         rm -f asterisk.8
248         docbook2man asterisk.sgml
249         mv ./*.8 asterisk.8
250         gzip asterisk.8
251
252 ifneq ($(strip $(ASTERISKVERSION)),)
253 build.h: .version
254         ./make_build_h
255 else
256 build.h:
257         ./make_build_h
258 endif
259
260 stdtime/libtime.a: FORCE
261         @if [ -d stdtime ]; then \
262                 $(MAKE) -C stdtime libtime.a ; \
263         else \
264                 echo "You need to do a cvs update -d not just cvs update"; \
265                 exit 1; \
266         fi
267
268 asterisk: editline/libedit.a db1-ast/libdb1.a stdtime/libtime.a $(OBJS)
269         $(CC) $(DEBUG) -o asterisk $(ASTLINK) $(OBJS) $(LIBEDIT) db1-ast/libdb1.a stdtime/libtime.a $(LIBS)
270
271 muted: muted.o
272         $(CC) -o muted muted.o
273
274 subdirs: 
275         for x in $(SUBDIRS); do $(MAKE) -C $$x || exit 1 ; done
276
277 clean:
278         for x in $(SUBDIRS); do $(MAKE) -C $$x clean || exit 1 ; done
279         rm -f *.o *.so asterisk .depend
280         rm -f build.h 
281         rm -f ast_expr.c
282         @if [ -e editline/Makefile ]; then $(MAKE) -C editline distclean ; fi
283         $(MAKE) -C db1-ast clean
284         $(MAKE) -C stdtime clean
285
286 datafiles: all
287         mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/digits
288         for x in sounds/digits/*.gsm; do \
289                 if grep -q "^%`basename $$x`%" sounds.txt; then \
290                         install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds/digits ; \
291                 else \
292                         echo "No description for $$x"; \
293                         exit 1; \
294                 fi; \
295         done
296         mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/letters
297         for x in sounds/letters/*.gsm; do \
298                 if grep -q "^%`basename $$x`%" sounds.txt; then \
299                         install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds/letters ; \
300                 else \
301                         echo "No description for $$x"; \
302                         exit 1; \
303                 fi; \
304         done
305         mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/phonetic
306         for x in sounds/phonetic/*.gsm; do \
307                 if grep -q "^%`basename $$x`%" sounds.txt; then \
308                         install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds/phonetic ; \
309                 else \
310                         echo "No description for $$x"; \
311                         exit 1; \
312                 fi; \
313         done
314         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 \
315                 if grep -q "^%`basename $$x`%" sounds.txt; then \
316                         install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds ; \
317                 else \
318                         echo "No description for $$x"; \
319                         exit 1; \
320                 fi; \
321         done
322         mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/mohmp3
323         mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/images
324         for x in images/*.jpg; do \
325                 install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/images ; \
326         done
327         mkdir -p $(DESTDIR)$(AGI_DIR)
328
329 update: 
330         @if [ -d CVS ]; then \
331                 echo "Updating from CVS..." ; \
332                 cvs -q update -Pd; \
333                 rm -f .version; \
334         else \
335                 echo "Not CVS";  \
336         fi
337
338 bininstall: all
339         mkdir -p $(DESTDIR)$(MODULES_DIR)
340         mkdir -p $(DESTDIR)$(ASTSBINDIR)
341         mkdir -p $(DESTDIR)$(ASTETCDIR)
342         mkdir -p $(DESTDIR)$(ASTBINDIR)
343         mkdir -p $(DESTDIR)$(ASTSBINDIR)
344         mkdir -p $(DESTDIR)$(ASTVARRUNDIR)
345         mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail
346         install -m 755 asterisk $(DESTDIR)$(ASTSBINDIR)/
347         install -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
348         if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \
349                 install -m 755 contrib/scripts/safe_asterisk $(DESTDIR)$(ASTSBINDIR)/ ;\
350         fi
351         for x in $(SUBDIRS); do $(MAKE) -C $$x install || exit 1 ; done
352         install -d $(DESTDIR)$(ASTHEADERDIR)
353         install -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
354         rm -f $(DESTDIR)$(ASTVARLIBDIR)/sounds/vm
355         rm -f $(DESTDIR)$(ASTVARLIBDIR)/sounds/voicemail
356         if [ ! -h $(DESTDIR)$(ASTSPOOLDIR)/vm ] && [ -d $(DESTDIR)$(ASTSPOOLDIR)/vm ]; then \
357                 mv $(DESTDIR)$(ASTSPOOLDIR)/vm $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default; \
358         else \
359                 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default; \
360                 rm -f $(DESTDIR)$(ASTSPOOLDIR)/vm; \
361         fi
362         ln -s $(ASTSPOOLDIR)/voicemail/default $(DESTDIR)$(ASTSPOOLDIR)/vm
363         rm -f $(DESTDIR)$(MODULES_DIR)/chan_ixj.so
364         rm -f $(DESTDIR)$(MODULES_DIR)/chan_tor.so
365         rm -f $(DESTDIR)$(MODULES_DIR)/cdr_mysql.so
366         rm -f $(DESTDIR)$(MODULES_DIR)/cdr_unixodbc.so
367         rm -f $(DESTDIR)$(MODULES_DIR)/codec_mp3_d.so
368         rm -f $(DESTDIR)$(MODULES_DIR)/format_mp3.so
369         rm -f $(DESTDIR)$(MODULES_DIR)/app_voicemail2.so
370         mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds
371         mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
372         mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/keys
373         mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/firmware
374         mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/firmware/iax
375         mkdir -p $(DESTDIR)$(ASTMANDIR)/man8
376         install -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTVARLIBDIR)/keys
377         install -m 644 keys/freeworlddialup.pub $(DESTDIR)$(ASTVARLIBDIR)/keys
378         install -m 644 asterisk.8.gz $(DESTDIR)$(ASTMANDIR)/man8
379         if [ -d contrib/firmware/iax ]; then \
380                 install -m 644 contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTVARLIBDIR)/firmware/iax/iaxy.bin; \
381         else \
382                 echo "You need to do cvs update -d not just cvs update" ; \
383         fi 
384         ( cd $(DESTDIR)$(ASTVARLIBDIR)/sounds  ; ln -s $(ASTSPOOLDIR)/vm . )
385         ( cd $(DESTDIR)$(ASTVARLIBDIR)/sounds  ; ln -s $(ASTSPOOLDIR)/voicemail . )
386         @echo " +---- Asterisk Installation Complete -------+"  
387         @echo " +                                           +"
388         @echo " +    YOU MUST READ THE SECURITY DOCUMENT    +"
389         @echo " +                                           +"
390         @echo " + Asterisk has successfully been installed. +"  
391         @echo " + If you would like to install the sample   +"  
392         @echo " + configuration files (overwriting any      +"
393         @echo " + existing config files), run:              +"  
394         @echo " +                                           +"
395         @echo " +               $(MAKE) samples                +"
396         @echo " +                                           +"
397         @echo " +-----------------  or ---------------------+"
398         @echo " +                                           +"
399         @echo " + You can go ahead and install the asterisk +"
400         @echo " + program documentation now or later run:   +"
401         @echo " +                                           +"
402         @echo " +              $(MAKE) progdocs                +"
403         @echo " +                                           +"
404         @echo " + **Note** This requires that you have      +"
405         @echo " + doxygen installed on your local system    +"
406         @echo " +-------------------------------------------+"
407
408 install: all datafiles bininstall
409
410 upgrade: all bininstall
411
412 adsi: all
413         mkdir -p $(DESTDIR)$(ASTETCDIR)
414         for x in configs/*.adsi; do \
415                 if ! [ -f $(DESTDIR)$(ASTETCDIRX)/$$x ]; then \
416                         install -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`basename $$x` ; \
417                 fi ; \
418         done
419
420 samples: all datafiles adsi
421         mkdir -p $(DESTDIR)$(ASTETCDIR)
422         for x in configs/*.sample; do \
423                 if [ -f $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` ]; then \
424                         mv -f $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample`.old ; \
425                 fi ; \
426                 install -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` ;\
427         done
428         echo "[directories]" > $(DESTDIR)$(ASTETCDIR)/asterisk.conf
429         echo "astetcdir => $(ASTETCDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
430         echo "astmoddir => $(MODULES_DIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
431         echo "astvarlibdir => $(ASTVARLIBDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
432         echo "astagidir => $(AGI_DIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
433         echo "astspooldir => $(ASTSPOOLDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
434         echo "astrundir => $(ASTVARRUNDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
435         echo "astlogdir => $(ASTLOGDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
436         for x in sounds/demo-*; do \
437                 if grep -q "^%`basename $$x`%" sounds.txt; then \
438                         install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds ; \
439                 else \
440                         echo "No description for $$x"; \
441                         exit 1; \
442                 fi; \
443         done
444         for x in sounds/*.mp3; do \
445                 install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/mohmp3 ; \
446         done
447         rm -f $(DESTDIR)$(ASTVARLIBDIR)/mohmp3/sample-hold.mp3
448         mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
449         :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm
450         for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isunavail; do \
451                 cat $(DESTDIR)$(ASTVARLIBDIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm ; \
452         done
453         :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm
454         for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isonphone; do \
455                 cat $(DESTDIR)$(ASTVARLIBDIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm ; \
456         done
457
458 webvmail:
459         @[ -d $(DESTDIR)$(HTTPDIR) ] || ( echo "No HTTP directory" && exit 1 )
460         @[ -d $(DESTDIR)$(HTTPDIR)/html ] || ( echo "No http directory" && exit 1 )
461         @[ -d $(DESTDIR)$(HTTPDIR)/cgi-bin ] || ( echo "No cgi-bin directory" && exit 1 )
462         install -m 4755 -o root -g root contrib/scripts/vmail.cgi $(DESTDIR)$(HTTPDIR)/cgi-bin/vmail.cgi
463         mkdir -p $(DESTDIR)$(HTTPDIR)/html/_asterisk
464         for x in images/*.gif; do \
465                 install -m 644 $$x $(DESTDIR)$(HTTPDIR)/html/_asterisk/; \
466         done
467         @echo " +--------- Asterisk Web Voicemail ----------+"  
468         @echo " +                                           +"
469         @echo " + Asterisk Web Voicemail is installed in    +"
470         @echo " + your cgi-bin directory.  IT USES A SETUID +"
471         @echo " + ROOT PERL SCRIPT, SO IF YOU DON'T LIKE    +"
472         @echo " + THAT, UNINSTALL IT!                       +"
473         @echo " +                                           +"
474         @echo " +-------------------------------------------+"  
475
476 mailbox:
477         ./contrib/scripts/addmailbox 
478
479 rpm: __rpm
480
481 __rpm: _version
482         rm -rf /tmp/asterisk ; \
483         mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
484         $(MAKE) DESTDIR=/tmp/asterisk install ; \
485         $(MAKE) DESTDIR=/tmp/asterisk samples ; \
486         mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
487         cp -f redhat/asterisk /tmp/asterisk/etc/rc.d/init.d/ ; \
488         sed "s/^Version:.*/Version: $(RPMVERSION)/g" redhat/asterisk.spec > asterisk.spec ; \
489         rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec
490
491 progdocs:
492         doxygen contrib/asterisk-ng-doxygen
493
494 config:
495         if [ -d /etc/rc.d/init.d ]; then \
496                 install -m 755 contrib/init.d/rc.redhat.asterisk /etc/rc.d/init.d/asterisk; \
497                 /sbin/chkconfig --add asterisk; \
498         elif [ -d /etc/init.d ]; then \
499                 install -m 755 init.asterisk /etc/init.d/asterisk; \
500         fi 
501
502 dont-optimize:
503         $(MAKE) OPTIMIZE= K6OPT= install
504
505 valgrind: dont-optimize
506
507 depend: .depend
508         for x in $(SUBDIRS); do $(MAKE) -C $$x depend || exit 1 ; done
509
510 .depend:
511         ./mkdep ${CFLAGS} `ls *.c`
512
513 FORCE:
514
515 %_env:
516         make -C $(shell echo $@ | sed "s/_env//g") env
517
518 env:
519         env