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 .EXPORT_ALL_VARIABLES:
16 .PHONY: sounds clean clean-depend dist-clean all
18 # Create OPTIONS variable
21 # If cross compiling, define these to suit
22 #CROSS_COMPILE=/opt/montavista/pro/devkit/arm/xscale_be/bin/xscale_be-
23 #CROSS_COMPILE_BIN=/opt/montavista/pro/devkit/arm/xscale_be/bin/
24 #CROSS_COMPILE_TARGET=/opt/montavista/pro/devkit/arm/xscale_be/target
27 #SUB_PROC=xscale # or maverick
29 ifeq ($(CROSS_COMPILE),)
30 OSARCH=$(shell uname -s)
31 PROC?=$(shell uname -m)
39 # Remember the MAKELEVEL at the top
40 MAKETOPLEVEL?=$(MAKELEVEL)
42 # Overwite config files on "make samples"
45 # Include debug and macro symbols in the executables (-g) and profiling info (-pg)
49 # Files are copied here temporarily during the install process
50 # For example, make DESTDIR=/tmp/asterisk woud put things in
51 # /tmp/asterisk/etc/asterisk
52 # !!! Watch out, put no spaces or comments after the value !!!
54 #DESTDIR?=/tmp/asterisk
56 # Original busydetect routine
57 #BUSYDETECT = -DBUSYDETECT
59 # Improved busydetect routine, comment the previous one if you use this one
60 #BUSYDETECT+= -DBUSYDETECT_MARTIN
61 # Detect the busy signal looking only at tone lengths
62 # For example if you have 3 beeps 100ms tone, 100ms silence separated by 500 ms of silence
63 #BUSYDETECT+= -DBUSYDETECT_TONEONLY
64 # Enforce the detection of busy signal (get rid of false hangups)
65 # Don't use together with -DBUSYDETECT_TONEONLY
66 #BUSYDETECT+= -DBUSYDETECT_COMPARE_TONE_AND_SILENCE
68 # Define standard directories for various platforms
69 # These apply if they are not redefined in asterisk.conf
70 ifeq ($(OSARCH),SunOS)
71 ASTETCDIR=/etc/opt/asterisk
72 ASTLIBDIR=/opt/asterisk/lib
73 ASTVARLIBDIR=/var/opt/asterisk/lib
74 ASTSPOOLDIR=/var/opt/asterisk/spool
75 ASTLOGDIR=/var/opt/asterisk/log
76 ASTHEADERDIR=/opt/asterisk/usr/include/asterisk
77 ASTBINDIR=/opt/asterisk/usr/bin
78 ASTSBINDIR=/opt/asterisk/usr/sbin
79 ASTVARRUNDIR=/var/opt/asterisk/run
80 ASTMANDIR=/opt/asterisk/usr/share/man
82 ASTETCDIR=$(sysconfdir)/asterisk
83 ASTLIBDIR=$(libdir)/asterisk
84 ASTHEADERDIR=$(includedir)/asterisk
87 ASTSPOOLDIR=$(localstatedir)/spool/asterisk
88 ASTLOGDIR=$(localstatedir)/log/asterisk
89 ASTVARRUNDIR=$(localstatedir)/run
91 ifeq ($(OSARCH),FreeBSD)
92 ASTVARLIBDIR=$(prefix)/share/asterisk
94 ASTVARLIBDIR=$(localstatedir)/lib/asterisk
97 ASTDATADIR?=$(ASTVARLIBDIR)
99 # Asterisk.conf is located in ASTETCDIR or by using the -C flag
100 # when starting Asterisk
101 ASTCONFPATH=$(ASTETCDIR)/asterisk.conf
102 MODULES_DIR=$(ASTLIBDIR)/modules
103 AGI_DIR=$(ASTDATADIR)/agi-bin
105 # If you use Apache, you may determine by a grep 'DocumentRoot' of your httpd.conf file
106 HTTP_DOCSDIR=/var/www/html
107 # Determine by a grep 'ScriptAlias' of your Apache httpd.conf file
108 HTTP_CGIDIR=/var/www/cgi-bin
112 # Uncomment this to use the older DSP routines
113 #ASTCFLAGS+=-DOLD_DSP_ROUTINES
115 # If the file .asterisk.makeopts is present in your home directory, you can
116 # include all of your favorite menuselect options so that every time you download
117 # a new version of Asterisk, you don't have to run menuselect to set them.
118 # The file /etc/asterisk.makeopts will also be included but can be overridden
119 # by the file in your home directory.
121 GLOBAL_MAKEOPTS=$(wildcard /etc/asterisk.makeopts)
122 USER_MAKEOPTS=$(wildcard ~/.asterisk.makeopts)
124 ifneq ($(wildcard menuselect.makeopts),)
125 include menuselect.makeopts
128 ifneq ($(wildcard makeopts),)
132 TOPDIR_CFLAGS=-Iinclude
133 MOD_SUBDIR_CFLAGS=-I../include -I..
134 OTHER_SUBDIR_CFLAGS=-I../include -I..
136 ifeq ($(or $(findstring dont-optimize,$(MAKECMDGOALS)),$(findstring DONT_OPTIMIZE,$(MENUSELECT_CFLAGS))),)
137 # More GSM codec optimization
138 # Uncomment to enable MMXTM optimizations for x86 architecture CPU's
139 # which support MMX instructions. This should be newer pentiums,
140 # ppro's, etc, as well as the AMD K6 and K7.
143 # Tell gcc to optimize the code
146 # Stack backtraces, while useful for debugging, are incompatible with optimizations
147 ifeq ($(OSARCH),Linux)
148 CFLAGS+=-DSTACK_BACKTRACES
152 # *CLI> show memory allocations [filename]
153 # *CLI> show memory summary [filename]
154 ifneq ($(findstring MALLOC_DEBUG,$(MENUSELECT_CFLAGS)),)
155 TOPDIR_CFLAGS+=-include include/asterisk/astmm.h
156 MOD_SUBDIR_CFLAGS+=-include ../include/asterisk/astmm.h
159 MOD_SUBDIR_CFLAGS+=-fPIC
161 ifeq ($(OSARCH),Linux)
162 ifeq ($(PROC),x86_64)
163 # You must have GCC 3.4 to use k8, otherwise use athlon
168 ifeq ($(PROC),sparc64)
169 #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
170 #This works for even old (2.96) versions of gcc and provides a small boost either way.
171 #A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
172 #So we go lowest common available by gcc and go a step down, still a step up from
173 #the default as we now have a better instruction set to work with. - Belgarath
175 OPTIONS+=$(shell if $(CC) -mtune=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mtune=$(PROC)"; fi)
176 OPTIONS+=$(shell if $(CC) -mcpu=v8 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mcpu=v8"; fi)
177 OPTIONS+=-fomit-frame-pointer
181 # The Cirrus logic is the only heavily shipping arm processor with a real floating point unit
182 ifeq ($(SUB_PROC),maverick)
183 OPTIONS+=-fsigned-char -mcpu=ep9312
185 ifeq ($(SUB_PROC),xscale)
186 OPTIONS+=-fsigned-char -mcpu=xscale
188 OPTIONS+=-fsigned-char
197 ifeq ($(OSARCH),SunOS)
198 GREP=/usr/xpg4/bin/grep
203 ASTCFLAGS+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG)
204 ASTCFLAGS+=$(OPTIMIZE)
206 ifeq ($(AST_DEVMODE),yes)
207 ASTCFLAGS+=-Werror -Wunused
210 ifeq ($(shell gcc -v 2>&1 | grep 'gcc version' | cut -f3 -d' ' | cut -f1 -d.),4)
211 ASTCFLAGS+=-Wno-pointer-sign
215 ifeq ($(findstring BSD,$(OSARCH)),BSD)
216 ASTCFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include -L$(CROSS_COMPILE_TARGET)/usr/local/lib
219 ifneq ($(PROC),ultrasparc)
220 ASTCFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
224 ASTCFLAGS+=-fsigned-char
227 ifeq ($(OSARCH),FreeBSD)
228 BSDVERSION=$(shell make -V OSVERSION -f $(CROSS_COMPILE_TARGET)/usr/share/mk/bsd.port.subdir.mk)
229 ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
230 LIBS+=$(shell if test $(BSDVERSION) -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi)
231 ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/spandsp),)
232 ASTCFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include/spandsp
236 ifeq ($(OSARCH),NetBSD)
237 AST_CFLAGS+=-pthread -I$(CROSS_COMPILE_TARGET)/usr/pkg/include
240 ifeq ($(OSARCH),OpenBSD)
244 ifeq ($(OSARCH),SunOS)
245 ASTCFLAGS+=-Wcast-align -DSOLARIS -Iinclude/solaris-compat -I$(CROSS_COMPILE_TARGET)/usr/local/ssl/include
248 LIBEDIT=editline/libedit.a
250 ASTERISKVERSION:=$(shell build_tools/make_version .)
252 ifneq ($(wildcard .version),)
253 ASTERISKVERSIONNUM:=$(shell awk -F. '{printf "%02d%02d%02d", $$1, $$2, $$3}' .version)
254 RPMVERSION:=$(shell sed 's/[-\/:]/_/g' .version)
259 ifneq ($(wildcard .svn),)
260 ASTERISKVERSIONNUM=999999
263 ASTCFLAGS+=$(MALLOC_DEBUG)$(BUSYDETECT)$(OPTIONS)
265 MOD_SUBDIRS=res channels pbx apps codecs formats cdr funcs
266 OTHER_SUBDIRS=utils agi
267 SUBDIRS:=$(MOD_SUBDIRS) $(OTHER_SUBDIRS)
268 SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)
270 OBJS=io.o sched.o logger.o frame.o loader.o config.o channel.o \
271 translate.o file.o pbx.o cli.o md5.o term.o \
272 ulaw.o alaw.o callerid.o fskmodem.o image.o app.o \
273 cdr.o tdd.o acl.o rtp.o udptl.o manager.o asterisk.o \
274 dsp.o chanvars.o indications.o autoservice.o db.o privacy.o \
275 astmm.o enum.o srv.o dns.o aescrypt.o aestab.o aeskey.o \
276 utils.o plc.o jitterbuf.o dnsmgr.o devicestate.o \
277 netsock.o slinfactory.o ast_expr2.o ast_expr2f.o \
278 cryptostub.o sha1.o http.o fixedjitterbuf.o abstract_jb.o
280 # we need to link in the objects statically, not as a library, because
281 # otherwise modules will not have them available if none of the static
283 OBJS+=stdtime/localtime.o
285 # At the moment say.o is an optional component which can be overridden
289 ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/sys/poll.h),)
291 ASTCFLAGS+=-DPOLLCOMPAT
294 ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/dlfcn.h),)
296 ASTCFLAGS+=-DDLFCNCOMPAT
299 ifeq ($(OSARCH),Linux)
300 LIBS+=-ldl -lpthread $(EDITLINE_LIBS) -lm -lresolv #-lnjamd
302 LIBS+=$(EDITLINE_LIBS) -lm
305 ifeq ($(OSARCH),Darwin)
307 ASTCFLAGS+=-D__Darwin__
308 AUDIO_LIBS=-framework CoreAudio
310 SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
311 # Mac on Intel CoreDuo does not need poll compatibility layer
314 ASTCFLAGS+=-DPOLLCOMPAT
317 # These are used for all but Darwin
319 SOLINK=-shared -Xlinker -x
320 ifeq ($(findstring BSD,$(OSARCH)),BSD)
321 SOLINK+=-L$(CROSS_COMPILE_TARGET)/usr/local/lib
325 ifeq ($(OSARCH),FreeBSD)
329 ifeq ($(OSARCH),NetBSD)
330 LIBS+=-lpthread -lcrypto -lm -L$(CROSS_COMPILE_TARGET)/usr/pkg/lib $(EDITLINE_LIBS)
333 ifeq ($(OSARCH),OpenBSD)
334 LIBS+=-lcrypto -lpthread -lm $(EDITLINE_LIBS)
337 ifeq ($(OSARCH),SunOS)
338 LIBS+=-lpthread -ldl -lnsl -lsocket -lresolv -L$(CROSS_COMPILE_TARGET)/usr/local/ssl/lib
340 MENUSELECT_OBJS+=strcompat.o
342 SOLINK=-shared -fpic -L$(CROSS_COMPILE_TARGET)/usr/local/ssl/lib
345 ifeq ($(MAKETOPLEVEL),$(MAKELEVEL))
346 CFLAGS+=$(TOPDIR_CFLAGS)$(ASTCFLAGS)
349 # This is used when generating the doxygen documentation
357 @echo " +--------- Asterisk Build Complete ---------+"
358 @echo " + Asterisk has successfully been built, but +"
359 @echo " + cannot be run before being installed by +"
360 @echo " + running: +"
362 @echo " + make install +"
363 @echo " +-------------------------------------------+"
365 all: cleantest config.status menuselect.makeopts depend asterisk $(SUBDIRS)
367 config.status: configure
368 @CFLAGS="" ./configure
370 @echo "**** The configure script was just executed, so 'make' needs to be"
371 @echo "**** restarted."
376 @CFLAGS="" ./configure
378 @echo "**** The configure script was just executed, so 'make' needs to be"
379 @echo "**** restarted."
383 menuselect.makeopts: build_tools/menuselect makeopts.xml
384 @build_tools/menuselect --check-deps ${GLOBAL_MAKEOPTS} ${USER_MAKEOPTS} $@
386 #ifneq ($(wildcard tags),)
390 ifneq ($(wildcard TAGS),)
395 cd editline && unset CFLAGS LIBS && CFLAGS="$(OPTIMIZE)" ./configure ; \
398 cd editline && unset CFLAGS LIBS && test -f config.h || CFLAGS="$(OPTIMIZE)" ./configure
399 $(MAKE) -C editline libedit.a
402 $(MAKE) -C db1-ast libdb1.a
404 ifneq ($(wildcard .depend),)
408 ifneq ($(wildcard .tags-depend),)
412 ast_expr2.c ast_expr2.h:
413 bison -o $@ -d --name-prefix=ast_yy ast_expr2.y
416 flex -o $@ --full ast_expr2.fl
418 testexpr2: config.status include/asterisk/buildopts.h ast_expr2f.c ast_expr2.c ast_expr2.h
419 $(CC) -g -c -Iinclude -DSTANDALONE ast_expr2f.c
420 $(CC) -g -c -Iinclude -DSTANDALONE ast_expr2.c
421 $(CC) -g -o testexpr2 ast_expr2f.o ast_expr2.o
422 rm ast_expr2.o ast_expr2f.o
426 asterisk.8: asterisk.sgml
428 docbook2man asterisk.sgml
431 asterisk.pdf: asterisk.sgml
432 docbook2pdf asterisk.sgml
434 asterisk.ps: asterisk.sgml
435 docbook2ps asterisk.sgml
437 asterisk.html: asterisk.sgml
438 docbook2html asterisk.sgml
439 mv r1.html asterisk.html
441 asterisk.txt: asterisk.sgml
442 docbook2txt asterisk.sgml
445 @build_tools/make_defaults_h > $@.tmp
446 @if cmp -s $@.tmp $@ ; then : ; else \
451 include/asterisk/version.h:
452 @build_tools/make_version_h > $@.tmp
453 @if cmp -s $@.tmp $@ ; then : ; else \
458 include/asterisk/buildopts.h: menuselect.makeopts
459 @build_tools/make_buildopts_h > $@.tmp
460 @if cmp -s $@.tmp $@ ; then : ; else \
465 asterisk: include/asterisk/buildopts.h editline/libedit.a db1-ast/libdb1.a $(OBJS)
466 build_tools/make_build_h > include/asterisk/build.h.tmp
467 if cmp -s include/asterisk/build.h.tmp include/asterisk/build.h ; then echo ; else \
468 mv include/asterisk/build.h.tmp include/asterisk/build.h ; \
470 rm -f include/asterisk/build.h.tmp
471 $(CC) -c -o buildinfo.o $(CFLAGS) buildinfo.c
472 $(CC) $(DEBUG) $(ASTOBJ) $(ASTLINK) $(OBJS) buildinfo.o $(LIBEDIT) db1-ast/libdb1.a $(LIBS)
475 $(CC) $(AUDIO_LIBS) -o muted muted.o
477 $(MOD_SUBDIRS): FORCE
478 @CFLAGS="$(MOD_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $@
480 $(OTHER_SUBDIRS): FORCE
481 @CFLAGS="$(OTHER_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $@
484 @for x in $(SUBDIRS); do $(MAKE) -C $$x clean-depend || exit 1 ; done
485 rm -f .depend .tags-depend
488 @for x in $(SUBDIRS); do $(MAKE) -C $$x clean || exit 1 ; done
489 rm -f *.o *.so asterisk
491 rm -f include/asterisk/build.h
492 rm -f include/asterisk/version.h
493 rm -f .tags-sources tags TAGS
494 @if [ -f editline/Makefile ]; then $(MAKE) -C editline distclean ; fi
495 $(MAKE) -C db1-ast clean
496 $(MAKE) -C stdtime clean
498 distclean: dist-clean
501 $(MAKE) -C mxml clean
502 $(MAKE) -C build_tools dist-clean
503 $(MAKE) -C sounds dist-clean
504 rm -f menuselect.makeopts makeopts makeopts.xml
505 rm -f config.log config.status
506 rm -f include/autoconfig.h
507 rm -f include/asterisk/buildopts.h
510 if [ x`$(ID) -un` = xroot ]; then sh build_tools/mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig; fi
511 # Should static HTTP be installed during make samples or even with its own target ala
512 # webvoicemail? There are portions here that *could* be customized but might also be
513 # improved a lot. I'll put it here for now.
514 mkdir -p $(DESTDIR)$(ASTDATADIR)/static-http
515 for x in static-http/*; do \
516 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/static-http ; \
518 mkdir -p $(DESTDIR)$(ASTDATADIR)/images
519 for x in images/*.jpg; do \
520 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/images ; \
522 mkdir -p $(DESTDIR)$(AGI_DIR)
523 $(MAKE) -C sounds install
526 @if [ -d .svn ]; then \
527 echo "Updating from Subversion..." ; \
528 svn update | tee update.out; \
530 if [ `grep -c ^C update.out` -gt 0 ]; then \
531 echo ; echo "The following files have conflicts:" ; \
532 grep ^C update.out | cut -b4- ; \
535 $(MAKE) clean-depend; \
537 echo "Not under version control"; \
540 NEWHEADERS=$(notdir $(wildcard include/asterisk/*.h))
541 OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h)))
544 mkdir -p $(DESTDIR)$(MODULES_DIR)
545 mkdir -p $(DESTDIR)$(ASTSBINDIR)
546 mkdir -p $(DESTDIR)$(ASTETCDIR)
547 mkdir -p $(DESTDIR)$(ASTBINDIR)
548 mkdir -p $(DESTDIR)$(ASTVARRUNDIR)
549 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail
550 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/dictate
551 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/system
552 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/tmp
553 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/meetme
554 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/monitor
555 if [ -f asterisk ]; then $(INSTALL) -m 755 asterisk $(DESTDIR)$(ASTSBINDIR)/; fi
556 if [ -f asterisk.dll ]; then $(INSTALL) -m 755 asterisk.dll $(DESTDIR)$(ASTSBINDIR)/; fi
557 $(LN) -sf asterisk $(DESTDIR)$(ASTSBINDIR)/rasterisk
558 $(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
559 $(INSTALL) -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/
560 if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \
561 cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;' > $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ;\
562 chmod 755 $(DESTDIR)$(ASTSBINDIR)/safe_asterisk;\
564 $(INSTALL) -d $(DESTDIR)$(ASTHEADERDIR)
565 $(INSTALL) -m 644 include/asterisk.h $(DESTDIR)$(includedir)
566 $(INSTALL) -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
567 if [ -n "$(OLDHEADERS)" ]; then \
568 rm -f $(addprefix $(DESTDIR)$(ASTHEADERDIR)/,$(OLDHEADERS)) ;\
570 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
571 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-custom
572 mkdir -p $(DESTDIR)$(ASTDATADIR)/keys
573 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware
574 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware/iax
575 mkdir -p $(DESTDIR)$(ASTMANDIR)/man8
576 $(INSTALL) -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTDATADIR)/keys
577 $(INSTALL) -m 644 keys/freeworlddialup.pub $(DESTDIR)$(ASTDATADIR)/keys
578 $(INSTALL) -m 644 asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
579 $(INSTALL) -m 644 contrib/scripts/astgenkey.8 $(DESTDIR)$(ASTMANDIR)/man8
580 $(INSTALL) -m 644 contrib/scripts/autosupport.8 $(DESTDIR)$(ASTMANDIR)/man8
581 $(INSTALL) -m 644 contrib/scripts/safe_asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
582 $(INSTALL) -m 644 contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTDATADIR)/firmware/iax/iaxy.bin; \
585 @$(MAKE) -C $(@:-install=) install
587 NEWMODS=$(notdir $(wildcard */*.so))
588 OLDMODS=$(filter-out $(NEWMODS),$(notdir $(wildcard $(DESTDIR)$(MODULES_DIR)/*.so)))
591 @if [ -n "$(OLDMODS)" ]; then \
592 echo " WARNING WARNING WARNING" ;\
594 echo " Your Asterisk modules directory, located at" ;\
595 echo " $(DESTDIR)$(MODULES_DIR)" ;\
596 echo " contains modules that were not installed by this " ;\
597 echo " version of Asterisk. Please ensure that these" ;\
598 echo " modules are compatible with this version before" ;\
599 echo " attempting to run Asterisk." ;\
601 for f in $(OLDMODS); do \
605 echo " WARNING WARNING WARNING" ;\
608 install: all datafiles bininstall $(SUBDIRS_INSTALL)
609 @if [ -x /usr/sbin/asterisk-post-install ]; then \
610 /usr/sbin/asterisk-post-install $(DESTDIR) . ; \
612 @echo " +---- Asterisk Installation Complete -------+"
614 @echo " + YOU MUST READ THE SECURITY DOCUMENT +"
616 @echo " + Asterisk has successfully been installed. +"
617 @echo " + If you would like to install the sample +"
618 @echo " + configuration files (overwriting any +"
619 @echo " + existing config files), run: +"
621 @echo " + $(MAKE) samples +"
623 @echo " +----------------- or ---------------------+"
625 @echo " + You can go ahead and install the asterisk +"
626 @echo " + program documentation now or later run: +"
628 @echo " + $(MAKE) progdocs +"
630 @echo " + **Note** This requires that you have +"
631 @echo " + doxygen installed on your local system +"
632 @echo " +-------------------------------------------+"
633 @$(MAKE) -s oldmodcheck
635 upgrade: all bininstall
638 mkdir -p $(DESTDIR)$(ASTETCDIR)
639 for x in configs/*.adsi; do \
640 if [ ! -f $(DESTDIR)$(ASTETCDIR)/$$x ]; then \
641 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x` ; \
646 mkdir -p $(DESTDIR)$(ASTETCDIR)
647 for x in configs/*.sample; do \
648 if [ -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ]; then \
649 if [ "$(OVERWRITE)" = "y" ]; then \
650 if cmp -s $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $$x ; then \
651 echo "Config file $$x is unchanged"; \
654 mv -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample`.old ; \
656 echo "Skipping config file $$x"; \
660 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ;\
662 if [ "$(OVERWRITE)" = "y" ] || [ ! -f $(DESTDIR)$(ASTCONFPATH) ]; then \
664 echo "[directories]" ; \
665 echo "astetcdir => $(ASTETCDIR)" ; \
666 echo "astmoddir => $(MODULES_DIR)" ; \
667 echo "astvarlibdir => $(ASTVARLIBDIR)" ; \
668 echo "astdatadir => $(ASTDATADIR)" ; \
669 echo "astagidir => $(AGI_DIR)" ; \
670 echo "astspooldir => $(ASTSPOOLDIR)" ; \
671 echo "astrundir => $(ASTVARRUNDIR)" ; \
672 echo "astlogdir => $(ASTLOGDIR)" ; \
674 echo "; Changing the following lines may compromise your security." ; \
676 echo ";astctlpermissions = 0660" ; \
677 echo ";astctlowner = root" ; \
678 echo ";astctlgroup = apache" ; \
679 echo ";astctl = asterisk.ctl" ; \
680 echo ";[options]" ; \
681 echo ";internal_timing = yes" ; \
682 ) > $(DESTDIR)$(ASTCONFPATH) ; \
684 echo "Skipping asterisk.conf creation"; \
686 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
687 :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm
688 for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isunavail; do \
689 cat $(DESTDIR)$(ASTDATADIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm ; \
691 :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm
692 for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isonphone; do \
693 cat $(DESTDIR)$(ASTDATADIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm ; \
697 @[ -d $(DESTDIR)$(HTTP_DOCSDIR)/ ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 )
698 @[ -d $(DESTDIR)$(HTTP_CGIDIR) ] || ( printf "cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit 1 )
699 $(INSTALL) -m 4755 -o root -g root contrib/scripts/vmail.cgi $(DESTDIR)$(HTTP_CGIDIR)/vmail.cgi
700 mkdir -p $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk
701 for x in images/*.gif; do \
702 $(INSTALL) -m 644 $$x $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk/; \
704 @echo " +--------- Asterisk Web Voicemail ----------+"
706 @echo " + Asterisk Web Voicemail is installed in +"
707 @echo " + your cgi-bin directory: +"
708 @echo " + $(DESTDIR)$(HTTP_CGIDIR)"
709 @echo " + IT USES A SETUID ROOT PERL SCRIPT, SO +"
710 @echo " + IF YOU DON'T LIKE THAT, UNINSTALL IT! +"
712 @echo " + Other static items have been stored in: +"
713 @echo " + $(DESTDIR)$(HTTP_DOCSDIR)"
715 @echo " + If these paths do not match your httpd +"
716 @echo " + installation, correct the definitions +"
717 @echo " + in your Makefile of HTTP_CGIDIR and +"
718 @echo " + HTTP_DOCSDIR +"
720 @echo " +-------------------------------------------+"
723 sed "s/^Version:.*/Version: $(RPMVERSION)/g" redhat/asterisk.spec > asterisk.spec ; \
727 __rpm: include/asterisk/version.h include/asterisk/buildopts.h spec
728 rm -rf /tmp/asterisk ; \
729 mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
730 $(MAKE) DESTDIR=/tmp/asterisk install ; \
731 $(MAKE) DESTDIR=/tmp/asterisk samples ; \
732 mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
733 cp -f contrib/init.d/rc.redhat.asterisk /tmp/asterisk/etc/rc.d/init.d/asterisk ; \
734 rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec
737 (cat contrib/asterisk-ng-doxygen; echo "HAVE_DOT=$(HAVEDOT)"; \
738 echo "PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen -
741 @if [ "${OSARCH}" = "Linux" ]; then \
742 if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \
743 $(INSTALL) -m 755 contrib/init.d/rc.redhat.asterisk /etc/rc.d/init.d/asterisk; \
744 /sbin/chkconfig --add asterisk; \
745 elif [ -f /etc/debian_version ]; then \
746 $(INSTALL) -m 755 contrib/init.d/rc.debian.asterisk /etc/init.d/asterisk; \
747 /usr/sbin/update-rc.d asterisk start 10 2 3 4 5 . stop 91 2 3 4 5 .; \
748 elif [ -f /etc/gentoo-release ]; then \
749 $(INSTALL) -m 755 contrib/init.d/rc.gentoo.asterisk /etc/init.d/asterisk; \
750 /sbin/rc-update add asterisk default; \
751 elif [ -f /etc/mandrake-release ]; then \
752 $(INSTALL) -m 755 contrib/init.d/rc.mandrake.asterisk /etc/rc.d/init.d/asterisk; \
753 /sbin/chkconfig --add asterisk; \
754 elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then \
755 $(INSTALL) -m 755 contrib/init.d/rc.suse.asterisk /etc/init.d/asterisk; \
756 /sbin/chkconfig --add asterisk; \
757 elif [ -f /etc/slackware-version ]; then \
758 echo "Slackware is not currently supported, although an init script does exist for it." \
760 echo "We could not install init scripts for your distribution."; \
763 echo "We could not install init scripts for your operating system."; \
768 valgrind: dont-optimize
770 depend: include/asterisk/version.h include/asterisk/buildopts.h .depend defaults.h
771 @for x in $(MOD_SUBDIRS); do CFLAGS="$(MOD_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $$x depend || exit 1 ; done
772 @for x in $(OTHER_SUBDIRS); do CFLAGS="$(OTHER_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $$x depend || exit 1 ; done
774 .depend: include/asterisk/version.h include/asterisk/buildopts.h defaults.h
775 build_tools/mkdep $(CFLAGS) $(wildcard *.c)
778 @echo -n ".tags-depend: " > $@
779 @$(FIND) . -maxdepth 1 -name \*.c -printf "\t%p \\\\\n" >> $@
780 @$(FIND) . -maxdepth 1 -name \*.h -printf "\t%p \\\\\n" >> $@
781 @$(FIND) $(SUBDIRS) -name \*.c -printf "\t%p \\\\\n" >> $@
782 @$(FIND) $(SUBDIRS) -name \*.h -printf "\t%p \\\\\n" >> $@
783 @$(FIND) include -name \*.h -printf "\t%p \\\\\n" >> $@
788 @$(FIND) . -maxdepth 1 -name \*.c -print >> $@
789 @$(FIND) . -maxdepth 1 -name \*.h -print >> $@
790 @$(FIND) $(SUBDIRS) -name \*.c -print >> $@
791 @$(FIND) $(SUBDIRS) -name \*.h -print >> $@
792 @$(FIND) include -name \*.h -print >> $@
794 tags: .tags-depend .tags-sources
795 ctags -L .tags-sources -o $@
799 TAGS: .tags-depend .tags-sources
800 etags -o $@ `cat .tags-sources`
807 $(MAKE) -C $(shell echo $@ | sed "s/_env//g") env
810 $(MAKE) -C sounds all
815 # If the cleancount has been changed, force a make clean.
816 # .cleancount is the global clean count, and .lastclean is the
817 # last clean count we had
820 @if cmp -s .cleancount .lastclean ; then echo ; else \
821 $(MAKE) clean; cp -f .cleancount .lastclean;\
826 rm -f $(DESTDIR)$(MODULES_DIR)/*
827 rm -f $(DESTDIR)$(ASTSBINDIR)/*asterisk*
828 rm -f $(DESTDIR)$(ASTSBINDIR)/astgenkey
829 rm -f $(DESTDIR)$(ASTSBINDIR)/autosupport
830 rm -rf $(DESTDIR)$(ASTHEADERDIR)
831 rm -rf $(DESTDIR)$(ASTDATADIR)/firmware
832 rm -rf $(DESTDIR)$(ASTMANDIR)/man8
833 for x in $(SUBDIRS); do $(MAKE) -C $$x uninstall || exit 1 ; done
834 $(MAKE) -C sounds uninstall
836 uninstall: _uninstall
837 @echo " +--------- Asterisk Uninstall Complete -----+"
838 @echo " + Asterisk binaries, sounds, man pages, +"
839 @echo " + headers, modules, and firmware builds, +"
840 @echo " + have all been uninstalled. +"
842 @echo " + To remove ALL traces of Asterisk, +"
843 @echo " + including configuration, spool +"
844 @echo " + directories, and logs, run the following +"
845 @echo " + command: +"
847 @echo " + $(MAKE) uninstall-all +"
848 @echo " +-------------------------------------------+"
850 uninstall-all: _uninstall
851 rm -rf $(DESTDIR)$(ASTLIBDIR)
852 rm -rf $(DESTDIR)$(ASTVARLIBDIR)
853 rm -rf $(DESTDIR)$(ASTDATADIR)
854 rm -rf $(DESTDIR)$(ASTSPOOLDIR)
855 rm -rf $(DESTDIR)$(ASTETCDIR)
856 rm -rf $(DESTDIR)$(ASTLOGDIR)
858 menuselect: build_tools/menuselect makeopts.xml
859 -@build_tools/menuselect ${GLOBAL_MAKEOPTS} ${USER_MAKEOPTS} menuselect.makeopts && echo "menuselect changes saved!" || echo "menuselect changes NOT saved!"
861 build_tools/menuselect: build_tools/menuselect.c build_tools/menuselect_curses.c build_tools/menuselect.h config.status mxml/libmxml.a $(MENUSELECT_OBJS)
862 $(MAKE) -C build_tools menuselect
865 @cd mxml && unset CFLAGS LIBS && test -f config.h || ./configure
866 $(MAKE) -C mxml libmxml.a
868 makeopts.xml: $(foreach dir,$(MOD_SUBDIRS),$(dir)/*.c) build_tools/cflags.xml sounds/sounds.xml
869 @echo "Generating list of available modules ..."
870 @build_tools/prep_moduledeps > $@