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