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