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