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