e52a71a1fe311fc5385bba142d04daa57cf3f1df
[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 # If you are running a radio application, define RADIO_RELAX so that the DTMF
61 # will be received more reliably
62 #OPTIONS += -DRADIO_RELAX
63
64 # Optional debugging parameters
65 DEBUG_THREADS = #-DDEBUG_THREADS #-DDO_CRASH 
66
67 # Uncomment next one to enable ast_frame tracing (for debugging)
68 TRACE_FRAMES = #-DTRACE_FRAMES
69
70 # Uncomment next one to enable malloc debugging
71 # You can view malloc debugging with:
72 #   *CLI> show memory allocations [filename]
73 #   *CLI> show memory summary [filename]
74 #
75 MALLOC_DEBUG = #-include $(PWD)/include/asterisk/astmm.h
76
77 # Where to install asterisk after compiling
78 # Default -> leave empty
79 INSTALL_PREFIX=
80
81 # Staging directory
82 # Files are copied here temporarily during the install process
83 # For example, make DESTDIR=/tmp/asterisk woud put things in
84 # /tmp/asterisk/etc/asterisk
85 DESTDIR=
86
87 # Original busydetect routine
88 BUSYDETECT = #-DBUSYDETECT
89
90 # Improved busydetect routine, comment the previous one if you use this one
91 BUSYDETECT+= -DBUSYDETECT_MARTIN 
92 # Detect the busy signal looking only at tone lengths
93 # For example if you have 3 beeps 100ms tone, 100ms silence separated by 500 ms of silence
94 BUSYDETECT+= #-DBUSYDETECT_TONEONLY
95 # Inforce the detection of busy singal (get rid of false hangups)
96 # Don't use together with -DBUSYDETECT_TONEONLY
97 BUSYDETECT+= #-DBUSYDETECT_COMPARE_TONE_AND_SILENCE
98
99 ASTLIBDIR=$(INSTALL_PREFIX)/usr/lib/asterisk
100 ASTVARLIBDIR=$(INSTALL_PREFIX)/var/lib/asterisk
101 ASTETCDIR=$(INSTALL_PREFIX)/etc/asterisk
102 ASTSPOOLDIR=$(INSTALL_PREFIX)/var/spool/asterisk
103 ASTLOGDIR=$(INSTALL_PREFIX)/var/log/asterisk
104 ASTHEADERDIR=$(INSTALL_PREFIX)/usr/include/asterisk
105 ASTCONFPATH=$(ASTETCDIR)/asterisk.conf
106 ASTBINDIR=$(INSTALL_PREFIX)/usr/bin
107 ASTSBINDIR=$(INSTALL_PREFIX)/usr/sbin
108 ASTVARRUNDIR=$(INSTALL_PREFIX)/var/run
109
110 MODULES_DIR=$(ASTLIBDIR)/modules
111 AGI_DIR=$(ASTVARLIBDIR)/agi-bin
112
113 INCLUDE=-Iinclude -I../include
114 CFLAGS=-pipe  -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG) $(INCLUDE) -D_REENTRANT -D_GNU_SOURCE #-DMAKE_VALGRIND_HAPPY
115 CFLAGS+=$(OPTIMIZE)
116 CFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
117 CFLAGS+=$(shell if uname -m | grep -q ppc; then echo "-fsigned-char"; fi)
118 ifeq (${OSARCH},FreeBSD)
119 CFLAGS+=-pthread
120 INCLUDE+=-I/usr/local/include
121 endif
122 ifeq (${OSARCH},OpenBSD)
123 CFLAGS+=-pthread
124 endif
125
126 #Uncomment this to use the older DSP routines
127 #CFLAGS+=-DOLD_DSP_ROUTINES
128
129 CFLAGS+=$(shell if [ -f /usr/include/linux/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         if [ -d contrib/firmware/iax ]; then \
363                 install -m 644 contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTVARLIBDIR)/firmware/iax/iaxy.bin; \
364         else \
365                 echo "You need to do cvs update -d not just cvs update" ; \
366         fi 
367         ( cd $(DESTDIR)$(ASTVARLIBDIR)/sounds  ; ln -s $(ASTSPOOLDIR)/vm . )
368         ( cd $(DESTDIR)$(ASTVARLIBDIR)/sounds  ; ln -s $(ASTSPOOLDIR)/voicemail . )
369         @echo " +---- Asterisk Installation Complete -------+"  
370         @echo " +                                           +"
371         @echo " +    YOU MUST READ THE SECURITY DOCUMENT    +"
372         @echo " +                                           +"
373         @echo " + Asterisk has successfully been installed. +"  
374         @echo " + If you would like to install the sample   +"  
375         @echo " + configuration files (overwriting any      +"
376         @echo " + existing config files), run:              +"  
377         @echo " +                                           +"
378         @echo " +               $(MAKE) samples                +"
379         @echo " +                                           +"
380         @echo " +-----------------  or ---------------------+"
381         @echo " +                                           +"
382         @echo " + You can go ahead and install the asterisk +"
383         @echo " + program documentation now or later run:   +"
384         @echo " +                                           +"
385         @echo " +              $(MAKE) progdocs                +"
386         @echo " +                                           +"
387         @echo " + **Note** This requires that you have      +"
388         @echo " + doxygen installed on your local system    +"
389         @echo " +-------------------------------------------+"
390
391 install: all datafiles bininstall
392
393 upgrade: all bininstall
394
395 adsi: all
396         mkdir -p $(DESTDIR)$(ASTETCDIR)
397         for x in configs/*.adsi; do \
398                 if ! [ -f $(DESTDIR)$(ASTETCDIRX)/$$x ]; then \
399                         install -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`basename $$x` ; \
400                 fi ; \
401         done
402
403 samples: all datafiles adsi
404         mkdir -p $(DESTDIR)$(ASTETCDIR)
405         for x in configs/*.sample; do \
406                 if [ -f $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` ]; then \
407                         mv -f $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample`.old ; \
408                 fi ; \
409                 install -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` ;\
410         done
411         echo "[directories]" > $(DESTDIR)$(ASTETCDIR)/asterisk.conf
412         echo "astetcdir => $(ASTETCDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
413         echo "astmoddir => $(MODULES_DIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
414         echo "astvarlibdir => $(ASTVARLIBDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
415         echo "astagidir => $(AGI_DIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
416         echo "astspooldir => $(ASTSPOOLDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
417         echo "astrundir => $(ASTVARRUNDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
418         echo "astlogdir => $(ASTLOGDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
419         for x in sounds/demo-*; do \
420                 if grep -q "^%`basename $$x`%" sounds.txt; then \
421                         install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds ; \
422                 else \
423                         echo "No description for $$x"; \
424                         exit 1; \
425                 fi; \
426         done
427         for x in sounds/*.mp3; do \
428                 install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/mohmp3 ; \
429         done
430         mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
431         :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm
432         for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isunavail; do \
433                 cat $(DESTDIR)$(ASTVARLIBDIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm ; \
434         done
435         :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm
436         for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isonphone; do \
437                 cat $(DESTDIR)$(ASTVARLIBDIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm ; \
438         done
439
440 webvmail:
441         @[ -d $(DESTDIR)$(HTTPDIR) ] || ( echo "No HTTP directory" && exit 1 )
442         @[ -d $(DESTDIR)$(HTTPDIR)/html ] || ( echo "No http directory" && exit 1 )
443         @[ -d $(DESTDIR)$(HTTPDIR)/cgi-bin ] || ( echo "No cgi-bin directory" && exit 1 )
444         install -m 4755 -o root -g root contrib/scripts/vmail.cgi $(DESTDIR)$(HTTPDIR)/cgi-bin/vmail.cgi
445         mkdir -p $(DESTDIR)$(HTTPDIR)/html/_asterisk
446         for x in images/*.gif; do \
447                 install -m 644 $$x $(DESTDIR)$(HTTPDIR)/html/_asterisk/; \
448         done
449         @echo " +--------- Asterisk Web Voicemail ----------+"  
450         @echo " +                                           +"
451         @echo " + Asterisk Web Voicemail is installed in    +"
452         @echo " + your cgi-bin directory.  IT USES A SETUID +"
453         @echo " + ROOT PERL SCRIPT, SO IF YOU DON'T LIKE    +"
454         @echo " + THAT, UNINSTALL IT!                       +"
455         @echo " +                                           +"
456         @echo " +-------------------------------------------+"  
457
458 mailbox:
459         ./contrib/scripts/addmailbox 
460
461 rpm: __rpm
462
463 __rpm: _version
464         rm -rf /tmp/asterisk ; \
465         mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
466         $(MAKE) DESTDIR=/tmp/asterisk install ; \
467         $(MAKE) DESTDIR=/tmp/asterisk samples ; \
468         mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
469         cp -f redhat/asterisk /tmp/asterisk/etc/rc.d/init.d/ ; \
470         sed "s/^Version:.*/Version: $(RPMVERSION)/g" redhat/asterisk.spec > asterisk.spec ; \
471         rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec
472
473 progdocs:
474         doxygen contrib/asterisk-ng-doxygen
475
476 config:
477         if [ -d /etc/rc.d/init.d ]; then \
478                 install -m 755 contrib/init.d/rc.redhat.asterisk /etc/rc.d/init.d/asterisk; \
479                 /sbin/chkconfig --add asterisk; \
480         elif [ -d /etc/init.d ]; then \
481                 install -m 755 init.asterisk /etc/init.d/asterisk; \
482         fi 
483
484 dont-optimize:
485         $(MAKE) OPTIMIZE= K6OPT= install
486
487 valgrind: dont-optimize
488
489 depend: .depend
490         for x in $(SUBDIRS); do $(MAKE) -C $$x depend || exit 1 ; done
491
492 .depend:
493         ./mkdep ${CFLAGS} `ls *.c`
494
495 FORCE:
496
497 %_env:
498         make -C $(shell echo $@ | sed "s/_env//g") env
499
500 env:
501         env