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