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