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 # Create OPTIONS variable
19 # If cross compiling, define these to suit
20 #CROSS_COMPILE=/opt/montavista/pro/devkit/arm/xscale_be/bin/xscale_be-
21 #CROSS_COMPILE_BIN=/opt/montavista/pro/devkit/arm/xscale_be/bin/
22 #CROSS_COMPILE_TARGET=/opt/montavista/pro/devkit/arm/xscale_be/target
25 #SUB_PROC=xscale # or maverick
27 ifeq ($(CROSS_COMPILE),)
28 OSARCH=$(shell uname -s)
29 PROC?=$(shell uname -m)
37 # Remember the MAKELEVEL at the top
38 MAKETOPLEVEL?=$(MAKELEVEL)
40 # Overwite config files on "make samples"
43 # Include debug and macro symbols in the executables (-g) and profiling info (-pg)
47 # Files are copied here temporarily during the install process
48 # For example, make DESTDIR=/tmp/asterisk woud put things in
49 # /tmp/asterisk/etc/asterisk
50 # !!! Watch out, put no spaces or comments after the value !!!
52 #DESTDIR?=/tmp/asterisk
54 # Original busydetect routine
55 #BUSYDETECT = -DBUSYDETECT
57 # Improved busydetect routine, comment the previous one if you use this one
58 #BUSYDETECT+= -DBUSYDETECT_MARTIN
59 # Detect the busy signal looking only at tone lengths
60 # For example if you have 3 beeps 100ms tone, 100ms silence separated by 500 ms of silence
61 #BUSYDETECT+= -DBUSYDETECT_TONEONLY
62 # Enforce the detection of busy signal (get rid of false hangups)
63 # Don't use together with -DBUSYDETECT_TONEONLY
64 #BUSYDETECT+= -DBUSYDETECT_COMPARE_TONE_AND_SILENCE
66 # Define standard directories for various platforms
67 # These apply if they are not redefined in asterisk.conf
68 ifeq ($(OSARCH),SunOS)
69 ASTETCDIR=/etc/opt/asterisk
70 ASTLIBDIR=/opt/asterisk/lib
71 ASTVARLIBDIR=/var/opt/asterisk/lib
72 ASTSPOOLDIR=/var/opt/asterisk/spool
73 ASTLOGDIR=/var/opt/asterisk/log
74 ASTHEADERDIR=/opt/asterisk/usr/include/asterisk
75 ASTBINDIR=/opt/asterisk/usr/bin
76 ASTSBINDIR=/opt/asterisk/usr/sbin
77 ASTVARRUNDIR=/var/opt/asterisk/run
78 ASTMANDIR=/opt/asterisk/usr/share/man
80 ASTETCDIR=$(sysconfdir)/asterisk
81 ASTLIBDIR=$(libdir)/asterisk
82 ASTHEADERDIR=$(includedir)/asterisk
85 ASTSPOOLDIR=$(localstatedir)/spool/asterisk
86 ASTLOGDIR=$(localstatedir)/log/asterisk
87 ASTVARRUNDIR=$(localstatedir)/run
89 ifeq ($(OSARCH),FreeBSD)
90 ASTVARLIBDIR=$(prefix)/share/asterisk
92 ASTVARLIBDIR=$(localstatedir)/lib/asterisk
95 ASTDATADIR?=$(ASTVARLIBDIR)
97 # Asterisk.conf is located in ASTETCDIR or by using the -C flag
98 # when starting Asterisk
99 ASTCONFPATH=$(ASTETCDIR)/asterisk.conf
100 MODULES_DIR=$(ASTLIBDIR)/modules
101 AGI_DIR=$(ASTDATADIR)/agi-bin
103 # If you use Apache, you may determine by a grep 'DocumentRoot' of your httpd.conf file
104 HTTP_DOCSDIR=/var/www/html
105 # Determine by a grep 'ScriptAlias' of your Apache httpd.conf file
106 HTTP_CGIDIR=/var/www/cgi-bin
110 # Uncomment this to use the older DSP routines
111 #ASTCFLAGS+=-DOLD_DSP_ROUTINES
113 # If the file .asterisk.makeopts is present in your home directory, you can
114 # include all of your favorite menuselect options so that every time you download
115 # a new version of Asterisk, you don't have to run menuselect to set them.
116 # The file /etc/asterisk.makeopts will also be included but can be overridden
117 # by the file in your home directory.
119 GLOBAL_MAKEOPTS=$(wildcard /etc/asterisk.makeopts)
120 USER_MAKEOPTS=$(wildcard ~/.asterisk.makeopts)
122 ifneq ($(wildcard menuselect.makeopts),)
123 include menuselect.makeopts
124 include menuselect.makedeps
127 ifneq ($(wildcard makeopts),)
131 TOPDIR_CFLAGS=-Iinclude
132 MOD_SUBDIR_CFLAGS=-I../include -I..
133 OTHER_SUBDIR_CFLAGS=-I../include -I..
135 ifeq ($(or $(findstring dont-optimize,$(MAKECMDGOALS)),$(findstring DONT_OPTIMIZE,$(MENUSELECT_CFLAGS))),)
136 # More GSM codec optimization
137 # Uncomment to enable MMXTM optimizations for x86 architecture CPU's
138 # which support MMX instructions. This should be newer pentiums,
139 # ppro's, etc, as well as the AMD K6 and K7.
142 # Tell gcc to optimize the code
145 # Stack backtraces, while useful for debugging, are incompatible with optimizations
146 ifeq ($(OSARCH),Linux)
147 CFLAGS+=-DSTACK_BACKTRACES
151 # *CLI> show memory allocations [filename]
152 # *CLI> show memory summary [filename]
153 ifneq ($(findstring MALLOC_DEBUG,$(MENUSELECT_CFLAGS)),)
154 TOPDIR_CFLAGS+=-include include/asterisk/astmm.h
155 MOD_SUBDIR_CFLAGS+=-include ../include/asterisk/astmm.h
158 MOD_SUBDIR_CFLAGS+=-fPIC
160 ifeq ($(OSARCH),Linux)
161 ifeq ($(PROC),x86_64)
162 # You must have GCC 3.4 to use k8, otherwise use athlon
167 ifeq ($(PROC),sparc64)
168 #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
169 #This works for even old (2.96) versions of gcc and provides a small boost either way.
170 #A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
171 #So we go lowest common available by gcc and go a step down, still a step up from
172 #the default as we now have a better instruction set to work with. - Belgarath
174 OPTIONS+=$(shell if $(CC) -mtune=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mtune=$(PROC)"; fi)
175 OPTIONS+=$(shell if $(CC) -mcpu=v8 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mcpu=v8"; fi)
176 OPTIONS+=-fomit-frame-pointer
180 # The Cirrus logic is the only heavily shipping arm processor with a real floating point unit
181 ifeq ($(SUB_PROC),maverick)
182 OPTIONS+=-fsigned-char -mcpu=ep9312
184 ifeq ($(SUB_PROC),xscale)
185 OPTIONS+=-fsigned-char -mcpu=xscale
187 OPTIONS+=-fsigned-char
196 ifeq ($(OSARCH),SunOS)
197 GREP=/usr/xpg4/bin/grep
202 ASTCFLAGS+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG)
204 ASTCFLAGS+=$(OPTIMIZE)
207 ifeq ($(AST_DEVMODE),yes)
208 ASTCFLAGS+=-Werror -Wunused
211 ifeq ($(shell gcc -v 2>&1 | grep 'gcc version' | cut -f3 -d' ' | cut -f1 -d.),4)
212 ASTCFLAGS+=-Wno-pointer-sign
216 ifeq ($(findstring BSD,$(OSARCH)),BSD)
217 ASTCFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include -L$(CROSS_COMPILE_TARGET)/usr/local/lib
220 ifneq ($(PROC),ultrasparc)
221 ASTCFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
225 ASTCFLAGS+=-fsigned-char
228 ifeq ($(OSARCH),FreeBSD)
229 BSDVERSION=$(shell make -V OSVERSION -f $(CROSS_COMPILE_TARGET)/usr/share/mk/bsd.port.subdir.mk)
230 ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
231 LIBS+=$(shell if test $(BSDVERSION) -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi)
234 ifeq ($(OSARCH),NetBSD)
235 AST_CFLAGS+=-pthread -I$(CROSS_COMPILE_TARGET)/usr/pkg/include
238 ifeq ($(OSARCH),OpenBSD)
242 ifeq ($(OSARCH),SunOS)
243 ASTCFLAGS+=-Wcast-align -DSOLARIS -Iinclude/solaris-compat -I$(CROSS_COMPILE_TARGET)/usr/local/ssl/include
246 LIBEDIT=editline/libedit.a
248 ASTERISKVERSION:=$(shell build_tools/make_version .)
250 ifneq ($(wildcard .version),)
251 ASTERISKVERSIONNUM:=$(shell awk -F. '{printf "%02d%02d%02d", $$1, $$2, $$3}' .version)
252 RPMVERSION:=$(shell sed 's/[-\/:]/_/g' .version)
257 ifneq ($(wildcard .svn),)
258 ASTERISKVERSIONNUM=999999
261 ASTCFLAGS+=$(MALLOC_DEBUG)$(BUSYDETECT)$(OPTIONS)
263 MOD_SUBDIRS:=res channels pbx apps codecs formats cdr funcs
264 OTHER_SUBDIRS:=utils agi
265 SUBDIRS:=$(MOD_SUBDIRS) $(OTHER_SUBDIRS)
266 SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)
267 SUBDIRS_CLEAN:=$(SUBDIRS:%=%-clean)
268 SUBDIRS_CLEAN_DEPEND:=$(SUBDIRS:%=%-clean-depend)
269 MOD_SUBDIRS_DEPEND:=$(MOD_SUBDIRS:%=%-depend)
270 OTHER_SUBDIRS_DEPEND:=$(OTHER_SUBDIRS:%=%-depend)
271 SUBDIRS_DEPEND:=$(MOD_SUBDIRS_DEPEND) $(OTHER_SUBDIRS_DEPEND)
272 SUBDIRS_UNINSTALL:=$(SUBDIRS:%=%-uninstall)
274 OBJS=io.o sched.o logger.o frame.o loader.o config.o channel.o \
275 translate.o file.o pbx.o cli.o md5.o term.o \
276 ulaw.o alaw.o callerid.o fskmodem.o image.o app.o \
277 cdr.o tdd.o acl.o rtp.o udptl.o manager.o asterisk.o \
278 dsp.o chanvars.o indications.o autoservice.o db.o privacy.o \
279 astmm.o enum.o srv.o dns.o aescrypt.o aestab.o aeskey.o \
280 utils.o plc.o jitterbuf.o dnsmgr.o devicestate.o \
281 netsock.o slinfactory.o ast_expr2.o ast_expr2f.o \
282 cryptostub.o sha1.o http.o fixedjitterbuf.o abstract_jb.o
284 # we need to link in the objects statically, not as a library, because
285 # otherwise modules will not have them available if none of the static
287 OBJS+=stdtime/localtime.o
289 # At the moment say.o is an optional component which can be overridden
293 ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/sys/poll.h),)
295 ASTCFLAGS+=-DPOLLCOMPAT
298 ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/dlfcn.h),)
300 ASTCFLAGS+=-DDLFCNCOMPAT
303 ifeq ($(OSARCH),Linux)
304 LIBS+=-ldl -lpthread $(EDITLINE_LIB) -lm -lresolv #-lnjamd
306 LIBS+=$(EDITLINE_LIB) -lm
309 ifeq ($(OSARCH),Darwin)
311 ASTCFLAGS+=-D__Darwin__
312 AUDIO_LIBS=-framework CoreAudio
314 SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
315 # Mac on Intel CoreDuo does not need poll compatibility layer
318 ASTCFLAGS+=-DPOLLCOMPAT
321 # These are used for all but Darwin
323 SOLINK=-shared -Xlinker -x
324 ifeq ($(findstring BSD,$(OSARCH)),BSD)
325 SOLINK+=-L$(CROSS_COMPILE_TARGET)/usr/local/lib
329 ifeq ($(OSARCH),FreeBSD)
333 ifeq ($(OSARCH),NetBSD)
334 LIBS+=-lpthread -lcrypto -lm -L$(CROSS_COMPILE_TARGET)/usr/pkg/lib $(EDITLINE_LIB)
337 ifeq ($(OSARCH),OpenBSD)
338 LIBS+=-lcrypto -lpthread -lm $(EDITLINE_LIB)
341 ifeq ($(OSARCH),SunOS)
342 LIBS+=-lpthread -ldl -lnsl -lsocket -lresolv -L$(CROSS_COMPILE_TARGET)/usr/local/ssl/lib
344 MENUSELECT_OBJS+=strcompat.o
346 SOLINK=-shared -fpic -L$(CROSS_COMPILE_TARGET)/usr/local/ssl/lib
349 ifeq ($(MAKETOPLEVEL),$(MAKELEVEL))
350 CFLAGS+=$(TOPDIR_CFLAGS)$(ASTCFLAGS)
353 # This is used when generating the doxygen documentation
361 @echo " +--------- Asterisk Build Complete ---------+"
362 @echo " + Asterisk has successfully been built, but +"
363 @echo " + cannot be run before being installed by +"
364 @echo " + running: +"
366 @echo " + make install +"
367 @echo " +-------------------------------------------+"
369 all: cleantest config.status menuselect.makeopts depend asterisk $(SUBDIRS)
372 @CFLAGS="$(MOD_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $@
375 @CFLAGS="$(OTHER_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $@
377 config.status: configure
378 @CFLAGS="" ./configure
380 @echo "**** The configure script was just executed, so 'make' needs to be"
381 @echo "**** restarted."
386 @CFLAGS="" ./configure
388 @echo "**** The configure script was just executed, so 'make' needs to be"
389 @echo "**** restarted."
393 menuselect.makeopts menuselect.makedeps: menuselect/menuselect makeopts.xml
394 menuselect/menuselect --check-deps ${GLOBAL_MAKEOPTS} ${USER_MAKEOPTS} menuselect.makeopts
396 #ifneq ($(wildcard tags),)
400 ifneq ($(wildcard TAGS),)
405 cd editline && unset CFLAGS LIBS && CFLAGS="$(OPTIMIZE)" ./configure ; \
408 cd editline && unset CFLAGS LIBS && test -f config.h || CFLAGS="$(OPTIMIZE)" ./configure
409 $(MAKE) -C editline libedit.a
412 $(MAKE) -C db1-ast libdb1.a
414 ifneq ($(wildcard .depend),)
418 ifneq ($(wildcard .tags-depend),)
422 ast_expr2.c ast_expr2.h:
423 bison -o $@ -d --name-prefix=ast_yy ast_expr2.y
426 flex -o $@ --full ast_expr2.fl
428 testexpr2: config.status include/asterisk/buildopts.h ast_expr2f.c ast_expr2.c ast_expr2.h
429 $(CC) -g -c -Iinclude -DSTANDALONE ast_expr2f.c
430 $(CC) -g -c -Iinclude -DSTANDALONE ast_expr2.c
431 $(CC) -g -o testexpr2 ast_expr2f.o ast_expr2.o
432 rm ast_expr2.o ast_expr2f.o
436 asterisk.8: asterisk.sgml
438 docbook2man asterisk.sgml
441 asterisk.pdf: asterisk.sgml
442 docbook2pdf asterisk.sgml
444 asterisk.ps: asterisk.sgml
445 docbook2ps asterisk.sgml
447 asterisk.html: asterisk.sgml
448 docbook2html asterisk.sgml
449 mv r1.html asterisk.html
451 asterisk.txt: asterisk.sgml
452 docbook2txt asterisk.sgml
455 @build_tools/make_defaults_h > $@.tmp
456 @if cmp -s $@.tmp $@ ; then : ; else \
461 include/asterisk/version.h:
462 @build_tools/make_version_h > $@.tmp
463 @if cmp -s $@.tmp $@ ; then : ; else \
468 include/asterisk/buildopts.h: menuselect.makeopts
469 @build_tools/make_buildopts_h > $@.tmp
470 @if cmp -s $@.tmp $@ ; then : ; else \
475 channel.o: CFLAGS+=$(ZAPTEL_INCLUDE)
477 asterisk: include/asterisk/buildopts.h editline/libedit.a db1-ast/libdb1.a $(OBJS)
478 build_tools/make_build_h > include/asterisk/build.h.tmp
479 if cmp -s include/asterisk/build.h.tmp include/asterisk/build.h ; then echo ; else \
480 mv include/asterisk/build.h.tmp include/asterisk/build.h ; \
482 rm -f include/asterisk/build.h.tmp
483 $(CC) -c -o buildinfo.o $(CFLAGS) buildinfo.c
484 $(CC) $(DEBUG) $(ASTOBJ) $(ASTLINK) $(OBJS) buildinfo.o $(LIBEDIT) db1-ast/libdb1.a $(LIBS)
487 $(CC) $(AUDIO_LIBS) -o muted muted.o
489 $(SUBDIRS_CLEAN_DEPEND):
490 @$(MAKE) -C $(@:-clean-depend=) clean-depend
493 @$(MAKE) -C $(@:-clean=) clean
495 clean-depend: $(SUBDIRS_CLEAN_DEPEND)
497 clean: $(SUBDIRS_CLEAN) clean-depend
498 rm -f *.o *.so asterisk
500 rm -f include/asterisk/build.h
501 rm -f include/asterisk/version.h
502 rm -f .tags-sources tags TAGS
503 rm -f .depend .tags-depend
504 @if [ -f editline/Makefile ]; then $(MAKE) -C editline distclean ; fi
505 @$(MAKE) -C db1-ast clean
506 @$(MAKE) -C stdtime clean
507 @$(MAKE) -C menuselect clean
509 distclean: dist-clean
512 @$(MAKE) -C mxml clean
513 @$(MAKE) -C menuselect dist-clean
514 @$(MAKE) -C sounds dist-clean
515 rm -f menuselect.makeopts makeopts makeopts.xml menuselect.makedeps
516 rm -f config.log config.status
517 rm -rf autom4te.cache
518 rm -f include/autoconfig.h
519 rm -f include/asterisk/buildopts.h
523 if [ x`$(ID) -un` = xroot ]; then sh build_tools/mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig; fi
524 # Should static HTTP be installed during make samples or even with its own target ala
525 # webvoicemail? There are portions here that *could* be customized but might also be
526 # improved a lot. I'll put it here for now.
527 mkdir -p $(DESTDIR)$(ASTDATADIR)/static-http
528 for x in static-http/*; do \
529 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/static-http ; \
531 mkdir -p $(DESTDIR)$(ASTDATADIR)/images
532 for x in images/*.jpg; do \
533 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/images ; \
535 mkdir -p $(DESTDIR)$(AGI_DIR)
536 $(MAKE) -C sounds install
539 @if [ -d .svn ]; then \
540 echo "Updating from Subversion..." ; \
541 svn update | tee update.out; \
543 if [ `grep -c ^C update.out` -gt 0 ]; then \
544 echo ; echo "The following files have conflicts:" ; \
545 grep ^C update.out | cut -b4- ; \
548 $(MAKE) clean-depend; \
550 echo "Not under version control"; \
553 NEWHEADERS=$(notdir $(wildcard include/asterisk/*.h))
554 OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h)))
557 mkdir -p $(DESTDIR)$(MODULES_DIR)
558 mkdir -p $(DESTDIR)$(ASTSBINDIR)
559 mkdir -p $(DESTDIR)$(ASTETCDIR)
560 mkdir -p $(DESTDIR)$(ASTBINDIR)
561 mkdir -p $(DESTDIR)$(ASTVARRUNDIR)
562 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail
563 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/dictate
564 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/system
565 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/tmp
566 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/meetme
567 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/monitor
568 if [ -f asterisk ]; then $(INSTALL) -m 755 asterisk $(DESTDIR)$(ASTSBINDIR)/; fi
569 if [ -f asterisk.dll ]; then $(INSTALL) -m 755 asterisk.dll $(DESTDIR)$(ASTSBINDIR)/; fi
570 $(LN) -sf asterisk $(DESTDIR)$(ASTSBINDIR)/rasterisk
571 $(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
572 $(INSTALL) -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/
573 if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \
574 cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;' > $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ;\
575 chmod 755 $(DESTDIR)$(ASTSBINDIR)/safe_asterisk;\
577 $(INSTALL) -d $(DESTDIR)$(ASTHEADERDIR)
578 $(INSTALL) -m 644 include/asterisk.h $(DESTDIR)$(includedir)
579 $(INSTALL) -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
580 if [ -n "$(OLDHEADERS)" ]; then \
581 rm -f $(addprefix $(DESTDIR)$(ASTHEADERDIR)/,$(OLDHEADERS)) ;\
583 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
584 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-custom
585 mkdir -p $(DESTDIR)$(ASTDATADIR)/keys
586 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware
587 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware/iax
588 mkdir -p $(DESTDIR)$(ASTMANDIR)/man8
589 $(INSTALL) -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTDATADIR)/keys
590 $(INSTALL) -m 644 keys/freeworlddialup.pub $(DESTDIR)$(ASTDATADIR)/keys
591 $(INSTALL) -m 644 asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
592 $(INSTALL) -m 644 contrib/scripts/astgenkey.8 $(DESTDIR)$(ASTMANDIR)/man8
593 $(INSTALL) -m 644 contrib/scripts/autosupport.8 $(DESTDIR)$(ASTMANDIR)/man8
594 $(INSTALL) -m 644 contrib/scripts/safe_asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
595 $(INSTALL) -m 644 contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTDATADIR)/firmware/iax/iaxy.bin; \
598 @$(MAKE) -C $(@:-install=) install
600 NEWMODS=$(notdir $(wildcard */*.so))
601 OLDMODS=$(filter-out $(NEWMODS),$(notdir $(wildcard $(DESTDIR)$(MODULES_DIR)/*.so)))
604 @if [ -n "$(OLDMODS)" ]; then \
605 echo " WARNING WARNING WARNING" ;\
607 echo " Your Asterisk modules directory, located at" ;\
608 echo " $(DESTDIR)$(MODULES_DIR)" ;\
609 echo " contains modules that were not installed by this " ;\
610 echo " version of Asterisk. Please ensure that these" ;\
611 echo " modules are compatible with this version before" ;\
612 echo " attempting to run Asterisk." ;\
614 for f in $(OLDMODS); do \
618 echo " WARNING WARNING WARNING" ;\
621 install: all datafiles bininstall $(SUBDIRS_INSTALL)
622 @if [ -x /usr/sbin/asterisk-post-install ]; then \
623 /usr/sbin/asterisk-post-install $(DESTDIR) . ; \
625 @echo " +---- Asterisk Installation Complete -------+"
627 @echo " + YOU MUST READ THE SECURITY DOCUMENT +"
629 @echo " + Asterisk has successfully been installed. +"
630 @echo " + If you would like to install the sample +"
631 @echo " + configuration files (overwriting any +"
632 @echo " + existing config files), run: +"
634 @echo " + $(MAKE) samples +"
636 @echo " +----------------- or ---------------------+"
638 @echo " + You can go ahead and install the asterisk +"
639 @echo " + program documentation now or later run: +"
641 @echo " + $(MAKE) progdocs +"
643 @echo " + **Note** This requires that you have +"
644 @echo " + doxygen installed on your local system +"
645 @echo " +-------------------------------------------+"
646 @$(MAKE) -s oldmodcheck
648 upgrade: all bininstall
651 mkdir -p $(DESTDIR)$(ASTETCDIR)
652 for x in configs/*.adsi; do \
653 if [ ! -f $(DESTDIR)$(ASTETCDIR)/$$x ]; then \
654 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x` ; \
659 mkdir -p $(DESTDIR)$(ASTETCDIR)
660 for x in configs/*.sample; do \
661 if [ -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ]; then \
662 if [ "$(OVERWRITE)" = "y" ]; then \
663 if cmp -s $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $$x ; then \
664 echo "Config file $$x is unchanged"; \
667 mv -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample`.old ; \
669 echo "Skipping config file $$x"; \
673 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ;\
675 if [ "$(OVERWRITE)" = "y" ] || [ ! -f $(DESTDIR)$(ASTCONFPATH) ]; then \
677 echo "[directories]" ; \
678 echo "astetcdir => $(ASTETCDIR)" ; \
679 echo "astmoddir => $(MODULES_DIR)" ; \
680 echo "astvarlibdir => $(ASTVARLIBDIR)" ; \
681 echo "astdatadir => $(ASTDATADIR)" ; \
682 echo "astagidir => $(AGI_DIR)" ; \
683 echo "astspooldir => $(ASTSPOOLDIR)" ; \
684 echo "astrundir => $(ASTVARRUNDIR)" ; \
685 echo "astlogdir => $(ASTLOGDIR)" ; \
687 echo "; Changing the following lines may compromise your security." ; \
689 echo ";astctlpermissions = 0660" ; \
690 echo ";astctlowner = root" ; \
691 echo ";astctlgroup = apache" ; \
692 echo ";astctl = asterisk.ctl" ; \
693 echo ";[options]" ; \
694 echo ";internal_timing = yes" ; \
695 ) > $(DESTDIR)$(ASTCONFPATH) ; \
697 echo "Skipping asterisk.conf creation"; \
699 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
700 :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm
701 for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isunavail; do \
702 cat $(DESTDIR)$(ASTDATADIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm ; \
704 :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm
705 for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isonphone; do \
706 cat $(DESTDIR)$(ASTDATADIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm ; \
710 @[ -d $(DESTDIR)$(HTTP_DOCSDIR)/ ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 )
711 @[ -d $(DESTDIR)$(HTTP_CGIDIR) ] || ( printf "cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit 1 )
712 $(INSTALL) -m 4755 -o root -g root contrib/scripts/vmail.cgi $(DESTDIR)$(HTTP_CGIDIR)/vmail.cgi
713 mkdir -p $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk
714 for x in images/*.gif; do \
715 $(INSTALL) -m 644 $$x $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk/; \
717 @echo " +--------- Asterisk Web Voicemail ----------+"
719 @echo " + Asterisk Web Voicemail is installed in +"
720 @echo " + your cgi-bin directory: +"
721 @echo " + $(DESTDIR)$(HTTP_CGIDIR)"
722 @echo " + IT USES A SETUID ROOT PERL SCRIPT, SO +"
723 @echo " + IF YOU DON'T LIKE THAT, UNINSTALL IT! +"
725 @echo " + Other static items have been stored in: +"
726 @echo " + $(DESTDIR)$(HTTP_DOCSDIR)"
728 @echo " + If these paths do not match your httpd +"
729 @echo " + installation, correct the definitions +"
730 @echo " + in your Makefile of HTTP_CGIDIR and +"
731 @echo " + HTTP_DOCSDIR +"
733 @echo " +-------------------------------------------+"
736 sed "s/^Version:.*/Version: $(RPMVERSION)/g" redhat/asterisk.spec > asterisk.spec ; \
740 __rpm: include/asterisk/version.h include/asterisk/buildopts.h spec
741 rm -rf /tmp/asterisk ; \
742 mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
743 $(MAKE) DESTDIR=/tmp/asterisk install ; \
744 $(MAKE) DESTDIR=/tmp/asterisk samples ; \
745 mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
746 cp -f contrib/init.d/rc.redhat.asterisk /tmp/asterisk/etc/rc.d/init.d/asterisk ; \
747 rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec
750 (cat contrib/asterisk-ng-doxygen; echo "HAVE_DOT=$(HAVEDOT)"; \
751 echo "PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen -
754 @if [ "${OSARCH}" = "Linux" ]; then \
755 if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \
756 $(INSTALL) -m 755 contrib/init.d/rc.redhat.asterisk /etc/rc.d/init.d/asterisk; \
757 /sbin/chkconfig --add asterisk; \
758 elif [ -f /etc/debian_version ]; then \
759 $(INSTALL) -m 755 contrib/init.d/rc.debian.asterisk /etc/init.d/asterisk; \
760 /usr/sbin/update-rc.d asterisk start 10 2 3 4 5 . stop 91 2 3 4 5 .; \
761 elif [ -f /etc/gentoo-release ]; then \
762 $(INSTALL) -m 755 contrib/init.d/rc.gentoo.asterisk /etc/init.d/asterisk; \
763 /sbin/rc-update add asterisk default; \
764 elif [ -f /etc/mandrake-release ]; then \
765 $(INSTALL) -m 755 contrib/init.d/rc.mandrake.asterisk /etc/rc.d/init.d/asterisk; \
766 /sbin/chkconfig --add asterisk; \
767 elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then \
768 $(INSTALL) -m 755 contrib/init.d/rc.suse.asterisk /etc/init.d/asterisk; \
769 /sbin/chkconfig --add asterisk; \
770 elif [ -f /etc/slackware-version ]; then \
771 echo "Slackware is not currently supported, although an init script does exist for it." \
773 echo "We could not install init scripts for your distribution."; \
776 echo "We could not install init scripts for your operating system."; \
781 valgrind: dont-optimize
783 $(MOD_SUBDIRS_DEPEND):
784 @CFLAGS="$(MOD_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $(@:-depend=) depend
786 $(OTHER_SUBDIRS_DEPEND):
787 @CFLAGS="$(OTHER_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $(@:-depend=) depend
789 depend: include/asterisk/version.h include/asterisk/buildopts.h .depend defaults.h $(SUBDIRS_DEPEND)
791 .depend: include/asterisk/version.h include/asterisk/buildopts.h defaults.h
792 build_tools/mkdep $(CFLAGS) $(wildcard *.c)
795 @echo -n ".tags-depend: " > $@
796 @$(FIND) . -maxdepth 1 -name \*.c -printf "\t%p \\\\\n" >> $@
797 @$(FIND) . -maxdepth 1 -name \*.h -printf "\t%p \\\\\n" >> $@
798 @$(FIND) $(SUBDIRS) -name \*.c -printf "\t%p \\\\\n" >> $@
799 @$(FIND) $(SUBDIRS) -name \*.h -printf "\t%p \\\\\n" >> $@
800 @$(FIND) include -name \*.h -printf "\t%p \\\\\n" >> $@
805 @$(FIND) . -maxdepth 1 -name \*.c -print >> $@
806 @$(FIND) . -maxdepth 1 -name \*.h -print >> $@
807 @$(FIND) $(SUBDIRS) -name \*.c -print >> $@
808 @$(FIND) $(SUBDIRS) -name \*.h -print >> $@
809 @$(FIND) include -name \*.h -print >> $@
811 tags: .tags-depend .tags-sources
812 ctags -L .tags-sources -o $@
816 TAGS: .tags-depend .tags-sources
817 etags -o $@ `cat .tags-sources`
822 $(MAKE) -C $(shell echo $@ | sed "s/_env//g") env
825 $(MAKE) -C sounds all
830 # If the cleancount has been changed, force a make clean.
831 # .cleancount is the global clean count, and .lastclean is the
832 # last clean count we had
835 @if cmp -s .cleancount .lastclean ; then echo ; else \
836 $(MAKE) clean; cp -f .cleancount .lastclean;\
840 $(SUBDIRS_UNINSTALL):
841 @$(MAKE) -C $(@:-uninstall=) uninstall
843 _uninstall: $(SUBDIRS_UNINSTALL)
844 rm -f $(DESTDIR)$(MODULES_DIR)/*
845 rm -f $(DESTDIR)$(ASTSBINDIR)/*asterisk*
846 rm -f $(DESTDIR)$(ASTSBINDIR)/astgenkey
847 rm -f $(DESTDIR)$(ASTSBINDIR)/autosupport
848 rm -rf $(DESTDIR)$(ASTHEADERDIR)
849 rm -rf $(DESTDIR)$(ASTDATADIR)/firmware
850 rm -rf $(DESTDIR)$(ASTMANDIR)/man8
851 $(MAKE) -C sounds uninstall
853 uninstall: _uninstall
854 @echo " +--------- Asterisk Uninstall Complete -----+"
855 @echo " + Asterisk binaries, sounds, man pages, +"
856 @echo " + headers, modules, and firmware builds, +"
857 @echo " + have all been uninstalled. +"
859 @echo " + To remove ALL traces of Asterisk, +"
860 @echo " + including configuration, spool +"
861 @echo " + directories, and logs, run the following +"
862 @echo " + command: +"
864 @echo " + $(MAKE) uninstall-all +"
865 @echo " +-------------------------------------------+"
867 uninstall-all: _uninstall
868 rm -rf $(DESTDIR)$(ASTLIBDIR)
869 rm -rf $(DESTDIR)$(ASTVARLIBDIR)
870 rm -rf $(DESTDIR)$(ASTDATADIR)
871 rm -rf $(DESTDIR)$(ASTSPOOLDIR)
872 rm -rf $(DESTDIR)$(ASTETCDIR)
873 rm -rf $(DESTDIR)$(ASTLOGDIR)
875 menuselect: menuselect/menuselect makeopts.xml
876 -@menuselect/menuselect ${GLOBAL_MAKEOPTS} ${USER_MAKEOPTS} menuselect.makeopts && echo "menuselect changes saved!" || echo "menuselect changes NOT saved!"
878 menuselect/menuselect: menuselect/menuselect.c menuselect/menuselect_curses.c menuselect/menuselect.h menuselect/linkedlists.h config.status mxml/libmxml.a $(MENUSELECT_OBJS)
879 @CFLAGS="-include ../include/asterisk/autoconfig.h" $(MAKE) -C menuselect menuselect
882 @cd mxml && unset CFLAGS LIBS && test -f config.h || ./configure
883 $(MAKE) -C mxml libmxml.a
885 makeopts.xml: $(foreach dir,$(MOD_SUBDIRS),$(dir)/*.c) build_tools/cflags.xml sounds/sounds.xml
886 @echo "Generating list of available modules ..."
887 @build_tools/prep_moduledeps > $@
889 .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)