Add init script for ArchLinux
[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) _clean
444
445 _clean:
446         rm -f defaults.h
447         rm -f include/asterisk/build.h
448         rm -f main/version.c
449         rm -f include/asterisk/version.h
450         @$(MAKE) -C menuselect clean
451         cp -f .cleancount .lastclean
452
453 dist-clean: distclean
454
455 distclean: $(SUBDIRS_DIST_CLEAN) _clean
456         @$(MAKE) -C menuselect dist-clean
457         @$(MAKE) -C sounds dist-clean
458         rm -f menuselect.makeopts makeopts menuselect-tree menuselect.makedeps
459         rm -f makeopts.embed_rules
460         rm -f config.log config.status config.cache
461         rm -rf autom4te.cache
462         rm -f include/asterisk/autoconfig.h
463         rm -f include/asterisk/buildopts.h
464         rm -rf doc/api
465         rm -f build_tools/menuselect-deps
466
467 datafiles: _all
468         if [ x`$(ID) -un` = xroot ]; then CFLAGS="$(ASTCFLAGS)" sh build_tools/mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig; fi
469 # Should static HTTP be installed during make samples or even with its own target ala
470 # webvoicemail?  There are portions here that *could* be customized but might also be
471 # improved a lot.  I'll put it here for now.
472         mkdir -p $(DESTDIR)$(ASTDATADIR)/static-http
473         for x in static-http/*; do \
474                 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/static-http ; \
475         done
476         if [ -d doc/tex/asterisk ] ; then \
477                         mkdir -p $(DESTDIR)$(ASTDATADIR)/static-http/docs ; \
478                         for n in doc/tex/asterisk/* ; do \
479                                 $(INSTALL) -m 644 $$n $(DESTDIR)$(ASTDATADIR)/static-http/docs ; \
480                         done \
481         fi
482         mkdir -p $(DESTDIR)$(ASTDATADIR)/images
483         for x in images/*.jpg; do \
484                 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/images ; \
485         done
486         mkdir -p $(DESTDIR)$(AGI_DIR)
487         $(MAKE) -C sounds install
488
489 doc/core-en_US.xml: $(foreach dir,$(MOD_SUBDIRS),$(wildcard $(dir)/*.c) $(wildcard $(dir)/*.cc)) 
490         @echo -n "Building Documentation For: "
491         @echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > $@
492         @echo "<!DOCTYPE docs SYSTEM \"appdocsxml.dtd\">" >> $@
493         @echo "<docs>" >> $@
494         @for x in $(MOD_SUBDIRS); do \
495                 echo -n "$$x " ; \
496                 for i in $$x/*.c; do \
497                         $(AWK) -f build_tools/get_documentation $$i >> $@ ; \
498                 done ; \
499         done
500         @echo
501         @echo "</docs>" >> $@
502
503 validate-docs: doc/core-en_US.xml
504 ifeq ($(XMLSTARLET),:)
505         @echo "---------------------------------------------------------------"
506         @echo "--- Please install xmlstarlet to validate the documentation ---"
507         @echo "---------------------------------------------------------------"
508 else
509         $(XMLSTARLET) val -d doc/appdocsxml.dtd $<
510 endif
511
512 update: 
513         @if [ -d .svn ]; then \
514                 echo "Updating from Subversion..." ; \
515                 fromrev="`svn info | $(AWK) '/Revision: / {print $$2}'`"; \
516                 svn update | tee update.out; \
517                 torev="`svn info | $(AWK) '/Revision: / {print $$2}'`"; \
518                 echo "`date`  Updated from revision $${fromrev} to $${torev}." >> update.log; \
519                 rm -f .version; \
520                 if [ `grep -c ^C update.out` -gt 0 ]; then \
521                         echo ; echo "The following files have conflicts:" ; \
522                         grep ^C update.out | cut -b4- ; \
523                 fi ; \
524                 rm -f update.out; \
525         else \
526                 echo "Not under version control";  \
527         fi
528
529 NEWHEADERS=$(notdir $(wildcard include/asterisk/*.h))
530 OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h)))
531
532 installdirs:
533         mkdir -p $(DESTDIR)$(MODULES_DIR)
534         mkdir -p $(DESTDIR)$(ASTSBINDIR)
535         mkdir -p $(DESTDIR)$(ASTETCDIR)
536         mkdir -p $(DESTDIR)$(ASTBINDIR)
537         mkdir -p $(DESTDIR)$(ASTVARRUNDIR)
538         mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail
539         mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/dictate
540         mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/system
541         mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/tmp
542         mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/meetme
543         mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/monitor
544
545 bininstall: _all installdirs $(SUBDIRS_INSTALL)
546         $(INSTALL) -m 755 main/asterisk $(DESTDIR)$(ASTSBINDIR)/
547         $(LN) -sf asterisk $(DESTDIR)$(ASTSBINDIR)/rasterisk
548         $(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
549         $(INSTALL) -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/
550         if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \
551                 cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;' > $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ;\
552                 chmod 755 $(DESTDIR)$(ASTSBINDIR)/safe_asterisk;\
553         fi
554         $(INSTALL) -d $(DESTDIR)$(ASTHEADERDIR)
555         $(INSTALL) -m 644 include/asterisk.h $(DESTDIR)$(includedir)
556         $(INSTALL) -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
557         if [ -n "$(OLDHEADERS)" ]; then \
558                 rm -f $(addprefix $(DESTDIR)$(ASTHEADERDIR)/,$(OLDHEADERS)) ;\
559         fi
560         mkdir -p $(DESTDIR)$(ASTDATADIR)/documentation
561         mkdir -p $(DESTDIR)$(ASTDATADIR)/documentation/thirdparty
562         mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
563         mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-custom
564         mkdir -p $(DESTDIR)$(ASTDATADIR)/keys
565         mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware
566         mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware/iax
567         mkdir -p $(DESTDIR)$(ASTMANDIR)/man8
568         $(INSTALL) -m 644 doc/core-*.xml $(ASTDATADIR)/documentation
569         $(INSTALL) -m 644 doc/appdocsxml.dtd $(ASTVARLIBDIR)/documentation
570         $(INSTALL) -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTDATADIR)/keys
571         $(INSTALL) -m 644 keys/freeworlddialup.pub $(DESTDIR)$(ASTDATADIR)/keys
572         $(INSTALL) -m 644 doc/asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
573         $(INSTALL) -m 644 contrib/scripts/astgenkey.8 $(DESTDIR)$(ASTMANDIR)/man8
574         $(INSTALL) -m 644 contrib/scripts/autosupport.8 $(DESTDIR)$(ASTMANDIR)/man8
575         $(INSTALL) -m 644 contrib/scripts/safe_asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
576         if [ -f contrib/firmware/iax/iaxy.bin ] ; then \
577                 $(INSTALL) -m 644 contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTDATADIR)/firmware/iax/iaxy.bin; \
578         fi
579
580 $(SUBDIRS_INSTALL):
581         @DESTDIR="$(DESTDIR)" ASTSBINDIR="$(ASTSBINDIR)" $(SUBMAKE) -C $(@:-install=) install
582
583 NEWMODS:=$(foreach d,$(MOD_SUBDIRS),$(notdir $(wildcard $(d)/*.so)))
584 OLDMODS=$(filter-out $(NEWMODS),$(notdir $(wildcard $(DESTDIR)$(MODULES_DIR)/*.so)))
585
586 oldmodcheck:
587         @if [ -n "$(OLDMODS)" ]; then \
588                 echo " WARNING WARNING WARNING" ;\
589                 echo "" ;\
590                 echo " Your Asterisk modules directory, located at" ;\
591                 echo " $(DESTDIR)$(MODULES_DIR)" ;\
592                 echo " contains modules that were not installed by this " ;\
593                 echo " version of Asterisk. Please ensure that these" ;\
594                 echo " modules are compatible with this version before" ;\
595                 echo " attempting to run Asterisk." ;\
596                 echo "" ;\
597                 for f in $(OLDMODS); do \
598                         echo "    $$f" ;\
599                 done ;\
600                 echo "" ;\
601                 echo " WARNING WARNING WARNING" ;\
602         fi
603
604 badshell:
605 ifneq ($(findstring ~,$(DESTDIR)),)
606         @echo "Your shell doesn't do ~ expansion when expected (specifically, when doing \"make install DESTDIR=~/path\")."
607         @echo "Try replacing ~ with \$$HOME, as in \"make install DESTDIR=\$$HOME/path\"."
608         @exit 1
609 endif
610
611 install: badshell datafiles bininstall
612         @if [ -x /usr/sbin/asterisk-post-install ]; then \
613                 /usr/sbin/asterisk-post-install $(DESTDIR) . ; \
614         fi
615         @echo " +---- Asterisk Installation Complete -------+"  
616         @echo " +                                           +"
617         @echo " +    YOU MUST READ THE SECURITY DOCUMENT    +"
618         @echo " +                                           +"
619         @echo " + Asterisk has successfully been installed. +"  
620         @echo " + If you would like to install the sample   +"  
621         @echo " + configuration files (overwriting any      +"
622         @echo " + existing config files), run:              +"  
623         @echo " +                                           +"
624         @echo " +               $(mK) samples               +"
625         @echo " +                                           +"
626         @echo " +-----------------  or ---------------------+"
627         @echo " +                                           +"
628         @echo " + You can go ahead and install the asterisk +"
629         @echo " + program documentation now or later run:   +"
630         @echo " +                                           +"
631         @echo " +              $(mK) progdocs               +"
632         @echo " +                                           +"
633         @echo " + **Note** This requires that you have      +"
634         @echo " + doxygen installed on your local system    +"
635         @echo " +-------------------------------------------+"
636         @$(MAKE) -s oldmodcheck
637
638 isntall: install
639
640 upgrade: bininstall
641
642 # XXX why *.adsi is installed first ?
643 adsi:
644         @echo Installing adsi config files...
645         @mkdir -p $(DESTDIR)$(ASTETCDIR)
646         @for x in configs/*.adsi; do \
647                 dst="$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x`" ; \
648                 if [ -f $${dst} ] ; then \
649                         echo "Overwriting $$x" ; \
650                 else \
651                         echo "Installing $$x" ; \
652                 fi ; \
653                 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x` ; \
654         done
655
656 samples: adsi
657         @echo Installing other config files...
658         @mkdir -p $(DESTDIR)$(ASTETCDIR)
659         @for x in configs/*.sample; do \
660                 dst="$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample`" ;        \
661                 if [ -f $${dst} ]; then \
662                         if [ "$(OVERWRITE)" = "y" ]; then \
663                                 if cmp -s $${dst} $$x ; then \
664                                         echo "Config file $$x is unchanged"; \
665                                         continue; \
666                                 fi ; \
667                                 mv -f $${dst} $${dst}.old ; \
668                         else \
669                                 echo "Skipping config file $$x"; \
670                                 continue; \
671                         fi ;\
672                 fi ; \
673                 echo "Installing file $$x"; \
674                 $(INSTALL) -m 644 $$x $${dst} ;\
675         done
676         @if [ "$(OVERWRITE)" = "y" ] || [ ! -f $(DESTDIR)$(ASTCONFPATH) ]; then \
677                 echo "Creating asterisk.conf"; \
678                 ( \
679                 echo "[directories](!) ; remove the (!) to enable this" ; \
680                 echo "astetcdir => $(ASTETCDIR)" ; \
681                 echo "astmoddir => $(MODULES_DIR)" ; \
682                 echo "astvarlibdir => $(ASTVARLIBDIR)" ; \
683                 echo "astdbdir => $(ASTDBDIR)" ; \
684                 echo "astkeydir => $(ASTKEYDIR)" ; \
685                 echo "astdatadir => $(ASTDATADIR)" ; \
686                 echo "astagidir => $(AGI_DIR)" ; \
687                 echo "astspooldir => $(ASTSPOOLDIR)" ; \
688                 echo "astrundir => $(ASTVARRUNDIR)" ; \
689                 echo "astlogdir => $(ASTLOGDIR)" ; \
690                 echo "" ; \
691                 echo "[options]" ; \
692                 echo ";verbose = 3" ; \
693                 echo ";debug = 3" ; \
694                 echo ";alwaysfork = yes ; same as -F at startup" ; \
695                 echo ";nofork = yes ; same as -f at startup" ; \
696                 echo ";quiet = yes ; same as -q at startup" ; \
697                 echo ";timestamp = yes ; same as -T at startup" ; \
698                 echo ";execincludes = yes ; support #exec in config files" ; \
699                 echo ";console = yes ; Run as console (same as -c at startup)" ; \
700                 echo ";highpriority = yes ; Run realtime priority (same as -p at startup)" ; \
701                 echo ";initcrypto = yes ; Initialize crypto keys (same as -i at startup)" ; \
702                 echo ";nocolor = yes ; Disable console colors" ; \
703                 echo ";dontwarn = yes ; Disable some warnings" ; \
704                 echo ";dumpcore = yes ; Dump core on crash (same as -g at startup)" ; \
705                 echo ";languageprefix = yes ; Use the new sound prefix path syntax" ; \
706                 echo ";internal_timing = yes" ; \
707                 echo ";systemname = my_system_name ; prefix uniqueid with a system name for global uniqueness issues" ; \
708                 echo ";autosystemname = yes ; automatically set systemname to hostname - uses 'localhost' on failure, or systemname if set" ; \
709                 echo ";maxcalls = 10 ; Maximum amount of calls allowed" ; \
710                 echo ";maxload = 0.9 ; Asterisk stops accepting new calls if the load average exceed this limit" ; \
711                 echo ";maxfiles = 1000 ; Maximum amount of openfiles" ; \
712                 echo ";minmemfree = 1 ; in MBs, Asterisk stops accepting new calls if the amount of free memory falls below this watermark" ; \
713                 echo ";cache_record_files = yes ; Cache recorded sound files to another directory during recording" ; \
714                 echo ";record_cache_dir = /tmp ; Specify cache directory (used in cnjunction with cache_record_files)" ; \
715                 echo ";transmit_silence_during_record = yes ; Transmit SLINEAR silence while a channel is being recorded" ; \
716                 echo ";transmit_silence = yes ; Transmit SLINEAR silence while a channel is being recorded or DTMF is being generated" ; \
717                 echo ";transcode_via_sln = yes ; Build transcode paths via SLINEAR, instead of directly" ; \
718                 echo ";runuser = asterisk ; The user to run as" ; \
719                 echo ";rungroup = asterisk ; The group to run as" ; \
720                 echo ";lightbackground = yes ; If your terminal is set for a light-colored background" ; \
721                 echo "documentation_language = en_US ; Set the Language you want Documentation displayed in. Value is in the same format as locale names" ; \
722                 echo "" ; \
723                 echo "; Changing the following lines may compromise your security." ; \
724                 echo ";[files]" ; \
725                 echo ";astctlpermissions = 0660" ; \
726                 echo ";astctlowner = root" ; \
727                 echo ";astctlgroup = apache" ; \
728                 echo ";astctl = asterisk.ctl" ; \
729                 echo "" ; \
730                 echo "[compat]" ; \
731                 echo "pbx_realtime=1.6" ; \
732                 echo "res_agi=1.6" ; \
733                 echo "app_set=1.6" ; \
734                 ) > $(DESTDIR)$(ASTCONFPATH) ; \
735         else \
736                 echo "Skipping asterisk.conf creation"; \
737         fi
738         mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
739         build_tools/make_sample_voicemail $(DESTDIR)/$(ASTDATADIR) $(DESTDIR)/$(ASTSPOOLDIR)
740         @mkdir -p $(DESTDIR)$(ASTDATADIR)/phoneprov
741         @for x in phoneprov/*; do \
742                 dst="$(DESTDIR)$(ASTDATADIR)/$$x" ;     \
743                 if [ -f $${dst} ]; then \
744                         if [ "$(OVERWRITE)" = "y" ]; then \
745                                 if cmp -s $${dst} $$x ; then \
746                                         echo "Config file $$x is unchanged"; \
747                                         continue; \
748                                 fi ; \
749                                 mv -f $${dst} $${dst}.old ; \
750                         else \
751                                 echo "Skipping config file $$x"; \
752                                 continue; \
753                         fi ;\
754                 fi ; \
755                 echo "Installing file $$x"; \
756                 $(INSTALL) -m 644 $$x $${dst} ;\
757         done
758
759 webvmail:
760         @[ -d $(DESTDIR)$(HTTP_DOCSDIR)/ ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 )
761         @[ -d $(DESTDIR)$(HTTP_CGIDIR) ] || ( printf "cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit 1 )
762         $(INSTALL) -m 4755 -o root -g root contrib/scripts/vmail.cgi $(DESTDIR)$(HTTP_CGIDIR)/vmail.cgi
763         mkdir -p $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk
764         for x in images/*.gif; do \
765                 $(INSTALL) -m 644 $$x $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk/; \
766         done
767         @echo " +--------- Asterisk Web Voicemail ----------+"  
768         @echo " +                                           +"
769         @echo " + Asterisk Web Voicemail is installed in    +"
770         @echo " + your cgi-bin directory:                   +"
771         @echo " + $(DESTDIR)$(HTTP_CGIDIR)"
772         @echo " + IT USES A SETUID ROOT PERL SCRIPT, SO     +"
773         @echo " + IF YOU DON'T LIKE THAT, UNINSTALL IT!     +"
774         @echo " +                                           +"
775         @echo " + Other static items have been stored in:   +"
776         @echo " + $(DESTDIR)$(HTTP_DOCSDIR)"
777         @echo " +                                           +"
778         @echo " + If these paths do not match your httpd    +"
779         @echo " + installation, correct the definitions     +"
780         @echo " + in your Makefile of HTTP_CGIDIR and       +"
781         @echo " + HTTP_DOCSDIR                              +"
782         @echo " +                                           +"
783         @echo " +-------------------------------------------+"  
784
785 progdocs:
786         (cat contrib/asterisk-ng-doxygen; echo "HAVE_DOT=$(HAVEDOT)"; \
787         echo "PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen - 
788
789 install-logrotate:
790         if [ ! -d $(ASTETCDIR)/../logrotate.d ]; then \
791                 mkdir $(ASTETCDIR)/../logrotate.d ; \
792         fi
793         sed 's#__LOGDIR__#$(ASTLOGDIR)#g' < contrib/scripts/asterisk.logrotate | sed 's#__SBINDIR__#$(ASTSBINDIR)#g' > contrib/scripts/asterisk.logrotate.tmp
794         install -m 0644 contrib/scripts/asterisk.logrotate.tmp $(ASTETCDIR)/../logrotate.d/asterisk
795         rm -f contrib/scripts/asterisk.logrotate.tmp
796
797 config:
798         @if [ "${OSARCH}" = "linux-gnu" ]; then \
799                 if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \
800                         $(INSTALL) -m 755 contrib/init.d/rc.redhat.asterisk $(DESTDIR)/etc/rc.d/init.d/asterisk; \
801                         if [ -z "$(DESTDIR)" ]; then /sbin/chkconfig --add asterisk; fi; \
802                 elif [ -f /etc/debian_version ]; then \
803                         $(INSTALL) -m 755 contrib/init.d/rc.debian.asterisk $(DESTDIR)/etc/init.d/asterisk; \
804                         if [ -z "$(DESTDIR)" ]; then /usr/sbin/update-rc.d asterisk start 50 2 3 4 5 . stop 91 2 3 4 5 .; fi; \
805                 elif [ -f /etc/gentoo-release ]; then \
806                         $(INSTALL) -m 755 contrib/init.d/rc.gentoo.asterisk $(DESTDIR)/etc/init.d/asterisk; \
807                         if [ -z "$(DESTDIR)" ]; then /sbin/rc-update add asterisk default; fi; \
808                 elif [ -f /etc/mandrake-release -o -f /etc/mandriva-release ]; then \
809                         $(INSTALL) -m 755 contrib/init.d/rc.mandriva.asterisk $(DESTDIR)/etc/rc.d/init.d/asterisk; \
810                         if [ -z "$(DESTDIR)" ]; then /sbin/chkconfig --add asterisk; fi; \
811                 elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then \
812                         $(INSTALL) -m 755 contrib/init.d/rc.suse.asterisk $(DESTDIR)/etc/init.d/asterisk; \
813                         if [ -z "$(DESTDIR)" ]; then /sbin/chkconfig --add asterisk; fi; \
814                 elif [ -f /etc/arch-release -o -f /etc/arch-release ]; then \
815                         $(INSTALL) -m 755 contrib/init.d/rc.archlinux.asterisk $(DESTDIR)/etc/rc.d/asterisk; \
816                         echo "Archlinux is not currently supported, although an init script does exits for it. please add asterisk to your DAEMONS line in /etc/rc.conf to start it when computer boots."; \
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