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
65 # even though we could use '-include makeopts' here, use a wildcard
66 # lookup anyway, so that make won't try to build makeopts if it doesn't
67 # exist (other rules will force it to be built if needed)
68 ifneq ($(wildcard makeopts),)
72 # Some build systems, such as the one in openwrt, like to pass custom target
73 # CFLAGS and LDFLAGS in the COPTS and LDOPTS variables.
77 #Uncomment this to see all build commands instead of 'quiet' output
80 # Create OPTIONS variable
85 # Overwite config files on "make samples"
88 # Include debug and macro symbols in the executables (-g) and profiling info (-pg)
92 # Files are copied here temporarily during the install process
93 # For example, make DESTDIR=/tmp/asterisk woud put things in
94 # /tmp/asterisk/etc/asterisk
95 # !!! Watch out, put no spaces or comments after the value !!!
96 #DESTDIR?=/tmp/asterisk
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:=res channels pbx apps codecs formats cdr funcs main
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)
297 @echo " +--------- Asterisk Build Complete ---------+"
298 @echo " + Asterisk has successfully been built, and +"
299 @echo " + can be installed by running: +"
301 @echo " + $(mK) install +"
302 @echo " +-------------------------------------------+"
304 _all: cleantest $(SUBDIRS)
308 @echo "**** The configure script must be executed before running '$(MAKE)'."
309 @echo "**** Please run \"./configure\"."
313 menuselect.makeopts: menuselect/menuselect menuselect-tree
314 menuselect/menuselect --check-deps $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts
316 $(MOD_SUBDIRS_EMBED_LDSCRIPT):
317 @echo "EMBED_LDSCRIPTS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-ldscript=) SUBDIR=$(@:-embed-ldscript=) __embed_ldscript` >> makeopts.embed_rules
319 $(MOD_SUBDIRS_EMBED_LDFLAGS):
320 @echo "EMBED_LDFLAGS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-ldflags=) SUBDIR=$(@:-embed-ldflags=) __embed_ldflags` >> makeopts.embed_rules
322 $(MOD_SUBDIRS_EMBED_LIBS):
323 @echo "EMBED_LIBS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-libs=) SUBDIR=$(@:-embed-libs=) __embed_libs` >> makeopts.embed_rules
325 makeopts.embed_rules: menuselect.makeopts
326 @echo "Generating embedded module rules ..."
328 @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LDSCRIPT)
329 @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LDFLAGS)
330 @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LIBS)
332 $(SUBDIRS): include/asterisk/version.h include/asterisk/build.h include/asterisk/buildopts.h defaults.h makeopts.embed_rules
334 # ensure that all module subdirectories are processed before 'main' during
335 # a parallel build, since if there are modules selected to be embedded the
336 # directories containing them must be completed before the main Asterisk
337 # binary can be built
338 main: $(filter-out main,$(MOD_SUBDIRS))
341 @ASTCFLAGS="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" $(MAKE) --no-print-directory --no-builtin-rules -C $@ SUBDIR=$@ all
344 @ASTCFLAGS="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" $(MAKE) --no-print-directory --no-builtin-rules -C $@ SUBDIR=$@ all
347 @build_tools/make_defaults_h > $@.tmp
348 @if cmp -s $@.tmp $@ ; then : ; else \
353 include/asterisk/version.h:
354 @build_tools/make_version_h > $@.tmp
355 @if cmp -s $@.tmp $@ ; then : ; else \
360 include/asterisk/buildopts.h: menuselect.makeopts
361 @build_tools/make_buildopts_h > $@.tmp
362 @if cmp -s $@.tmp $@ ; then : ; else \
367 include/asterisk/build.h:
368 @build_tools/make_build_h > $@.tmp
369 @if cmp -s $@.tmp $@ ; then : ; else \
375 @$(MAKE) --no-print-directory -C $(@:-clean=) clean
377 $(SUBDIRS_DIST_CLEAN):
378 @$(MAKE) --no-print-directory -C $(@:-dist-clean=) dist-clean
380 clean: $(SUBDIRS_CLEAN)
382 rm -f include/asterisk/build.h
383 rm -f include/asterisk/version.h
384 @$(MAKE) -C menuselect clean
385 cp -f .cleancount .lastclean
387 dist-clean: distclean
389 distclean: $(SUBDIRS_DIST_CLEAN) clean
390 @$(MAKE) -C menuselect dist-clean
391 @$(MAKE) -C sounds dist-clean
392 rm -f menuselect.makeopts makeopts menuselect-tree menuselect.makedeps
393 rm -f makeopts.embed_rules
394 rm -f config.log config.status
395 rm -rf autom4te.cache
396 rm -f include/asterisk/autoconfig.h
397 rm -f include/asterisk/buildopts.h
399 rm -f build_tools/menuselect-deps
402 if [ x`$(ID) -un` = xroot ]; then CFLAGS="$(ASTCFLAGS)" sh build_tools/mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig; fi
403 # Should static HTTP be installed during make samples or even with its own target ala
404 # webvoicemail? There are portions here that *could* be customized but might also be
405 # improved a lot. I'll put it here for now.
406 mkdir -p $(DESTDIR)$(ASTDATADIR)/static-http
407 for x in static-http/*; do \
408 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/static-http ; \
410 mkdir -p $(DESTDIR)$(ASTDATADIR)/images
411 for x in images/*.jpg; do \
412 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/images ; \
414 mkdir -p $(DESTDIR)$(AGI_DIR)
415 $(MAKE) -C sounds install
418 @if [ -d .svn ]; then \
419 echo "Updating from Subversion..." ; \
420 svn update | tee update.out; \
422 if [ `grep -c ^C update.out` -gt 0 ]; then \
423 echo ; echo "The following files have conflicts:" ; \
424 grep ^C update.out | cut -b4- ; \
428 echo "Not under version control"; \
431 NEWHEADERS=$(notdir $(wildcard include/asterisk/*.h))
432 OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h)))
435 mkdir -p $(DESTDIR)$(MODULES_DIR)
436 mkdir -p $(DESTDIR)$(ASTSBINDIR)
437 mkdir -p $(DESTDIR)$(ASTETCDIR)
438 mkdir -p $(DESTDIR)$(ASTBINDIR)
439 mkdir -p $(DESTDIR)$(ASTVARRUNDIR)
440 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail
441 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/dictate
442 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/system
443 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/tmp
444 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/meetme
445 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/monitor
446 $(INSTALL) -m 755 main/asterisk $(DESTDIR)$(ASTSBINDIR)/
447 $(LN) -sf asterisk $(DESTDIR)$(ASTSBINDIR)/rasterisk
448 $(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
449 $(INSTALL) -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/
450 if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \
451 cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;' > $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ;\
452 chmod 755 $(DESTDIR)$(ASTSBINDIR)/safe_asterisk;\
454 $(INSTALL) -d $(DESTDIR)$(ASTHEADERDIR)
455 $(INSTALL) -m 644 include/asterisk.h $(DESTDIR)$(includedir)
456 $(INSTALL) -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
457 if [ -n "$(OLDHEADERS)" ]; then \
458 rm -f $(addprefix $(DESTDIR)$(ASTHEADERDIR)/,$(OLDHEADERS)) ;\
460 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
461 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-custom
462 mkdir -p $(DESTDIR)$(ASTDATADIR)/keys
463 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware
464 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware/iax
465 mkdir -p $(DESTDIR)$(ASTMANDIR)/man8
466 $(INSTALL) -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTDATADIR)/keys
467 $(INSTALL) -m 644 keys/freeworlddialup.pub $(DESTDIR)$(ASTDATADIR)/keys
468 $(INSTALL) -m 644 doc/asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
469 $(INSTALL) -m 644 contrib/scripts/astgenkey.8 $(DESTDIR)$(ASTMANDIR)/man8
470 $(INSTALL) -m 644 contrib/scripts/autosupport.8 $(DESTDIR)$(ASTMANDIR)/man8
471 $(INSTALL) -m 644 contrib/scripts/safe_asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
472 if [ -f contrib/firmware/iax/iaxy.bin ] ; then \
473 $(INSTALL) -m 644 contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTDATADIR)/firmware/iax/iaxy.bin; \
477 @DESTDIR="$(DESTDIR)" ASTSBINDIR="$(ASTSBINDIR)" $(MAKE) -C $(@:-install=) install
479 NEWMODS=$(notdir $(wildcard */*.so))
480 OLDMODS=$(filter-out $(NEWMODS),$(notdir $(wildcard $(DESTDIR)$(MODULES_DIR)/*.so)))
483 @if [ -n "$(OLDMODS)" ]; then \
484 echo " WARNING WARNING WARNING" ;\
486 echo " Your Asterisk modules directory, located at" ;\
487 echo " $(DESTDIR)$(MODULES_DIR)" ;\
488 echo " contains modules that were not installed by this " ;\
489 echo " version of Asterisk. Please ensure that these" ;\
490 echo " modules are compatible with this version before" ;\
491 echo " attempting to run Asterisk." ;\
493 for f in $(OLDMODS); do \
497 echo " WARNING WARNING WARNING" ;\
500 install: datafiles bininstall $(SUBDIRS_INSTALL)
501 @if [ -x /usr/sbin/asterisk-post-install ]; then \
502 /usr/sbin/asterisk-post-install $(DESTDIR) . ; \
504 @echo " +---- Asterisk Installation Complete -------+"
506 @echo " + YOU MUST READ THE SECURITY DOCUMENT +"
508 @echo " + Asterisk has successfully been installed. +"
509 @echo " + If you would like to install the sample +"
510 @echo " + configuration files (overwriting any +"
511 @echo " + existing config files), run: +"
513 @echo " + $(mK) samples +"
515 @echo " +----------------- or ---------------------+"
517 @echo " + You can go ahead and install the asterisk +"
518 @echo " + program documentation now or later run: +"
520 @echo " + $(mK) progdocs +"
522 @echo " + **Note** This requires that you have +"
523 @echo " + doxygen installed on your local system +"
524 @echo " +-------------------------------------------+"
525 @$(MAKE) -s oldmodcheck
529 # XXX why *.adsi is installed first ?
531 @echo Installing adsi config files...
532 @mkdir -p $(DESTDIR)$(ASTETCDIR)
533 @for x in configs/*.adsi; do \
534 dst="$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x`" ; \
535 if [ -f $${dst} ] ; then \
536 echo "Overwriting $$x" ; \
538 echo "Installing $$x" ; \
540 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x` ; \
544 @echo Installing other config files...
545 @mkdir -p $(DESTDIR)$(ASTETCDIR)
546 @for x in configs/*.sample; do \
547 dst="$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample`" ; \
548 if [ -f $${dst} ]; then \
549 if [ "$(OVERWRITE)" = "y" ]; then \
550 if cmp -s $${dst} $$x ; then \
551 echo "Config file $$x is unchanged"; \
554 mv -f $${dst} $${dst}.old ; \
556 echo "Skipping config file $$x"; \
560 echo "Installing file $$x"; \
561 $(INSTALL) -m 644 $$x $${dst} ;\
563 @if [ "$(OVERWRITE)" = "y" ] || [ ! -f $(DESTDIR)$(ASTCONFPATH) ]; then \
564 echo "Creating asterisk.conf"; \
566 echo "[directories]" ; \
567 echo "astetcdir => $(ASTETCDIR)" ; \
568 echo "astmoddir => $(MODULES_DIR)" ; \
569 echo "astvarlibdir => $(ASTVARLIBDIR)" ; \
570 echo "astdbdir => $(ASTDBDIR)" ; \
571 echo "astkeydir => $(ASTKEYDIR)" ; \
572 echo "astdatadir => $(ASTDATADIR)" ; \
573 echo "astagidir => $(AGI_DIR)" ; \
574 echo "astspooldir => $(ASTSPOOLDIR)" ; \
575 echo "astrundir => $(ASTVARRUNDIR)" ; \
576 echo "astlogdir => $(ASTLOGDIR)" ; \
578 echo ";[options]" ; \
579 echo ";verbose = 3" ; \
580 echo ";debug = 3" ; \
581 echo ";alwaysfork = yes ; same as -F at startup" ; \
582 echo ";nofork = yes ; same as -f at startup" ; \
583 echo ";quiet = yes ; same as -q at startup" ; \
584 echo ";timestamp = yes ; same as -T at startup" ; \
585 echo ";execincludes = yes ; support #exec in config files" ; \
586 echo ";console = yes ; Run as console (same as -c at startup)" ; \
587 echo ";highpriority = yes ; Run realtime priority (same as -p at startup)" ; \
588 echo ";initcrypto = yes ; Initialize crypto keys (same as -i at startup)" ; \
589 echo ";nocolor = yes ; Disable console colors" ; \
590 echo ";dontwarn = yes ; Disable some warnings" ; \
591 echo ";dumpcore = yes ; Dump core on crash (same as -g at startup)" ; \
592 echo ";languageprefix = yes ; Use the new sound prefix path syntax" ; \
593 echo ";internal_timing = yes" ; \
594 echo ";systemname = my_system_name ; prefix uniqueid with a system name for global uniqueness issues" ; \
595 echo ";autosystemname = yes ; automatically set systemname to hostname - uses 'localhost' on failure, or systemname if set" ; \
596 echo ";maxcalls = 10 ; Maximum amount of calls allowed" ; \
597 echo ";maxload = 0.9 ; Asterisk stops accepting new calls if the load average exceed this limit" ; \
598 echo ";maxfiles = 1000 ; Maximum amount of openfiles" ; \
599 echo ";minmemfree = 1 ; in MBs, Asterisk stops accepting new calls if the amount of free memory falls below this watermark" ; \
600 echo ";cache_record_files = yes ; Cache recorded sound files to another directory during recording" ; \
601 echo ";record_cache_dir = /tmp ; Specify cache directory (used in cnjunction with cache_record_files)" ; \
602 echo ";transmit_silence_during_record = yes ; Transmit SLINEAR silence while a channel is being recorded" ; \
603 echo ";transcode_via_sln = yes ; Build transcode paths via SLINEAR, instead of directly" ; \
604 echo ";runuser = asterisk ; The user to run as" ; \
605 echo ";rungroup = asterisk ; The group to run as" ; \
607 echo "; Changing the following lines may compromise your security." ; \
609 echo ";astctlpermissions = 0660" ; \
610 echo ";astctlowner = root" ; \
611 echo ";astctlgroup = apache" ; \
612 echo ";astctl = asterisk.ctl" ; \
613 ) > $(DESTDIR)$(ASTCONFPATH) ; \
615 echo "Skipping asterisk.conf creation"; \
617 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
618 build_tools/make_sample_voicemail $(DESTDIR)/$(ASTDATADIR) $(DESTDIR)/$(ASTSPOOLDIR)
621 @[ -d $(DESTDIR)$(HTTP_DOCSDIR)/ ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 )
622 @[ -d $(DESTDIR)$(HTTP_CGIDIR) ] || ( printf "cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit 1 )
623 $(INSTALL) -m 4755 -o root -g root contrib/scripts/vmail.cgi $(DESTDIR)$(HTTP_CGIDIR)/vmail.cgi
624 mkdir -p $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk
625 for x in images/*.gif; do \
626 $(INSTALL) -m 644 $$x $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk/; \
628 @echo " +--------- Asterisk Web Voicemail ----------+"
630 @echo " + Asterisk Web Voicemail is installed in +"
631 @echo " + your cgi-bin directory: +"
632 @echo " + $(DESTDIR)$(HTTP_CGIDIR)"
633 @echo " + IT USES A SETUID ROOT PERL SCRIPT, SO +"
634 @echo " + IF YOU DON'T LIKE THAT, UNINSTALL IT! +"
636 @echo " + Other static items have been stored in: +"
637 @echo " + $(DESTDIR)$(HTTP_DOCSDIR)"
639 @echo " + If these paths do not match your httpd +"
640 @echo " + installation, correct the definitions +"
641 @echo " + in your Makefile of HTTP_CGIDIR and +"
642 @echo " + HTTP_DOCSDIR +"
644 @echo " +-------------------------------------------+"
647 sed "s/^Version:.*/Version: $(RPMVERSION)/g" redhat/asterisk.spec > asterisk.spec ; \
651 __rpm: include/asterisk/version.h include/asterisk/buildopts.h spec
652 rm -rf /tmp/asterisk ; \
653 mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
654 $(MAKE) DESTDIR=/tmp/asterisk install ; \
655 $(MAKE) DESTDIR=/tmp/asterisk samples ; \
656 mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
657 cp -f contrib/init.d/rc.redhat.asterisk /tmp/asterisk/etc/rc.d/init.d/asterisk ; \
658 rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec
661 (cat contrib/asterisk-ng-doxygen; echo "HAVE_DOT=$(HAVEDOT)"; \
662 echo "PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen -
665 @if [ "${OSARCH}" = "linux-gnu" ]; then \
666 if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \
667 $(INSTALL) -m 755 contrib/init.d/rc.redhat.asterisk $(DESTDIR)/etc/rc.d/init.d/asterisk; \
668 if [ -z "$(DESTDIR)" ]; then /sbin/chkconfig --add asterisk; fi; \
669 elif [ -f /etc/debian_version ]; then \
670 $(INSTALL) -m 755 contrib/init.d/rc.debian.asterisk $(DESTDIR)/etc/init.d/asterisk; \
671 if [ -z "$(DESTDIR)" ]; then /usr/sbin/update-rc.d asterisk start 50 2 3 4 5 . stop 91 2 3 4 5 .; fi; \
672 elif [ -f /etc/gentoo-release ]; then \
673 $(INSTALL) -m 755 contrib/init.d/rc.gentoo.asterisk $(DESTDIR)/etc/init.d/asterisk; \
674 if [ -z "$(DESTDIR)" ]; then /sbin/rc-update add asterisk default; fi; \
675 elif [ -f /etc/mandrake-release -o -f /etc/mandriva-release ]; then \
676 $(INSTALL) -m 755 contrib/init.d/rc.mandrake.asterisk $(DESTDIR)/etc/rc.d/init.d/asterisk; \
677 if [ -z "$(DESTDIR)" ]; then /sbin/chkconfig --add asterisk; fi; \
678 elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then \
679 $(INSTALL) -m 755 contrib/init.d/rc.suse.asterisk $(DESTDIR)/etc/init.d/asterisk; \
680 if [ -z "$(DESTDIR)" ]; then /sbin/chkconfig --add asterisk; fi; \
681 elif [ -f /etc/slackware-version ]; then \
682 echo "Slackware is not currently supported, although an init script does exist for it." \
684 echo "We could not install init scripts for your distribution."; \
687 echo "We could not install init scripts for your operating system."; \
691 $(MAKE) -C sounds all
693 # If the cleancount has been changed, force a make clean.
694 # .cleancount is the global clean count, and .lastclean is the
695 # last clean count we had
698 @cmp -s .cleancount .lastclean || $(MAKE) clean
700 $(SUBDIRS_UNINSTALL):
701 @$(MAKE) --no-print-directory -C $(@:-uninstall=) uninstall
703 _uninstall: $(SUBDIRS_UNINSTALL)
704 rm -f $(DESTDIR)$(MODULES_DIR)/*
705 rm -f $(DESTDIR)$(ASTSBINDIR)/*asterisk*
706 rm -f $(DESTDIR)$(ASTSBINDIR)/astgenkey
707 rm -f $(DESTDIR)$(ASTSBINDIR)/autosupport
708 rm -rf $(DESTDIR)$(ASTHEADERDIR)
709 rm -rf $(DESTDIR)$(ASTDATADIR)/firmware
710 rm -f $(DESTDIR)$(ASTMANDIR)/man8/asterisk.8
711 rm -f $(DESTDIR)$(ASTMANDIR)/man8/astgenkey.8
712 rm -f $(DESTDIR)$(ASTMANDIR)/man8/autosupport.8
713 rm -f $(DESTDIR)$(ASTMANDIR)/man8/safe_asterisk.8
714 $(MAKE) -C sounds uninstall
716 uninstall: _uninstall
717 @echo " +--------- Asterisk Uninstall Complete -----+"
718 @echo " + Asterisk binaries, sounds, man pages, +"
719 @echo " + headers, modules, and firmware builds, +"
720 @echo " + have all been uninstalled. +"
722 @echo " + To remove ALL traces of Asterisk, +"
723 @echo " + including configuration, spool +"
724 @echo " + directories, and logs, run the following +"
725 @echo " + command: +"
727 @echo " + $(mK) uninstall-all +"
728 @echo " +-------------------------------------------+"
730 uninstall-all: _uninstall
731 rm -rf $(DESTDIR)$(ASTLIBDIR)
732 rm -rf $(DESTDIR)$(ASTVARLIBDIR)
733 rm -rf $(DESTDIR)$(ASTDATADIR)
734 rm -rf $(DESTDIR)$(ASTSPOOLDIR)
735 rm -rf $(DESTDIR)$(ASTETCDIR)
736 rm -rf $(DESTDIR)$(ASTLOGDIR)
738 menuconfig: menuselect
740 gmenuconfig: gmenuselect
742 menuselect: menuselect/menuselect menuselect-tree
743 -@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!"
745 gmenuselect: menuselect/gmenuselect menuselect-tree
746 -@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!"
748 menuselect/menuselect: menuselect/makeopts
749 echo "doing menuselect with $(HOST_CC)"
750 @CC="$(HOST_CC)" LD="" AR="" RANLIB="" CFLAGS="" $(MAKE) -C menuselect CONFIGURE_SILENT="--silent"
752 menuselect/gmenuselect: menuselect/makeopts
753 @CC="$(HOST_CC)" CXX="$(CXX)" LD="" AR="" RANLIB="" CFLAGS="" $(MAKE) -C menuselect gmenuselect CONFIGURE_SILENT="--silent"
756 @CC="$(HOST_CC)" CXX="$(CXX)" LD="" AR="" RANLIB="" CFLAGS="" $(MAKE) -C menuselect makeopts CONFIGURE_SILENT="--silent"
758 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
759 @echo "Generating input for menuselect ..."
760 @build_tools/prep_moduledeps > $@
763 $(MAKE) -C doc/tex asterisk.pdf
765 .PHONY: menuselect main sounds clean dist-clean distclean all prereqs cleantest uninstall _uninstall uninstall-all 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