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