0e654157d88f81632049ae3d6fcab8db1882dd51
[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 # If you are running a radio application, define RADIO_RELAX so that the DTMF
56 # will be received more reliably
57 #OPTIONS += -DRADIO_RELAX
58
59 # If you don't have a lot of memory (e.g. embedded Asterisk), uncomment the
60 # following to reduce the size of certain static buffers
61 #OPTIONS += -DLOW_MEMORY
62
63 # Optional debugging parameters
64 DEBUG_THREADS = #-DDEBUG_THREADS #-DDO_CRASH 
65
66 # Uncomment next one to enable ast_frame tracing (for debugging)
67 TRACE_FRAMES = #-DTRACE_FRAMES
68
69 # Uncomment next one to enable malloc debugging
70 # You can view malloc debugging with:
71 #   *CLI> show memory allocations [filename]
72 #   *CLI> show memory summary [filename]
73 #
74 MALLOC_DEBUG = #-include $(PWD)/include/asterisk/astmm.h
75
76 # Where to install asterisk after compiling
77 # Default -> leave empty
78 INSTALL_PREFIX=
79
80 # Staging directory
81 # Files are copied here temporarily during the install process
82 # For example, make DESTDIR=/tmp/asterisk woud put things in
83 # /tmp/asterisk/etc/asterisk
84 DESTDIR=
85
86 # Original busydetect routine
87 BUSYDETECT = #-DBUSYDETECT
88
89 # Improved busydetect routine, comment the previous one if you use this one
90 BUSYDETECT+= -DBUSYDETECT_MARTIN 
91 # Detect the busy signal looking only at tone lengths
92 # For example if you have 3 beeps 100ms tone, 100ms silence separated by 500 ms of silence
93 BUSYDETECT+= #-DBUSYDETECT_TONEONLY
94 # Inforce the detection of busy singal (get rid of false hangups)
95 # Don't use together with -DBUSYDETECT_TONEONLY
96 BUSYDETECT+= #-DBUSYDETECT_COMPARE_TONE_AND_SILENCE
97
98 ASTLIBDIR=$(INSTALL_PREFIX)/usr/lib/asterisk
99 ASTVARLIBDIR=$(INSTALL_PREFIX)/var/lib/asterisk
100 ASTETCDIR=$(INSTALL_PREFIX)/etc/asterisk
101 ASTSPOOLDIR=$(INSTALL_PREFIX)/var/spool/asterisk
102 ASTLOGDIR=$(INSTALL_PREFIX)/var/log/asterisk
103 ASTHEADERDIR=$(INSTALL_PREFIX)/usr/include/asterisk
104 ASTCONFPATH=$(ASTETCDIR)/asterisk.conf
105 ASTBINDIR=$(INSTALL_PREFIX)/usr/bin
106 ASTSBINDIR=$(INSTALL_PREFIX)/usr/sbin
107 ASTVARRUNDIR=$(INSTALL_PREFIX)/var/run
108
109 MODULES_DIR=$(ASTLIBDIR)/modules
110 AGI_DIR=$(ASTVARLIBDIR)/agi-bin
111
112 INCLUDE=-Iinclude -I../include
113 CFLAGS=-pipe  -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG) $(INCLUDE) -D_REENTRANT -D_GNU_SOURCE #-DMAKE_VALGRIND_HAPPY
114 CFLAGS+=$(OPTIMIZE)
115 CFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
116 CFLAGS+=$(shell if uname -m | grep -q ppc; then echo "-fsigned-char"; fi)
117 ifeq (${OSARCH},FreeBSD)
118 CFLAGS+=-pthread
119 INCLUDE+=-I/usr/local/include
120 endif
121 ifeq (${OSARCH},OpenBSD)
122 CFLAGS+=-pthread
123 endif
124
125 #Uncomment this to use the older DSP routines
126 #CFLAGS+=-DOLD_DSP_ROUTINES
127
128 CFLAGS+=$(shell if [ -f /usr/include/linux/zaptel.h ]; then echo "-DZAPTEL_OPTIMIZATIONS"; fi)
129 CFLAGS+=$(shell if [ -f /usr/local/include/zaptel.h ]; then echo "-DZAPTEL_OPTIMIZATIONS"; fi)
130
131 LIBEDIT=editline/libedit.a
132
133 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)
134 HTTPDIR=$(shell if [ -d /var/www ]; then echo "/var/www"; else echo "/home/httpd"; fi)
135 RPMVERSION=$(shell if [ -f .version ]; then sed 's/[-\/:]/_/g' .version; else echo "unknown" ; fi)
136 CFLAGS+=-DASTERISK_VERSION=\"$(ASTERISKVERSION)\"
137 CFLAGS+=-DINSTALL_PREFIX=\"$(INSTALL_PREFIX)\"
138 CFLAGS+=-DASTETCDIR=\"$(ASTETCDIR)\"
139 CFLAGS+=-DASTLIBDIR=\"$(ASTLIBDIR)\"
140 CFLAGS+=-DASTVARLIBDIR=\"$(ASTVARLIBDIR)\"
141 CFLAGS+=-DASTVARRUNDIR=\"$(ASTVARRUNDIR)\"
142 CFLAGS+=-DASTSPOOLDIR=\"$(ASTSPOOLDIR)\"
143 CFLAGS+=-DASTLOGDIR=\"$(ASTLOGDIR)\"
144 CFLAGS+=-DASTCONFPATH=\"$(ASTCONFPATH)\"
145 CFLAGS+=-DASTMODDIR=\"$(MODULES_DIR)\"
146 CFLAGS+=-DASTAGIDIR=\"$(AGI_DIR)\"
147
148 CFLAGS+= $(DEBUG_THREADS)
149 CFLAGS+= $(TRACE_FRAMES)
150 CFLAGS+= $(MALLOC_DEBUG)
151 CFLAGS+= $(BUSYDETECT)
152 CFLAGS+= $(OPTIONS)
153 CFLAGS+=# -fomit-frame-pointer 
154 SUBDIRS=res channels pbx apps codecs formats agi cdr astman stdtime
155 ifeq (${OSARCH},Linux)
156 LIBS=-ldl -lpthread
157 endif
158 ifeq (${OSARCH},OpenBSD)
159 LIBS=-pthread
160 else
161 ifeq (${OSARCH},FreeBSD)
162 LIBS=-pthread
163 else
164 endif
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