silly people that don't want to install/run autoconf :-)
[asterisk/asterisk.git] / Makefile
1 #
2 # Asterisk -- A telephony toolkit for Linux.
3
4 # Top level Makefile
5 #
6 # Copyright (C) 1999-2006, Digium, Inc.
7 #
8 # Mark Spencer <markster@digium.com>
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 # If cross compiling, define these to suit
20 #CROSS_COMPILE=/opt/montavista/pro/devkit/arm/xscale_be/bin/xscale_be-
21 #CROSS_COMPILE_BIN=/opt/montavista/pro/devkit/arm/xscale_be/bin/
22 #CROSS_COMPILE_TARGET=/opt/montavista/pro/devkit/arm/xscale_be/target
23 #CROSS_ARCH=Linux
24 #CROSS_PROC=arm
25 #SUB_PROC=xscale # or maverick
26
27 # Pentium Pro Optimize
28 #PROC=i686
29
30 # Pentium & VIA processors optimize
31 #PROC=i586
32
33 #PROC=k6
34 #PROC=ppc
35
36 CC=$(CROSS_COMPILE)gcc
37 HOST_CC=gcc
38
39 ifeq ($(CROSS_COMPILE),)
40   OSARCH=$(shell uname -s)
41   PROC?=$(shell uname -m)
42 else
43   OSARCH=$(CROSS_ARCH)
44   PROC=$(CROSS_PROC)
45 endif
46
47 PWD=$(shell pwd)
48
49 # Remember the MAKELEVEL at the top
50 MAKETOPLEVEL?=$(MAKELEVEL)
51
52 ifeq ($(findstring dont-optimize,$(MAKECMDGOALS)),)
53 # More GSM codec optimization
54 # Uncomment to enable MMXTM optimizations for x86 architecture CPU's
55 # which support MMX instructions.  This should be newer pentiums,
56 # ppro's, etc, as well as the AMD K6 and K7.  
57 #K6OPT  = -DK6OPT
58
59 # Tell gcc to optimize the code
60 OPTIMIZE+=-O6
61 else
62   # Stack backtraces, while useful for debugging, are incompatible with optimizations
63   ifeq (${OSARCH},Linux)
64     CFLAGS+=-DSTACK_BACKTRACES
65   endif
66 endif
67
68 # Overwite config files on "make samples"
69 OVERWRITE=y
70
71 # Include debug and macro symbols in the executables (-g) and profiling info (-pg)
72 DEBUG=-g3 #-pg
73
74 # Set NOCRYPTO to yes if you do not want to have crypto support or dependencies
75 #NOCRYPTO=yes
76
77 # If you are running a radio application, define RADIO_RELAX so that the DTMF
78 # will be received more reliably
79 #OPTIONS += -DRADIO_RELAX
80
81 # If you don't have a lot of memory (e.g. embedded Asterisk), define LOW_MEMORY
82 # to reduce the size of certain static buffers
83 #ifneq ($(CROSS_COMPILE),)
84 #OPTIONS += -DLOW_MEMORY
85 #endif
86
87 # Asterisk SMDI integration
88 WITH_SMDI = 1
89
90 # Optional debugging parameters
91 DEBUG_THREADS = #-DDUMP_SCHEDULER #-DDEBUG_SCHEDULER #-DDEBUG_THREADS #-DDO_CRASH #-DDETECT_DEADLOCKS
92
93 # If you want to debug channel locking, try this (depends on code using
94 # ast_channel_lock and companions to work)
95 DEBUG_THREADS += #-DDEBUG_CHANNEL_LOCKS
96
97 # Uncomment next one to enable ast_frame tracing (for debugging)
98 TRACE_FRAMES = #-DTRACE_FRAMES
99
100 # Where to install asterisk after compiling
101 # Default -> leave empty
102 INSTALL_PREFIX?=
103
104 # Staging directory
105 # Files are copied here temporarily during the install process
106 # For example, make DESTDIR=/tmp/asterisk woud put things in
107 # /tmp/asterisk/etc/asterisk
108 # !!! Watch out, put no spaces or comments after the value !!!
109 DESTDIR?=
110 #DESTDIR?=/tmp/asterisk
111
112 # Original busydetect routine
113 BUSYDETECT = #-DBUSYDETECT
114
115 # Improved busydetect routine, comment the previous one if you use this one
116 BUSYDETECT+= #-DBUSYDETECT_MARTIN 
117 # Detect the busy signal looking only at tone lengths
118 # For example if you have 3 beeps 100ms tone, 100ms silence separated by 500 ms of silence
119 BUSYDETECT+= #-DBUSYDETECT_TONEONLY
120 # Enforce the detection of busy signal (get rid of false hangups)
121 # Don't use together with -DBUSYDETECT_TONEONLY
122 BUSYDETECT+= #-DBUSYDETECT_COMPARE_TONE_AND_SILENCE
123
124 # Define standard directories for various platforms
125 # These apply if they are not redefined in asterisk.conf 
126 ifeq ($(OSARCH),SunOS)
127   ASTETCDIR=$(INSTALL_PREFIX)/etc/opt/asterisk
128   ASTLIBDIR=$(INSTALL_PREFIX)/opt/asterisk/lib
129   ASTVARLIBDIR=$(INSTALL_PREFIX)/var/opt/asterisk/lib
130   ASTSPOOLDIR=$(INSTALL_PREFIX)/var/opt/asterisk/spool
131   ASTLOGDIR=$(INSTALL_PREFIX)/var/opt/asterisk/log
132   ASTHEADERDIR=$(INSTALL_PREFIX)/opt/asterisk/usr/include/asterisk
133   ASTBINDIR=$(INSTALL_PREFIX)/opt/asterisk/usr/bin
134   ASTSBINDIR=$(INSTALL_PREFIX)/opt/asterisk/usr/sbin
135   ASTVARRUNDIR=$(INSTALL_PREFIX)/var/opt/asterisk/run
136   ASTMANDIR=$(INSTALL_PREFIX)/opt/asterisk/usr/share/man
137 else
138 ifeq ($(OSARCH),FreeBSD)
139   PREFIX?=/usr/local
140   ASTETCDIR=$(INSTALL_PREFIX)$(PREFIX)/etc/asterisk
141   ASTLIBDIR=$(INSTALL_PREFIX)$(PREFIX)/lib/asterisk
142   ASTVARLIBDIR=$(INSTALL_PREFIX)$(PREFIX)/share/asterisk
143   ASTSPOOLDIR=$(INSTALL_PREFIX)/var/spool/asterisk
144   ASTLOGDIR=$(INSTALL_PREFIX)/var/log/asterisk
145   ASTHEADERDIR=$(INSTALL_PREFIX)$(PREFIX)/include/asterisk
146   ASTBINDIR=$(INSTALL_PREFIX)$(PREFIX)/bin
147   ASTSBINDIR=$(INSTALL_PREFIX)$(PREFIX)/sbin
148   ASTVARRUNDIR=$(INSTALL_PREFIX)/var/run
149   ASTMANDIR=$(INSTALL_PREFIX)$(PREFIX)/man
150 else
151   ASTETCDIR=$(INSTALL_PREFIX)/etc/asterisk
152   ASTLIBDIR=$(INSTALL_PREFIX)/usr/lib/asterisk
153   ASTVARLIBDIR=$(INSTALL_PREFIX)/var/lib/asterisk
154   ASTSPOOLDIR=$(INSTALL_PREFIX)/var/spool/asterisk
155   ASTLOGDIR=$(INSTALL_PREFIX)/var/log/asterisk
156   ASTHEADERDIR=$(INSTALL_PREFIX)/usr/include/asterisk
157   ASTBINDIR=$(INSTALL_PREFIX)/usr/bin
158   ASTSBINDIR=$(INSTALL_PREFIX)/usr/sbin
159   ASTVARRUNDIR=$(INSTALL_PREFIX)/var/run
160   ASTMANDIR=$(INSTALL_PREFIX)/usr/share/man
161 endif
162 endif
163 ASTDATADIR?=$(ASTVARLIBDIR)
164
165 # Asterisk.conf is located in ASTETCDIR or by using the -C flag
166 # when starting Asterisk
167 ASTCONFPATH=$(ASTETCDIR)/asterisk.conf
168 MODULES_DIR=$(ASTLIBDIR)/modules
169 AGI_DIR=$(ASTDATADIR)/agi-bin
170
171 # If you use Apache, you may determine by a grep 'DocumentRoot' of your httpd.conf file
172 HTTP_DOCSDIR=/var/www/html
173 # Determine by a grep 'ScriptAlias' of your Apache httpd.conf file
174 HTTP_CGIDIR=/var/www/cgi-bin
175
176 ASTCFLAGS=
177
178 # Uncomment this to use the older DSP routines
179 #ASTCFLAGS+=-DOLD_DSP_ROUTINES
180
181 # If the file .asterisk.makeopts is present in your home directory, you can
182 # include all of your favorite menuselect options so that every time you download
183 # a new version of Asterisk, you don't have to run menuselect to set them. 
184 # The file /etc/asterisk.makeopts will also be included but can be overridden
185 # by the file in your home directory.
186
187 GLOBAL_MAKEOPTS=$(wildcard /etc/asterisk.makeopts)
188 USER_MAKEOPTS=$(wildcard ~/.asterisk.makeopts)
189
190 ifneq ($(wildcard menuselect.makeopts),)
191   include menuselect.makeopts
192 endif
193
194 ifneq ($(wildcard makeopts),)
195   include makeopts
196 endif
197
198 ASTCFLAGS+=$(MENUSELECT_CFLAGS)
199 TOPDIR_CFLAGS=-include include/autoconfig.h -Iinclude
200 MOD_SUBDIR_CFLAGS=-include ../include/autoconfig.h -I../include -I..
201 OTHER_SUBDIR_CFLAGS=-include ../include/autoconfig.h -I../include -I..
202
203 #   *CLI> show memory allocations [filename]
204 #   *CLI> show memory summary [filename]
205 ifneq ($(findstring -DMALLOC_DEBUG,$(ASTCFLAGS)),)
206   TOPDIR_CFLAGS+=-include include/asterisk/astmm.h
207   MOD_SUBDIR_CFLAGS+=-include ../include/asterisk/astmm.h
208 endif
209
210 MOD_SUBDIR_CFLAGS+=-fPIC
211
212 ifeq ($(OSARCH),Linux)
213   ifeq ($(PROC),x86_64)
214     # You must have GCC 3.4 to use k8, otherwise use athlon
215     PROC=k8
216     #PROC=athlon
217   endif
218
219   ifeq ($(PROC),sparc64)
220     #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
221     #This works for even old (2.96) versions of gcc and provides a small boost either way.
222     #A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
223     #So we go lowest common available by gcc and go a step down, still a step up from
224     #the default as we now have a better instruction set to work with. - Belgarath
225     PROC=ultrasparc
226     OPTIONS+=$(shell if $(CC) -mtune=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mtune=$(PROC)"; fi)
227     OPTIONS+=$(shell if $(CC) -mcpu=v8 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mcpu=v8"; fi)
228     OPTIONS+=-fomit-frame-pointer
229   endif
230
231   ifeq ($(PROC),arm)
232     # The Cirrus logic is the only heavily shipping arm processor with a real floating point unit
233     ifeq ($(SUB_PROC),maverick)
234       OPTIONS+=-fsigned-char -mcpu=ep9312
235     else
236       ifeq ($(SUB_PROC),xscale)
237         OPTIONS+=-fsigned-char -mcpu=xscale
238       else
239         OPTIONS+=-fsigned-char 
240       endif
241     endif
242   endif
243   MPG123TARG=linux
244 endif
245
246 GREP=grep
247 ID=id
248
249 ifeq ($(OSARCH),SunOS)
250   GREP=/usr/xpg4/bin/grep
251   M4=/usr/local/bin/m4
252   ID=/usr/xpg4/bin/id
253 endif
254
255 ASTCFLAGS+=-pipe  -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG) $(INCLUDE) #-DMAKE_VALGRIND_HAPPY
256 ASTCFLAGS+=$(OPTIMIZE)
257
258 ifeq ($(AST_DEVMODE),yes)
259   ASTCFLAGS+=-Werror -Wunused
260 endif
261
262 ifeq ($(shell gcc -v 2>&1 | grep 'gcc version' | cut -f3 -d' ' | cut -f1 -d.),4)
263 ASTCFLAGS+= -Wno-pointer-sign
264 endif
265 ASTOBJ=-o asterisk
266
267 ifeq ($(findstring BSD,$(OSARCH)),BSD)
268   ASTCFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include -L$(CROSS_COMPILE_TARGET)/usr/local/lib
269 endif
270
271 ifneq ($(PROC),ultrasparc)
272   ASTCFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
273 endif
274
275 ifeq ($(PROC),ppc)
276   ASTCFLAGS+=-fsigned-char
277 endif
278
279 ifeq ($(OSARCH),FreeBSD)
280   BSDVERSION=$(shell make -V OSVERSION -f $(CROSS_COMPILE_TARGET)/usr/share/mk/bsd.port.subdir.mk)
281   ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
282   LIBS+=$(shell if test  $(BSDVERSION) -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi)
283   ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/spandsp),)
284     ASTCFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include/spandsp
285   endif
286   MPG123TARG=freebsd
287 endif # FreeBSD
288
289 ifeq ($(OSARCH),NetBSD)
290   ASTCFLAGS+=-pthread
291   INCLUDE+=-I$(CROSS_COMPILE_TARGET)/usr/pkg/include
292   MPG123TARG=netbsd
293 endif
294
295 ifeq ($(OSARCH),OpenBSD)
296   ASTCFLAGS+=-pthread
297 endif
298
299 ifeq ($(OSARCH),SunOS)
300   ASTCFLAGS+=-Wcast-align -DSOLARIS
301   INCLUDE+=-Iinclude/solaris-compat -I$(CROSS_COMPILE_TARGET)/usr/local/ssl/include
302 endif
303
304 LIBEDIT=editline/libedit.a
305
306 ASTERISKVERSION:=$(shell build_tools/make_version .)
307
308 ifneq ($(wildcard .version),)
309   ASTERISKVERSIONNUM:=$(shell awk -F. '{printf "%02d%02d%02d", $$1, $$2, $$3}' .version)
310   RPMVERSION:=$(shell sed 's/[-\/:]/_/g' .version)
311 else
312   RPMVERSION=unknown
313 endif
314
315 # CVS mirrors of SVN have .svnrevision files showing
316 # which SVN revision they are based on, and .svnbranch
317 # showing the branch they are made from
318 ifneq ($(wildcard .svnrevision),)
319   ASTERISKVERSIONNUM=999999
320 else
321   ifneq ($(wildcard .svn),)
322     ASTERISKVERSIONNUM=999999
323   endif
324 endif
325
326 ASTCFLAGS+= $(DEBUG_THREADS)
327 ASTCFLAGS+= $(TRACE_FRAMES)
328 ASTCFLAGS+= $(MALLOC_DEBUG)
329 ASTCFLAGS+= $(BUSYDETECT)
330 ASTCFLAGS+= $(OPTIONS)
331 ifeq ($(findstring dont-optimize,$(MAKECMDGOALS)),)
332 ASTCFLAGS+= -fomit-frame-pointer 
333 endif
334
335 MOD_SUBDIRS=res channels pbx apps codecs formats cdr funcs
336 SUBDIRS:=$(MOD_SUBDIRS) utils stdtime agi
337
338 OBJS=io.o sched.o logger.o frame.o loader.o config.o channel.o \
339         translate.o file.o pbx.o cli.o md5.o term.o \
340         ulaw.o alaw.o callerid.o fskmodem.o image.o app.o \
341         cdr.o tdd.o acl.o rtp.o udptl.o manager.o asterisk.o \
342         dsp.o chanvars.o indications.o autoservice.o db.o privacy.o \
343         astmm.o enum.o srv.o dns.o aescrypt.o aestab.o aeskey.o \
344         utils.o plc.o jitterbuf.o dnsmgr.o devicestate.o \
345         netsock.o slinfactory.o ast_expr2.o ast_expr2f.o \
346         cryptostub.o sha1.o http.o
347
348 # we need to link in the objects statically, not as a library, because
349 # otherwise modules will not have them available if none of the static
350 # objects use it.
351 OBJS+= stdtime/localtime.o
352
353 # At the moment say.o is an optional component which can be overridden
354 # by a module.
355 OBJS+= say.o
356
357 ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/sys/poll.h),)
358   OBJS+= poll.o
359   ASTCFLAGS+=-DPOLLCOMPAT
360 endif
361
362 ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/dlfcn.h),)
363   OBJS+= dlfcn.o
364   ASTCFLAGS+=-DDLFCNCOMPAT
365 endif
366
367 ifeq ($(OSARCH),Linux)
368   LIBS+=-ldl -lpthread $(EDITLINE_LIBS) -lm -lresolv  #-lnjamd
369 else
370   LIBS+=$(EDITLINE_LIBS) -lm
371 endif
372
373 ifeq ($(OSARCH),Darwin)
374   LIBS+=-lresolv
375   ASTCFLAGS+=-D__Darwin__
376   AUDIO_LIBS=-framework CoreAudio
377   ASTLINK=-Wl,-dynamic
378   SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
379   # Mac on Intel CoreDuo does not need poll compatibility layer
380   ifneq ($(PROC),i386)
381     OBJS+=poll.o
382     ASTCFLAGS+=-DPOLLCOMPAT
383   endif
384 else
385 # These are used for all but Darwin
386   ASTLINK=-Wl,-E 
387   SOLINK=-shared -Xlinker -x
388   ifeq ($(findstring BSD,$(OSARCH)),BSD)
389     SOLINK+=-L$(CROSS_COMPILE_TARGET)/usr/local/lib
390   endif
391 endif
392
393 ifeq ($(OSARCH),FreeBSD)
394   LIBS+=-lcrypto
395 endif
396
397 ifeq ($(OSARCH),NetBSD)
398   LIBS+=-lpthread -lcrypto -lm -L$(CROSS_COMPILE_TARGET)/usr/pkg/lib $(EDITLINE_LIBS)
399 endif
400
401 ifeq ($(OSARCH),OpenBSD)
402   LIBS+=-lcrypto -lpthread -lm $(EDITLINE_LIBS)
403 endif
404
405 ifeq ($(OSARCH),SunOS)
406   LIBS+=-lpthread -ldl -lnsl -lsocket -lresolv -L$(CROSS_COMPILE_TARGET)/usr/local/ssl/lib
407   OBJS+=strcompat.o
408   ASTLINK=
409   SOLINK=-shared -fpic -L$(CROSS_COMPILE_TARGET)/usr/local/ssl/lib
410 endif
411
412 ifeq ($(MAKETOPLEVEL),$(MAKELEVEL))
413   CFLAGS+=$(TOPDIR_CFLAGS) $(ASTCFLAGS)
414 endif
415
416 # This is used when generating the doxygen documentation
417 ifneq ($(DOT),:)
418   HAVEDOT=yes
419 else
420   HAVEDOT=no
421 endif
422
423 INSTALL=install
424
425 _all: all
426         @echo " +--------- Asterisk Build Complete ---------+"  
427         @echo " + Asterisk has successfully been built, but +"  
428         @echo " + cannot be run before being installed by   +"  
429         @echo " + running:                                  +"  
430         @echo " +                                           +"
431         @echo " +               make install                +"  
432         @echo " +-------------------------------------------+"  
433
434 all: config.status menuselect.makeopts cleantest depend asterisk subdirs
435
436 configure:
437         -@./bootstrap.sh
438
439 config.status: configure
440         @CFLAGS="" ./configure
441         @echo "****"
442         @echo "**** The configure script was just executed, so 'make' needs to be"
443         @echo "**** restarted."
444         @echo "****"
445         @exit 1
446
447 makeopts: configure
448         @CFLAGS="" ./configure
449         @echo "****"
450         @echo "**** The configure script was just executed, so 'make' needs to be"
451         @echo "**** restarted."
452         @echo "****"
453         @exit 1
454
455 menuselect.makeopts: build_tools/menuselect makeopts.xml
456         @build_tools/menuselect --check-deps ${GLOBAL_MAKEOPTS} ${USER_MAKEOPTS} $@
457
458 #ifneq ($(wildcard tags),)
459 ctags: tags
460 #endif
461
462 ifneq ($(wildcard TAGS),)
463 all: TAGS
464 endif
465
466 editline/config.h:
467         cd editline && unset CFLAGS LIBS && CFLAGS="$(OPTIMIZE)" ./configure ; \
468
469 editline/libedit.a:
470         cd editline && unset CFLAGS LIBS && test -f config.h || CFLAGS="$(OPTIMIZE)" ./configure
471         $(MAKE) -C editline libedit.a
472
473 db1-ast/libdb1.a:
474         $(MAKE) -C db1-ast libdb1.a
475
476 ifneq ($(wildcard .depend),)
477   include .depend
478 endif
479
480 ifneq ($(wildcard .tags-depend),)
481   include .tags-depend
482 endif
483
484 ast_expr2.c:
485         bison -o $@ -d --name-prefix=ast_yy ast_expr2.y
486
487 ast_expr2f.c:
488         flex -o $@ --full ast_expr2.fl
489
490 testexpr2: ast_expr2f.c ast_expr2.c ast_expr2.h
491         gcc -g -c -DSTANDALONE ast_expr2f.c
492         gcc -g -c -DSTANDALONE ast_expr2.c
493         gcc -g -o testexpr2 ast_expr2f.o ast_expr2.o
494         rm ast_expr2.o ast_expr2f.o 
495
496 manpage: asterisk.8
497
498 asterisk.8: asterisk.sgml
499         rm -f asterisk.8
500         docbook2man asterisk.sgml
501         mv ./*.8 asterisk.8
502
503 asterisk.pdf: asterisk.sgml
504         docbook2pdf asterisk.sgml
505
506 asterisk.ps: asterisk.sgml
507         docbook2ps asterisk.sgml
508
509 asterisk.html: asterisk.sgml
510         docbook2html asterisk.sgml
511         mv r1.html asterisk.html
512
513 asterisk.txt: asterisk.sgml
514         docbook2txt asterisk.sgml
515
516 defaults.h: makeopts
517         build_tools/make_defaults_h > $@.tmp
518         if cmp -s $@.tmp $@ ; then echo ; else \
519                 mv $@.tmp $@ ; \
520         fi
521         rm -f $@.tmp
522
523 include/asterisk/version.h:
524         build_tools/make_version_h > $@.tmp
525         if cmp -s $@.tmp $@ ; then echo; else \
526                 mv $@.tmp $@ ; \
527         fi
528         rm -f $@.tmp
529
530 stdtime/libtime.a:
531         CFLAGS="$(ASTCFLAGS) $(MOD_SUBDIR_CFLAGS)" $(MAKE) -C stdtime libtime.a
532
533 asterisk: editline/libedit.a db1-ast/libdb1.a stdtime/libtime.a $(OBJS)
534         build_tools/make_build_h > include/asterisk/build.h.tmp
535         if cmp -s include/asterisk/build.h.tmp include/asterisk/build.h ; then echo ; else \
536                 mv include/asterisk/build.h.tmp include/asterisk/build.h ; \
537         fi
538         rm -f include/asterisk/build.h.tmp
539         $(CC) -c -o buildinfo.o $(CFLAGS) buildinfo.c
540         $(CC) $(DEBUG) $(ASTOBJ) $(ASTLINK) $(OBJS) buildinfo.o $(LIBEDIT) db1-ast/libdb1.a stdtime/libtime.a $(LIBS)
541
542 muted: muted.o
543         $(CC) $(AUDIO_LIBS) -o muted muted.o
544
545 subdirs: 
546         for x in $(MOD_SUBDIRS); do CFLAGS="$(ASTCFLAGS) $(MOD_SUBDIR_CFLAGS)" $(MAKE) -C $$x || exit 1 ; done
547         CFLAGS="$(ASTCFLAGS) $(OTHER_SUBDIR_CFLAGS)" $(MAKE) -C utils
548         CFLAGS="$(ASTCFLAGS) $(OTHER_SUBDIR_CFLAGS)" $(MAKE) -C agi
549
550 clean-depend:
551         for x in $(SUBDIRS); do $(MAKE) -C $$x clean-depend || exit 1 ; done
552         rm -f .depend .tags-depend
553
554 clean: clean-depend
555         for x in $(SUBDIRS); do $(MAKE) -C $$x clean || exit 1 ; done
556         rm -f *.o *.so asterisk
557         rm -f defaults.h
558         rm -f include/asterisk/build.h
559         rm -f include/asterisk/version.h
560         rm -f .tags-sources tags TAGS
561         @if [ -f editline/Makefile ]; then $(MAKE) -C editline distclean ; fi
562         @if [ -d mpg123-0.59r ]; then $(MAKE) -C mpg123-0.59r clean; fi
563         $(MAKE) -C db1-ast clean
564         $(MAKE) -C stdtime clean
565
566 distclean: dist-clean
567
568 dist-clean: clean
569         rm -f menuselect.makeopts makeopts makeopts.xml
570         rm -f config.log config.status
571         rm -f include/autoconfig.h
572         $(MAKE) -C mxml clean
573         $(MAKE) -C build_tools dist-clean
574
575 datafiles: all
576         if [ x`$(ID) -un` = xroot ]; then sh build_tools/mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig; fi
577 # Should static HTTP be installed during make samples or even with its own target ala
578 # webvoicemail?  There are portions here that *could* be customized but might also be
579 # improved a lot.  I'll put it here for now.
580         mkdir -p $(DESTDIR)$(ASTDATADIR)/static-http
581         for x in static-http/*; do \
582                 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/static-http ; \
583         done
584         mkdir -p $(DESTDIR)$(ASTDATADIR)/sounds/digits
585         mkdir -p $(DESTDIR)$(ASTDATADIR)/sounds/priv-callerintros
586         for x in sounds/digits/*.gsm; do \
587                 if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
588                         $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/sounds/digits ; \
589                 else \
590                         echo "No description for $$x"; \
591                         exit 1; \
592                 fi; \
593         done
594         mkdir -p $(DESTDIR)$(ASTDATADIR)/sounds/dictate
595         for x in sounds/dictate/*.gsm; do \
596                 if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
597                         $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/sounds/dictate ; \
598                 else \
599                         echo "No description for $$x"; \
600                         exit 1; \
601                 fi; \
602         done
603         mkdir -p $(DESTDIR)$(ASTDATADIR)/sounds/letters
604         for x in sounds/letters/*.gsm; do \
605                 if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
606                         $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/sounds/letters ; \
607                 else \
608                         echo "No description for $$x"; \
609                         exit 1; \
610                 fi; \
611         done
612         mkdir -p $(DESTDIR)$(ASTDATADIR)/sounds/phonetic
613         for x in sounds/phonetic/*.gsm; do \
614                 if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
615                         $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/sounds/phonetic ; \
616                 else \
617                         echo "No description for $$x"; \
618                         exit 1; \
619                 fi; \
620         done
621         for x in sounds/demo-* 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-* sounds/spy-* sounds/priv-* sounds/screen-* sounds/hello-*; do \
622                 if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
623                         $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/sounds ; \
624                 else \
625                         echo "No description for $$x"; \
626                         exit 1; \
627                 fi; \
628         done
629         mkdir -p $(DESTDIR)$(ASTDATADIR)/mohmp3
630         mkdir -p $(DESTDIR)$(ASTDATADIR)/images
631         for x in images/*.jpg; do \
632                 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/images ; \
633         done
634         mkdir -p $(DESTDIR)$(AGI_DIR)
635
636 update: 
637         @if [ -d .svn ]; then \
638                 echo "Updating from Subversion..." ; \
639                 svn update | tee update.out; \
640                 rm -f .version; \
641                 if [ `grep -c ^C update.out` -gt 0 ]; then \
642                         echo ; echo "The following files have conflicts:" ; \
643                         grep ^C update.out | cut -b4- ; \
644                 fi ; \
645                 rm -f update.out; \
646                 $(MAKE) clean-depend; \
647         elif [ -d CVS ]; then \
648                 echo "Updating from CVS..." ; \
649                 cvs -q -z3 update -Pd | tee update.out; \
650                 rm -f .version; \
651                 if [ `grep -c ^C update.out` -gt 0 ]; then \
652                         echo ; echo "The following files have conflicts:" ; \
653                         grep ^C update.out | cut -d' ' -f2- ; \
654                 fi ; \
655                 rm -f update.out; \
656                 $(MAKE) clean-depend; \
657         else \
658                 echo "Not under version control";  \
659         fi
660
661 NEWHEADERS=$(notdir $(wildcard include/asterisk/*.h))
662 OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h)))
663
664 bininstall: all
665         mkdir -p $(DESTDIR)$(MODULES_DIR)
666         mkdir -p $(DESTDIR)$(ASTSBINDIR)
667         mkdir -p $(DESTDIR)$(ASTETCDIR)
668         mkdir -p $(DESTDIR)$(ASTBINDIR)
669         mkdir -p $(DESTDIR)$(ASTVARRUNDIR)
670         mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail
671         mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/dictate
672         mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/system
673         mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/tmp
674         mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/meetme
675         mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/monitor
676         if [ -f asterisk ]; then $(INSTALL) -m 755 asterisk $(DESTDIR)$(ASTSBINDIR)/; fi
677         if [ -f asterisk.dll ]; then $(INSTALL) -m 755 asterisk.dll $(DESTDIR)$(ASTSBINDIR)/; fi
678         ln -sf asterisk $(DESTDIR)$(ASTSBINDIR)/rasterisk
679         $(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
680         $(INSTALL) -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/  
681         if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \
682                 cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;' > $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ;\
683                 chmod 755 $(DESTDIR)$(ASTSBINDIR)/safe_asterisk;\
684         fi
685         $(INSTALL) -d $(DESTDIR)$(ASTHEADERDIR)
686         $(INSTALL) -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
687         if [ -n "$(OLDHEADERS)" ]; then \
688                 rm -f $(addprefix $(DESTDIR)$(ASTHEADERDIR)/,$(OLDHEADERS)) ;\
689         fi
690         mkdir -p $(DESTDIR)$(ASTDATADIR)/sounds
691         mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
692         mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-custom
693         mkdir -p $(DESTDIR)$(ASTDATADIR)/keys
694         mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware
695         mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware/iax
696         mkdir -p $(DESTDIR)$(ASTMANDIR)/man8
697         $(INSTALL) -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTDATADIR)/keys
698         $(INSTALL) -m 644 keys/freeworlddialup.pub $(DESTDIR)$(ASTDATADIR)/keys
699         $(INSTALL) -m 644 asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
700         $(INSTALL) -m 644 contrib/scripts/astgenkey.8 $(DESTDIR)$(ASTMANDIR)/man8
701         $(INSTALL) -m 644 contrib/scripts/autosupport.8 $(DESTDIR)$(ASTMANDIR)/man8
702         $(INSTALL) -m 644 contrib/scripts/safe_asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
703         if [ -d contrib/firmware/iax ]; then \
704                 $(INSTALL) -m 644 contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTDATADIR)/firmware/iax/iaxy.bin; \
705         else \
706                 echo "You need to do cvs update -d not just cvs update" ; \
707         fi 
708         if [ -f mpg123-0.59r/mpg123 ]; then $(MAKE) -C mpg123-0.59r install; fi
709
710 install-subdirs:
711         for x in $(SUBDIRS); do $(MAKE) -C $$x install || exit 1 ; done
712
713 NEWMODS=$(notdir $(wildcard */*.so))
714 OLDMODS=$(filter-out $(NEWMODS),$(notdir $(wildcard $(DESTDIR)$(MODULES_DIR)/*.so)))
715
716 oldmodcheck:
717         @if [ -n "$(OLDMODS)" ]; then \
718                 echo " WARNING WARNING WARNING" ;\
719                 echo "" ;\
720                 echo " Your Asterisk modules directory, located at" ;\
721                 echo " $(DESTDIR)$(MODULES_DIR)" ;\
722                 echo " contains modules that were not installed by this " ;\
723                 echo " version of Asterisk. Please ensure that these" ;\
724                 echo " modules are compatible with this version before" ;\
725                 echo " attempting to run Asterisk." ;\
726                 echo "" ;\
727                 for f in $(OLDMODS); do \
728                         echo "    $$f" ;\
729                 done ;\
730                 echo "" ;\
731                 echo " WARNING WARNING WARNING" ;\
732         fi
733
734 install: all datafiles bininstall install-subdirs
735         @if [ -x /usr/sbin/asterisk-post-install ]; then \
736                 /usr/sbin/asterisk-post-install $(DESTDIR) . ; \
737         fi
738         @echo " +---- Asterisk Installation Complete -------+"  
739         @echo " +                                           +"
740         @echo " +    YOU MUST READ THE SECURITY DOCUMENT    +"
741         @echo " +                                           +"
742         @echo " + Asterisk has successfully been installed. +"  
743         @echo " + If you would like to install the sample   +"  
744         @echo " + configuration files (overwriting any      +"
745         @echo " + existing config files), run:              +"  
746         @echo " +                                           +"
747         @echo " +               $(MAKE) samples                +"
748         @echo " +                                           +"
749         @echo " +-----------------  or ---------------------+"
750         @echo " +                                           +"
751         @echo " + You can go ahead and install the asterisk +"
752         @echo " + program documentation now or later run:   +"
753         @echo " +                                           +"
754         @echo " +              $(MAKE) progdocs                +"
755         @echo " +                                           +"
756         @echo " + **Note** This requires that you have      +"
757         @echo " + doxygen installed on your local system    +"
758         @echo " +-------------------------------------------+"
759         @$(MAKE) -s oldmodcheck
760
761 upgrade: all bininstall
762
763 adsi:
764         mkdir -p $(DESTDIR)$(ASTETCDIR)
765         for x in configs/*.adsi; do \
766                 if [ ! -f $(DESTDIR)$(ASTETCDIRX)/$$x ]; then \
767                         $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`basename $$x` ; \
768                 fi ; \
769         done
770
771 samples: adsi
772         mkdir -p $(DESTDIR)$(ASTETCDIR)
773         for x in configs/*.sample; do \
774                 if [ -f $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` ]; then \
775                         if [ "$(OVERWRITE)" = "y" ]; then \
776                                 if cmp -s $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` $$x ; then \
777                                         echo "Config file $$x is unchanged"; \
778                                         continue; \
779                                 fi ; \
780                                 mv -f $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample`.old ; \
781                         else \
782                                 echo "Skipping config file $$x"; \
783                                 continue; \
784                         fi ;\
785                 fi ; \
786                 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` ;\
787         done
788         if [ "$(OVERWRITE)" = "y" ] || [ ! -f $(DESTDIR)$(ASTCONFPATH) ]; then \
789                 ( \
790                 echo "[directories]" ; \
791                 echo "astetcdir => $(ASTETCDIR)" ; \
792                 echo "astmoddir => $(MODULES_DIR)" ; \
793                 echo "astvarlibdir => $(ASTVARLIBDIR)" ; \
794                 echo "astdatadir => $(ASTDATADIR)" ; \
795                 echo "astagidir => $(AGI_DIR)" ; \
796                 echo "astspooldir => $(ASTSPOOLDIR)" ; \
797                 echo "astrundir => $(ASTVARRUNDIR)" ; \
798                 echo "astlogdir => $(ASTLOGDIR)" ; \
799                 echo "" ; \
800                 echo "; Changing the following lines may compromise your security." ; \
801                 echo ";[files]" ; \
802                 echo ";astctlpermissions = 0660" ; \
803                 echo ";astctlowner = root" ; \
804                 echo ";astctlgroup = apache" ; \
805                 echo ";astctl = asterisk.ctl" ; \
806                 echo ";[options]" ; \
807                 echo ";internal_timing = yes" ; \
808                 ) > $(DESTDIR)$(ASTCONFPATH) ; \
809         else \
810                 echo "Skipping asterisk.conf creation"; \
811         fi
812         mkdir -p $(DESTDIR)$(ASTDATADIR)/sounds ; \
813         for x in sounds/demo-*; do \
814                 if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
815                         $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/sounds ; \
816                 else \
817                         echo "No description for $$x"; \
818                         exit 1; \
819                 fi; \
820         done
821         mkdir -p $(DESTDIR)$(ASTDATADIR)/mohmp3 ; \
822         for x in sounds/*.mp3; do \
823                 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/mohmp3 ; \
824         done
825         rm -f $(DESTDIR)$(ASTDATADIR)/mohmp3/sample-hold.mp3
826         mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
827         :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm
828         for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isunavail; do \
829                 cat $(DESTDIR)$(ASTDATADIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm ; \
830         done
831         :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm
832         for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isonphone; do \
833                 cat $(DESTDIR)$(ASTDATADIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm ; \
834         done
835
836 webvmail:
837         @[ -d $(DESTDIR)$(HTTP_DOCSDIR)/ ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 )
838         @[ -d $(DESTDIR)$(HTTP_CGIDIR) ] || ( printf "cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit 1 )
839         $(INSTALL) -m 4755 -o root -g root contrib/scripts/vmail.cgi $(DESTDIR)$(HTTP_CGIDIR)/vmail.cgi
840         mkdir -p $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk
841         for x in images/*.gif; do \
842                 $(INSTALL) -m 644 $$x $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk/; \
843         done
844         @echo " +--------- Asterisk Web Voicemail ----------+"  
845         @echo " +                                           +"
846         @echo " + Asterisk Web Voicemail is installed in    +"
847         @echo " + your cgi-bin directory:                   +"
848         @echo " + $(DESTDIR)$(HTTP_CGIDIR)"
849         @echo " + IT USES A SETUID ROOT PERL SCRIPT, SO     +"
850         @echo " + IF YOU DON'T LIKE THAT, UNINSTALL IT!     +"
851         @echo " +                                           +"
852         @echo " + Other static items have been stored in:   +"
853         @echo " + $(DESTDIR)$(HTTP_DOCSDIR)"
854         @echo " +                                           +"
855         @echo " + If these paths do not match your httpd    +"
856         @echo " + installation, correct the definitions     +"
857         @echo " + in your Makefile of HTTP_CGIDIR and       +"
858         @echo " + HTTP_DOCSDIR                              +"
859         @echo " +                                           +"
860         @echo " +-------------------------------------------+"  
861
862 spec: 
863         sed "s/^Version:.*/Version: $(RPMVERSION)/g" redhat/asterisk.spec > asterisk.spec ; \
864
865 rpm: __rpm
866
867 __rpm: include/asterisk/version.h spec
868         rm -rf /tmp/asterisk ; \
869         mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
870         $(MAKE) DESTDIR=/tmp/asterisk install ; \
871         $(MAKE) DESTDIR=/tmp/asterisk samples ; \
872         mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
873         cp -f contrib/init.d/rc.redhat.asterisk /tmp/asterisk/etc/rc.d/init.d/asterisk ; \
874         rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec
875
876 progdocs:
877         (cat contrib/asterisk-ng-doxygen; echo "HAVE_DOT=$(HAVEDOT)"; \
878         echo "PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen - 
879
880 mpg123:
881         @wget -V >/dev/null || (echo "You need wget" ; false )
882         [ -f mpg123-0.59r.tar.gz ] || wget http://www.mpg123.de/mpg123/mpg123-0.59r.tar.gz
883         [ -d mpg123-0.59r ] || tar xfz mpg123-0.59r.tar.gz
884         $(MAKE) -C mpg123-0.59r $(MPG123TARG)
885
886 config:
887         @if [ "${OSARCH}" = "Linux" ]; then \
888                 if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \
889                         $(INSTALL) -m 755 contrib/init.d/rc.redhat.asterisk /etc/rc.d/init.d/asterisk; \
890                         /sbin/chkconfig --add asterisk; \
891                 elif [ -f /etc/debian_version ]; then \
892                         $(INSTALL) -m 755 contrib/init.d/rc.debian.asterisk /etc/init.d/asterisk; \
893                         /usr/sbin/update-rc.d asterisk start 10 2 3 4 5 . stop 91 2 3 4 5 .; \
894                 elif [ -f /etc/gentoo-release ]; then \
895                         $(INSTALL) -m 755 contrib/init.d/rc.gentoo.asterisk /etc/init.d/asterisk; \
896                         /sbin/rc-update add asterisk default; \
897                 elif [ -f /etc/mandrake-release ]; then \
898                         $(INSTALL) -m 755 contrib/init.d/rc.mandrake.asterisk /etc/rc.d/init.d/asterisk; \
899                         /sbin/chkconfig --add asterisk; \
900                 elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then \
901                         $(INSTALL) -m 755 contrib/init.d/rc.suse.asterisk /etc/init.d/asterisk; \
902                         /sbin/chkconfig --add asterisk; \
903                 elif [ -f /etc/slackware-version ]; then \
904                         echo "Slackware is not currently supported, although an init script does exist for it." \
905                 else \
906                         echo "We could not install init scripts for your distribution."; \
907                 fi \
908         else \
909                 echo "We could not install init scripts for your operating system."; \
910         fi
911
912 dont-optimize: _all
913
914 valgrind: dont-optimize
915
916 depend: include/asterisk/version.h .depend defaults.h 
917         for x in $(SUBDIRS); do $(MAKE) -C $$x depend || exit 1 ; done
918
919 .depend: include/asterisk/version.h defaults.h
920         build_tools/mkdep $(CFLAGS) $(wildcard *.c)
921
922 .tags-depend:
923         @echo -n ".tags-depend: " > $@
924         @find . -maxdepth 1 -name \*.c -printf "\t%p \\\\\n" >> $@
925         @find . -maxdepth 1 -name \*.h -printf "\t%p \\\\\n" >> $@
926         @find $(SUBDIRS) -name \*.c -printf "\t%p \\\\\n" >> $@
927         @find $(SUBDIRS) -name \*.h -printf "\t%p \\\\\n" >> $@
928         @find include -name \*.h -printf "\t%p \\\\\n" >> $@
929         @echo >> $@
930
931 .tags-sources:
932         @rm -f $@
933         @find . -maxdepth 1 -name \*.c -print >> $@
934         @find . -maxdepth 1 -name \*.h -print >> $@
935         @find $(SUBDIRS) -name \*.c -print >> $@
936         @find $(SUBDIRS) -name \*.h -print >> $@
937         @find include -name \*.h -print >> $@
938
939 tags: .tags-depend .tags-sources
940         ctags -L .tags-sources -o $@
941
942 ctags: tags
943
944 TAGS: .tags-depend .tags-sources
945         etags -o $@ `cat .tags-sources`
946
947 etags: TAGS
948
949 FORCE:
950
951 %_env:
952         $(MAKE) -C $(shell echo $@ | sed "s/_env//g") env
953
954 env:
955         env
956
957 # If the cleancount has been changed, force a make clean.
958 # .cleancount is the global clean count, and .lastclean is the 
959 # last clean count we had
960
961 cleantest:
962         if cmp -s .cleancount .lastclean ; then echo ; else \
963                 $(MAKE) clean; cp -f .cleancount .lastclean;\
964         fi
965
966 _uninstall:
967         rm -f $(DESTDIR)$(MODULES_DIR)/*
968         rm -f $(DESTDIR)$(ASTSBINDIR)/*asterisk*
969         rm -f $(DESTDIR)$(ASTSBINDIR)/astgenkey
970         rm -f $(DESTDIR)$(ASTSBINDIR)/autosupport
971         rm -rf $(DESTDIR)$(ASTHEADERDIR)
972         rm -rf $(DESTDIR)$(ASTDATADIR)/sounds
973         rm -rf $(DESTDIR)$(ASTDATADIR)/firmware
974         rm -rf $(DESTDIR)$(ASTMANDIR)/man8
975         for x in $(SUBDIRS); do $(MAKE) -C $$x uninstall || exit 1 ; done
976
977 uninstall: _uninstall
978         @echo " +--------- Asterisk Uninstall Complete -----+"  
979         @echo " + Asterisk binaries, sounds, man pages,     +"  
980         @echo " + headers, modules, and firmware builds,    +"  
981         @echo " + have all been uninstalled.                +"  
982         @echo " +                                           +"
983         @echo " + To remove ALL traces of Asterisk,         +"
984         @echo " + including configuration, spool            +"
985         @echo " + directories, and logs, run the following  +"
986         @echo " + command:                                  +"
987         @echo " +                                           +"
988         @echo " +            $(MAKE) uninstall-all             +"  
989         @echo " +-------------------------------------------+"  
990
991 uninstall-all: _uninstall
992         rm -rf $(DESTDIR)$(ASTLIBDIR)
993         rm -rf $(DESTDIR)$(ASTVARLIBDIR)
994         rm -rf $(DESTDIR)$(ASTDATADIR)
995         rm -rf $(DESTDIR)$(ASTSPOOLDIR)
996         rm -rf $(DESTDIR)$(ASTETCDIR)
997         rm -rf $(DESTDIR)$(ASTLOGDIR)
998
999 menuselect: build_tools/menuselect makeopts.xml
1000         -@build_tools/menuselect ${GLOBAL_MAKEOPTS} ${USER_MAKEOPTS} menuselect.makeopts && echo "menuselect changes saved!" || echo "menuselect changes NOT saved!"
1001
1002 build_tools/menuselect: build_tools/menuselect.c build_tools/menuselect_curses.c build_tools/menuselect.h include/autoconfig.h strcompat.o mxml/libmxml.a
1003         $(MAKE) -C build_tools menuselect
1004
1005 mxml/libmxml.a:
1006         @cd mxml && unset CFLAGS LIBS && test -f config.h || ./configure
1007         $(MAKE) -C mxml libmxml.a
1008
1009 makeopts.xml: $(foreach dir,$(MOD_SUBDIRS),$(dir)/*.c) build_tools/cflags.xml
1010         @echo "Generating list of available modules ..."
1011         @build_tools/prep_moduledeps > $@