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