suppress the output from generating defaults.h and versions.h, as well as
[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   MENUSELECT_OBJS+=strcompat.o
409   ASTLINK=
410   SOLINK=-shared -fpic -L$(CROSS_COMPILE_TARGET)/usr/local/ssl/lib
411 endif
412
413 ifeq ($(MAKETOPLEVEL),$(MAKELEVEL))
414   CFLAGS+=$(TOPDIR_CFLAGS) $(ASTCFLAGS)
415 endif
416
417 # This is used when generating the doxygen documentation
418 ifneq ($(DOT),:)
419   HAVEDOT=yes
420 else
421   HAVEDOT=no
422 endif
423
424 INSTALL=install
425
426 _all: all
427         @echo " +--------- Asterisk Build Complete ---------+"  
428         @echo " + Asterisk has successfully been built, but +"  
429         @echo " + cannot be run before being installed by   +"  
430         @echo " + running:                                  +"  
431         @echo " +                                           +"
432         @echo " +               make install                +"  
433         @echo " +-------------------------------------------+"  
434
435 all: config.status menuselect.makeopts cleantest depend asterisk subdirs
436
437 config.status: configure
438         @CFLAGS="" ./configure
439         @echo "****"
440         @echo "**** The configure script was just executed, so 'make' needs to be"
441         @echo "**** restarted."
442         @echo "****"
443         @exit 1
444
445 makeopts: configure
446         @CFLAGS="" ./configure
447         @echo "****"
448         @echo "**** The configure script was just executed, so 'make' needs to be"
449         @echo "**** restarted."
450         @echo "****"
451         @exit 1
452
453 menuselect.makeopts: build_tools/menuselect makeopts.xml
454         @build_tools/menuselect --check-deps ${GLOBAL_MAKEOPTS} ${USER_MAKEOPTS} $@
455
456 #ifneq ($(wildcard tags),)
457 ctags: tags
458 #endif
459
460 ifneq ($(wildcard TAGS),)
461 all: TAGS
462 endif
463
464 editline/config.h:
465         cd editline && unset CFLAGS LIBS && CFLAGS="$(OPTIMIZE)" ./configure ; \
466
467 editline/libedit.a:
468         cd editline && unset CFLAGS LIBS && test -f config.h || CFLAGS="$(OPTIMIZE)" ./configure
469         $(MAKE) -C editline libedit.a
470
471 db1-ast/libdb1.a:
472         $(MAKE) -C db1-ast libdb1.a
473
474 ifneq ($(wildcard .depend),)
475   include .depend
476 endif
477
478 ifneq ($(wildcard .tags-depend),)
479   include .tags-depend
480 endif
481
482 ast_expr2.c ast_expr2.h:
483         bison -o $@ -d --name-prefix=ast_yy ast_expr2.y
484
485 ast_expr2f.c:
486         flex -o $@ --full ast_expr2.fl
487
488 testexpr2: ast_expr2f.c ast_expr2.c ast_expr2.h
489         gcc -g -c -DSTANDALONE ast_expr2f.c
490         gcc -g -c -DSTANDALONE ast_expr2.c
491         gcc -g -o testexpr2 ast_expr2f.o ast_expr2.o
492         rm ast_expr2.o ast_expr2f.o 
493
494 manpage: asterisk.8
495
496 asterisk.8: asterisk.sgml
497         rm -f asterisk.8
498         docbook2man asterisk.sgml
499         mv ./*.8 asterisk.8
500
501 asterisk.pdf: asterisk.sgml
502         docbook2pdf asterisk.sgml
503
504 asterisk.ps: asterisk.sgml
505         docbook2ps asterisk.sgml
506
507 asterisk.html: asterisk.sgml
508         docbook2html asterisk.sgml
509         mv r1.html asterisk.html
510
511 asterisk.txt: asterisk.sgml
512         docbook2txt asterisk.sgml
513
514 defaults.h: makeopts
515         @build_tools/make_defaults_h > $@.tmp
516         @if cmp -s $@.tmp $@ ; then echo ; else \
517                 mv $@.tmp $@ ; \
518         fi
519         @rm -f $@.tmp
520
521 include/asterisk/version.h:
522         @build_tools/make_version_h > $@.tmp
523         @if cmp -s $@.tmp $@ ; then echo; else \
524                 mv $@.tmp $@ ; \
525         fi
526         @rm -f $@.tmp
527
528 stdtime/libtime.a:
529         CFLAGS="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" $(MAKE) -C stdtime libtime.a
530
531 asterisk: editline/libedit.a db1-ast/libdb1.a stdtime/libtime.a $(OBJS)
532         build_tools/make_build_h > include/asterisk/build.h.tmp
533         if cmp -s include/asterisk/build.h.tmp include/asterisk/build.h ; then echo ; else \
534                 mv include/asterisk/build.h.tmp include/asterisk/build.h ; \
535         fi
536         rm -f include/asterisk/build.h.tmp
537         $(CC) -c -o buildinfo.o $(CFLAGS) buildinfo.c
538         $(CC) $(DEBUG) $(ASTOBJ) $(ASTLINK) $(OBJS) buildinfo.o $(LIBEDIT) db1-ast/libdb1.a stdtime/libtime.a $(LIBS)
539
540 muted: muted.o
541         $(CC) $(AUDIO_LIBS) -o muted muted.o
542
543 subdirs: 
544         @for x in $(MOD_SUBDIRS); do CFLAGS="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" $(MAKE) -C $$x || exit 1 ; done
545         @CFLAGS="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" $(MAKE) -C utils
546         @CFLAGS="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" $(MAKE) -C agi
547
548 clean-depend:
549         @for x in $(SUBDIRS); do $(MAKE) -C $$x clean-depend || exit 1 ; done
550         rm -f .depend .tags-depend
551
552 clean: clean-depend
553         @for x in $(SUBDIRS); do $(MAKE) -C $$x clean || exit 1 ; done
554         rm -f *.o *.so asterisk
555         rm -f defaults.h
556         rm -f include/asterisk/build.h
557         rm -f include/asterisk/version.h
558         rm -f .tags-sources tags TAGS
559         @if [ -f editline/Makefile ]; then $(MAKE) -C editline distclean ; fi
560         @if [ -d mpg123-0.59r ]; then $(MAKE) -C mpg123-0.59r clean; fi
561         $(MAKE) -C db1-ast clean
562         $(MAKE) -C stdtime clean
563
564 distclean: dist-clean
565
566 dist-clean: clean
567         rm -f menuselect.makeopts makeopts makeopts.xml
568         rm -f config.log config.status
569         rm -f include/autoconfig.h
570         $(MAKE) -C mxml clean
571         $(MAKE) -C build_tools dist-clean
572
573 datafiles: all
574         if [ x`$(ID) -un` = xroot ]; then sh build_tools/mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig; fi
575 # Should static HTTP be installed during make samples or even with its own target ala
576 # webvoicemail?  There are portions here that *could* be customized but might also be
577 # improved a lot.  I'll put it here for now.
578         mkdir -p $(DESTDIR)$(ASTDATADIR)/static-http
579         for x in static-http/*; do \
580                 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/static-http ; \
581         done
582         mkdir -p $(DESTDIR)$(ASTDATADIR)/sounds/digits
583         mkdir -p $(DESTDIR)$(ASTDATADIR)/sounds/priv-callerintros
584         for x in sounds/digits/*.gsm; do \
585                 if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
586                         $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/sounds/digits ; \
587                 else \
588                         echo "No description for $$x"; \
589                         exit 1; \
590                 fi; \
591         done
592         mkdir -p $(DESTDIR)$(ASTDATADIR)/sounds/dictate
593         for x in sounds/dictate/*.gsm; do \
594                 if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
595                         $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/sounds/dictate ; \
596                 else \
597                         echo "No description for $$x"; \
598                         exit 1; \
599                 fi; \
600         done
601         mkdir -p $(DESTDIR)$(ASTDATADIR)/sounds/letters
602         for x in sounds/letters/*.gsm; do \
603                 if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
604                         $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/sounds/letters ; \
605                 else \
606                         echo "No description for $$x"; \
607                         exit 1; \
608                 fi; \
609         done
610         mkdir -p $(DESTDIR)$(ASTDATADIR)/sounds/phonetic
611         for x in sounds/phonetic/*.gsm; do \
612                 if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
613                         $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/sounds/phonetic ; \
614                 else \
615                         echo "No description for $$x"; \
616                         exit 1; \
617                 fi; \
618         done
619         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 \
620                 if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
621                         $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/sounds ; \
622                 else \
623                         echo "No description for $$x"; \
624                         exit 1; \
625                 fi; \
626         done
627         mkdir -p $(DESTDIR)$(ASTDATADIR)/mohmp3
628         mkdir -p $(DESTDIR)$(ASTDATADIR)/images
629         for x in images/*.jpg; do \
630                 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/images ; \
631         done
632         mkdir -p $(DESTDIR)$(AGI_DIR)
633
634 update: 
635         @if [ -d .svn ]; then \
636                 echo "Updating from Subversion..." ; \
637                 svn update | tee update.out; \
638                 rm -f .version; \
639                 if [ `grep -c ^C update.out` -gt 0 ]; then \
640                         echo ; echo "The following files have conflicts:" ; \
641                         grep ^C update.out | cut -b4- ; \
642                 fi ; \
643                 rm -f update.out; \
644                 $(MAKE) clean-depend; \
645         elif [ -d CVS ]; then \
646                 echo "Updating from CVS..." ; \
647                 cvs -q -z3 update -Pd | tee update.out; \
648                 rm -f .version; \
649                 if [ `grep -c ^C update.out` -gt 0 ]; then \
650                         echo ; echo "The following files have conflicts:" ; \
651                         grep ^C update.out | cut -d' ' -f2- ; \
652                 fi ; \
653                 rm -f update.out; \
654                 $(MAKE) clean-depend; \
655         else \
656                 echo "Not under version control";  \
657         fi
658
659 NEWHEADERS=$(notdir $(wildcard include/asterisk/*.h))
660 OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h)))
661
662 bininstall: all
663         mkdir -p $(DESTDIR)$(MODULES_DIR)
664         mkdir -p $(DESTDIR)$(ASTSBINDIR)
665         mkdir -p $(DESTDIR)$(ASTETCDIR)
666         mkdir -p $(DESTDIR)$(ASTBINDIR)
667         mkdir -p $(DESTDIR)$(ASTVARRUNDIR)
668         mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail
669         mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/dictate
670         mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/system
671         mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/tmp
672         mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/meetme
673         mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/monitor
674         if [ -f asterisk ]; then $(INSTALL) -m 755 asterisk $(DESTDIR)$(ASTSBINDIR)/; fi
675         if [ -f asterisk.dll ]; then $(INSTALL) -m 755 asterisk.dll $(DESTDIR)$(ASTSBINDIR)/; fi
676         ln -sf asterisk $(DESTDIR)$(ASTSBINDIR)/rasterisk
677         $(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
678         $(INSTALL) -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/  
679         if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \
680                 cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;' > $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ;\
681                 chmod 755 $(DESTDIR)$(ASTSBINDIR)/safe_asterisk;\
682         fi
683         $(INSTALL) -d $(DESTDIR)$(ASTHEADERDIR)
684         $(INSTALL) -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
685         if [ -n "$(OLDHEADERS)" ]; then \
686                 rm -f $(addprefix $(DESTDIR)$(ASTHEADERDIR)/,$(OLDHEADERS)) ;\
687         fi
688         mkdir -p $(DESTDIR)$(ASTDATADIR)/sounds
689         mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
690         mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-custom
691         mkdir -p $(DESTDIR)$(ASTDATADIR)/keys
692         mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware
693         mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware/iax
694         mkdir -p $(DESTDIR)$(ASTMANDIR)/man8
695         $(INSTALL) -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTDATADIR)/keys
696         $(INSTALL) -m 644 keys/freeworlddialup.pub $(DESTDIR)$(ASTDATADIR)/keys
697         $(INSTALL) -m 644 asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
698         $(INSTALL) -m 644 contrib/scripts/astgenkey.8 $(DESTDIR)$(ASTMANDIR)/man8
699         $(INSTALL) -m 644 contrib/scripts/autosupport.8 $(DESTDIR)$(ASTMANDIR)/man8
700         $(INSTALL) -m 644 contrib/scripts/safe_asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
701         if [ -d contrib/firmware/iax ]; then \
702                 $(INSTALL) -m 644 contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTDATADIR)/firmware/iax/iaxy.bin; \
703         else \
704                 echo "You need to do cvs update -d not just cvs update" ; \
705         fi 
706         if [ -f mpg123-0.59r/mpg123 ]; then $(MAKE) -C mpg123-0.59r install; fi
707
708 install-subdirs:
709         @for x in $(SUBDIRS); do $(MAKE) -C $$x install || exit 1 ; done
710
711 NEWMODS=$(notdir $(wildcard */*.so))
712 OLDMODS=$(filter-out $(NEWMODS),$(notdir $(wildcard $(DESTDIR)$(MODULES_DIR)/*.so)))
713
714 oldmodcheck:
715         @if [ -n "$(OLDMODS)" ]; then \
716                 echo " WARNING WARNING WARNING" ;\
717                 echo "" ;\
718                 echo " Your Asterisk modules directory, located at" ;\
719                 echo " $(DESTDIR)$(MODULES_DIR)" ;\
720                 echo " contains modules that were not installed by this " ;\
721                 echo " version of Asterisk. Please ensure that these" ;\
722                 echo " modules are compatible with this version before" ;\
723                 echo " attempting to run Asterisk." ;\
724                 echo "" ;\
725                 for f in $(OLDMODS); do \
726                         echo "    $$f" ;\
727                 done ;\
728                 echo "" ;\
729                 echo " WARNING WARNING WARNING" ;\
730         fi
731
732 install: all datafiles bininstall install-subdirs
733         @if [ -x /usr/sbin/asterisk-post-install ]; then \
734                 /usr/sbin/asterisk-post-install $(DESTDIR) . ; \
735         fi
736         @echo " +---- Asterisk Installation Complete -------+"  
737         @echo " +                                           +"
738         @echo " +    YOU MUST READ THE SECURITY DOCUMENT    +"
739         @echo " +                                           +"
740         @echo " + Asterisk has successfully been installed. +"  
741         @echo " + If you would like to install the sample   +"  
742         @echo " + configuration files (overwriting any      +"
743         @echo " + existing config files), run:              +"  
744         @echo " +                                           +"
745         @echo " +               $(MAKE) samples                +"
746         @echo " +                                           +"
747         @echo " +-----------------  or ---------------------+"
748         @echo " +                                           +"
749         @echo " + You can go ahead and install the asterisk +"
750         @echo " + program documentation now or later run:   +"
751         @echo " +                                           +"
752         @echo " +              $(MAKE) progdocs                +"
753         @echo " +                                           +"
754         @echo " + **Note** This requires that you have      +"
755         @echo " + doxygen installed on your local system    +"
756         @echo " +-------------------------------------------+"
757         @$(MAKE) -s oldmodcheck
758
759 upgrade: all bininstall
760
761 adsi:
762         mkdir -p $(DESTDIR)$(ASTETCDIR)
763         for x in configs/*.adsi; do \
764                 if [ ! -f $(DESTDIR)$(ASTETCDIRX)/$$x ]; then \
765                         $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`basename $$x` ; \
766                 fi ; \
767         done
768
769 samples: adsi
770         mkdir -p $(DESTDIR)$(ASTETCDIR)
771         for x in configs/*.sample; do \
772                 if [ -f $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` ]; then \
773                         if [ "$(OVERWRITE)" = "y" ]; then \
774                                 if cmp -s $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` $$x ; then \
775                                         echo "Config file $$x is unchanged"; \
776                                         continue; \
777                                 fi ; \
778                                 mv -f $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample`.old ; \
779                         else \
780                                 echo "Skipping config file $$x"; \
781                                 continue; \
782                         fi ;\
783                 fi ; \
784                 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` ;\
785         done
786         if [ "$(OVERWRITE)" = "y" ] || [ ! -f $(DESTDIR)$(ASTCONFPATH) ]; then \
787                 ( \
788                 echo "[directories]" ; \
789                 echo "astetcdir => $(ASTETCDIR)" ; \
790                 echo "astmoddir => $(MODULES_DIR)" ; \
791                 echo "astvarlibdir => $(ASTVARLIBDIR)" ; \
792                 echo "astdatadir => $(ASTDATADIR)" ; \
793                 echo "astagidir => $(AGI_DIR)" ; \
794                 echo "astspooldir => $(ASTSPOOLDIR)" ; \
795                 echo "astrundir => $(ASTVARRUNDIR)" ; \
796                 echo "astlogdir => $(ASTLOGDIR)" ; \
797                 echo "" ; \
798                 echo "; Changing the following lines may compromise your security." ; \
799                 echo ";[files]" ; \
800                 echo ";astctlpermissions = 0660" ; \
801                 echo ";astctlowner = root" ; \
802                 echo ";astctlgroup = apache" ; \
803                 echo ";astctl = asterisk.ctl" ; \
804                 echo ";[options]" ; \
805                 echo ";internal_timing = yes" ; \
806                 ) > $(DESTDIR)$(ASTCONFPATH) ; \
807         else \
808                 echo "Skipping asterisk.conf creation"; \
809         fi
810         mkdir -p $(DESTDIR)$(ASTDATADIR)/sounds ; \
811         for x in sounds/demo-*; do \
812                 if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
813                         $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/sounds ; \
814                 else \
815                         echo "No description for $$x"; \
816                         exit 1; \
817                 fi; \
818         done
819         mkdir -p $(DESTDIR)$(ASTDATADIR)/mohmp3 ; \
820         for x in sounds/*.mp3; do \
821                 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/mohmp3 ; \
822         done
823         rm -f $(DESTDIR)$(ASTDATADIR)/mohmp3/sample-hold.mp3
824         mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
825         :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm
826         for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isunavail; do \
827                 cat $(DESTDIR)$(ASTDATADIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm ; \
828         done
829         :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm
830         for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isonphone; do \
831                 cat $(DESTDIR)$(ASTDATADIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm ; \
832         done
833
834 webvmail:
835         @[ -d $(DESTDIR)$(HTTP_DOCSDIR)/ ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 )
836         @[ -d $(DESTDIR)$(HTTP_CGIDIR) ] || ( printf "cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit 1 )
837         $(INSTALL) -m 4755 -o root -g root contrib/scripts/vmail.cgi $(DESTDIR)$(HTTP_CGIDIR)/vmail.cgi
838         mkdir -p $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk
839         for x in images/*.gif; do \
840                 $(INSTALL) -m 644 $$x $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk/; \
841         done
842         @echo " +--------- Asterisk Web Voicemail ----------+"  
843         @echo " +                                           +"
844         @echo " + Asterisk Web Voicemail is installed in    +"
845         @echo " + your cgi-bin directory:                   +"
846         @echo " + $(DESTDIR)$(HTTP_CGIDIR)"
847         @echo " + IT USES A SETUID ROOT PERL SCRIPT, SO     +"
848         @echo " + IF YOU DON'T LIKE THAT, UNINSTALL IT!     +"
849         @echo " +                                           +"
850         @echo " + Other static items have been stored in:   +"
851         @echo " + $(DESTDIR)$(HTTP_DOCSDIR)"
852         @echo " +                                           +"
853         @echo " + If these paths do not match your httpd    +"
854         @echo " + installation, correct the definitions     +"
855         @echo " + in your Makefile of HTTP_CGIDIR and       +"
856         @echo " + HTTP_DOCSDIR                              +"
857         @echo " +                                           +"
858         @echo " +-------------------------------------------+"  
859
860 spec: 
861         sed "s/^Version:.*/Version: $(RPMVERSION)/g" redhat/asterisk.spec > asterisk.spec ; \
862
863 rpm: __rpm
864
865 __rpm: include/asterisk/version.h spec
866         rm -rf /tmp/asterisk ; \
867         mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
868         $(MAKE) DESTDIR=/tmp/asterisk install ; \
869         $(MAKE) DESTDIR=/tmp/asterisk samples ; \
870         mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
871         cp -f contrib/init.d/rc.redhat.asterisk /tmp/asterisk/etc/rc.d/init.d/asterisk ; \
872         rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec
873
874 progdocs:
875         (cat contrib/asterisk-ng-doxygen; echo "HAVE_DOT=$(HAVEDOT)"; \
876         echo "PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen - 
877
878 mpg123:
879         @wget -V >/dev/null || (echo "You need wget" ; false )
880         [ -f mpg123-0.59r.tar.gz ] || wget http://www.mpg123.de/mpg123/mpg123-0.59r.tar.gz
881         [ -d mpg123-0.59r ] || tar xfz mpg123-0.59r.tar.gz
882         $(MAKE) -C mpg123-0.59r $(MPG123TARG)
883
884 config:
885         @if [ "${OSARCH}" = "Linux" ]; then \
886                 if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \
887                         $(INSTALL) -m 755 contrib/init.d/rc.redhat.asterisk /etc/rc.d/init.d/asterisk; \
888                         /sbin/chkconfig --add asterisk; \
889                 elif [ -f /etc/debian_version ]; then \
890                         $(INSTALL) -m 755 contrib/init.d/rc.debian.asterisk /etc/init.d/asterisk; \
891                         /usr/sbin/update-rc.d asterisk start 10 2 3 4 5 . stop 91 2 3 4 5 .; \
892                 elif [ -f /etc/gentoo-release ]; then \
893                         $(INSTALL) -m 755 contrib/init.d/rc.gentoo.asterisk /etc/init.d/asterisk; \
894                         /sbin/rc-update add asterisk default; \
895                 elif [ -f /etc/mandrake-release ]; then \
896                         $(INSTALL) -m 755 contrib/init.d/rc.mandrake.asterisk /etc/rc.d/init.d/asterisk; \
897                         /sbin/chkconfig --add asterisk; \
898                 elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then \
899                         $(INSTALL) -m 755 contrib/init.d/rc.suse.asterisk /etc/init.d/asterisk; \
900                         /sbin/chkconfig --add asterisk; \
901                 elif [ -f /etc/slackware-version ]; then \
902                         echo "Slackware is not currently supported, although an init script does exist for it." \
903                 else \
904                         echo "We could not install init scripts for your distribution."; \
905                 fi \
906         else \
907                 echo "We could not install init scripts for your operating system."; \
908         fi
909
910 dont-optimize: _all
911
912 valgrind: dont-optimize
913
914 depend: include/asterisk/version.h .depend defaults.h 
915         @for x in $(SUBDIRS); do $(MAKE) -C $$x depend || exit 1 ; done
916
917 .depend: include/asterisk/version.h defaults.h
918         build_tools/mkdep $(CFLAGS) $(wildcard *.c)
919
920 .tags-depend:
921         @echo -n ".tags-depend: " > $@
922         @find . -maxdepth 1 -name \*.c -printf "\t%p \\\\\n" >> $@
923         @find . -maxdepth 1 -name \*.h -printf "\t%p \\\\\n" >> $@
924         @find $(SUBDIRS) -name \*.c -printf "\t%p \\\\\n" >> $@
925         @find $(SUBDIRS) -name \*.h -printf "\t%p \\\\\n" >> $@
926         @find include -name \*.h -printf "\t%p \\\\\n" >> $@
927         @echo >> $@
928
929 .tags-sources:
930         @rm -f $@
931         @find . -maxdepth 1 -name \*.c -print >> $@
932         @find . -maxdepth 1 -name \*.h -print >> $@
933         @find $(SUBDIRS) -name \*.c -print >> $@
934         @find $(SUBDIRS) -name \*.h -print >> $@
935         @find include -name \*.h -print >> $@
936
937 tags: .tags-depend .tags-sources
938         ctags -L .tags-sources -o $@
939
940 ctags: tags
941
942 TAGS: .tags-depend .tags-sources
943         etags -o $@ `cat .tags-sources`
944
945 etags: TAGS
946
947 FORCE:
948
949 %_env:
950         $(MAKE) -C $(shell echo $@ | sed "s/_env//g") env
951
952 env:
953         env
954
955 # If the cleancount has been changed, force a make clean.
956 # .cleancount is the global clean count, and .lastclean is the 
957 # last clean count we had
958
959 cleantest:
960         @if cmp -s .cleancount .lastclean ; then echo ; else \
961                 $(MAKE) clean; cp -f .cleancount .lastclean;\
962         fi
963
964 _uninstall:
965         rm -f $(DESTDIR)$(MODULES_DIR)/*
966         rm -f $(DESTDIR)$(ASTSBINDIR)/*asterisk*
967         rm -f $(DESTDIR)$(ASTSBINDIR)/astgenkey
968         rm -f $(DESTDIR)$(ASTSBINDIR)/autosupport
969         rm -rf $(DESTDIR)$(ASTHEADERDIR)
970         rm -rf $(DESTDIR)$(ASTDATADIR)/sounds
971         rm -rf $(DESTDIR)$(ASTDATADIR)/firmware
972         rm -rf $(DESTDIR)$(ASTMANDIR)/man8
973         for x in $(SUBDIRS); do $(MAKE) -C $$x uninstall || exit 1 ; done
974
975 uninstall: _uninstall
976         @echo " +--------- Asterisk Uninstall Complete -----+"  
977         @echo " + Asterisk binaries, sounds, man pages,     +"  
978         @echo " + headers, modules, and firmware builds,    +"  
979         @echo " + have all been uninstalled.                +"  
980         @echo " +                                           +"
981         @echo " + To remove ALL traces of Asterisk,         +"
982         @echo " + including configuration, spool            +"
983         @echo " + directories, and logs, run the following  +"
984         @echo " + command:                                  +"
985         @echo " +                                           +"
986         @echo " +            $(MAKE) uninstall-all             +"  
987         @echo " +-------------------------------------------+"  
988
989 uninstall-all: _uninstall
990         rm -rf $(DESTDIR)$(ASTLIBDIR)
991         rm -rf $(DESTDIR)$(ASTVARLIBDIR)
992         rm -rf $(DESTDIR)$(ASTDATADIR)
993         rm -rf $(DESTDIR)$(ASTSPOOLDIR)
994         rm -rf $(DESTDIR)$(ASTETCDIR)
995         rm -rf $(DESTDIR)$(ASTLOGDIR)
996
997 menuselect: build_tools/menuselect makeopts.xml
998         -@build_tools/menuselect ${GLOBAL_MAKEOPTS} ${USER_MAKEOPTS} menuselect.makeopts && echo "menuselect changes saved!" || echo "menuselect changes NOT saved!"
999
1000 build_tools/menuselect: build_tools/menuselect.c build_tools/menuselect_curses.c build_tools/menuselect.h include/autoconfig.h mxml/libmxml.a $(MENUSELECT_OBJS)
1001         $(MAKE) -C build_tools menuselect
1002
1003 mxml/libmxml.a:
1004         @cd mxml && unset CFLAGS LIBS && test -f config.h || ./configure
1005         $(MAKE) -C mxml libmxml.a
1006
1007 makeopts.xml: $(foreach dir,$(MOD_SUBDIRS),$(dir)/*.c) build_tools/cflags.xml
1008         @echo "Generating list of available modules ..."
1009         @build_tools/prep_moduledeps > $@