Merge major BSD mutex and symbol conflict patches (bug #1816) (link patch still pending)
[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
112 MODULES_DIR=$(ASTLIBDIR)/modules
113 AGI_DIR=$(ASTVARLIBDIR)/agi-bin
114
115 INCLUDE=-Iinclude -I../include
116 CFLAGS=-pipe  -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG) $(INCLUDE) -D_REENTRANT -D_GNU_SOURCE #-DMAKE_VALGRIND_HAPPY
117 CFLAGS+=$(OPTIMIZE)
118 CFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
119 CFLAGS+=$(shell if uname -m | grep -q ppc; then echo "-fsigned-char"; fi)
120
121 ifeq (${OSARCH},FreeBSD)
122 OSVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk)
123 CFLAGS+=$(if ${OSVERSION}<500016,-D_THREAD_SAFE)
124 LIBS+=$(if ${OSVERSION}<502102,-lc_r,-pthread)
125 INCLUDE+=-I/usr/local/include
126 CFLAGS+=$(shell if [ -d /usr/local/include/spandsp ]; then echo "-I/usr/local/include/spandsp"; fi)
127 endif # FreeBSD
128
129 ifeq (${OSARCH},OpenBSD)
130 CFLAGS+=-pthread
131 endif
132
133 #Uncomment this to use the older DSP routines
134 #CFLAGS+=-DOLD_DSP_ROUTINES
135
136 CFLAGS+=$(shell if [ -f /usr/include/linux/zaptel.h ]; then echo "-DZAPTEL_OPTIMIZATIONS"; fi)
137 CFLAGS+=$(shell if [ -f /usr/local/include/zaptel.h ]; then echo "-DZAPTEL_OPTIMIZATIONS"; fi)
138
139 LIBEDIT=editline/libedit.a
140
141 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)
142 HTTPDIR=$(shell if [ -d /var/www ]; then echo "/var/www"; else echo "/home/httpd"; fi)
143 RPMVERSION=$(shell if [ -f .version ]; then sed 's/[-\/:]/_/g' .version; else echo "unknown" ; fi)
144 CFLAGS+=-DASTERISK_VERSION=\"$(ASTERISKVERSION)\"
145 CFLAGS+=-DINSTALL_PREFIX=\"$(INSTALL_PREFIX)\"
146 CFLAGS+=-DASTETCDIR=\"$(ASTETCDIR)\"
147 CFLAGS+=-DASTLIBDIR=\"$(ASTLIBDIR)\"
148 CFLAGS+=-DASTVARLIBDIR=\"$(ASTVARLIBDIR)\"
149 CFLAGS+=-DASTVARRUNDIR=\"$(ASTVARRUNDIR)\"
150 CFLAGS+=-DASTSPOOLDIR=\"$(ASTSPOOLDIR)\"
151 CFLAGS+=-DASTLOGDIR=\"$(ASTLOGDIR)\"
152 CFLAGS+=-DASTCONFPATH=\"$(ASTCONFPATH)\"
153 CFLAGS+=-DASTMODDIR=\"$(MODULES_DIR)\"
154 CFLAGS+=-DASTAGIDIR=\"$(AGI_DIR)\"
155
156 CFLAGS+= $(DEBUG_THREADS)
157 CFLAGS+= $(TRACE_FRAMES)
158 CFLAGS+= $(MALLOC_DEBUG)
159 CFLAGS+= $(BUSYDETECT)
160 CFLAGS+= $(OPTIONS)
161 CFLAGS+=# -fomit-frame-pointer 
162 SUBDIRS=res channels pbx apps codecs formats agi cdr astman stdtime
163 ifeq (${OSARCH},Linux)
164 LIBS=-ldl -lpthread
165 endif
166 LIBS+=-lncurses -lm
167 ifeq (${OSARCH},Linux)
168 LIBS+=-lresolv  #-lnjamd
169 endif
170 ifeq (${OSARCH},Darwin)
171 LIBS+=-lresolv
172 endif
173 OBJS=io.o sched.o logger.o frame.o loader.o config.o channel.o \
174         translate.o file.o say.o pbx.o cli.o md5.o term.o \
175         ulaw.o alaw.o callerid.o fskmodem.o image.o app.o \
176         cdr.o tdd.o acl.o rtp.o manager.o asterisk.o ast_expr.o \
177         dsp.o chanvars.o indications.o autoservice.o db.o privacy.o \
178         astmm.o enum.o srv.o dns.o aescrypt.o aestab.o aeskey.o \
179         utils.o 
180 ifeq (${OSARCH},Darwin)
181 OBJS+=poll.o dlfcn.o
182 ASTLINK=-Wl,-dynamic
183 SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
184 else
185 ASTLINK=-Wl,-E 
186 SOLINK=-shared -Xlinker -x
187 endif
188
189 CC=gcc
190 INSTALL=install
191
192 _all: all
193         @echo " +--------- Asterisk Build Complete ---------+"  
194         @echo " + Asterisk has successfully been built, but +"  
195         @echo " + cannot be run before being installed by   +"  
196         @echo " + running:                                  +"  
197         @echo " +                                           +"
198         @echo " +               $(MAKE) install                +"  
199         @echo " +-------------------------------------------+"  
200
201 all: depend asterisk subdirs
202
203 editline/config.h:
204         cd editline && unset CFLAGS LIBS && ./configure ; \
205
206 editline/libedit.a: FORCE
207         cd editline && unset CFLAGS LIBS && test -f config.h || ./configure
208         $(MAKE) -C editline libedit.a
209
210 db1-ast/libdb1.a: FORCE
211         @if [ -d db1-ast ]; then \
212                 $(MAKE) -C db1-ast libdb1.a ; \
213         else \
214                 echo "You need to do a cvs update -d not just cvs update"; \
215                 exit 1; \
216         fi
217
218 ifneq ($(wildcard .depend),)
219 include .depend
220 endif
221
222 .PHONY: _version
223
224 _version: 
225         if [ -d CVS ] && ! [ -f .version ]; then echo $(ASTERISKVERSION) > .version; fi 
226
227 .version: _version
228
229 .y.c:
230         bison $< --name-prefix=ast_yy -o $@
231
232 ast_expr.o: ast_expr.c
233
234 cli.o: cli.c build.h
235
236 asterisk.o: asterisk.c build.h
237
238 ifneq ($(strip $(ASTERISKVERSION)),)
239 build.h: .version
240         ./make_build_h
241 else
242 build.h:
243         ./make_build_h
244 endif
245
246 stdtime/libtime.a: FORCE
247         @if [ -d stdtime ]; then \
248                 $(MAKE) -C stdtime libtime.a ; \
249         else \
250                 echo "You need to do a cvs update -d not just cvs update"; \
251                 exit 1; \
252         fi
253
254 asterisk: editline/libedit.a db1-ast/libdb1.a stdtime/libtime.a $(OBJS)
255         $(CC) $(DEBUG) -o asterisk $(ASTLINK) $(OBJS) $(LIBEDIT) db1-ast/libdb1.a stdtime/libtime.a $(LIBS)
256
257 muted: muted.o
258         $(CC) -o muted muted.o
259
260 subdirs: 
261         for x in $(SUBDIRS); do $(MAKE) -C $$x || exit 1 ; done
262
263 clean:
264         for x in $(SUBDIRS); do $(MAKE) -C $$x clean || exit 1 ; done
265         rm -f *.o *.so asterisk .depend
266         rm -f build.h 
267         rm -f ast_expr.c
268         @if [ -e editline/Makefile ]; then $(MAKE) -C editline distclean ; fi
269         $(MAKE) -C db1-ast clean
270         $(MAKE) -C stdtime clean
271
272 datafiles: all
273         mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/digits
274         for x in sounds/digits/*.gsm; do \
275                 if grep -q "^%`basename $$x`%" sounds.txt; then \
276                         install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds/digits ; \
277                 else \
278                         echo "No description for $$x"; \
279                         exit 1; \
280                 fi; \
281         done
282         mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/letters
283         for x in sounds/letters/*.gsm; do \
284                 if grep -q "^%`basename $$x`%" sounds.txt; then \
285                         install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds/letters ; \
286                 else \
287                         echo "No description for $$x"; \
288                         exit 1; \
289                 fi; \
290         done
291         mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/phonetic
292         for x in sounds/phonetic/*.gsm; do \
293                 if grep -q "^%`basename $$x`%" sounds.txt; then \
294                         install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds/phonetic ; \
295                 else \
296                         echo "No description for $$x"; \
297                         exit 1; \
298                 fi; \
299         done
300         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 \
301                 if grep -q "^%`basename $$x`%" sounds.txt; then \
302                         install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds ; \
303                 else \
304                         echo "No description for $$x"; \
305                         exit 1; \
306                 fi; \
307         done
308         mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/mohmp3
309         mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/images
310         for x in images/*.jpg; do \
311                 install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/images ; \
312         done
313         mkdir -p $(DESTDIR)$(AGI_DIR)
314
315 update: 
316         @if [ -d CVS ]; then \
317                 echo "Updating from CVS..." ; \
318                 cvs -q update -Pd; \
319                 rm -f .version; \
320         else \
321                 echo "Not CVS";  \
322         fi
323
324 bininstall: all
325         mkdir -p $(DESTDIR)$(MODULES_DIR)
326         mkdir -p $(DESTDIR)$(ASTSBINDIR)
327         mkdir -p $(DESTDIR)$(ASTETCDIR)
328         mkdir -p $(DESTDIR)$(ASTBINDIR)
329         mkdir -p $(DESTDIR)$(ASTSBINDIR)
330         mkdir -p $(DESTDIR)$(ASTVARRUNDIR)
331         mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail
332         install -m 755 asterisk $(DESTDIR)$(ASTSBINDIR)/
333         install -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
334         if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \
335                 install -m 755 contrib/scripts/safe_asterisk $(DESTDIR)$(ASTSBINDIR)/ ;\
336         fi
337         for x in $(SUBDIRS); do $(MAKE) -C $$x install || exit 1 ; done
338         install -d $(DESTDIR)$(ASTHEADERDIR)
339         install -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
340         rm -f $(DESTDIR)$(ASTVARLIBDIR)/sounds/vm
341         rm -f $(DESTDIR)$(ASTVARLIBDIR)/sounds/voicemail
342         if [ ! -h $(DESTDIR)$(ASTSPOOLDIR)/vm ] && [ -d $(DESTDIR)$(ASTSPOOLDIR)/vm ]; then \
343                 mv $(DESTDIR)$(ASTSPOOLDIR)/vm $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default; \
344         else \
345                 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default; \
346                 rm -f $(DESTDIR)$(ASTSPOOLDIR)/vm; \
347         fi
348         ln -s $(ASTSPOOLDIR)/voicemail/default $(DESTDIR)$(ASTSPOOLDIR)/vm
349         rm -f $(DESTDIR)$(MODULES_DIR)/chan_ixj.so
350         rm -f $(DESTDIR)$(MODULES_DIR)/chan_tor.so
351         rm -f $(DESTDIR)$(MODULES_DIR)/cdr_mysql.so
352         rm -f $(DESTDIR)$(MODULES_DIR)/cdr_unixodbc.so
353         rm -f $(DESTDIR)$(MODULES_DIR)/codec_mp3_d.so
354         rm -f $(DESTDIR)$(MODULES_DIR)/format_mp3.so
355         rm -f $(DESTDIR)$(MODULES_DIR)/app_voicemail2.so
356         mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds
357         mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
358         mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/keys
359         mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/firmware
360         mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/firmware/iax
361         install -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTVARLIBDIR)/keys
362         install -m 644 keys/freeworlddialup.pub $(DESTDIR)$(ASTVARLIBDIR)/keys
363         if [ -d contrib/firmware/iax ]; then \
364                 install -m 644 contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTVARLIBDIR)/firmware/iax/iaxy.bin; \
365         else \
366                 echo "You need to do cvs update -d not just cvs update" ; \
367         fi 
368         ( cd $(DESTDIR)$(ASTVARLIBDIR)/sounds  ; ln -s $(ASTSPOOLDIR)/vm . )
369         ( cd $(DESTDIR)$(ASTVARLIBDIR)/sounds  ; ln -s $(ASTSPOOLDIR)/voicemail . )
370         @echo " +---- Asterisk Installation Complete -------+"  
371         @echo " +                                           +"
372         @echo " +    YOU MUST READ THE SECURITY DOCUMENT    +"
373         @echo " +                                           +"
374         @echo " + Asterisk has successfully been installed. +"  
375         @echo " + If you would like to install the sample   +"  
376         @echo " + configuration files (overwriting any      +"
377         @echo " + existing config files), run:              +"  
378         @echo " +                                           +"
379         @echo " +               $(MAKE) samples                +"
380         @echo " +                                           +"
381         @echo " +-----------------  or ---------------------+"
382         @echo " +                                           +"
383         @echo " + You can go ahead and install the asterisk +"
384         @echo " + program documentation now or later run:   +"
385         @echo " +                                           +"
386         @echo " +              $(MAKE) progdocs                +"
387         @echo " +                                           +"
388         @echo " + **Note** This requires that you have      +"
389         @echo " + doxygen installed on your local system    +"
390         @echo " +-------------------------------------------+"
391
392 install: all datafiles bininstall
393
394 upgrade: all bininstall
395
396 adsi: all
397         mkdir -p $(DESTDIR)$(ASTETCDIR)
398         for x in configs/*.adsi; do \
399                 if ! [ -f $(DESTDIR)$(ASTETCDIRX)/$$x ]; then \
400                         install -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`basename $$x` ; \
401                 fi ; \
402         done
403
404 samples: all datafiles adsi
405         mkdir -p $(DESTDIR)$(ASTETCDIR)
406         for x in configs/*.sample; do \
407                 if [ -f $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` ]; then \
408                         mv -f $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample`.old ; \
409                 fi ; \
410                 install -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` ;\
411         done
412         echo "[directories]" > $(DESTDIR)$(ASTETCDIR)/asterisk.conf
413         echo "astetcdir => $(ASTETCDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
414         echo "astmoddir => $(MODULES_DIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
415         echo "astvarlibdir => $(ASTVARLIBDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
416         echo "astagidir => $(AGI_DIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
417         echo "astspooldir => $(ASTSPOOLDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
418         echo "astrundir => $(ASTVARRUNDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
419         echo "astlogdir => $(ASTLOGDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
420         for x in sounds/demo-*; do \
421                 if grep -q "^%`basename $$x`%" sounds.txt; then \
422                         install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds ; \
423                 else \
424                         echo "No description for $$x"; \
425                         exit 1; \
426                 fi; \
427         done
428         for x in sounds/*.mp3; do \
429                 install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/mohmp3 ; \
430         done
431         mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
432         :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm
433         for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isunavail; do \
434                 cat $(DESTDIR)$(ASTVARLIBDIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm ; \
435         done
436         :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm
437         for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isonphone; do \
438                 cat $(DESTDIR)$(ASTVARLIBDIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm ; \
439         done
440
441 webvmail:
442         @[ -d $(DESTDIR)$(HTTPDIR) ] || ( echo "No HTTP directory" && exit 1 )
443         @[ -d $(DESTDIR)$(HTTPDIR)/html ] || ( echo "No http directory" && exit 1 )
444         @[ -d $(DESTDIR)$(HTTPDIR)/cgi-bin ] || ( echo "No cgi-bin directory" && exit 1 )
445         install -m 4755 -o root -g root contrib/scripts/vmail.cgi $(DESTDIR)$(HTTPDIR)/cgi-bin/vmail.cgi
446         mkdir -p $(DESTDIR)$(HTTPDIR)/html/_asterisk
447         for x in images/*.gif; do \
448                 install -m 644 $$x $(DESTDIR)$(HTTPDIR)/html/_asterisk/; \
449         done
450         @echo " +--------- Asterisk Web Voicemail ----------+"  
451         @echo " +                                           +"
452         @echo " + Asterisk Web Voicemail is installed in    +"
453         @echo " + your cgi-bin directory.  IT USES A SETUID +"
454         @echo " + ROOT PERL SCRIPT, SO IF YOU DON'T LIKE    +"
455         @echo " + THAT, UNINSTALL IT!                       +"
456         @echo " +                                           +"
457         @echo " +-------------------------------------------+"  
458
459 mailbox:
460         ./contrib/scripts/addmailbox 
461
462 rpm: __rpm
463
464 __rpm: _version
465         rm -rf /tmp/asterisk ; \
466         mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
467         $(MAKE) DESTDIR=/tmp/asterisk install ; \
468         $(MAKE) DESTDIR=/tmp/asterisk samples ; \
469         mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
470         cp -f redhat/asterisk /tmp/asterisk/etc/rc.d/init.d/ ; \
471         sed "s/^Version:.*/Version: $(RPMVERSION)/g" redhat/asterisk.spec > asterisk.spec ; \
472         rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec
473
474 progdocs:
475         doxygen contrib/asterisk-ng-doxygen
476
477 config:
478         if [ -d /etc/rc.d/init.d ]; then \
479                 install -m 755 contrib/init.d/rc.redhat.asterisk /etc/rc.d/init.d/asterisk; \
480                 /sbin/chkconfig --add asterisk; \
481         elif [ -d /etc/init.d ]; then \
482                 install -m 755 init.asterisk /etc/init.d/asterisk; \
483         fi 
484
485 dont-optimize:
486         $(MAKE) OPTIMIZE= K6OPT= install
487
488 valgrind: dont-optimize
489
490 depend: .depend
491         for x in $(SUBDIRS); do $(MAKE) -C $$x depend || exit 1 ; done
492
493 .depend:
494         ./mkdep ${CFLAGS} `ls *.c`
495
496 FORCE:
497
498 %_env:
499         make -C $(shell echo $@ | sed "s/_env//g") env
500
501 env:
502         env