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 # Initial values for ASTCFLAGS and ASTLDFLAGS can be specified in the
24 # environment when running make, as follows:
26 # $ ASTCFLAGS="-Werror" make ...
28 # note that this is different from
30 # $ make ASTCFLAGS="-Werror" ...
32 # If you need to pass compiler/linker flags as 'make' variables, please use
34 # $ make COPTS="..." LDOPTS="..." ...
37 # You can add the path of local module subdirs from the command line with
38 # make LOCAL_MOD_SUBDIRS= ....
40 export ASTTOPDIR # Top level dir, used in subdirs' Makefiles
41 export ASTERISKVERSION
42 export ASTERISKVERSIONNUM
44 #--- values used for default paths
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)
53 export INSTALL_PATH # Additional prefix for the following paths
54 export ASTETCDIR # Path for config files
69 export OSARCH # Operating system
70 export PROC # Processor type
72 export NOISY_BUILD # Used in Makefile.rules
73 export MENUSELECT_CFLAGS # Options selected in menuselect.
74 export AST_DEVMODE # Set to "yes" for additional compiler
77 export SOLINK # linker flags for shared objects
78 export STATIC_BUILD # Additional cflags, set to -static
79 # for static builds. Probably
80 # should go directly to ASTLDFLAGS
82 #--- paths to various commands
95 # even though we could use '-include makeopts' here, use a wildcard
96 # lookup anyway, so that make won't try to build makeopts if it doesn't
97 # exist (other rules will force it to be built if needed)
98 ifneq ($(wildcard makeopts),)
102 # Some build systems, such as the one in openwrt, like to pass custom target
103 # CFLAGS and LDFLAGS in the COPTS and LDOPTS variables.
105 ASTLDFLAGS+=$(LDOPTS)
107 #Uncomment this to see all build commands instead of 'quiet' output
112 # Overwite config files on "make samples"
115 # Include debug and macro symbols in the executables (-g) and profiling info (-pg)
119 # Define standard directories for various platforms
120 # These apply if they are not redefined in asterisk.conf
121 ifeq ($(OSARCH),SunOS)
122 ASTETCDIR=/var/etc/asterisk
123 ASTLIBDIR=/opt/asterisk/lib
124 ASTVARLIBDIR=/var/opt/asterisk
125 ASTDBDIR=$(ASTVARLIBDIR)
126 ASTKEYDIR=$(ASTVARLIBDIR)
127 ASTSPOOLDIR=/var/spool/asterisk
128 ASTLOGDIR=/var/log/asterisk
129 ASTHEADERDIR=/opt/asterisk/include
130 ASTBINDIR=/opt/asterisk/bin
131 ASTSBINDIR=/opt/asterisk/sbin
132 ASTVARRUNDIR=/var/run/asterisk
133 ASTMANDIR=/opt/asterisk/man
135 ASTETCDIR=$(sysconfdir)/asterisk
136 ASTLIBDIR=$(libdir)/asterisk
137 ASTHEADERDIR=$(includedir)/asterisk
139 ASTSBINDIR=$(sbindir)
140 ASTSPOOLDIR=$(localstatedir)/spool/asterisk
141 ASTLOGDIR=$(localstatedir)/log/asterisk
142 ASTVARRUNDIR=$(localstatedir)/run
144 ifneq ($(findstring BSD,$(OSARCH)),)
145 ASTVARLIBDIR=$(prefix)/share/asterisk
146 ASTVARRUNDIR=$(localstatedir)/run/asterisk
147 ASTDBDIR=$(localstatedir)/db/asterisk
149 ASTVARLIBDIR=$(localstatedir)/lib/asterisk
150 ASTDBDIR=$(ASTVARLIBDIR)
152 ASTKEYDIR=$(ASTVARLIBDIR)
154 ifeq ($(ASTDATADIR),)
155 ASTDATADIR:=$(ASTVARLIBDIR)
158 # Asterisk.conf is located in ASTETCDIR or by using the -C flag
159 # when starting Asterisk
160 ASTCONFPATH=$(ASTETCDIR)/asterisk.conf
161 MODULES_DIR=$(ASTLIBDIR)/modules
162 AGI_DIR=$(ASTDATADIR)/agi-bin
164 # If you use Apache, you may determine by a grep 'DocumentRoot' of your httpd.conf file
165 HTTP_DOCSDIR=/var/www/html
166 # Determine by a grep 'ScriptAlias' of your Apache httpd.conf file
167 HTTP_CGIDIR=/var/www/cgi-bin
169 # Uncomment this to use the older DSP routines
170 #ASTCFLAGS+=-DOLD_DSP_ROUTINES
172 # If the file .asterisk.makeopts is present in your home directory, you can
173 # include all of your favorite menuselect options so that every time you download
174 # a new version of Asterisk, you don't have to run menuselect to set them.
175 # The file /etc/asterisk.makeopts will also be included but can be overridden
176 # by the file in your home directory.
178 GLOBAL_MAKEOPTS=$(wildcard /etc/asterisk.makeopts)
179 USER_MAKEOPTS=$(wildcard ~/.asterisk.makeopts)
181 MOD_SUBDIR_CFLAGS=-I$(ASTTOPDIR)/include
182 OTHER_SUBDIR_CFLAGS=-I$(ASTTOPDIR)/include
184 # Create OPTIONS variable, but probably we can assign directly to ASTCFLAGS
187 ifeq ($(OSARCH),linux-gnu)
188 ifeq ($(PROC),x86_64)
189 # You must have GCC 3.4 to use k8, otherwise use athlon
194 ifeq ($(PROC),sparc64)
195 #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
196 #This works for even old (2.96) versions of gcc and provides a small boost either way.
197 #A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
198 #So we go lowest common available by gcc and go a step down, still a step up from
199 #the default as we now have a better instruction set to work with. - Belgarath
201 OPTIONS+=$(shell if $(CC) -mtune=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mtune=$(PROC)"; fi)
202 OPTIONS+=$(shell if $(CC) -mcpu=v8 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mcpu=v8"; fi)
203 OPTIONS+=-fomit-frame-pointer
207 # The Cirrus logic is the only heavily shipping arm processor with a real floating point unit
208 ifeq ($(SUB_PROC),maverick)
209 OPTIONS+=-fsigned-char -mcpu=ep9312
211 ifeq ($(SUB_PROC),xscale)
212 OPTIONS+=-fsigned-char -mcpu=xscale
214 OPTIONS+=-fsigned-char
220 ifeq ($(findstring -save-temps,$(ASTCFLAGS)),)
224 ASTCFLAGS+=-Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG)
226 ASTCFLAGS+=-include $(ASTTOPDIR)/include/asterisk/autoconfig.h
228 ifeq ($(AST_DEVMODE),yes)
229 ASTCFLAGS+=-Werror -Wunused -Wundef $(AST_DECLARATION_AFTER_STATEMENT)
232 ifneq ($(findstring BSD,$(OSARCH)),)
233 ASTCFLAGS+=-I/usr/local/include
234 ASTLDFLAGS+=-L/usr/local/lib
237 ifneq ($(PROC),ultrasparc)
238 ASTCFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
242 ASTCFLAGS+=-fsigned-char
245 ifeq ($(OSARCH),FreeBSD)
246 # -V is understood by BSD Make, not by GNU make.
247 BSDVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk)
248 ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
251 ifeq ($(OSARCH),NetBSD)
252 ASTCFLAGS+=-pthread -I/usr/pkg/include
255 ifeq ($(OSARCH),OpenBSD)
259 ifeq ($(OSARCH),SunOS)
260 ASTCFLAGS+=-Wcast-align -DSOLARIS -I../include/solaris-compat -I/opt/ssl/include -I/usr/local/ssl/include -D_XPG4_2
263 ASTERISKVERSION:=$(shell GREP=$(GREP) AWK=$(AWK) build_tools/make_version .)
265 ifneq ($(wildcard .version),)
266 ASTERISKVERSIONNUM:=$(shell $(AWK) -F. '{printf "%01d%02d%02d", $$1, $$2, $$3}' .version)
267 RPMVERSION:=$(shell sed 's/[-\/:]/_/g' .version)
272 ifneq ($(wildcard .svn),)
273 ASTERISKVERSIONNUM:=999999
276 # XXX MALLOC_DEBUG is probably unused, Makefile.moddir_rules adds the
277 # value directly to ASTCFLAGS
278 # XXX BUSYDETECT is probably useless, the only similar reference is to
279 # #ifdef BUSYDETECT in main/dsp.c
280 ASTCFLAGS+=$(MALLOC_DEBUG)$(BUSYDETECT)$(OPTIONS)
282 MOD_SUBDIRS:=channels pbx apps codecs formats cdr funcs tests main res $(LOCAL_MOD_SUBDIRS)
283 OTHER_SUBDIRS:=utils agi
284 SUBDIRS:=$(OTHER_SUBDIRS) $(MOD_SUBDIRS)
285 SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)
286 SUBDIRS_CLEAN:=$(SUBDIRS:%=%-clean)
287 SUBDIRS_DIST_CLEAN:=$(SUBDIRS:%=%-dist-clean)
288 SUBDIRS_UNINSTALL:=$(SUBDIRS:%=%-uninstall)
289 MOD_SUBDIRS_EMBED_LDSCRIPT:=$(MOD_SUBDIRS:%=%-embed-ldscript)
290 MOD_SUBDIRS_EMBED_LDFLAGS:=$(MOD_SUBDIRS:%=%-embed-ldflags)
291 MOD_SUBDIRS_EMBED_LIBS:=$(MOD_SUBDIRS:%=%-embed-libs)
292 MOD_SUBDIRS_MENUSELECT_TREE:=$(MOD_SUBDIRS:%=%-menuselect-tree)
294 ifneq ($(findstring darwin,$(OSARCH)),)
295 ASTCFLAGS+=-D__Darwin__
296 SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
298 # These are used for all but Darwin
299 SOLINK=-shared -Xlinker -x
300 ifneq ($(findstring BSD,$(OSARCH)),)
301 LDFLAGS+=-L/usr/local/lib
305 ifeq ($(OSARCH),SunOS)
306 SOLINK=-shared -fpic -L/usr/local/ssl/lib
309 # comment to print directories during submakes
312 SILENTMAKE:=$(MAKE) --quiet --no-print-directory
313 ifneq ($(PRINT_DIR)$(NOISY_BUILD),)
314 SUBMAKE:=$(MAKE) --quiet
316 SUBMAKE:=$(MAKE) --quiet --no-print-directory
319 # This is used when generating the doxygen documentation
326 # $(MAKE) is printed in several places, and we want it to be a
327 # fixed size string. Define a variable whose name has also the
328 # same size, so we can easily align text.
329 ifeq ($(MAKE), gmake)
336 @echo " +--------- Asterisk Build Complete ---------+"
337 @echo " + Asterisk has successfully been built, and +"
338 @echo " + can be installed by running: +"
340 @echo " + $(mK) install +"
341 @echo " +-------------------------------------------+"
343 _all: cleantest makeopts $(SUBDIRS)
347 @echo "**** The configure script must be executed before running '$(MAKE)'."
348 @echo "**** Please run \"./configure\"."
352 menuselect.makeopts: menuselect/menuselect menuselect-tree
353 menuselect/menuselect --check-deps $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts
355 $(MOD_SUBDIRS_EMBED_LDSCRIPT):
356 @echo "EMBED_LDSCRIPTS+="`$(SILENTMAKE) -C $(@:-embed-ldscript=) SUBDIR=$(@:-embed-ldscript=) __embed_ldscript` >> makeopts.embed_rules
358 $(MOD_SUBDIRS_EMBED_LDFLAGS):
359 @echo "EMBED_LDFLAGS+="`$(SILENTMAKE) -C $(@:-embed-ldflags=) SUBDIR=$(@:-embed-ldflags=) __embed_ldflags` >> makeopts.embed_rules
361 $(MOD_SUBDIRS_EMBED_LIBS):
362 @echo "EMBED_LIBS+="`$(SILENTMAKE) -C $(@:-embed-libs=) SUBDIR=$(@:-embed-libs=) __embed_libs` >> makeopts.embed_rules
364 $(MOD_SUBDIRS_MENUSELECT_TREE):
365 @$(SUBMAKE) -C $(@:-menuselect-tree=) SUBDIR=$(@:-menuselect-tree=) moduleinfo
366 @$(SUBMAKE) -C $(@:-menuselect-tree=) SUBDIR=$(@:-menuselect-tree=) makeopts
368 makeopts.embed_rules: menuselect.makeopts
369 @echo "Generating embedded module rules ..."
371 @$(MAKE) $(PRINT_DIR) $(MOD_SUBDIRS_EMBED_LDSCRIPT)
372 @$(MAKE) $(PRINT_DIR) $(MOD_SUBDIRS_EMBED_LDFLAGS)
373 @$(MAKE) $(PRINT_DIR) $(MOD_SUBDIRS_EMBED_LIBS)
375 $(SUBDIRS): main/version.c include/asterisk/build.h include/asterisk/buildopts.h defaults.h makeopts.embed_rules
377 ifeq ($(findstring $(OSARCH), mingw32 cygwin ),)
379 # ensure that all module subdirectories are processed before 'main' during
380 # a parallel build, since if there are modules selected to be embedded the
381 # directories containing them must be completed before the main Asterisk
382 # binary can be built
383 main: $(filter-out main,$(MOD_SUBDIRS))
385 # Windows: we need to build main (i.e. the asterisk dll) first,
386 # followed by res, followed by the other directories, because
387 # dll symbols must be resolved during linking and not at runtime.
388 D1:= $(filter-out main,$(MOD_SUBDIRS))
389 D1:= $(filter-out res,$(D1))
396 @ASTCFLAGS="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" $(MAKE) $(PRINT_DIR) --no-builtin-rules -C $@ SUBDIR=$@ all
399 @ASTCFLAGS="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" $(MAKE) $(PRINT_DIR) --no-builtin-rules -C $@ SUBDIR=$@ all
402 @build_tools/make_defaults_h > $@.tmp
403 @cmp -s $@.tmp $@ || mv $@.tmp $@
407 @build_tools/make_version_c > $@.tmp
408 @cmp -s $@.tmp $@ || mv $@.tmp $@
411 include/asterisk/buildopts.h: menuselect.makeopts
412 @build_tools/make_buildopts_h > $@.tmp
413 @cmp -s $@.tmp $@ || mv $@.tmp $@
416 include/asterisk/build.h:
417 @build_tools/make_build_h > $@.tmp
418 @cmp -s $@.tmp $@ || mv $@.tmp $@
422 @$(MAKE) $(PRINT_DIR) -C $(@:-clean=) clean
424 $(SUBDIRS_DIST_CLEAN):
425 @$(MAKE) $(PRINT_DIR) -C $(@:-dist-clean=) dist-clean
427 clean: $(SUBDIRS_CLEAN)
429 rm -f include/asterisk/build.h
431 @$(MAKE) -C menuselect clean
432 cp -f .cleancount .lastclean
434 dist-clean: distclean
436 distclean: $(SUBDIRS_DIST_CLEAN) clean
437 @$(MAKE) -C menuselect dist-clean
438 @$(MAKE) -C sounds dist-clean
439 rm -f menuselect.makeopts makeopts menuselect-tree menuselect.makedeps
440 rm -f makeopts.embed_rules
441 rm -f config.log config.status
442 rm -rf autom4te.cache
443 rm -f include/asterisk/autoconfig.h
444 rm -f include/asterisk/buildopts.h
446 rm -f build_tools/menuselect-deps
449 if [ x`$(ID) -un` = xroot ]; then CFLAGS="$(ASTCFLAGS)" sh build_tools/mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig; fi
450 # Should static HTTP be installed during make samples or even with its own target ala
451 # webvoicemail? There are portions here that *could* be customized but might also be
452 # improved a lot. I'll put it here for now.
453 mkdir -p $(DESTDIR)$(ASTDATADIR)/static-http
454 for x in static-http/*; do \
455 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/static-http ; \
457 mkdir -p $(DESTDIR)$(ASTDATADIR)/images
458 for x in images/*.jpg; do \
459 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/images ; \
461 mkdir -p $(DESTDIR)$(AGI_DIR)
462 $(MAKE) -C sounds install
465 @if [ -d .svn ]; then \
466 echo "Updating from Subversion..." ; \
467 svn update | tee update.out; \
469 if [ `grep -c ^C update.out` -gt 0 ]; then \
470 echo ; echo "The following files have conflicts:" ; \
471 grep ^C update.out | cut -b4- ; \
475 echo "Not under version control"; \
478 NEWHEADERS=$(notdir $(wildcard include/asterisk/*.h))
479 OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h)))
482 mkdir -p $(DESTDIR)$(MODULES_DIR)
483 mkdir -p $(DESTDIR)$(ASTSBINDIR)
484 mkdir -p $(DESTDIR)$(ASTETCDIR)
485 mkdir -p $(DESTDIR)$(ASTBINDIR)
486 mkdir -p $(DESTDIR)$(ASTVARRUNDIR)
487 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail
488 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/dictate
489 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/system
490 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/tmp
491 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/meetme
492 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/monitor
493 $(INSTALL) -m 755 main/asterisk $(DESTDIR)$(ASTSBINDIR)/
494 $(LN) -sf asterisk $(DESTDIR)$(ASTSBINDIR)/rasterisk
495 $(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
496 $(INSTALL) -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/
497 if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \
498 cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;' > $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ;\
499 chmod 755 $(DESTDIR)$(ASTSBINDIR)/safe_asterisk;\
501 $(INSTALL) -d $(DESTDIR)$(ASTHEADERDIR)
502 $(INSTALL) -m 644 include/asterisk.h $(DESTDIR)$(includedir)
503 $(INSTALL) -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
504 if [ -n "$(OLDHEADERS)" ]; then \
505 rm -f $(addprefix $(DESTDIR)$(ASTHEADERDIR)/,$(OLDHEADERS)) ;\
507 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
508 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-custom
509 mkdir -p $(DESTDIR)$(ASTDATADIR)/keys
510 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware
511 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware/iax
512 mkdir -p $(DESTDIR)$(ASTMANDIR)/man8
513 $(INSTALL) -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTDATADIR)/keys
514 $(INSTALL) -m 644 keys/freeworlddialup.pub $(DESTDIR)$(ASTDATADIR)/keys
515 $(INSTALL) -m 644 doc/asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
516 $(INSTALL) -m 644 contrib/scripts/astgenkey.8 $(DESTDIR)$(ASTMANDIR)/man8
517 $(INSTALL) -m 644 contrib/scripts/autosupport.8 $(DESTDIR)$(ASTMANDIR)/man8
518 $(INSTALL) -m 644 contrib/scripts/safe_asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
519 if [ -f contrib/firmware/iax/iaxy.bin ] ; then \
520 $(INSTALL) -m 644 contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTDATADIR)/firmware/iax/iaxy.bin; \
524 @DESTDIR="$(DESTDIR)" ASTSBINDIR="$(ASTSBINDIR)" $(MAKE) --quiet $(PRINT_DIR) -C $(@:-install=) install
526 NEWMODS:=$(foreach d,$(MOD_SUBDIRS),$(notdir $(wildcard $(d)/*.so)))
527 OLDMODS=$(filter-out $(NEWMODS),$(notdir $(wildcard $(DESTDIR)$(MODULES_DIR)/*.so)))
530 @if [ -n "$(OLDMODS)" ]; then \
531 echo " WARNING WARNING WARNING" ;\
533 echo " Your Asterisk modules directory, located at" ;\
534 echo " $(DESTDIR)$(MODULES_DIR)" ;\
535 echo " contains modules that were not installed by this " ;\
536 echo " version of Asterisk. Please ensure that these" ;\
537 echo " modules are compatible with this version before" ;\
538 echo " attempting to run Asterisk." ;\
540 for f in $(OLDMODS); do \
544 echo " WARNING WARNING WARNING" ;\
547 install: datafiles bininstall $(SUBDIRS_INSTALL)
548 @if [ -x /usr/sbin/asterisk-post-install ]; then \
549 /usr/sbin/asterisk-post-install $(DESTDIR) . ; \
551 @echo " +---- Asterisk Installation Complete -------+"
553 @echo " + YOU MUST READ THE SECURITY DOCUMENT +"
555 @echo " + Asterisk has successfully been installed. +"
556 @echo " + If you would like to install the sample +"
557 @echo " + configuration files (overwriting any +"
558 @echo " + existing config files), run: +"
560 @echo " + $(mK) samples +"
562 @echo " +----------------- or ---------------------+"
564 @echo " + You can go ahead and install the asterisk +"
565 @echo " + program documentation now or later run: +"
567 @echo " + $(mK) progdocs +"
569 @echo " + **Note** This requires that you have +"
570 @echo " + doxygen installed on your local system +"
571 @echo " +-------------------------------------------+"
572 @$(MAKE) -s oldmodcheck
576 # XXX why *.adsi is installed first ?
578 @echo Installing adsi config files...
579 @mkdir -p $(DESTDIR)$(ASTETCDIR)
580 @for x in configs/*.adsi; do \
581 dst="$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x`" ; \
582 if [ -f $${dst} ] ; then \
583 echo "Overwriting $$x" ; \
585 echo "Installing $$x" ; \
587 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x` ; \
591 @echo Installing other config files...
592 @mkdir -p $(DESTDIR)$(ASTETCDIR)
593 @for x in configs/*.sample; do \
594 dst="$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample`" ; \
595 if [ -f $${dst} ]; then \
596 if [ "$(OVERWRITE)" = "y" ]; then \
597 if cmp -s $${dst} $$x ; then \
598 echo "Config file $$x is unchanged"; \
601 mv -f $${dst} $${dst}.old ; \
603 echo "Skipping config file $$x"; \
607 echo "Installing file $$x"; \
608 $(INSTALL) -m 644 $$x $${dst} ;\
610 @if [ "$(OVERWRITE)" = "y" ] || [ ! -f $(DESTDIR)$(ASTCONFPATH) ]; then \
611 echo "Creating asterisk.conf"; \
613 echo "[directories](!) ; remove the (!) to enable this" ; \
614 echo "astetcdir => $(ASTETCDIR)" ; \
615 echo "astmoddir => $(MODULES_DIR)" ; \
616 echo "astvarlibdir => $(ASTVARLIBDIR)" ; \
617 echo "astdbdir => $(ASTDBDIR)" ; \
618 echo "astkeydir => $(ASTKEYDIR)" ; \
619 echo "astdatadir => $(ASTDATADIR)" ; \
620 echo "astagidir => $(AGI_DIR)" ; \
621 echo "astspooldir => $(ASTSPOOLDIR)" ; \
622 echo "astrundir => $(ASTVARRUNDIR)" ; \
623 echo "astlogdir => $(ASTLOGDIR)" ; \
625 echo ";[options]" ; \
626 echo ";verbose = 3" ; \
627 echo ";debug = 3" ; \
628 echo ";alwaysfork = yes ; same as -F at startup" ; \
629 echo ";nofork = yes ; same as -f at startup" ; \
630 echo ";quiet = yes ; same as -q at startup" ; \
631 echo ";timestamp = yes ; same as -T at startup" ; \
632 echo ";execincludes = yes ; support #exec in config files" ; \
633 echo ";console = yes ; Run as console (same as -c at startup)" ; \
634 echo ";highpriority = yes ; Run realtime priority (same as -p at startup)" ; \
635 echo ";initcrypto = yes ; Initialize crypto keys (same as -i at startup)" ; \
636 echo ";nocolor = yes ; Disable console colors" ; \
637 echo ";dontwarn = yes ; Disable some warnings" ; \
638 echo ";dumpcore = yes ; Dump core on crash (same as -g at startup)" ; \
639 echo ";languageprefix = yes ; Use the new sound prefix path syntax" ; \
640 echo ";internal_timing = yes" ; \
641 echo ";systemname = my_system_name ; prefix uniqueid with a system name for global uniqueness issues" ; \
642 echo ";autosystemname = yes ; automatically set systemname to hostname - uses 'localhost' on failure, or systemname if set" ; \
643 echo ";maxcalls = 10 ; Maximum amount of calls allowed" ; \
644 echo ";maxload = 0.9 ; Asterisk stops accepting new calls if the load average exceed this limit" ; \
645 echo ";maxfiles = 1000 ; Maximum amount of openfiles" ; \
646 echo ";minmemfree = 1 ; in MBs, Asterisk stops accepting new calls if the amount of free memory falls below this watermark" ; \
647 echo ";cache_record_files = yes ; Cache recorded sound files to another directory during recording" ; \
648 echo ";record_cache_dir = /tmp ; Specify cache directory (used in cnjunction with cache_record_files)" ; \
649 echo ";transmit_silence_during_record = yes ; Transmit SLINEAR silence while a channel is being recorded" ; \
650 echo ";transcode_via_sln = yes ; Build transcode paths via SLINEAR, instead of directly" ; \
651 echo ";runuser = asterisk ; The user to run as" ; \
652 echo ";rungroup = asterisk ; The group to run as" ; \
654 echo "; Changing the following lines may compromise your security." ; \
656 echo ";astctlpermissions = 0660" ; \
657 echo ";astctlowner = root" ; \
658 echo ";astctlgroup = apache" ; \
659 echo ";astctl = asterisk.ctl" ; \
660 ) > $(DESTDIR)$(ASTCONFPATH) ; \
662 echo "Skipping asterisk.conf creation"; \
664 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
665 build_tools/make_sample_voicemail $(DESTDIR)/$(ASTDATADIR) $(DESTDIR)/$(ASTSPOOLDIR)
668 @[ -d $(DESTDIR)$(HTTP_DOCSDIR)/ ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 )
669 @[ -d $(DESTDIR)$(HTTP_CGIDIR) ] || ( printf "cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit 1 )
670 $(INSTALL) -m 4755 -o root -g root contrib/scripts/vmail.cgi $(DESTDIR)$(HTTP_CGIDIR)/vmail.cgi
671 mkdir -p $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk
672 for x in images/*.gif; do \
673 $(INSTALL) -m 644 $$x $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk/; \
675 @echo " +--------- Asterisk Web Voicemail ----------+"
677 @echo " + Asterisk Web Voicemail is installed in +"
678 @echo " + your cgi-bin directory: +"
679 @echo " + $(DESTDIR)$(HTTP_CGIDIR)"
680 @echo " + IT USES A SETUID ROOT PERL SCRIPT, SO +"
681 @echo " + IF YOU DON'T LIKE THAT, UNINSTALL IT! +"
683 @echo " + Other static items have been stored in: +"
684 @echo " + $(DESTDIR)$(HTTP_DOCSDIR)"
686 @echo " + If these paths do not match your httpd +"
687 @echo " + installation, correct the definitions +"
688 @echo " + in your Makefile of HTTP_CGIDIR and +"
689 @echo " + HTTP_DOCSDIR +"
691 @echo " +-------------------------------------------+"
694 sed "s/^Version:.*/Version: $(RPMVERSION)/g" redhat/asterisk.spec > asterisk.spec ; \
698 __rpm: main/version.c include/asterisk/buildopts.h spec
699 rm -rf /tmp/asterisk ; \
700 mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
701 $(MAKE) DESTDIR=/tmp/asterisk install ; \
702 $(MAKE) DESTDIR=/tmp/asterisk samples ; \
703 mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
704 cp -f contrib/init.d/rc.redhat.asterisk /tmp/asterisk/etc/rc.d/init.d/asterisk ; \
705 rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec
708 (cat contrib/asterisk-ng-doxygen; echo "HAVE_DOT=$(HAVEDOT)"; \
709 echo "PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen -
712 @if [ "${OSARCH}" = "linux-gnu" ]; then \
713 if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \
714 $(INSTALL) -m 755 contrib/init.d/rc.redhat.asterisk $(DESTDIR)/etc/rc.d/init.d/asterisk; \
715 if [ -z "$(DESTDIR)" ]; then /sbin/chkconfig --add asterisk; fi; \
716 elif [ -f /etc/debian_version ]; then \
717 $(INSTALL) -m 755 contrib/init.d/rc.debian.asterisk $(DESTDIR)/etc/init.d/asterisk; \
718 if [ -z "$(DESTDIR)" ]; then /usr/sbin/update-rc.d asterisk start 50 2 3 4 5 . stop 91 2 3 4 5 .; fi; \
719 elif [ -f /etc/gentoo-release ]; then \
720 $(INSTALL) -m 755 contrib/init.d/rc.gentoo.asterisk $(DESTDIR)/etc/init.d/asterisk; \
721 if [ -z "$(DESTDIR)" ]; then /sbin/rc-update add asterisk default; fi; \
722 elif [ -f /etc/mandrake-release -o -f /etc/mandriva-release ]; then \
723 $(INSTALL) -m 755 contrib/init.d/rc.mandrake.asterisk $(DESTDIR)/etc/rc.d/init.d/asterisk; \
724 if [ -z "$(DESTDIR)" ]; then /sbin/chkconfig --add asterisk; fi; \
725 elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then \
726 $(INSTALL) -m 755 contrib/init.d/rc.suse.asterisk $(DESTDIR)/etc/init.d/asterisk; \
727 if [ -z "$(DESTDIR)" ]; then /sbin/chkconfig --add asterisk; fi; \
728 elif [ -f /etc/slackware-version ]; then \
729 echo "Slackware is not currently supported, although an init script does exist for it." \
731 echo "We could not install init scripts for your distribution."; \
734 echo "We could not install init scripts for your operating system."; \
738 $(MAKE) -C sounds all
740 # If the cleancount has been changed, force a make clean.
741 # .cleancount is the global clean count, and .lastclean is the
742 # last clean count we had
745 @cmp -s .cleancount .lastclean || $(MAKE) clean
747 $(SUBDIRS_UNINSTALL):
748 @$(MAKE) $(PRINT_DIR) -C $(@:-uninstall=) uninstall
750 _uninstall: $(SUBDIRS_UNINSTALL)
751 rm -f $(DESTDIR)$(MODULES_DIR)/*
752 rm -f $(DESTDIR)$(ASTSBINDIR)/*asterisk*
753 rm -f $(DESTDIR)$(ASTSBINDIR)/astgenkey
754 rm -f $(DESTDIR)$(ASTSBINDIR)/autosupport
755 rm -rf $(DESTDIR)$(ASTHEADERDIR)
756 rm -rf $(DESTDIR)$(ASTDATADIR)/firmware
757 rm -f $(DESTDIR)$(ASTMANDIR)/man8/asterisk.8
758 rm -f $(DESTDIR)$(ASTMANDIR)/man8/astgenkey.8
759 rm -f $(DESTDIR)$(ASTMANDIR)/man8/autosupport.8
760 rm -f $(DESTDIR)$(ASTMANDIR)/man8/safe_asterisk.8
761 $(MAKE) -C sounds uninstall
763 uninstall: _uninstall
764 @echo " +--------- Asterisk Uninstall Complete -----+"
765 @echo " + Asterisk binaries, sounds, man pages, +"
766 @echo " + headers, modules, and firmware builds, +"
767 @echo " + have all been uninstalled. +"
769 @echo " + To remove ALL traces of Asterisk, +"
770 @echo " + including configuration, spool +"
771 @echo " + directories, and logs, run the following +"
772 @echo " + command: +"
774 @echo " + $(mK) uninstall-all +"
775 @echo " +-------------------------------------------+"
777 uninstall-all: _uninstall
778 rm -rf $(DESTDIR)$(ASTLIBDIR)
779 rm -rf $(DESTDIR)$(ASTVARLIBDIR)
780 rm -rf $(DESTDIR)$(ASTDATADIR)
781 rm -rf $(DESTDIR)$(ASTSPOOLDIR)
782 rm -rf $(DESTDIR)$(ASTETCDIR)
783 rm -rf $(DESTDIR)$(ASTLOGDIR)
785 menuconfig: menuselect
787 gmenuconfig: gmenuselect
789 menuselect: menuselect/menuselect menuselect-tree
790 -@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!"
792 gmenuselect: menuselect/gmenuselect menuselect-tree
793 -@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!"
795 # options for make in menuselect/
796 MAKE_MENUSELECT=CC="$(HOST_CC)" CXX="$(CXX)" LD="" AR="" RANLIB="" CFLAGS="" $(MAKE) -C menuselect CONFIGURE_SILENT="--silent"
798 menuselect/menuselect: menuselect/makeopts
801 menuselect/gmenuselect: menuselect/makeopts
802 $(MAKE_MENUSELECT) gmenuselect
805 $(MAKE_MENUSELECT) makeopts
807 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
808 @echo "Generating input for menuselect ..."
809 @echo "<?xml version=\"1.0\"?>" > $@
811 @echo "<menu name=\"Asterisk Module and Build Option Selection\">" >> $@
812 @for dir in $(sort $(filter-out main,$(MOD_SUBDIRS))); do $(SUBMAKE) -C $${dir} SUBDIR=$${dir} moduleinfo >> $@; done
813 @for dir in $(sort $(filter-out main,$(MOD_SUBDIRS))); do $(SUBMAKE) -C $${dir} SUBDIR=$${dir} makeopts >> $@; done
814 @cat build_tools/cflags.xml >> $@
815 @cat build_tools/embed_modules.xml >> $@
816 @cat sounds/sounds.xml >> $@
817 @echo "</menu>" >> $@
821 $(MAKE) -C doc/tex asterisk.pdf
823 .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) main/version.c