Fix a few build problems on Solaris (and check for an md5 utility in
[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 # All Makefiles use the following variables:
15 #
16 # ASTCFLAGS - compiler options
17 # ASTLDFLAGS - linker flags (not libraries)
18 # LIBS - additional libraries, at top-level for all links,
19 #      on a single object just for that object
20 # SOLINK - linker flags used only for creating shared objects (.so files),
21 #      used for all .so links
22 #
23 # Initial values for ASTCFLAGS and ASTLDFLAGS can be specified in the
24 # environment when running make, as follows:
25 #
26 #       $ ASTCFLAGS="-Werror" make ...
27 #
28 # note that this is different from
29 #
30 #       $ make ASTCFLAGS="-Werror" ...
31 #
32 # If you need to pass compiler/linker flags as 'make' variables, please use
33 #
34 #       $ make COPTS="..." LDOPTS="..." ...
35 #
36 #
37 # You can add the path of local module subdirs from the command line with
38 #   make LOCAL_MOD_SUBDIRS= ....
39
40 export ASTTOPDIR                # Top level dir, used in subdirs' Makefiles
41 export ASTERISKVERSION
42 export ASTERISKVERSIONNUM
43
44 #--- values used for default paths
45
46 # DESTDIR is the staging (or final) directory where files are copied
47 # during the install process. Define it before 'export', otherwise
48 # export will set it to the empty string making ?= fail.
49 # WARNING: do not put spaces or comments after the value.
50 DESTDIR?=$(INSTALL_PATH)
51 export DESTDIR
52
53 export INSTALL_PATH     # Additional prefix for the following paths
54 export ASTETCDIR                # Path for config files
55 export ASTVARRUNDIR
56 export MODULES_DIR
57 export ASTSPOOLDIR
58 export ASTVARLIBDIR
59 export ASTDATADIR
60 export ASTDBDIR
61 export ASTLOGDIR
62 export ASTLIBDIR
63 export ASTMANDIR
64 export ASTHEADERDIR
65 export ASTBINDIR
66 export ASTSBINDIR
67 export AGI_DIR
68 export ASTCONFPATH
69
70 export OSARCH                   # Operating system
71 export PROC                     # Processor type
72
73 export NOISY_BUILD              # Used in Makefile.rules
74 export MENUSELECT_CFLAGS        # Options selected in menuselect.
75 export AST_DEVMODE              # Set to "yes" for additional compiler
76                                 # and runtime checks
77
78 export SOLINK                   # linker flags for shared objects
79 export STATIC_BUILD             # Additional cflags, set to -static
80                                 # for static builds. Probably
81                                 # should go directly to ASTLDFLAGS
82
83 #--- paths to various commands
84 export CC
85 export CXX
86 export AR
87 export RANLIB
88 export HOST_CC
89 export INSTALL
90 export STRIP
91 export DOWNLOAD
92 export AWK
93 export GREP
94 export ID
95 export MD5
96
97 # even though we could use '-include makeopts' here, use a wildcard
98 # lookup anyway, so that make won't try to build makeopts if it doesn't
99 # exist (other rules will force it to be built if needed)
100 ifneq ($(wildcard makeopts),)
101   include makeopts
102 endif
103
104 # Some build systems, such as the one in openwrt, like to pass custom target
105 # CFLAGS and LDFLAGS in the COPTS and LDOPTS variables.
106 ASTCFLAGS+=$(COPTS)
107 ASTLDFLAGS+=$(LDOPTS)
108
109 # libxml2 cflags
110 ASTCFLAGS+=$(LIBXML2_INCLUDE)
111
112 #Uncomment this to see all build commands instead of 'quiet' output
113 #NOISY_BUILD=yes
114
115 empty:=
116 space:=$(empty) $(empty)
117 ASTTOPDIR:=$(subst $(space),\$(space),$(CURDIR))
118
119 # Overwite config files on "make samples"
120 OVERWRITE=y
121
122 # Include debug and macro symbols in the executables (-g) and profiling info (-pg)
123 DEBUG=-g3
124
125
126 # Define standard directories for various platforms
127 # These apply if they are not redefined in asterisk.conf 
128 ifeq ($(OSARCH),SunOS)
129   ASTETCDIR=/var/etc/asterisk
130   ASTLIBDIR=/opt/asterisk/lib
131   ASTVARLIBDIR=/var/opt/asterisk
132   ASTDBDIR=$(ASTVARLIBDIR)
133   ASTKEYDIR=$(ASTVARLIBDIR)
134   ASTSPOOLDIR=/var/spool/asterisk
135   ASTLOGDIR=/var/log/asterisk
136   ASTHEADERDIR=/opt/asterisk/include
137   ASTBINDIR=/opt/asterisk/bin
138   ASTSBINDIR=/opt/asterisk/sbin
139   ASTVARRUNDIR=/var/run/asterisk
140   ASTMANDIR=/opt/asterisk/man
141 else
142   ASTETCDIR=$(sysconfdir)/asterisk
143   ASTLIBDIR=$(libdir)/asterisk
144   ASTHEADERDIR=$(includedir)/asterisk
145   ASTBINDIR=$(bindir)
146   ASTSBINDIR=$(sbindir)
147   ASTSPOOLDIR=$(localstatedir)/spool/asterisk
148   ASTLOGDIR=$(localstatedir)/log/asterisk
149   ASTVARRUNDIR=$(localstatedir)/run
150   ASTMANDIR=$(mandir)
151 ifneq ($(findstring BSD,$(OSARCH)),)
152   ASTVARLIBDIR=$(prefix)/share/asterisk
153   ASTVARRUNDIR=$(localstatedir)/run/asterisk
154   ASTDBDIR=$(localstatedir)/db/asterisk
155 else
156   ASTVARLIBDIR=$(localstatedir)/lib/asterisk
157   ASTDBDIR=$(ASTVARLIBDIR)
158 endif
159   ASTKEYDIR=$(ASTVARLIBDIR)
160 endif
161 ifeq ($(ASTDATADIR),)
162   ASTDATADIR:=$(ASTVARLIBDIR)
163 endif
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 # Uncomment this to use the older DSP routines
177 #ASTCFLAGS+=-DOLD_DSP_ROUTINES
178
179 # If the file .asterisk.makeopts is present in your home directory, you can
180 # include all of your favorite menuselect options so that every time you download
181 # a new version of Asterisk, you don't have to run menuselect to set them. 
182 # The file /etc/asterisk.makeopts will also be included but can be overridden
183 # by the file in your home directory.
184
185 GLOBAL_MAKEOPTS=$(wildcard /etc/asterisk.makeopts)
186 USER_MAKEOPTS=$(wildcard ~/.asterisk.makeopts)
187
188 MOD_SUBDIR_CFLAGS=-I$(ASTTOPDIR)/include
189 OTHER_SUBDIR_CFLAGS=-I$(ASTTOPDIR)/include
190
191 # Create OPTIONS variable, but probably we can assign directly to ASTCFLAGS
192 OPTIONS=
193
194 ifeq ($(OSARCH),linux-gnu)
195   ifeq ($(PROC),x86_64)
196     # You must have GCC 3.4 to use k8, otherwise use athlon
197     PROC=k8
198     #PROC=athlon
199   endif
200
201   ifeq ($(PROC),sparc64)
202     #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
203     #This works for even old (2.96) versions of gcc and provides a small boost either way.
204     #A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
205     #So we go lowest common available by gcc and go a step down, still a step up from
206     #the default as we now have a better instruction set to work with. - Belgarath
207     PROC=ultrasparc
208     OPTIONS+=$(shell if $(CC) -mtune=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mtune=$(PROC)"; fi)
209     OPTIONS+=$(shell if $(CC) -mcpu=v8 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mcpu=v8"; fi)
210     OPTIONS+=-fomit-frame-pointer
211   endif
212
213   ifeq ($(PROC),arm)
214     # The Cirrus logic is the only heavily shipping arm processor with a real floating point unit
215     ifeq ($(SUB_PROC),maverick)
216       OPTIONS+=-fsigned-char -mcpu=ep9312
217     else
218       ifeq ($(SUB_PROC),xscale)
219         OPTIONS+=-fsigned-char -mcpu=xscale
220       else
221         OPTIONS+=-fsigned-char 
222       endif
223     endif
224   endif
225 endif
226
227 ifeq ($(findstring -save-temps,$(ASTCFLAGS)),)
228   ifeq ($(findstring -pipe,$(ASTCFLAGS)),)
229     ASTCFLAGS+=-pipe
230   endif
231 endif
232
233 ifeq ($(findstring -Wall,$(ASTCFLAGS)),)
234   ASTCFLAGS+=-Wall
235 endif
236
237 ASTCFLAGS+=-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG)
238
239 ifeq ($(AST_DEVMODE),yes)
240   ASTCFLAGS+=-Werror -Wunused -Wundef $(AST_DECLARATION_AFTER_STATEMENT) -Wmissing-format-attribute -Wformat-security #-Wformat=2
241 endif
242
243 ifneq ($(findstring BSD,$(OSARCH)),)
244   ASTCFLAGS+=-I/usr/local/include
245   ASTLDFLAGS+=-L/usr/local/lib
246 endif
247
248 ifeq ($(findstring -march,$(ASTCFLAGS)),)
249   ifneq ($(PROC),ultrasparc)
250     ASTCFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
251   endif
252 endif
253
254 ifeq ($(PROC),ppc)
255   ASTCFLAGS+=-fsigned-char
256 endif
257
258 ifeq ($(OSARCH),FreeBSD)
259   # -V is understood by BSD Make, not by GNU make.
260   BSDVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk)
261   ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
262 endif
263
264 ifeq ($(OSARCH),NetBSD)
265   ASTCFLAGS+=-pthread -I/usr/pkg/include
266 endif
267
268 ifeq ($(OSARCH),OpenBSD)
269   ASTCFLAGS+=-pthread -ftrampolines
270 endif
271
272 ifeq ($(OSARCH),SunOS)
273   ASTCFLAGS+=-Wcast-align -DSOLARIS -I../include/solaris-compat -I/opt/ssl/include -I/usr/local/ssl/include -D_XPG4_2
274 endif
275
276 ASTERISKVERSION:=$(shell GREP=$(GREP) AWK=$(AWK) build_tools/make_version .)
277
278 ifneq ($(wildcard .version),)
279   ASTERISKVERSIONNUM:=$(shell $(AWK) -F. '{printf "%01d%02d%02d", $$1, $$2, $$3}' .version)
280 endif
281
282 ifneq ($(wildcard .svn),)
283   ASTERISKVERSIONNUM:=999999
284 endif
285
286 # XXX MALLOC_DEBUG is probably unused, Makefile.moddir_rules adds the
287 #       value directly to ASTCFLAGS
288 ASTCFLAGS+=$(MALLOC_DEBUG)$(OPTIONS)
289
290 MOD_SUBDIRS:=channels pbx apps codecs formats cdr funcs tests main res $(LOCAL_MOD_SUBDIRS)
291 OTHER_SUBDIRS:=utils agi
292 SUBDIRS:=$(OTHER_SUBDIRS) $(MOD_SUBDIRS)
293 SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)
294 SUBDIRS_CLEAN:=$(SUBDIRS:%=%-clean)
295 SUBDIRS_DIST_CLEAN:=$(SUBDIRS:%=%-dist-clean)
296 SUBDIRS_UNINSTALL:=$(SUBDIRS:%=%-uninstall)
297 MOD_SUBDIRS_EMBED_LDSCRIPT:=$(MOD_SUBDIRS:%=%-embed-ldscript)
298 MOD_SUBDIRS_EMBED_LDFLAGS:=$(MOD_SUBDIRS:%=%-embed-ldflags)
299 MOD_SUBDIRS_EMBED_LIBS:=$(MOD_SUBDIRS:%=%-embed-libs)
300 MOD_SUBDIRS_MENUSELECT_TREE:=$(MOD_SUBDIRS:%=%-menuselect-tree)
301
302 ifneq ($(findstring darwin,$(OSARCH)),)
303   ASTCFLAGS+=-D__Darwin__ -fnested-functions
304   SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
305 else
306 # These are used for all but Darwin
307   SOLINK=-shared
308   ifneq ($(findstring BSD,$(OSARCH)),)
309     LDFLAGS+=-L/usr/local/lib
310   endif
311 endif
312
313 ifeq ($(OSARCH),SunOS)
314   SOLINK=-shared -fpic -L/usr/local/ssl/lib -lrt
315 endif
316
317 ifeq ($(OSARCH),OpenBSD)
318   SOLINK=-shared -fpic
319 endif
320
321 # comment to print directories during submakes
322 #PRINT_DIR=yes
323
324 SILENTMAKE:=$(MAKE) --quiet --no-print-directory
325 ifneq ($(PRINT_DIR)$(NOISY_BUILD),)
326 SUBMAKE:=$(MAKE)
327 else
328 SUBMAKE:=$(MAKE) --quiet --no-print-directory
329 endif
330
331 # This is used when generating the doxygen documentation
332 ifneq ($(DOT),:)
333   HAVEDOT=yes
334 else
335   HAVEDOT=no
336 endif
337
338 # $(MAKE) is printed in several places, and we want it to be a
339 # fixed size string. Define a variable whose name has also the
340 # same size, so we can easily align text.
341 ifeq ($(MAKE), gmake)
342         mK="gmake"
343 else
344         mK=" make"
345 endif
346
347 all: _all
348         @echo " +--------- Asterisk Build Complete ---------+"  
349         @echo " + Asterisk has successfully been built, and +"  
350         @echo " + can be installed by running:              +"
351         @echo " +                                           +"
352         @echo " +               $(mK) install               +"  
353         @echo " +-------------------------------------------+"  
354
355 _all: cleantest makeopts $(SUBDIRS) doc/core-en_US.xml
356
357 makeopts: configure
358         @echo "****"
359         @echo "**** The configure script must be executed before running '$(MAKE)'." 
360         @echo "****               Please run \"./configure\"."
361         @echo "****"
362         @exit 1
363
364 menuselect.makeopts: menuselect/menuselect menuselect-tree makeopts
365         menuselect/menuselect --check-deps menuselect.makeopts $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS)
366
367 $(MOD_SUBDIRS_EMBED_LDSCRIPT):
368         @echo "EMBED_LDSCRIPTS+="`$(SILENTMAKE) -C $(@:-embed-ldscript=) SUBDIR=$(@:-embed-ldscript=) __embed_ldscript` >> makeopts.embed_rules
369
370 $(MOD_SUBDIRS_EMBED_LDFLAGS):
371         @echo "EMBED_LDFLAGS+="`$(SILENTMAKE) -C $(@:-embed-ldflags=) SUBDIR=$(@:-embed-ldflags=) __embed_ldflags` >> makeopts.embed_rules
372
373 $(MOD_SUBDIRS_EMBED_LIBS):
374         @echo "EMBED_LIBS+="`$(SILENTMAKE) -C $(@:-embed-libs=) SUBDIR=$(@:-embed-libs=) __embed_libs` >> makeopts.embed_rules
375
376 $(MOD_SUBDIRS_MENUSELECT_TREE):
377         @$(SUBMAKE) -C $(@:-menuselect-tree=) SUBDIR=$(@:-menuselect-tree=) moduleinfo
378         @$(SUBMAKE) -C $(@:-menuselect-tree=) SUBDIR=$(@:-menuselect-tree=) makeopts
379
380 makeopts.embed_rules: menuselect.makeopts
381         @echo "Generating embedded module rules ..."
382         @rm -f $@
383         @$(SUBMAKE) $(MOD_SUBDIRS_EMBED_LDSCRIPT)
384         @$(SUBMAKE) $(MOD_SUBDIRS_EMBED_LDFLAGS)
385         @$(SUBMAKE) $(MOD_SUBDIRS_EMBED_LIBS)
386
387 $(SUBDIRS): main/version.c include/asterisk/version.h include/asterisk/build.h include/asterisk/buildopts.h defaults.h makeopts.embed_rules
388
389 ifeq ($(findstring $(OSARCH), mingw32 cygwin ),)
390     # Non-windows:
391     # ensure that all module subdirectories are processed before 'main' during
392     # a parallel build, since if there are modules selected to be embedded the
393     # directories containing them must be completed before the main Asterisk
394     # binary can be built
395 main: $(filter-out main,$(MOD_SUBDIRS))
396 else
397     # Windows: we need to build main (i.e. the asterisk dll) first,
398     # followed by res, followed by the other directories, because
399     # dll symbols must be resolved during linking and not at runtime.
400 D1:= $(filter-out main,$(MOD_SUBDIRS))
401 D1:= $(filter-out res,$(D1))
402
403 $(D1): res
404 res:    main
405 endif
406
407 $(MOD_SUBDIRS):
408         @ASTCFLAGS="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" $(SUBMAKE) --no-builtin-rules -C $@ SUBDIR=$@ all
409
410 $(OTHER_SUBDIRS):
411         @ASTCFLAGS="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" $(SUBMAKE) --no-builtin-rules -C $@ SUBDIR=$@ all
412
413 defaults.h: makeopts
414         @build_tools/make_defaults_h > $@.tmp
415         @cmp -s $@.tmp $@ || mv $@.tmp $@
416         @rm -f $@.tmp
417
418 main/version.c: FORCE
419         @build_tools/make_version_c > $@.tmp
420         @cmp -s $@.tmp $@ || mv $@.tmp $@
421         @rm -f $@.tmp
422
423 include/asterisk/version.h: FORCE
424         @build_tools/make_version_h > $@.tmp
425         @cmp -s $@.tmp $@ || mv $@.tmp $@
426         @rm -f $@.tmp
427
428 include/asterisk/buildopts.h: menuselect.makeopts
429         @build_tools/make_buildopts_h > $@.tmp
430         @cmp -s $@.tmp $@ || mv $@.tmp $@
431         @rm -f $@.tmp
432
433 include/asterisk/build.h:
434         @build_tools/make_build_h > $@.tmp
435         @cmp -s $@.tmp $@ || mv $@.tmp $@
436         @rm -f $@.tmp
437
438 $(SUBDIRS_CLEAN):
439         @$(SUBMAKE) -C $(@:-clean=) clean
440
441 $(SUBDIRS_DIST_CLEAN):
442         @$(SUBMAKE) -C $(@:-dist-clean=) dist-clean
443
444 clean: $(SUBDIRS_CLEAN) _clean
445
446 _clean:
447         rm -f defaults.h
448         rm -f include/asterisk/build.h
449         rm -f main/version.c
450         rm -f include/asterisk/version.h
451         @$(MAKE) -C menuselect clean
452         cp -f .cleancount .lastclean
453
454 dist-clean: distclean
455
456 distclean: $(SUBDIRS_DIST_CLEAN) _clean
457         @$(MAKE) -C menuselect dist-clean
458         @$(MAKE) -C sounds dist-clean
459         rm -f menuselect.makeopts makeopts menuselect-tree menuselect.makedeps
460         rm -f makeopts.embed_rules
461         rm -f config.log config.status config.cache
462         rm -rf autom4te.cache
463         rm -f include/asterisk/autoconfig.h
464         rm -f include/asterisk/buildopts.h
465         rm -rf doc/api
466         rm -f build_tools/menuselect-deps
467
468 datafiles: _all
469         if [ x`$(ID) -un` = xroot ]; then CFLAGS="$(ASTCFLAGS)" sh build_tools/mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig; fi
470 # Should static HTTP be installed during make samples or even with its own target ala
471 # webvoicemail?  There are portions here that *could* be customized but might also be
472 # improved a lot.  I'll put it here for now.
473         mkdir -p $(DESTDIR)$(ASTDATADIR)/static-http
474         for x in static-http/*; do \
475                 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/static-http ; \
476         done
477         if [ -d doc/tex/asterisk ] ; then \
478                         mkdir -p $(DESTDIR)$(ASTDATADIR)/static-http/docs ; \
479                         for n in doc/tex/asterisk/* ; do \
480                                 $(INSTALL) -m 644 $$n $(DESTDIR)$(ASTDATADIR)/static-http/docs ; \
481                         done \
482         fi
483         mkdir -p $(DESTDIR)$(ASTDATADIR)/images
484         for x in images/*.jpg; do \
485                 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/images ; \
486         done
487         mkdir -p $(DESTDIR)$(AGI_DIR)
488         $(MAKE) -C sounds install
489
490 doc/core-en_US.xml: $(foreach dir,$(MOD_SUBDIRS),$(wildcard $(dir)/*.c) $(wildcard $(dir)/*.cc)) 
491         @echo -n "Building Documentation For: "
492         @echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > $@
493         @echo "<!DOCTYPE docs SYSTEM \"appdocsxml.dtd\">" >> $@
494         @echo "<docs>" >> $@
495         @for x in $(MOD_SUBDIRS); do \
496                 echo -n "$$x " ; \
497                 for i in $$x/*.c; do \
498                         $(AWK) -f build_tools/get_documentation $$i >> $@ ; \
499                 done ; \
500         done
501         @echo
502         @echo "</docs>" >> $@
503
504 validate-docs: doc/core-en_US.xml
505 ifeq ($(XMLSTARLET),:)
506         @echo "---------------------------------------------------------------"
507         @echo "--- Please install xmlstarlet to validate the documentation ---"
508         @echo "---------------------------------------------------------------"
509 else
510         $(XMLSTARLET) val -d doc/appdocsxml.dtd $<
511 endif
512
513 update: 
514         @if [ -d .svn ]; then \
515                 echo "Updating from Subversion..." ; \
516                 fromrev="`svn info | $(AWK) '/Revision: / {print $$2}'`"; \
517                 svn update | tee update.out; \
518                 torev="`svn info | $(AWK) '/Revision: / {print $$2}'`"; \
519                 echo "`date`  Updated from revision $${fromrev} to $${torev}." >> update.log; \
520                 rm -f .version; \
521                 if [ `grep -c ^C update.out` -gt 0 ]; then \
522                         echo ; echo "The following files have conflicts:" ; \
523                         grep ^C update.out | cut -b4- ; \
524                 fi ; \
525                 rm -f update.out; \
526         else \
527                 echo "Not under version control";  \
528         fi
529
530 NEWHEADERS=$(notdir $(wildcard include/asterisk/*.h))
531 OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h)))
532
533 installdirs:
534         mkdir -p $(DESTDIR)$(MODULES_DIR)
535         mkdir -p $(DESTDIR)$(ASTSBINDIR)
536         mkdir -p $(DESTDIR)$(ASTETCDIR)
537         mkdir -p $(DESTDIR)$(ASTBINDIR)
538         mkdir -p $(DESTDIR)$(ASTVARRUNDIR)
539         mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail
540         mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/dictate
541         mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/system
542         mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/tmp
543         mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/meetme
544         mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/monitor
545
546 bininstall: _all installdirs $(SUBDIRS_INSTALL)
547         $(INSTALL) -m 755 main/asterisk $(DESTDIR)$(ASTSBINDIR)/
548         $(LN) -sf asterisk $(DESTDIR)$(ASTSBINDIR)/rasterisk
549         $(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
550         $(INSTALL) -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/
551         if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \
552                 cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;' > $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ;\
553                 chmod 755 $(DESTDIR)$(ASTSBINDIR)/safe_asterisk;\
554         fi
555         $(INSTALL) -d $(DESTDIR)$(ASTHEADERDIR)
556         $(INSTALL) -m 644 include/asterisk.h $(DESTDIR)$(includedir)
557         $(INSTALL) -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
558         if [ -n "$(OLDHEADERS)" ]; then \
559                 rm -f $(addprefix $(DESTDIR)$(ASTHEADERDIR)/,$(OLDHEADERS)) ;\
560         fi
561         mkdir -p $(DESTDIR)$(ASTDATADIR)/documentation
562         mkdir -p $(DESTDIR)$(ASTDATADIR)/documentation/thirdparty
563         mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
564         mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-custom
565         mkdir -p $(DESTDIR)$(ASTDATADIR)/keys
566         mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware
567         mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware/iax
568         mkdir -p $(DESTDIR)$(ASTMANDIR)/man8
569         $(INSTALL) -m 644 doc/core-*.xml $(DESTDIR)$(ASTDATADIR)/documentation
570         $(INSTALL) -m 644 doc/appdocsxml.dtd $(DESTDIR)$(ASTVARLIBDIR)/documentation
571         $(INSTALL) -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTDATADIR)/keys
572         $(INSTALL) -m 644 keys/freeworlddialup.pub $(DESTDIR)$(ASTDATADIR)/keys
573         $(INSTALL) -m 644 doc/asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
574         $(INSTALL) -m 644 contrib/scripts/astgenkey.8 $(DESTDIR)$(ASTMANDIR)/man8
575         $(INSTALL) -m 644 contrib/scripts/autosupport.8 $(DESTDIR)$(ASTMANDIR)/man8
576         $(INSTALL) -m 644 contrib/scripts/safe_asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
577         if [ -f contrib/firmware/iax/iaxy.bin ] ; then \
578                 $(INSTALL) -m 644 contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTDATADIR)/firmware/iax/iaxy.bin; \
579         fi
580
581 $(SUBDIRS_INSTALL):
582         @DESTDIR="$(DESTDIR)" ASTSBINDIR="$(ASTSBINDIR)" $(SUBMAKE) -C $(@:-install=) install
583
584 NEWMODS:=$(foreach d,$(MOD_SUBDIRS),$(notdir $(wildcard $(d)/*.so)))
585 OLDMODS=$(filter-out $(NEWMODS),$(notdir $(wildcard $(DESTDIR)$(MODULES_DIR)/*.so)))
586
587 oldmodcheck:
588         @if [ -n "$(OLDMODS)" ]; then \
589                 echo " WARNING WARNING WARNING" ;\
590                 echo "" ;\
591                 echo " Your Asterisk modules directory, located at" ;\
592                 echo " $(DESTDIR)$(MODULES_DIR)" ;\
593                 echo " contains modules that were not installed by this " ;\
594                 echo " version of Asterisk. Please ensure that these" ;\
595                 echo " modules are compatible with this version before" ;\
596                 echo " attempting to run Asterisk." ;\
597                 echo "" ;\
598                 for f in $(OLDMODS); do \
599                         echo "    $$f" ;\
600                 done ;\
601                 echo "" ;\
602                 echo " WARNING WARNING WARNING" ;\
603         fi
604
605 badshell:
606 ifneq ($(findstring ~,$(DESTDIR)),)
607         @echo "Your shell doesn't do ~ expansion when expected (specifically, when doing \"make install DESTDIR=~/path\")."
608         @echo "Try replacing ~ with \$$HOME, as in \"make install DESTDIR=\$$HOME/path\"."
609         @exit 1
610 endif
611
612 install: badshell datafiles bininstall
613         @if [ -x /usr/sbin/asterisk-post-install ]; then \
614                 /usr/sbin/asterisk-post-install $(DESTDIR) . ; \
615         fi
616         @echo " +---- Asterisk Installation Complete -------+"  
617         @echo " +                                           +"
618         @echo " +    YOU MUST READ THE SECURITY DOCUMENT    +"
619         @echo " +                                           +"
620         @echo " + Asterisk has successfully been installed. +"  
621         @echo " + If you would like to install the sample   +"  
622         @echo " + configuration files (overwriting any      +"
623         @echo " + existing config files), run:              +"  
624         @echo " +                                           +"
625         @echo " +               $(mK) samples               +"
626         @echo " +                                           +"
627         @echo " +-----------------  or ---------------------+"
628         @echo " +                                           +"
629         @echo " + You can go ahead and install the asterisk +"
630         @echo " + program documentation now or later run:   +"
631         @echo " +                                           +"
632         @echo " +              $(mK) progdocs               +"
633         @echo " +                                           +"
634         @echo " + **Note** This requires that you have      +"
635         @echo " + doxygen installed on your local system    +"
636         @echo " +-------------------------------------------+"
637         @$(MAKE) -s oldmodcheck
638
639 isntall: install
640
641 upgrade: bininstall
642
643 # XXX why *.adsi is installed first ?
644 adsi:
645         @echo Installing adsi config files...
646         @mkdir -p $(DESTDIR)$(ASTETCDIR)
647         @for x in configs/*.adsi; do \
648                 dst="$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x`" ; \
649                 if [ -f $${dst} ] ; then \
650                         echo "Overwriting $$x" ; \
651                 else \
652                         echo "Installing $$x" ; \
653                 fi ; \
654                 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x` ; \
655         done
656
657 samples: adsi
658         @echo Installing other config files...
659         @mkdir -p $(DESTDIR)$(ASTETCDIR)
660         @for x in configs/*.sample; do \
661                 dst="$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample`" ;        \
662                 if [ -f $${dst} ]; then \
663                         if [ "$(OVERWRITE)" = "y" ]; then \
664                                 if cmp -s $${dst} $$x ; then \
665                                         echo "Config file $$x is unchanged"; \
666                                         continue; \
667                                 fi ; \
668                                 mv -f $${dst} $${dst}.old ; \
669                         else \
670                                 echo "Skipping config file $$x"; \
671                                 continue; \
672                         fi ;\
673                 fi ; \
674                 echo "Installing file $$x"; \
675                 $(INSTALL) -m 644 $$x $${dst} ;\
676         done
677         @if [ "$(OVERWRITE)" = "y" ] || [ ! -f $(DESTDIR)$(ASTCONFPATH) ]; then \
678                 echo "Creating asterisk.conf"; \
679                 ( \
680                 echo "[directories](!) ; remove the (!) to enable this" ; \
681                 echo "astetcdir => $(ASTETCDIR)" ; \
682                 echo "astmoddir => $(MODULES_DIR)" ; \
683                 echo "astvarlibdir => $(ASTVARLIBDIR)" ; \
684                 echo "astdbdir => $(ASTDBDIR)" ; \
685                 echo "astkeydir => $(ASTKEYDIR)" ; \
686                 echo "astdatadir => $(ASTDATADIR)" ; \
687                 echo "astagidir => $(AGI_DIR)" ; \
688                 echo "astspooldir => $(ASTSPOOLDIR)" ; \
689                 echo "astrundir => $(ASTVARRUNDIR)" ; \
690                 echo "astlogdir => $(ASTLOGDIR)" ; \
691                 echo "" ; \
692                 echo "[options]" ; \
693                 echo ";verbose = 3" ; \
694                 echo ";debug = 3" ; \
695                 echo ";alwaysfork = yes ; same as -F at startup" ; \
696                 echo ";nofork = yes ; same as -f at startup" ; \
697                 echo ";quiet = yes ; same as -q at startup" ; \
698                 echo ";timestamp = yes ; same as -T at startup" ; \
699                 echo ";execincludes = yes ; support #exec in config files" ; \
700                 echo ";console = yes ; Run as console (same as -c at startup)" ; \
701                 echo ";highpriority = yes ; Run realtime priority (same as -p at startup)" ; \
702                 echo ";initcrypto = yes ; Initialize crypto keys (same as -i at startup)" ; \
703                 echo ";nocolor = yes ; Disable console colors" ; \
704                 echo ";dontwarn = yes ; Disable some warnings" ; \
705                 echo ";dumpcore = yes ; Dump core on crash (same as -g at startup)" ; \
706                 echo ";languageprefix = yes ; Use the new sound prefix path syntax" ; \
707                 echo ";internal_timing = yes" ; \
708                 echo ";systemname = my_system_name ; prefix uniqueid with a system name for global uniqueness issues" ; \
709                 echo ";autosystemname = yes ; automatically set systemname to hostname - uses 'localhost' on failure, or systemname if set" ; \
710                 echo ";maxcalls = 10 ; Maximum amount of calls allowed" ; \
711                 echo ";maxload = 0.9 ; Asterisk stops accepting new calls if the load average exceed this limit" ; \
712                 echo ";maxfiles = 1000 ; Maximum amount of openfiles" ; \
713                 echo ";minmemfree = 1 ; in MBs, Asterisk stops accepting new calls if the amount of free memory falls below this watermark" ; \
714                 echo ";cache_record_files = yes ; Cache recorded sound files to another directory during recording" ; \
715                 echo ";record_cache_dir = /tmp ; Specify cache directory (used in cnjunction with cache_record_files)" ; \
716                 echo ";transmit_silence_during_record = yes ; Transmit SLINEAR silence while a channel is being recorded" ; \
717                 echo ";transmit_silence = yes ; Transmit SLINEAR silence while a channel is being recorded or DTMF is being generated" ; \
718                 echo ";transcode_via_sln = yes ; Build transcode paths via SLINEAR, instead of directly" ; \
719                 echo ";runuser = asterisk ; The user to run as" ; \
720                 echo ";rungroup = asterisk ; The group to run as" ; \
721                 echo ";lightbackground = yes ; If your terminal is set for a light-colored background" ; \
722                 echo "documentation_language = en_US ; Set the Language you want Documentation displayed in. Value is in the same format as locale names" ; \
723                 echo "" ; \
724                 echo "; Changing the following lines may compromise your security." ; \
725                 echo ";[files]" ; \
726                 echo ";astctlpermissions = 0660" ; \
727                 echo ";astctlowner = root" ; \
728                 echo ";astctlgroup = apache" ; \
729                 echo ";astctl = asterisk.ctl" ; \
730                 echo "" ; \
731                 echo "[compat]" ; \
732                 echo "pbx_realtime=1.6" ; \
733                 echo "res_agi=1.6" ; \
734                 echo "app_set=1.6" ; \
735                 ) > $(DESTDIR)$(ASTCONFPATH) ; \
736         else \
737                 echo "Skipping asterisk.conf creation"; \
738         fi
739         mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
740         build_tools/make_sample_voicemail $(DESTDIR)/$(ASTDATADIR) $(DESTDIR)/$(ASTSPOOLDIR)
741         @mkdir -p $(DESTDIR)$(ASTDATADIR)/phoneprov
742         @for x in phoneprov/*; do \
743                 dst="$(DESTDIR)$(ASTDATADIR)/$$x" ;     \
744                 if [ -f $${dst} ]; then \
745                         if [ "$(OVERWRITE)" = "y" ]; then \
746                                 if cmp -s $${dst} $$x ; then \
747                                         echo "Config file $$x is unchanged"; \
748                                         continue; \
749                                 fi ; \
750                                 mv -f $${dst} $${dst}.old ; \
751                         else \
752                                 echo "Skipping config file $$x"; \
753                                 continue; \
754                         fi ;\
755                 fi ; \
756                 echo "Installing file $$x"; \
757                 $(INSTALL) -m 644 $$x $${dst} ;\
758         done
759
760 webvmail:
761         @[ -d $(DESTDIR)$(HTTP_DOCSDIR)/ ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 )
762         @[ -d $(DESTDIR)$(HTTP_CGIDIR) ] || ( printf "cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit 1 )
763         $(INSTALL) -m 4755 -o root -g root contrib/scripts/vmail.cgi $(DESTDIR)$(HTTP_CGIDIR)/vmail.cgi
764         mkdir -p $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk
765         for x in images/*.gif; do \
766                 $(INSTALL) -m 644 $$x $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk/; \
767         done
768         @echo " +--------- Asterisk Web Voicemail ----------+"  
769         @echo " +                                           +"
770         @echo " + Asterisk Web Voicemail is installed in    +"
771         @echo " + your cgi-bin directory:                   +"
772         @echo " + $(DESTDIR)$(HTTP_CGIDIR)"
773         @echo " + IT USES A SETUID ROOT PERL SCRIPT, SO     +"
774         @echo " + IF YOU DON'T LIKE THAT, UNINSTALL IT!     +"
775         @echo " +                                           +"
776         @echo " + Other static items have been stored in:   +"
777         @echo " + $(DESTDIR)$(HTTP_DOCSDIR)"
778         @echo " +                                           +"
779         @echo " + If these paths do not match your httpd    +"
780         @echo " + installation, correct the definitions     +"
781         @echo " + in your Makefile of HTTP_CGIDIR and       +"
782         @echo " + HTTP_DOCSDIR                              +"
783         @echo " +                                           +"
784         @echo " +-------------------------------------------+"  
785
786 progdocs:
787         (cat contrib/asterisk-ng-doxygen; echo "HAVE_DOT=$(HAVEDOT)"; \
788         echo "PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen - 
789
790 install-logrotate:
791         if [ ! -d $(ASTETCDIR)/../logrotate.d ]; then \
792                 mkdir $(ASTETCDIR)/../logrotate.d ; \
793         fi
794         sed 's#__LOGDIR__#$(ASTLOGDIR)#g' < contrib/scripts/asterisk.logrotate | sed 's#__SBINDIR__#$(ASTSBINDIR)#g' > contrib/scripts/asterisk.logrotate.tmp
795         install -m 0644 contrib/scripts/asterisk.logrotate.tmp $(ASTETCDIR)/../logrotate.d/asterisk
796         rm -f contrib/scripts/asterisk.logrotate.tmp
797
798 config:
799         @if [ "${OSARCH}" = "linux-gnu" ]; then \
800                 if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \
801                         $(INSTALL) -m 755 contrib/init.d/rc.redhat.asterisk $(DESTDIR)/etc/rc.d/init.d/asterisk; \
802                         if [ -z "$(DESTDIR)" ]; then /sbin/chkconfig --add asterisk; fi; \
803                 elif [ -f /etc/debian_version ]; then \
804                         $(INSTALL) -m 755 contrib/init.d/rc.debian.asterisk $(DESTDIR)/etc/init.d/asterisk; \
805                         if [ -z "$(DESTDIR)" ]; then /usr/sbin/update-rc.d asterisk start 50 2 3 4 5 . stop 91 2 3 4 5 .; fi; \
806                 elif [ -f /etc/gentoo-release ]; then \
807                         $(INSTALL) -m 755 contrib/init.d/rc.gentoo.asterisk $(DESTDIR)/etc/init.d/asterisk; \
808                         if [ -z "$(DESTDIR)" ]; then /sbin/rc-update add asterisk default; fi; \
809                 elif [ -f /etc/mandrake-release -o -f /etc/mandriva-release ]; then \
810                         $(INSTALL) -m 755 contrib/init.d/rc.mandriva.asterisk $(DESTDIR)/etc/rc.d/init.d/asterisk; \
811                         if [ -z "$(DESTDIR)" ]; then /sbin/chkconfig --add asterisk; fi; \
812                 elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then \
813                         $(INSTALL) -m 755 contrib/init.d/rc.suse.asterisk $(DESTDIR)/etc/init.d/asterisk; \
814                         if [ -z "$(DESTDIR)" ]; then /sbin/chkconfig --add asterisk; fi; \
815                 elif [ -f /etc/arch-release -o -f /etc/arch-release ]; then \
816                         $(INSTALL) -m 755 contrib/init.d/rc.archlinux.asterisk $(DESTDIR)/etc/rc.d/asterisk; \
817                 elif [ -f /etc/slackware-version ]; then \
818                         echo "Slackware is not currently supported, although an init script does exist for it." \
819                 else \
820                         echo "We could not install init scripts for your distribution."; \
821                 fi \
822         else \
823                 echo "We could not install init scripts for your operating system."; \
824         fi
825
826 sounds:
827         $(MAKE) -C sounds all
828
829 # If the cleancount has been changed, force a make clean.
830 # .cleancount is the global clean count, and .lastclean is the 
831 # last clean count we had
832
833 cleantest:
834         @cmp -s .cleancount .lastclean || $(MAKE) clean
835
836 $(SUBDIRS_UNINSTALL):
837         @$(SUBMAKE) -C $(@:-uninstall=) uninstall
838
839 _uninstall: $(SUBDIRS_UNINSTALL)
840         rm -f $(DESTDIR)$(MODULES_DIR)/*
841         rm -f $(DESTDIR)$(ASTSBINDIR)/*asterisk*
842         rm -f $(DESTDIR)$(ASTSBINDIR)/astgenkey
843         rm -f $(DESTDIR)$(ASTSBINDIR)/autosupport
844         rm -rf $(DESTDIR)$(ASTHEADERDIR)
845         rm -rf $(DESTDIR)$(ASTDATADIR)/firmware
846         rm -f $(DESTDIR)$(ASTMANDIR)/man8/asterisk.8
847         rm -f $(DESTDIR)$(ASTMANDIR)/man8/astgenkey.8
848         rm -f $(DESTDIR)$(ASTMANDIR)/man8/autosupport.8
849         rm -f $(DESTDIR)$(ASTMANDIR)/man8/safe_asterisk.8
850         $(MAKE) -C sounds uninstall
851
852 uninstall: _uninstall
853         @echo " +--------- Asterisk Uninstall Complete -----+"  
854         @echo " + Asterisk binaries, sounds, man pages,     +"  
855         @echo " + headers, modules, and firmware builds,    +"  
856         @echo " + have all been uninstalled.                +"  
857         @echo " +                                           +"
858         @echo " + To remove ALL traces of Asterisk,         +"
859         @echo " + including configuration, spool            +"
860         @echo " + directories, and logs, run the following  +"
861         @echo " + command:                                  +"
862         @echo " +                                           +"
863         @echo " +            $(mK) uninstall-all            +"  
864         @echo " +-------------------------------------------+"  
865
866 uninstall-all: _uninstall
867         rm -rf $(DESTDIR)$(ASTLIBDIR)
868         rm -rf $(DESTDIR)$(ASTVARLIBDIR)
869         rm -rf $(DESTDIR)$(ASTDATADIR)
870         rm -rf $(DESTDIR)$(ASTSPOOLDIR)
871         rm -rf $(DESTDIR)$(ASTETCDIR)
872         rm -rf $(DESTDIR)$(ASTLOGDIR)
873
874 menuconfig: menuselect
875
876 cmenuconfig: cmenuselect
877
878 gmenuconfig: gmenuselect
879
880 nmenuconfig: nmenuselect
881
882 menuselect: menuselect/cmenuselect menuselect/nmenuselect menuselect/gmenuselect
883         @if [ -x menuselect/nmenuselect ]; then \
884                 $(MAKE) nmenuselect; \
885         elif [ -x menuselect/cmenuselect ]; then \
886                 $(MAKE) cmenuselect; \
887         elif [ -x menuselect/gmenuselect ]; then \
888                 $(MAKE) gmenuselect; \
889         else \
890                 echo "No menuselect user interface found. Install ncurses,"; \
891                 echo "newt or GTK libraries to build one and re-rerun"; \
892                 echo "'make menuselect'."; \
893         fi
894
895 cmenuselect: menuselect/cmenuselect menuselect-tree
896         -@menuselect/cmenuselect menuselect.makeopts $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
897
898 gmenuselect: menuselect/gmenuselect menuselect-tree
899         -@menuselect/gmenuselect menuselect.makeopts $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
900
901 nmenuselect: menuselect/nmenuselect menuselect-tree
902         -@menuselect/nmenuselect menuselect.makeopts $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
903
904 # options for make in menuselect/
905 MAKE_MENUSELECT=CC="$(HOST_CC)" CXX="$(CXX)" LD="" AR="" RANLIB="" CFLAGS="" $(MAKE) -C menuselect CONFIGURE_SILENT="--silent"
906
907 menuselect/menuselect: menuselect/makeopts
908         $(MAKE_MENUSELECT) menuselect
909
910 menuselect/cmenuselect: menuselect/makeopts
911         $(MAKE_MENUSELECT) cmenuselect
912
913 menuselect/gmenuselect: menuselect/makeopts
914         $(MAKE_MENUSELECT) gmenuselect
915
916 menuselect/nmenuselect: menuselect/makeopts
917         $(MAKE_MENUSELECT) nmenuselect
918
919 menuselect/makeopts: makeopts
920         $(MAKE_MENUSELECT) makeopts
921
922 menuselect-tree: $(foreach dir,$(filter-out main,$(MOD_SUBDIRS)),$(wildcard $(dir)/*.c) $(wildcard $(dir)/*.cc)) build_tools/cflags.xml build_tools/cflags-devmode.xml sounds/sounds.xml build_tools/embed_modules.xml configure
923         @echo "Generating input for menuselect ..."
924         @echo "<?xml version=\"1.0\"?>" > $@
925         @echo >> $@
926         @echo "<menu name=\"Asterisk Module and Build Option Selection\">" >> $@
927         @for dir in $(sort $(filter-out main,$(MOD_SUBDIRS))); do $(SILENTMAKE) -C $${dir} SUBDIR=$${dir} moduleinfo >> $@; done
928         @cat build_tools/cflags.xml >> $@
929         @for dir in $(sort $(filter-out main,$(MOD_SUBDIRS))); do $(SILENTMAKE) -C $${dir} SUBDIR=$${dir} makeopts >> $@; done
930         @if [ "${AST_DEVMODE}" = "yes" ]; then \
931                 cat build_tools/cflags-devmode.xml >> $@; \
932         fi
933         @cat build_tools/embed_modules.xml >> $@
934         @cat sounds/sounds.xml >> $@
935         @echo "</menu>" >> $@
936
937 pdf: asterisk.pdf
938 asterisk.pdf:
939         $(MAKE) -C doc/tex asterisk.pdf
940
941 .PHONY: menuselect menuselect.makeopts main sounds clean dist-clean distclean all prereqs cleantest uninstall _uninstall uninstall-all pdf dont-optimize $(SUBDIRS_INSTALL) $(SUBDIRS_DIST_CLEAN) $(SUBDIRS_CLEAN) $(SUBDIRS_UNINSTALL) $(SUBDIRS) $(MOD_SUBDIRS_EMBED_LDSCRIPT) $(MOD_SUBDIRS_EMBED_LDFLAGS) $(MOD_SUBDIRS_EMBED_LIBS) badshell installdirs validate-docs _clean
942
943 FORCE:
944