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