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 #Uncomment this to see all build commands instead of 'quiet' output
19 # Create OPTIONS variable
22 # If cross compiling, define these to suit
23 #CROSS_COMPILE=/opt/montavista/pro/devkit/arm/xscale_be/bin/xscale_be-
24 #CROSS_COMPILE_BIN=/opt/montavista/pro/devkit/arm/xscale_be/bin/
25 #CROSS_COMPILE_TARGET=/opt/montavista/pro/devkit/arm/xscale_be/target
28 #SUB_PROC=xscale # or maverick
30 ifeq ($(CROSS_COMPILE),)
31 OSARCH:=$(shell uname -s)
32 PROC?:=$(shell uname -m)
38 ASTTOPDIR:=$(shell pwd)
40 # Remember the MAKELEVEL at the top
41 MAKETOPLEVEL?=$(MAKELEVEL)
43 # Overwite config files on "make samples"
46 # Include debug and macro symbols in the executables (-g) and profiling info (-pg)
50 # Files are copied here temporarily during the install process
51 # For example, make DESTDIR=/tmp/asterisk woud put things in
52 # /tmp/asterisk/etc/asterisk
53 # !!! Watch out, put no spaces or comments after the value !!!
55 #DESTDIR?=/tmp/asterisk
57 # Original busydetect routine
58 #BUSYDETECT = -DBUSYDETECT
60 # Improved busydetect routine, comment the previous one if you use this one
61 #BUSYDETECT+= -DBUSYDETECT_MARTIN
62 # Detect the busy signal looking only at tone lengths
63 # For example if you have 3 beeps 100ms tone, 100ms silence separated by 500 ms of silence
64 #BUSYDETECT+= -DBUSYDETECT_TONEONLY
65 # Enforce the detection of busy signal (get rid of false hangups)
66 # Don't use together with -DBUSYDETECT_TONEONLY
67 #BUSYDETECT+= -DBUSYDETECT_COMPARE_TONE_AND_SILENCE
69 # Define standard directories for various platforms
70 # These apply if they are not redefined in asterisk.conf
71 ifeq ($(OSARCH),SunOS)
72 ASTETCDIR=/var/etc/asterisk
73 ASTLIBDIR=/opt/asterisk/lib
74 ASTVARLIBDIR=/var/opt/asterisk
75 ASTSPOOLDIR=/var/spool/asterisk
76 ASTLOGDIR=/var/log/asterisk
77 ASTHEADERDIR=/opt/asterisk/include
78 ASTBINDIR=/opt/asterisk/bin
79 ASTSBINDIR=/opt/asterisk/sbin
80 ASTVARRUNDIR=/var/run/asterisk
81 ASTMANDIR=/opt/asterisk/man
83 ASTETCDIR=$(sysconfdir)/asterisk
84 ASTLIBDIR=$(libdir)/asterisk
85 ASTHEADERDIR=$(includedir)/asterisk
88 ASTSPOOLDIR=$(localstatedir)/spool/asterisk
89 ASTLOGDIR=$(localstatedir)/log/asterisk
90 ASTVARRUNDIR=$(localstatedir)/run
92 ifeq ($(OSARCH),FreeBSD)
93 ASTVARLIBDIR=$(prefix)/share/asterisk
95 ASTVARLIBDIR=$(localstatedir)/lib/asterisk
98 ASTDATADIR?=$(ASTVARLIBDIR)
100 # Asterisk.conf is located in ASTETCDIR or by using the -C flag
101 # when starting Asterisk
102 ASTCONFPATH=$(ASTETCDIR)/asterisk.conf
103 MODULES_DIR=$(ASTLIBDIR)/modules
104 AGI_DIR=$(ASTDATADIR)/agi-bin
106 # If you use Apache, you may determine by a grep 'DocumentRoot' of your httpd.conf file
107 HTTP_DOCSDIR=/var/www/html
108 # Determine by a grep 'ScriptAlias' of your Apache httpd.conf file
109 HTTP_CGIDIR=/var/www/cgi-bin
113 # Uncomment this to use the older DSP routines
114 #ASTCFLAGS+=-DOLD_DSP_ROUTINES
116 # If the file .asterisk.makeopts is present in your home directory, you can
117 # include all of your favorite menuselect options so that every time you download
118 # a new version of Asterisk, you don't have to run menuselect to set them.
119 # The file /etc/asterisk.makeopts will also be included but can be overridden
120 # by the file in your home directory.
122 GLOBAL_MAKEOPTS=$(wildcard /etc/asterisk.makeopts)
123 USER_MAKEOPTS=$(wildcard ~/.asterisk.makeopts)
125 ifneq ($(wildcard menuselect.makeopts),)
126 include menuselect.makeopts
127 include menuselect.makedeps
130 ifneq ($(wildcard makeopts),)
134 TOPDIR_CFLAGS=-Iinclude
135 MOD_SUBDIR_CFLAGS=-I../include -I..
136 OTHER_SUBDIR_CFLAGS=-I../include -I..
138 ifeq ($(origin MENUSELECT_CFLAGS),undefined)
139 MENUSELECT_CFLAGS:=$(shell grep MENUSELECT_CFLAGS $(USER_MAKEOPTS) .)
140 ifeq ($(MENUSELECT_CFLAGS),)
141 MENUSELECT_CFLAGS:=$(shell grep MENUSELECT_CFLAGS $(GLOBAL_MAKEOPTS) .)
143 ifneq ($(MENUSELECT_CFLAGS),)
144 MENUSELECT_CFLAGS:=$(shell echo $(MENUSELECT_CFLAGS) | cut -f2 -d'=')
148 ifeq ($(findstring dont-optimize,$(MAKECMDGOALS)),$(findstring DONT_OPTIMIZE,$(MENUSELECT_CFLAGS)))
149 # More GSM codec optimization
150 # Uncomment to enable MMXTM optimizations for x86 architecture CPU's
151 # which support MMX instructions. This should be newer pentiums,
152 # ppro's, etc, as well as the AMD K6 and K7.
155 # Tell gcc to optimize the code
158 # Stack backtraces, while useful for debugging, are incompatible with optimizations
159 ifeq ($(OSARCH),Linux)
160 CFLAGS+=-DSTACK_BACKTRACES
164 # *CLI> show memory allocations [filename]
165 # *CLI> show memory summary [filename]
166 ifneq ($(findstring MALLOC_DEBUG,$(MENUSELECT_CFLAGS)),)
167 TOPDIR_CFLAGS+=-include include/asterisk/astmm.h
168 MOD_SUBDIR_CFLAGS+=-include ../include/asterisk/astmm.h
171 MOD_SUBDIR_CFLAGS+=-fPIC
173 ifeq ($(OSARCH),Linux)
174 ifeq ($(PROC),x86_64)
175 # You must have GCC 3.4 to use k8, otherwise use athlon
180 ifeq ($(PROC),sparc64)
181 #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
182 #This works for even old (2.96) versions of gcc and provides a small boost either way.
183 #A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
184 #So we go lowest common available by gcc and go a step down, still a step up from
185 #the default as we now have a better instruction set to work with. - Belgarath
187 OPTIONS+=$(shell if $(CC) -mtune=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mtune=$(PROC)"; fi)
188 OPTIONS+=$(shell if $(CC) -mcpu=v8 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mcpu=v8"; fi)
189 OPTIONS+=-fomit-frame-pointer
193 # The Cirrus logic is the only heavily shipping arm processor with a real floating point unit
194 ifeq ($(SUB_PROC),maverick)
195 OPTIONS+=-fsigned-char -mcpu=ep9312
197 ifeq ($(SUB_PROC),xscale)
198 OPTIONS+=-fsigned-char -mcpu=xscale
200 OPTIONS+=-fsigned-char
209 ifeq ($(OSARCH),SunOS)
210 GREP=/usr/xpg4/bin/grep
215 ASTCFLAGS+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG)
217 ASTCFLAGS+=$(OPTIMIZE)
220 ifeq ($(AST_DEVMODE),yes)
221 ASTCFLAGS+=-Werror -Wunused
226 ifeq ($(findstring BSD,$(OSARCH)),BSD)
227 ASTCFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include -L$(CROSS_COMPILE_TARGET)/usr/local/lib
230 ifneq ($(PROC),ultrasparc)
231 ASTCFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
235 ASTCFLAGS+=-fsigned-char
238 ifeq ($(OSARCH),FreeBSD)
239 BSDVERSION=$(shell make -V OSVERSION -f $(CROSS_COMPILE_TARGET)/usr/share/mk/bsd.port.subdir.mk)
240 ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
241 LIBS+=$(shell if test $(BSDVERSION) -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi)
244 ifeq ($(OSARCH),NetBSD)
245 AST_CFLAGS+=-pthread -I$(CROSS_COMPILE_TARGET)/usr/pkg/include
248 ifeq ($(OSARCH),OpenBSD)
252 ifeq ($(OSARCH),SunOS)
253 ASTCFLAGS+=-Wcast-align -DSOLARIS -Iinclude/solaris-compat -I$(CROSS_COMPILE_TARGET)/opt/ssl/include -I$(CROSS_COMPILE_TARGET)/usr/local/ssl/include
256 LIBEDIT=editline/libedit.a
258 ASTERISKVERSION:=$(shell build_tools/make_version .)
260 ifneq ($(wildcard .version),)
261 ASTERISKVERSIONNUM:=$(shell awk -F. '{printf "%02d%02d%02d", $$1, $$2, $$3}' .version)
262 RPMVERSION:=$(shell sed 's/[-\/:]/_/g' .version)
267 ifneq ($(wildcard .svn),)
268 ASTERISKVERSIONNUM=999999
271 ASTCFLAGS+=$(MALLOC_DEBUG)$(BUSYDETECT)$(OPTIONS)
273 MOD_SUBDIRS:=res channels pbx apps codecs formats cdr funcs
274 OTHER_SUBDIRS:=utils agi
275 SUBDIRS:=$(MOD_SUBDIRS) $(OTHER_SUBDIRS)
276 SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)
277 SUBDIRS_CLEAN:=$(SUBDIRS:%=%-clean)
278 SUBDIRS_CLEAN_DEPEND:=$(SUBDIRS:%=%-clean-depend)
279 MOD_SUBDIRS_DEPEND:=$(MOD_SUBDIRS:%=%-depend)
280 OTHER_SUBDIRS_DEPEND:=$(OTHER_SUBDIRS:%=%-depend)
281 SUBDIRS_DEPEND:=$(MOD_SUBDIRS_DEPEND) $(OTHER_SUBDIRS_DEPEND)
282 SUBDIRS_UNINSTALL:=$(SUBDIRS:%=%-uninstall)
284 OBJS=io.o sched.o logger.o frame.o loader.o config.o channel.o \
285 translate.o file.o pbx.o cli.o md5.o term.o \
286 ulaw.o alaw.o callerid.o fskmodem.o image.o app.o \
287 cdr.o tdd.o acl.o rtp.o udptl.o manager.o asterisk.o \
288 dsp.o chanvars.o indications.o autoservice.o db.o privacy.o \
289 astmm.o enum.o srv.o dns.o aescrypt.o aestab.o aeskey.o \
290 utils.o plc.o jitterbuf.o dnsmgr.o devicestate.o \
291 netsock.o slinfactory.o ast_expr2.o ast_expr2f.o \
292 cryptostub.o sha1.o http.o fixedjitterbuf.o abstract_jb.o
294 # we need to link in the objects statically, not as a library, because
295 # otherwise modules will not have them available if none of the static
297 OBJS+=stdtime/localtime.o
299 # At the moment say.o is an optional component which can be overridden
303 ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/sys/poll.h),)
305 ASTCFLAGS+=-DPOLLCOMPAT
308 ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/dlfcn.h),)
310 ASTCFLAGS+=-DDLFCNCOMPAT
313 ifeq ($(OSARCH),Linux)
314 LIBS+=-ldl -lpthread $(EDITLINE_LIB) -lm -lresolv #-lnjamd
316 LIBS+=$(EDITLINE_LIB) -lm
319 ifeq ($(OSARCH),Darwin)
321 ASTCFLAGS+=-D__Darwin__
322 AUDIO_LIBS=-framework CoreAudio
324 SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
325 # Mac on Intel CoreDuo does not need poll compatibility layer
328 ASTCFLAGS+=-DPOLLCOMPAT
331 # These are used for all but Darwin
333 SOLINK=-shared -Xlinker -x
334 ifeq ($(findstring BSD,$(OSARCH)),BSD)
335 SOLINK+=-L$(CROSS_COMPILE_TARGET)/usr/local/lib
339 ifeq ($(OSARCH),FreeBSD)
343 ifeq ($(OSARCH),NetBSD)
344 LIBS+=-lpthread -lcrypto -lm -L$(CROSS_COMPILE_TARGET)/usr/pkg/lib $(EDITLINE_LIB)
347 ifeq ($(OSARCH),OpenBSD)
348 LIBS+=-lcrypto -lpthread -lm $(EDITLINE_LIB)
351 ifeq ($(OSARCH),SunOS)
352 LIBS+=-lpthread -ldl -lnsl -lsocket -lresolv -L$(CROSS_COMPILE_TARGET)/opt/ssl/lib -L$(CROSS_COMPILE_TARGET)/usr/local/ssl/lib
355 SOLINK=-shared -fpic -L$(CROSS_COMPILE_TARGET)/usr/local/ssl/lib
358 ifeq ($(MAKETOPLEVEL),$(MAKELEVEL))
359 CFLAGS+=$(TOPDIR_CFLAGS)$(ASTCFLAGS)
362 # This is used when generating the doxygen documentation
369 include Makefile.rules
372 @echo " +--------- Asterisk Build Complete ---------+"
373 @echo " + Asterisk has successfully been built, but +"
374 @echo " + cannot be run before being installed by +"
375 @echo " + running: +"
377 @echo " + make install +"
378 @echo " +-------------------------------------------+"
380 all: cleantest config.status menuselect.makeopts depend asterisk $(SUBDIRS)
383 @CFLAGS="$(MOD_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $@
386 @CFLAGS="$(OTHER_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $@
388 config.status: configure
389 @CFLAGS="" ./configure
391 @echo "**** The configure script was just executed, so 'make' needs to be"
392 @echo "**** restarted."
397 @CFLAGS="" ./configure
399 @echo "**** The configure script was just executed, so 'make' needs to be"
400 @echo "**** restarted."
404 menuselect.makeopts menuselect.makedeps: menuselect/menuselect makeopts.xml
405 menuselect/menuselect --check-deps $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts
407 #ifneq ($(wildcard tags),)
411 ifneq ($(wildcard TAGS),)
416 cd editline && unset CFLAGS LIBS && CFLAGS="$(OPTIMIZE)" ./configure ; \
419 cd editline && unset CFLAGS LIBS && test -f config.h || CFLAGS="$(OPTIMIZE)" ./configure
420 $(MAKE) -C editline libedit.a
423 $(MAKE) -C db1-ast libdb1.a
425 ifneq ($(wildcard .depend),)
429 ifneq ($(wildcard .tags-depend),)
433 ast_expr2.c ast_expr2.h:
434 bison -o $@ -d --name-prefix=ast_yy ast_expr2.y
437 flex -o $@ --full ast_expr2.fl
439 testexpr2: config.status include/asterisk/buildopts.h ast_expr2f.c ast_expr2.c ast_expr2.h
440 $(CC) -g -c -Iinclude -DSTANDALONE ast_expr2f.c
441 $(CC) -g -c -Iinclude -DSTANDALONE ast_expr2.c
442 $(CC) -g -o testexpr2 ast_expr2f.o ast_expr2.o
443 rm ast_expr2.o ast_expr2f.o
447 asterisk.8: asterisk.sgml
449 docbook2man asterisk.sgml
452 asterisk.pdf: asterisk.sgml
453 docbook2pdf asterisk.sgml
455 asterisk.ps: asterisk.sgml
456 docbook2ps asterisk.sgml
458 asterisk.html: asterisk.sgml
459 docbook2html asterisk.sgml
460 mv r1.html asterisk.html
462 asterisk.txt: asterisk.sgml
463 docbook2txt asterisk.sgml
466 @build_tools/make_defaults_h > $@.tmp
467 @if cmp -s $@.tmp $@ ; then : ; else \
472 include/asterisk/version.h:
473 @build_tools/make_version_h > $@.tmp
474 @if cmp -s $@.tmp $@ ; then : ; else \
479 include/asterisk/buildopts.h: menuselect.makeopts
480 @build_tools/make_buildopts_h > $@.tmp
481 @if cmp -s $@.tmp $@ ; then : ; else \
486 channel.o: CFLAGS+=$(ZAPTEL_INCLUDE)
488 asterisk: include/asterisk/buildopts.h editline/libedit.a db1-ast/libdb1.a $(OBJS)
489 @build_tools/make_build_h > include/asterisk/build.h.tmp
490 @if cmp -s include/asterisk/build.h.tmp include/asterisk/build.h ; then echo ; else \
491 mv include/asterisk/build.h.tmp include/asterisk/build.h ; \
493 @rm -f include/asterisk/build.h.tmp
494 @$(CC) -c -o buildinfo.o $(CFLAGS) buildinfo.c
495 @echo " [LD] $(OBJS) buildinfo.o $(LIBEDIT) db1-ast/libdb1.1 $(LIBS) -> $@"
496 @$(CC) $(DEBUG) $(ASTOBJ) $(ASTLINK) $(OBJS) buildinfo.o $(LIBEDIT) db1-ast/libdb1.a $(LIBS)
499 muted: LIBS+=$(AUDIO_LIBS)
501 $(SUBDIRS_CLEAN_DEPEND):
502 @$(MAKE) -C $(@:-clean-depend=) clean-depend
505 @$(MAKE) -C $(@:-clean=) clean
507 clean-depend: $(SUBDIRS_CLEAN_DEPEND)
509 clean: $(SUBDIRS_CLEAN) clean-depend
510 rm -f *.o *.so asterisk
512 rm -f include/asterisk/build.h
513 rm -f include/asterisk/version.h
514 rm -f .tags-sources tags TAGS
515 rm -f .depend .tags-depend
516 @if [ -f editline/Makefile ]; then $(MAKE) -C editline distclean ; fi
517 @$(MAKE) -C db1-ast clean
518 @$(MAKE) -C stdtime clean
519 @$(MAKE) -C menuselect clean
521 dist-clean: distclean
524 @$(MAKE) -C mxml clean
525 @$(MAKE) -C menuselect dist-clean
526 @$(MAKE) -C sounds dist-clean
527 rm -f menuselect.makeopts makeopts makeopts.xml menuselect.makedeps
528 rm -f config.log config.status
529 rm -rf autom4te.cache
530 rm -f include/asterisk/autoconfig.h
531 rm -f include/asterisk/buildopts.h
533 rm -f build_tools/menuselect-deps
536 if [ x`$(ID) -un` = xroot ]; then sh build_tools/mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig; fi
537 # Should static HTTP be installed during make samples or even with its own target ala
538 # webvoicemail? There are portions here that *could* be customized but might also be
539 # improved a lot. I'll put it here for now.
540 mkdir -p $(DESTDIR)$(ASTDATADIR)/static-http
541 for x in static-http/*; do \
542 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/static-http ; \
544 mkdir -p $(DESTDIR)$(ASTDATADIR)/images
545 for x in images/*.jpg; do \
546 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/images ; \
548 mkdir -p $(DESTDIR)$(AGI_DIR)
549 $(MAKE) -C sounds install
552 @if [ -d .svn ]; then \
553 echo "Updating from Subversion..." ; \
554 svn update | tee update.out; \
556 if [ `grep -c ^C update.out` -gt 0 ]; then \
557 echo ; echo "The following files have conflicts:" ; \
558 grep ^C update.out | cut -b4- ; \
561 $(MAKE) clean-depend; \
563 echo "Not under version control"; \
566 NEWHEADERS=$(notdir $(wildcard include/asterisk/*.h))
567 OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h)))
570 mkdir -p $(DESTDIR)$(MODULES_DIR)
571 mkdir -p $(DESTDIR)$(ASTSBINDIR)
572 mkdir -p $(DESTDIR)$(ASTETCDIR)
573 mkdir -p $(DESTDIR)$(ASTBINDIR)
574 mkdir -p $(DESTDIR)$(ASTVARRUNDIR)
575 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail
576 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/dictate
577 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/system
578 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/tmp
579 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/meetme
580 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/monitor
581 if [ -f asterisk ]; then $(INSTALL) -m 755 asterisk $(DESTDIR)$(ASTSBINDIR)/; fi
582 if [ -f asterisk.dll ]; then $(INSTALL) -m 755 asterisk.dll $(DESTDIR)$(ASTSBINDIR)/; fi
583 $(LN) -sf asterisk $(DESTDIR)$(ASTSBINDIR)/rasterisk
584 $(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
585 $(INSTALL) -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/
586 if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \
587 cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;' > $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ;\
588 chmod 755 $(DESTDIR)$(ASTSBINDIR)/safe_asterisk;\
590 $(INSTALL) -d $(DESTDIR)$(ASTHEADERDIR)
591 $(INSTALL) -m 644 include/asterisk.h $(DESTDIR)$(includedir)
592 $(INSTALL) -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
593 if [ -n "$(OLDHEADERS)" ]; then \
594 rm -f $(addprefix $(DESTDIR)$(ASTHEADERDIR)/,$(OLDHEADERS)) ;\
596 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
597 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-custom
598 mkdir -p $(DESTDIR)$(ASTDATADIR)/keys
599 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware
600 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware/iax
601 mkdir -p $(DESTDIR)$(ASTMANDIR)/man8
602 $(INSTALL) -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTDATADIR)/keys
603 $(INSTALL) -m 644 keys/freeworlddialup.pub $(DESTDIR)$(ASTDATADIR)/keys
604 $(INSTALL) -m 644 asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
605 $(INSTALL) -m 644 contrib/scripts/astgenkey.8 $(DESTDIR)$(ASTMANDIR)/man8
606 $(INSTALL) -m 644 contrib/scripts/autosupport.8 $(DESTDIR)$(ASTMANDIR)/man8
607 $(INSTALL) -m 644 contrib/scripts/safe_asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
608 $(INSTALL) -m 644 contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTDATADIR)/firmware/iax/iaxy.bin; \
611 @$(MAKE) -C $(@:-install=) install
613 NEWMODS=$(notdir $(wildcard */*.so))
614 OLDMODS=$(filter-out $(NEWMODS),$(notdir $(wildcard $(DESTDIR)$(MODULES_DIR)/*.so)))
617 @if [ -n "$(OLDMODS)" ]; then \
618 echo " WARNING WARNING WARNING" ;\
620 echo " Your Asterisk modules directory, located at" ;\
621 echo " $(DESTDIR)$(MODULES_DIR)" ;\
622 echo " contains modules that were not installed by this " ;\
623 echo " version of Asterisk. Please ensure that these" ;\
624 echo " modules are compatible with this version before" ;\
625 echo " attempting to run Asterisk." ;\
627 for f in $(OLDMODS); do \
631 echo " WARNING WARNING WARNING" ;\
634 install: all datafiles bininstall $(SUBDIRS_INSTALL)
635 @if [ -x /usr/sbin/asterisk-post-install ]; then \
636 /usr/sbin/asterisk-post-install $(DESTDIR) . ; \
638 @echo " +---- Asterisk Installation Complete -------+"
640 @echo " + YOU MUST READ THE SECURITY DOCUMENT +"
642 @echo " + Asterisk has successfully been installed. +"
643 @echo " + If you would like to install the sample +"
644 @echo " + configuration files (overwriting any +"
645 @echo " + existing config files), run: +"
647 @echo " + $(MAKE) samples +"
649 @echo " +----------------- or ---------------------+"
651 @echo " + You can go ahead and install the asterisk +"
652 @echo " + program documentation now or later run: +"
654 @echo " + $(MAKE) progdocs +"
656 @echo " + **Note** This requires that you have +"
657 @echo " + doxygen installed on your local system +"
658 @echo " +-------------------------------------------+"
659 @$(MAKE) -s oldmodcheck
661 upgrade: all bininstall
664 mkdir -p $(DESTDIR)$(ASTETCDIR)
665 for x in configs/*.adsi; do \
666 if [ ! -f $(DESTDIR)$(ASTETCDIR)/$$x ]; then \
667 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x` ; \
672 mkdir -p $(DESTDIR)$(ASTETCDIR)
673 for x in configs/*.sample; do \
674 if [ -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ]; then \
675 if [ "$(OVERWRITE)" = "y" ]; then \
676 if cmp -s $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $$x ; then \
677 echo "Config file $$x is unchanged"; \
680 mv -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample`.old ; \
682 echo "Skipping config file $$x"; \
686 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ;\
688 if [ "$(OVERWRITE)" = "y" ] || [ ! -f $(DESTDIR)$(ASTCONFPATH) ]; then \
690 echo "[directories]" ; \
691 echo "astetcdir => $(ASTETCDIR)" ; \
692 echo "astmoddir => $(MODULES_DIR)" ; \
693 echo "astvarlibdir => $(ASTVARLIBDIR)" ; \
694 echo "astdatadir => $(ASTDATADIR)" ; \
695 echo "astagidir => $(AGI_DIR)" ; \
696 echo "astspooldir => $(ASTSPOOLDIR)" ; \
697 echo "astrundir => $(ASTVARRUNDIR)" ; \
698 echo "astlogdir => $(ASTLOGDIR)" ; \
700 echo "; Changing the following lines may compromise your security." ; \
702 echo ";astctlpermissions = 0660" ; \
703 echo ";astctlowner = root" ; \
704 echo ";astctlgroup = apache" ; \
705 echo ";astctl = asterisk.ctl" ; \
706 echo ";[options]" ; \
707 echo ";internal_timing = yes" ; \
708 ) > $(DESTDIR)$(ASTCONFPATH) ; \
710 echo "Skipping asterisk.conf creation"; \
712 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
713 :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm
714 for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isunavail; do \
715 cat $(DESTDIR)$(ASTDATADIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm ; \
717 :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm
718 for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isonphone; do \
719 cat $(DESTDIR)$(ASTDATADIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm ; \
723 @[ -d $(DESTDIR)$(HTTP_DOCSDIR)/ ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 )
724 @[ -d $(DESTDIR)$(HTTP_CGIDIR) ] || ( printf "cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit 1 )
725 $(INSTALL) -m 4755 -o root -g root contrib/scripts/vmail.cgi $(DESTDIR)$(HTTP_CGIDIR)/vmail.cgi
726 mkdir -p $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk
727 for x in images/*.gif; do \
728 $(INSTALL) -m 644 $$x $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk/; \
730 @echo " +--------- Asterisk Web Voicemail ----------+"
732 @echo " + Asterisk Web Voicemail is installed in +"
733 @echo " + your cgi-bin directory: +"
734 @echo " + $(DESTDIR)$(HTTP_CGIDIR)"
735 @echo " + IT USES A SETUID ROOT PERL SCRIPT, SO +"
736 @echo " + IF YOU DON'T LIKE THAT, UNINSTALL IT! +"
738 @echo " + Other static items have been stored in: +"
739 @echo " + $(DESTDIR)$(HTTP_DOCSDIR)"
741 @echo " + If these paths do not match your httpd +"
742 @echo " + installation, correct the definitions +"
743 @echo " + in your Makefile of HTTP_CGIDIR and +"
744 @echo " + HTTP_DOCSDIR +"
746 @echo " +-------------------------------------------+"
749 sed "s/^Version:.*/Version: $(RPMVERSION)/g" redhat/asterisk.spec > asterisk.spec ; \
753 __rpm: include/asterisk/version.h include/asterisk/buildopts.h spec
754 rm -rf /tmp/asterisk ; \
755 mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
756 $(MAKE) DESTDIR=/tmp/asterisk install ; \
757 $(MAKE) DESTDIR=/tmp/asterisk samples ; \
758 mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
759 cp -f contrib/init.d/rc.redhat.asterisk /tmp/asterisk/etc/rc.d/init.d/asterisk ; \
760 rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec
763 (cat contrib/asterisk-ng-doxygen; echo "HAVE_DOT=$(HAVEDOT)"; \
764 echo "PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen -
767 @if [ "${OSARCH}" = "Linux" ]; then \
768 if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \
769 $(INSTALL) -m 755 contrib/init.d/rc.redhat.asterisk /etc/rc.d/init.d/asterisk; \
770 /sbin/chkconfig --add asterisk; \
771 elif [ -f /etc/debian_version ]; then \
772 $(INSTALL) -m 755 contrib/init.d/rc.debian.asterisk /etc/init.d/asterisk; \
773 /usr/sbin/update-rc.d asterisk start 10 2 3 4 5 . stop 91 2 3 4 5 .; \
774 elif [ -f /etc/gentoo-release ]; then \
775 $(INSTALL) -m 755 contrib/init.d/rc.gentoo.asterisk /etc/init.d/asterisk; \
776 /sbin/rc-update add asterisk default; \
777 elif [ -f /etc/mandrake-release ]; then \
778 $(INSTALL) -m 755 contrib/init.d/rc.mandrake.asterisk /etc/rc.d/init.d/asterisk; \
779 /sbin/chkconfig --add asterisk; \
780 elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then \
781 $(INSTALL) -m 755 contrib/init.d/rc.suse.asterisk /etc/init.d/asterisk; \
782 /sbin/chkconfig --add asterisk; \
783 elif [ -f /etc/slackware-version ]; then \
784 echo "Slackware is not currently supported, although an init script does exist for it." \
786 echo "We could not install init scripts for your distribution."; \
789 echo "We could not install init scripts for your operating system."; \
794 valgrind: dont-optimize
796 $(MOD_SUBDIRS_DEPEND):
797 @CFLAGS="$(MOD_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $(@:-depend=) depend
799 $(OTHER_SUBDIRS_DEPEND):
800 @CFLAGS="$(OTHER_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $(@:-depend=) depend
802 depend: include/asterisk/version.h include/asterisk/buildopts.h .depend defaults.h $(SUBDIRS_DEPEND)
804 .depend: include/asterisk/version.h include/asterisk/buildopts.h defaults.h
805 build_tools/mkdep $(CFLAGS) $(wildcard *.c)
808 @echo -n ".tags-depend: " > $@
809 @$(FIND) . -maxdepth 1 -name \*.c -printf "\t%p \\\\\n" >> $@
810 @$(FIND) . -maxdepth 1 -name \*.h -printf "\t%p \\\\\n" >> $@
811 @$(FIND) $(SUBDIRS) -name \*.c -printf "\t%p \\\\\n" >> $@
812 @$(FIND) $(SUBDIRS) -name \*.h -printf "\t%p \\\\\n" >> $@
813 @$(FIND) include -name \*.h -printf "\t%p \\\\\n" >> $@
818 @$(FIND) . -maxdepth 1 -name \*.c -print >> $@
819 @$(FIND) . -maxdepth 1 -name \*.h -print >> $@
820 @$(FIND) $(SUBDIRS) -name \*.c -print >> $@
821 @$(FIND) $(SUBDIRS) -name \*.h -print >> $@
822 @$(FIND) include -name \*.h -print >> $@
824 tags: .tags-depend .tags-sources
825 ctags -L .tags-sources -o $@
829 TAGS: .tags-depend .tags-sources
830 etags -o $@ `cat .tags-sources`
835 $(MAKE) -C $(shell echo $@ | sed "s/_env//g") env
838 $(MAKE) -C sounds all
843 # If the cleancount has been changed, force a make clean.
844 # .cleancount is the global clean count, and .lastclean is the
845 # last clean count we had
848 @if cmp -s .cleancount .lastclean ; then echo ; else \
849 $(MAKE) clean; cp -f .cleancount .lastclean;\
853 $(SUBDIRS_UNINSTALL):
854 @$(MAKE) -C $(@:-uninstall=) uninstall
856 _uninstall: $(SUBDIRS_UNINSTALL)
857 rm -f $(DESTDIR)$(MODULES_DIR)/*
858 rm -f $(DESTDIR)$(ASTSBINDIR)/*asterisk*
859 rm -f $(DESTDIR)$(ASTSBINDIR)/astgenkey
860 rm -f $(DESTDIR)$(ASTSBINDIR)/autosupport
861 rm -rf $(DESTDIR)$(ASTHEADERDIR)
862 rm -rf $(DESTDIR)$(ASTDATADIR)/firmware
863 rm -rf $(DESTDIR)$(ASTMANDIR)/man8
864 $(MAKE) -C sounds uninstall
866 uninstall: _uninstall
867 @echo " +--------- Asterisk Uninstall Complete -----+"
868 @echo " + Asterisk binaries, sounds, man pages, +"
869 @echo " + headers, modules, and firmware builds, +"
870 @echo " + have all been uninstalled. +"
872 @echo " + To remove ALL traces of Asterisk, +"
873 @echo " + including configuration, spool +"
874 @echo " + directories, and logs, run the following +"
875 @echo " + command: +"
877 @echo " + $(MAKE) uninstall-all +"
878 @echo " +-------------------------------------------+"
880 uninstall-all: _uninstall
881 rm -rf $(DESTDIR)$(ASTLIBDIR)
882 rm -rf $(DESTDIR)$(ASTVARLIBDIR)
883 rm -rf $(DESTDIR)$(ASTDATADIR)
884 rm -rf $(DESTDIR)$(ASTSPOOLDIR)
885 rm -rf $(DESTDIR)$(ASTETCDIR)
886 rm -rf $(DESTDIR)$(ASTLOGDIR)
888 menuselect: menuselect/menuselect makeopts.xml
889 -@menuselect/menuselect $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts && echo "menuselect changes saved!" || echo "menuselect changes NOT saved!"
891 menuselect/menuselect: menuselect/menuselect.c menuselect/menuselect_curses.c menuselect/menuselect.h menuselect/linkedlists.h config.status mxml/libmxml.a
892 @CFLAGS="-include $(ASTTOPDIR)/include/asterisk/autoconfig.h -I$(ASTTOPDIR)/include" PARENTSRC="$(ASTTOPDIR)" $(MAKE) -C menuselect menuselect
895 @cd mxml && unset CFLAGS LIBS && test -f config.h || ./configure
896 $(MAKE) -C mxml libmxml.a
898 makeopts.xml: $(foreach dir,$(MOD_SUBDIRS),$(wildcard $(dir)/*.c) $(wildcard $(dir)/*.cc)) build_tools/cflags.xml sounds/sounds.xml
899 @echo "Generating list of available modules ..."
900 @build_tools/prep_moduledeps > $@
902 .PHONY: menuselect sounds clean clean-depend dist-clean distclean all _all depend cleantest uninstall _uninstall uninstall-all dont-optimize valgrind $(SUBDIRS_INSTALL) $(SUBDIRS_CLEAN) $(SUBDIRS_CLEAN_DEPEND) $(SUBDIRS_DEPEND) $(SUBDIRS_UNINSTALL) $(SUBDIRS)