2 # Asterisk -- A telephony toolkit for Linux.
6 # Copyright (C) 1999-2006, Digium, Inc.
8 # Mark Spencer <markster@digium.com>
10 # This program is free software, distributed under the terms of
11 # the GNU General Public License
14 # All Makefiles use the following variables:
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
23 # Default values fo ASTCFLAGS and ASTLDFLAGS can be specified in the
24 # environment when running make, as follows:
26 # $ ASTCFLAGS="-Werror" make
29 export ASTERISKVERSION
30 export ASTERISKVERSIONNUM
47 export MENUSELECT_CFLAGS
64 # even though we could use '-include makeopts' here, use a wildcard
65 # lookup anyway, so that make won't try to build makeopts if it doesn't
66 # exist (other rules will force it to be built if needed)
67 ifneq ($(wildcard makeopts),)
71 # Some build systems, such as the one in openwrt, like to pass custom target
72 # CFLAGS and LDFLAGS in the COPTS and LDOPTS variables.
76 #Uncomment this to see all build commands instead of 'quiet' output
79 # Create OPTIONS variable
84 # Overwite config files on "make samples"
87 # Include debug and macro symbols in the executables (-g) and profiling info (-pg)
90 # DESTDIR is the staging directory.
91 # Files are copied here temporarily during the install process
92 # WARNING: do not put spaces or comments after the value.
93 # Also, do not export it before this point or the 'export' will
94 # assign it to the empty string so ?= fails.
95 DESTDIR?=$(INSTALL_PATH)
98 # Define standard directories for various platforms
99 # These apply if they are not redefined in asterisk.conf
100 ifeq ($(OSARCH),SunOS)
101 ASTETCDIR=/var/etc/asterisk
102 ASTLIBDIR=/opt/asterisk/lib
103 ASTVARLIBDIR=/var/opt/asterisk
104 ASTDBDIR=$(ASTVARLIBDIR)
105 ASTKEYDIR=$(ASTVARLIBDIR)
106 ASTSPOOLDIR=/var/spool/asterisk
107 ASTLOGDIR=/var/log/asterisk
108 ASTHEADERDIR=/opt/asterisk/include
109 ASTBINDIR=/opt/asterisk/bin
110 ASTSBINDIR=/opt/asterisk/sbin
111 ASTVARRUNDIR=/var/run/asterisk
112 ASTMANDIR=/opt/asterisk/man
114 ASTETCDIR=$(sysconfdir)/asterisk
115 ASTLIBDIR=$(libdir)/asterisk
116 ASTHEADERDIR=$(includedir)/asterisk
118 ASTSBINDIR=$(sbindir)
119 ASTSPOOLDIR=$(localstatedir)/spool/asterisk
120 ASTLOGDIR=$(localstatedir)/log/asterisk
121 ASTVARRUNDIR=$(localstatedir)/run
123 ifneq ($(findstring BSD,$(OSARCH)),)
124 ASTVARLIBDIR=$(prefix)/share/asterisk
125 ASTVARRUNDIR=$(localstatedir)/run/asterisk
126 ASTDBDIR=$(localstatedir)/db/asterisk
128 ASTVARLIBDIR=$(localstatedir)/lib/asterisk
129 ASTDBDIR=$(ASTVARLIBDIR)
131 ASTKEYDIR=$(ASTVARLIBDIR)
133 ifeq ($(ASTDATADIR),)
134 ASTDATADIR:=$(ASTVARLIBDIR)
137 # Asterisk.conf is located in ASTETCDIR or by using the -C flag
138 # when starting Asterisk
139 ASTCONFPATH=$(ASTETCDIR)/asterisk.conf
140 MODULES_DIR=$(ASTLIBDIR)/modules
141 AGI_DIR=$(ASTDATADIR)/agi-bin
143 # If you use Apache, you may determine by a grep 'DocumentRoot' of your httpd.conf file
144 HTTP_DOCSDIR=/var/www/html
145 # Determine by a grep 'ScriptAlias' of your Apache httpd.conf file
146 HTTP_CGIDIR=/var/www/cgi-bin
148 # Uncomment this to use the older DSP routines
149 #ASTCFLAGS+=-DOLD_DSP_ROUTINES
151 # If the file .asterisk.makeopts is present in your home directory, you can
152 # include all of your favorite menuselect options so that every time you download
153 # a new version of Asterisk, you don't have to run menuselect to set them.
154 # The file /etc/asterisk.makeopts will also be included but can be overridden
155 # by the file in your home directory.
157 GLOBAL_MAKEOPTS=$(wildcard /etc/asterisk.makeopts)
158 USER_MAKEOPTS=$(wildcard ~/.asterisk.makeopts)
160 MOD_SUBDIR_CFLAGS=-I$(ASTTOPDIR)/include
161 OTHER_SUBDIR_CFLAGS=-I$(ASTTOPDIR)/include
163 ifeq ($(OSARCH),linux-gnu)
164 ifeq ($(PROC),x86_64)
165 # You must have GCC 3.4 to use k8, otherwise use athlon
170 ifeq ($(PROC),sparc64)
171 #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
172 #This works for even old (2.96) versions of gcc and provides a small boost either way.
173 #A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
174 #So we go lowest common available by gcc and go a step down, still a step up from
175 #the default as we now have a better instruction set to work with. - Belgarath
177 OPTIONS+=$(shell if $(CC) -mtune=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mtune=$(PROC)"; fi)
178 OPTIONS+=$(shell if $(CC) -mcpu=v8 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mcpu=v8"; fi)
179 OPTIONS+=-fomit-frame-pointer
183 # The Cirrus logic is the only heavily shipping arm processor with a real floating point unit
184 ifeq ($(SUB_PROC),maverick)
185 OPTIONS+=-fsigned-char -mcpu=ep9312
187 ifeq ($(SUB_PROC),xscale)
188 OPTIONS+=-fsigned-char -mcpu=xscale
190 OPTIONS+=-fsigned-char
196 ifeq ($(findstring -save-temps,$(ASTCFLAGS)),)
200 ASTCFLAGS+=-Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG)
202 ASTCFLAGS+=-include $(ASTTOPDIR)/include/asterisk/autoconfig.h
204 ifeq ($(AST_DEVMODE),yes)
205 ASTCFLAGS+=-Werror -Wunused -Wundef $(AST_DECLARATION_AFTER_STATEMENT)
208 ifneq ($(findstring BSD,$(OSARCH)),)
209 ASTCFLAGS+=-I/usr/local/include
210 ASTLDFLAGS+=-L/usr/local/lib
213 ifneq ($(PROC),ultrasparc)
214 ASTCFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
218 ASTCFLAGS+=-fsigned-char
221 ifeq ($(OSARCH),FreeBSD)
222 # -V is understood by BSD Make, not by GNU make.
223 BSDVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk)
224 ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
227 ifeq ($(OSARCH),NetBSD)
228 ASTCFLAGS+=-pthread -I/usr/pkg/include
231 ifeq ($(OSARCH),OpenBSD)
235 ifeq ($(OSARCH),SunOS)
236 ASTCFLAGS+=-Wcast-align -DSOLARIS -I../include/solaris-compat -I/opt/ssl/include -I/usr/local/ssl/include
239 ASTERISKVERSION:=$(shell build_tools/make_version .)
241 ifneq ($(wildcard .version),)
242 ASTERISKVERSIONNUM:=$(shell awk -F. '{printf "%01d%02d%02d", $$1, $$2, $$3}' .version)
243 RPMVERSION:=$(shell sed 's/[-\/:]/_/g' .version)
248 ifneq ($(wildcard .svn),)
249 ASTERISKVERSIONNUM=999999
252 ASTCFLAGS+=$(MALLOC_DEBUG)$(BUSYDETECT)$(OPTIONS)
254 MOD_SUBDIRS:=channels pbx apps codecs formats cdr funcs main res
255 OTHER_SUBDIRS:=utils agi
256 SUBDIRS:=$(OTHER_SUBDIRS) $(MOD_SUBDIRS)
257 SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)
258 SUBDIRS_CLEAN:=$(SUBDIRS:%=%-clean)
259 SUBDIRS_DIST_CLEAN:=$(SUBDIRS:%=%-dist-clean)
260 SUBDIRS_UNINSTALL:=$(SUBDIRS:%=%-uninstall)
261 MOD_SUBDIRS_EMBED_LDSCRIPT:=$(MOD_SUBDIRS:%=%-embed-ldscript)
262 MOD_SUBDIRS_EMBED_LDFLAGS:=$(MOD_SUBDIRS:%=%-embed-ldflags)
263 MOD_SUBDIRS_EMBED_LIBS:=$(MOD_SUBDIRS:%=%-embed-libs)
265 ifneq ($(findstring darwin,$(OSARCH)),)
266 ASTCFLAGS+=-D__Darwin__
267 SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
269 # These are used for all but Darwin
270 SOLINK=-shared -Xlinker -x
271 ifneq ($(findstring BSD,$(OSARCH)),)
272 LDFLAGS+=-L/usr/local/lib
276 ifeq ($(OSARCH),SunOS)
277 SOLINK=-shared -fpic -L/usr/local/ssl/lib
280 # This is used when generating the doxygen documentation
287 # $(MAKE) is printed in several places, and we want it to be a
288 # fixed size string. Define a variable whose name has also the
289 # same size, so we can easily align text.
290 ifeq ($(MAKE), gmake)
296 # comment to print directories during submakes
297 PRINT_DIR?= --no-print-directory
300 @echo " +--------- Asterisk Build Complete ---------+"
301 @echo " + Asterisk has successfully been built, and +"
302 @echo " + can be installed by running: +"
304 @echo " + $(mK) install +"
305 @echo " +-------------------------------------------+"
307 _all: cleantest makeopts $(SUBDIRS)
311 @echo "**** The configure script must be executed before running '$(MAKE)'."
312 @echo "**** Please run \"./configure\"."
316 menuselect.makeopts: menuselect/menuselect menuselect-tree
317 menuselect/menuselect --check-deps $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts
319 $(MOD_SUBDIRS_EMBED_LDSCRIPT):
320 @echo "EMBED_LDSCRIPTS+="`$(MAKE) --quiet $(PRINT_DIR) -C $(@:-embed-ldscript=) SUBDIR=$(@:-embed-ldscript=) __embed_ldscript` >> makeopts.embed_rules
322 $(MOD_SUBDIRS_EMBED_LDFLAGS):
323 @echo "EMBED_LDFLAGS+="`$(MAKE) --quiet $(PRINT_DIR) -C $(@:-embed-ldflags=) SUBDIR=$(@:-embed-ldflags=) __embed_ldflags` >> makeopts.embed_rules
325 $(MOD_SUBDIRS_EMBED_LIBS):
326 @echo "EMBED_LIBS+="`$(MAKE) --quiet $(PRINT_DIR) -C $(@:-embed-libs=) SUBDIR=$(@:-embed-libs=) __embed_libs` >> makeopts.embed_rules
328 makeopts.embed_rules: menuselect.makeopts
329 @echo "Generating embedded module rules ..."
331 @$(MAKE) $(PRINT_DIR) $(MOD_SUBDIRS_EMBED_LDSCRIPT)
332 @$(MAKE) $(PRINT_DIR) $(MOD_SUBDIRS_EMBED_LDFLAGS)
333 @$(MAKE) $(PRINT_DIR) $(MOD_SUBDIRS_EMBED_LIBS)
335 $(SUBDIRS): include/asterisk/version.h include/asterisk/build.h include/asterisk/buildopts.h defaults.h makeopts.embed_rules
337 ifeq ($(findstring $(OSARCH), mingw32 cygwin ),)
339 # ensure that all module subdirectories are processed before 'main' during
340 # a parallel build, since if there are modules selected to be embedded the
341 # directories containing them must be completed before the main Asterisk
342 # binary can be built
343 main: $(filter-out main,$(MOD_SUBDIRS))
345 # Windows: we need to build main (i.e. the asterisk dll) first,
346 # followed by res, followed by the other directories, because
347 # dll symbols must be resolved during linking and not at runtime.
348 D1:= $(filter-out main,$(MOD_SUBDIRS))
349 D1:= $(filter-out res,$(D1))
356 @ASTCFLAGS="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" $(MAKE) $(PRINT_DIR) --no-builtin-rules -C $@ SUBDIR=$@ all
359 @ASTCFLAGS="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" $(MAKE) $(PRINT_DIR) --no-builtin-rules -C $@ SUBDIR=$@ all
362 @build_tools/make_defaults_h > $@.tmp
363 @if cmp -s $@.tmp $@ ; then : ; else \
368 include/asterisk/version.h:
369 @build_tools/make_version_h > $@.tmp
370 @if cmp -s $@.tmp $@ ; then : ; else \
375 include/asterisk/buildopts.h: menuselect.makeopts
376 @build_tools/make_buildopts_h > $@.tmp
377 @if cmp -s $@.tmp $@ ; then : ; else \
382 include/asterisk/build.h:
383 @build_tools/make_build_h > $@.tmp
384 @if cmp -s $@.tmp $@ ; then : ; else \
390 @$(MAKE) $(PRINT_DIR) -C $(@:-clean=) clean
392 $(SUBDIRS_DIST_CLEAN):
393 @$(MAKE) $(PRINT_DIR) -C $(@:-dist-clean=) dist-clean
395 clean: $(SUBDIRS_CLEAN)
397 rm -f include/asterisk/build.h
398 rm -f include/asterisk/version.h
399 @$(MAKE) -C menuselect clean
400 cp -f .cleancount .lastclean
402 dist-clean: distclean
404 distclean: $(SUBDIRS_DIST_CLEAN) clean
405 @$(MAKE) -C menuselect dist-clean
406 @$(MAKE) -C sounds dist-clean
407 rm -f menuselect.makeopts makeopts menuselect-tree menuselect.makedeps
408 rm -f makeopts.embed_rules
409 rm -f config.log config.status
410 rm -rf autom4te.cache
411 rm -f include/asterisk/autoconfig.h
412 rm -f include/asterisk/buildopts.h
414 rm -f build_tools/menuselect-deps
417 if [ x`$(ID) -un` = xroot ]; then CFLAGS="$(ASTCFLAGS)" sh build_tools/mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig; fi
418 # Should static HTTP be installed during make samples or even with its own target ala
419 # webvoicemail? There are portions here that *could* be customized but might also be
420 # improved a lot. I'll put it here for now.
421 mkdir -p $(DESTDIR)$(ASTDATADIR)/static-http
422 for x in static-http/*; do \
423 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/static-http ; \
425 mkdir -p $(DESTDIR)$(ASTDATADIR)/images
426 for x in images/*.jpg; do \
427 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/images ; \
429 mkdir -p $(DESTDIR)$(AGI_DIR)
430 $(MAKE) -C sounds install
433 @if [ -d .svn ]; then \
434 echo "Updating from Subversion..." ; \
435 svn update | tee update.out; \
437 if [ `grep -c ^C update.out` -gt 0 ]; then \
438 echo ; echo "The following files have conflicts:" ; \
439 grep ^C update.out | cut -b4- ; \
443 echo "Not under version control"; \
446 NEWHEADERS=$(notdir $(wildcard include/asterisk/*.h))
447 OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h)))
450 mkdir -p $(DESTDIR)$(MODULES_DIR)
451 mkdir -p $(DESTDIR)$(ASTSBINDIR)
452 mkdir -p $(DESTDIR)$(ASTETCDIR)
453 mkdir -p $(DESTDIR)$(ASTBINDIR)
454 mkdir -p $(DESTDIR)$(ASTVARRUNDIR)
455 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail
456 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/dictate
457 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/system
458 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/tmp
459 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/meetme
460 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/monitor
461 $(INSTALL) -m 755 main/asterisk $(DESTDIR)$(ASTSBINDIR)/
462 $(LN) -sf asterisk $(DESTDIR)$(ASTSBINDIR)/rasterisk
463 $(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
464 $(INSTALL) -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/
465 if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \
466 cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;' > $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ;\
467 chmod 755 $(DESTDIR)$(ASTSBINDIR)/safe_asterisk;\
469 $(INSTALL) -d $(DESTDIR)$(ASTHEADERDIR)
470 $(INSTALL) -m 644 include/asterisk.h $(DESTDIR)$(includedir)
471 $(INSTALL) -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
472 if [ -n "$(OLDHEADERS)" ]; then \
473 rm -f $(addprefix $(DESTDIR)$(ASTHEADERDIR)/,$(OLDHEADERS)) ;\
475 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
476 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-custom
477 mkdir -p $(DESTDIR)$(ASTDATADIR)/keys
478 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware
479 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware/iax
480 mkdir -p $(DESTDIR)$(ASTMANDIR)/man8
481 $(INSTALL) -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTDATADIR)/keys
482 $(INSTALL) -m 644 keys/freeworlddialup.pub $(DESTDIR)$(ASTDATADIR)/keys
483 $(INSTALL) -m 644 doc/asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
484 $(INSTALL) -m 644 contrib/scripts/astgenkey.8 $(DESTDIR)$(ASTMANDIR)/man8
485 $(INSTALL) -m 644 contrib/scripts/autosupport.8 $(DESTDIR)$(ASTMANDIR)/man8
486 $(INSTALL) -m 644 contrib/scripts/safe_asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
487 if [ -f contrib/firmware/iax/iaxy.bin ] ; then \
488 $(INSTALL) -m 644 contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTDATADIR)/firmware/iax/iaxy.bin; \
492 @DESTDIR="$(DESTDIR)" ASTSBINDIR="$(ASTSBINDIR)" $(MAKE) -C $(@:-install=) install
494 NEWMODS=$(notdir $(wildcard */*.so))
495 OLDMODS=$(filter-out $(NEWMODS),$(notdir $(wildcard $(DESTDIR)$(MODULES_DIR)/*.so)))
498 @if [ -n "$(OLDMODS)" ]; then \
499 echo " WARNING WARNING WARNING" ;\
501 echo " Your Asterisk modules directory, located at" ;\
502 echo " $(DESTDIR)$(MODULES_DIR)" ;\
503 echo " contains modules that were not installed by this " ;\
504 echo " version of Asterisk. Please ensure that these" ;\
505 echo " modules are compatible with this version before" ;\
506 echo " attempting to run Asterisk." ;\
508 for f in $(OLDMODS); do \
512 echo " WARNING WARNING WARNING" ;\
515 install: datafiles bininstall $(SUBDIRS_INSTALL)
516 @if [ -x /usr/sbin/asterisk-post-install ]; then \
517 /usr/sbin/asterisk-post-install $(DESTDIR) . ; \
519 @echo " +---- Asterisk Installation Complete -------+"
521 @echo " + YOU MUST READ THE SECURITY DOCUMENT +"
523 @echo " + Asterisk has successfully been installed. +"
524 @echo " + If you would like to install the sample +"
525 @echo " + configuration files (overwriting any +"
526 @echo " + existing config files), run: +"
528 @echo " + $(mK) samples +"
530 @echo " +----------------- or ---------------------+"
532 @echo " + You can go ahead and install the asterisk +"
533 @echo " + program documentation now or later run: +"
535 @echo " + $(mK) progdocs +"
537 @echo " + **Note** This requires that you have +"
538 @echo " + doxygen installed on your local system +"
539 @echo " +-------------------------------------------+"
540 @$(MAKE) -s oldmodcheck
544 # XXX why *.adsi is installed first ?
546 @echo Installing adsi config files...
547 @mkdir -p $(DESTDIR)$(ASTETCDIR)
548 @for x in configs/*.adsi; do \
549 dst="$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x`" ; \
550 if [ -f $${dst} ] ; then \
551 echo "Overwriting $$x" ; \
553 echo "Installing $$x" ; \
555 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x` ; \
559 @echo Installing other config files...
560 @mkdir -p $(DESTDIR)$(ASTETCDIR)
561 @for x in configs/*.sample; do \
562 dst="$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample`" ; \
563 if [ -f $${dst} ]; then \
564 if [ "$(OVERWRITE)" = "y" ]; then \
565 if cmp -s $${dst} $$x ; then \
566 echo "Config file $$x is unchanged"; \
569 mv -f $${dst} $${dst}.old ; \
571 echo "Skipping config file $$x"; \
575 echo "Installing file $$x"; \
576 $(INSTALL) -m 644 $$x $${dst} ;\
578 @if [ "$(OVERWRITE)" = "y" ] || [ ! -f $(DESTDIR)$(ASTCONFPATH) ]; then \
579 echo "Creating asterisk.conf"; \
581 echo "[directories](!) ; remove the (!) to enable this" ; \
582 echo "astetcdir => $(ASTETCDIR)" ; \
583 echo "astmoddir => $(MODULES_DIR)" ; \
584 echo "astvarlibdir => $(ASTVARLIBDIR)" ; \
585 echo "astdbdir => $(ASTDBDIR)" ; \
586 echo "astkeydir => $(ASTKEYDIR)" ; \
587 echo "astdatadir => $(ASTDATADIR)" ; \
588 echo "astagidir => $(AGI_DIR)" ; \
589 echo "astspooldir => $(ASTSPOOLDIR)" ; \
590 echo "astrundir => $(ASTVARRUNDIR)" ; \
591 echo "astlogdir => $(ASTLOGDIR)" ; \
593 echo ";[options]" ; \
594 echo ";verbose = 3" ; \
595 echo ";debug = 3" ; \
596 echo ";alwaysfork = yes ; same as -F at startup" ; \
597 echo ";nofork = yes ; same as -f at startup" ; \
598 echo ";quiet = yes ; same as -q at startup" ; \
599 echo ";timestamp = yes ; same as -T at startup" ; \
600 echo ";execincludes = yes ; support #exec in config files" ; \
601 echo ";console = yes ; Run as console (same as -c at startup)" ; \
602 echo ";highpriority = yes ; Run realtime priority (same as -p at startup)" ; \
603 echo ";initcrypto = yes ; Initialize crypto keys (same as -i at startup)" ; \
604 echo ";nocolor = yes ; Disable console colors" ; \
605 echo ";dontwarn = yes ; Disable some warnings" ; \
606 echo ";dumpcore = yes ; Dump core on crash (same as -g at startup)" ; \
607 echo ";languageprefix = yes ; Use the new sound prefix path syntax" ; \
608 echo ";internal_timing = yes" ; \
609 echo ";systemname = my_system_name ; prefix uniqueid with a system name for global uniqueness issues" ; \
610 echo ";autosystemname = yes ; automatically set systemname to hostname - uses 'localhost' on failure, or systemname if set" ; \
611 echo ";maxcalls = 10 ; Maximum amount of calls allowed" ; \
612 echo ";maxload = 0.9 ; Asterisk stops accepting new calls if the load average exceed this limit" ; \
613 echo ";maxfiles = 1000 ; Maximum amount of openfiles" ; \
614 echo ";minmemfree = 1 ; in MBs, Asterisk stops accepting new calls if the amount of free memory falls below this watermark" ; \
615 echo ";cache_record_files = yes ; Cache recorded sound files to another directory during recording" ; \
616 echo ";record_cache_dir = /tmp ; Specify cache directory (used in cnjunction with cache_record_files)" ; \
617 echo ";transmit_silence_during_record = yes ; Transmit SLINEAR silence while a channel is being recorded" ; \
618 echo ";transcode_via_sln = yes ; Build transcode paths via SLINEAR, instead of directly" ; \
619 echo ";runuser = asterisk ; The user to run as" ; \
620 echo ";rungroup = asterisk ; The group to run as" ; \
622 echo "; Changing the following lines may compromise your security." ; \
624 echo ";astctlpermissions = 0660" ; \
625 echo ";astctlowner = root" ; \
626 echo ";astctlgroup = apache" ; \
627 echo ";astctl = asterisk.ctl" ; \
628 ) > $(DESTDIR)$(ASTCONFPATH) ; \
630 echo "Skipping asterisk.conf creation"; \
632 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
633 build_tools/make_sample_voicemail $(DESTDIR)/$(ASTDATADIR) $(DESTDIR)/$(ASTSPOOLDIR)
636 @[ -d $(DESTDIR)$(HTTP_DOCSDIR)/ ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 )
637 @[ -d $(DESTDIR)$(HTTP_CGIDIR) ] || ( printf "cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit 1 )
638 $(INSTALL) -m 4755 -o root -g root contrib/scripts/vmail.cgi $(DESTDIR)$(HTTP_CGIDIR)/vmail.cgi
639 mkdir -p $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk
640 for x in images/*.gif; do \
641 $(INSTALL) -m 644 $$x $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk/; \
643 @echo " +--------- Asterisk Web Voicemail ----------+"
645 @echo " + Asterisk Web Voicemail is installed in +"
646 @echo " + your cgi-bin directory: +"
647 @echo " + $(DESTDIR)$(HTTP_CGIDIR)"
648 @echo " + IT USES A SETUID ROOT PERL SCRIPT, SO +"
649 @echo " + IF YOU DON'T LIKE THAT, UNINSTALL IT! +"
651 @echo " + Other static items have been stored in: +"
652 @echo " + $(DESTDIR)$(HTTP_DOCSDIR)"
654 @echo " + If these paths do not match your httpd +"
655 @echo " + installation, correct the definitions +"
656 @echo " + in your Makefile of HTTP_CGIDIR and +"
657 @echo " + HTTP_DOCSDIR +"
659 @echo " +-------------------------------------------+"
662 sed "s/^Version:.*/Version: $(RPMVERSION)/g" redhat/asterisk.spec > asterisk.spec ; \
666 __rpm: include/asterisk/version.h include/asterisk/buildopts.h spec
667 rm -rf /tmp/asterisk ; \
668 mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
669 $(MAKE) DESTDIR=/tmp/asterisk install ; \
670 $(MAKE) DESTDIR=/tmp/asterisk samples ; \
671 mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
672 cp -f contrib/init.d/rc.redhat.asterisk /tmp/asterisk/etc/rc.d/init.d/asterisk ; \
673 rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec
676 (cat contrib/asterisk-ng-doxygen; echo "HAVE_DOT=$(HAVEDOT)"; \
677 echo "PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen -
680 @if [ "${OSARCH}" = "linux-gnu" ]; then \
681 if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \
682 $(INSTALL) -m 755 contrib/init.d/rc.redhat.asterisk $(DESTDIR)/etc/rc.d/init.d/asterisk; \
683 if [ -z "$(DESTDIR)" ]; then /sbin/chkconfig --add asterisk; fi; \
684 elif [ -f /etc/debian_version ]; then \
685 $(INSTALL) -m 755 contrib/init.d/rc.debian.asterisk $(DESTDIR)/etc/init.d/asterisk; \
686 if [ -z "$(DESTDIR)" ]; then /usr/sbin/update-rc.d asterisk start 50 2 3 4 5 . stop 91 2 3 4 5 .; fi; \
687 elif [ -f /etc/gentoo-release ]; then \
688 $(INSTALL) -m 755 contrib/init.d/rc.gentoo.asterisk $(DESTDIR)/etc/init.d/asterisk; \
689 if [ -z "$(DESTDIR)" ]; then /sbin/rc-update add asterisk default; fi; \
690 elif [ -f /etc/mandrake-release -o -f /etc/mandriva-release ]; then \
691 $(INSTALL) -m 755 contrib/init.d/rc.mandrake.asterisk $(DESTDIR)/etc/rc.d/init.d/asterisk; \
692 if [ -z "$(DESTDIR)" ]; then /sbin/chkconfig --add asterisk; fi; \
693 elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then \
694 $(INSTALL) -m 755 contrib/init.d/rc.suse.asterisk $(DESTDIR)/etc/init.d/asterisk; \
695 if [ -z "$(DESTDIR)" ]; then /sbin/chkconfig --add asterisk; fi; \
696 elif [ -f /etc/slackware-version ]; then \
697 echo "Slackware is not currently supported, although an init script does exist for it." \
699 echo "We could not install init scripts for your distribution."; \
702 echo "We could not install init scripts for your operating system."; \
706 $(MAKE) -C sounds all
708 # If the cleancount has been changed, force a make clean.
709 # .cleancount is the global clean count, and .lastclean is the
710 # last clean count we had
713 @cmp -s .cleancount .lastclean || $(MAKE) clean
715 $(SUBDIRS_UNINSTALL):
716 @$(MAKE) $(PRINT_DIR) -C $(@:-uninstall=) uninstall
718 _uninstall: $(SUBDIRS_UNINSTALL)
719 rm -f $(DESTDIR)$(MODULES_DIR)/*
720 rm -f $(DESTDIR)$(ASTSBINDIR)/*asterisk*
721 rm -f $(DESTDIR)$(ASTSBINDIR)/astgenkey
722 rm -f $(DESTDIR)$(ASTSBINDIR)/autosupport
723 rm -rf $(DESTDIR)$(ASTHEADERDIR)
724 rm -rf $(DESTDIR)$(ASTDATADIR)/firmware
725 rm -f $(DESTDIR)$(ASTMANDIR)/man8/asterisk.8
726 rm -f $(DESTDIR)$(ASTMANDIR)/man8/astgenkey.8
727 rm -f $(DESTDIR)$(ASTMANDIR)/man8/autosupport.8
728 rm -f $(DESTDIR)$(ASTMANDIR)/man8/safe_asterisk.8
729 $(MAKE) -C sounds uninstall
731 uninstall: _uninstall
732 @echo " +--------- Asterisk Uninstall Complete -----+"
733 @echo " + Asterisk binaries, sounds, man pages, +"
734 @echo " + headers, modules, and firmware builds, +"
735 @echo " + have all been uninstalled. +"
737 @echo " + To remove ALL traces of Asterisk, +"
738 @echo " + including configuration, spool +"
739 @echo " + directories, and logs, run the following +"
740 @echo " + command: +"
742 @echo " + $(mK) uninstall-all +"
743 @echo " +-------------------------------------------+"
745 uninstall-all: _uninstall
746 rm -rf $(DESTDIR)$(ASTLIBDIR)
747 rm -rf $(DESTDIR)$(ASTVARLIBDIR)
748 rm -rf $(DESTDIR)$(ASTDATADIR)
749 rm -rf $(DESTDIR)$(ASTSPOOLDIR)
750 rm -rf $(DESTDIR)$(ASTETCDIR)
751 rm -rf $(DESTDIR)$(ASTLOGDIR)
753 menuconfig: menuselect
755 gmenuconfig: gmenuselect
757 menuselect: menuselect/menuselect menuselect-tree
758 -@menuselect/menuselect $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
760 gmenuselect: menuselect/gmenuselect menuselect-tree
761 -@menuselect/gmenuselect $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
763 menuselect/menuselect: menuselect/makeopts
764 echo "doing menuselect with $(HOST_CC)"
765 @CC="$(HOST_CC)" LD="" AR="" RANLIB="" CFLAGS="" $(MAKE) -C menuselect CONFIGURE_SILENT="--silent"
767 menuselect/gmenuselect: menuselect/makeopts
768 @CC="$(HOST_CC)" CXX="$(CXX)" LD="" AR="" RANLIB="" CFLAGS="" $(MAKE) -C menuselect gmenuselect CONFIGURE_SILENT="--silent"
771 @CC="$(HOST_CC)" CXX="$(CXX)" LD="" AR="" RANLIB="" CFLAGS="" $(MAKE) -C menuselect makeopts CONFIGURE_SILENT="--silent"
773 menuselect-tree: $(foreach dir,$(filter-out main,$(MOD_SUBDIRS)),$(wildcard $(dir)/*.c) $(wildcard $(dir)/*.cc)) build_tools/cflags.xml sounds/sounds.xml build_tools/embed_modules.xml configure
774 @echo "Generating input for menuselect ..."
775 @build_tools/prep_moduledeps > $@
779 $(MAKE) -C doc/tex asterisk.pdf
781 .PHONY: menuselect 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) menuselect.makeopts