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