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/menuselect makeopts.xml
394 @menuselect/menuselect --check-deps ${GLOBAL_MAKEOPTS} ${USER_MAKEOPTS} $@
396 menuselect.makedeps: menuselect/menuselect makeopts.xml
397 @menuselect/menuselect --check-deps ${GLOBAL_MAKEOPTS} ${USER_MAKEOPTS} $@
399 #ifneq ($(wildcard tags),)
403 ifneq ($(wildcard TAGS),)
408 cd editline && unset CFLAGS LIBS && CFLAGS="$(OPTIMIZE)" ./configure ; \
411 cd editline && unset CFLAGS LIBS && test -f config.h || CFLAGS="$(OPTIMIZE)" ./configure
412 $(MAKE) -C editline libedit.a
415 $(MAKE) -C db1-ast libdb1.a
417 ifneq ($(wildcard .depend),)
421 ifneq ($(wildcard .tags-depend),)
425 ast_expr2.c ast_expr2.h:
426 bison -o $@ -d --name-prefix=ast_yy ast_expr2.y
429 flex -o $@ --full ast_expr2.fl
431 testexpr2: config.status include/asterisk/buildopts.h ast_expr2f.c ast_expr2.c ast_expr2.h
432 $(CC) -g -c -Iinclude -DSTANDALONE ast_expr2f.c
433 $(CC) -g -c -Iinclude -DSTANDALONE ast_expr2.c
434 $(CC) -g -o testexpr2 ast_expr2f.o ast_expr2.o
435 rm ast_expr2.o ast_expr2f.o
439 asterisk.8: asterisk.sgml
441 docbook2man asterisk.sgml
444 asterisk.pdf: asterisk.sgml
445 docbook2pdf asterisk.sgml
447 asterisk.ps: asterisk.sgml
448 docbook2ps asterisk.sgml
450 asterisk.html: asterisk.sgml
451 docbook2html asterisk.sgml
452 mv r1.html asterisk.html
454 asterisk.txt: asterisk.sgml
455 docbook2txt asterisk.sgml
458 @build_tools/make_defaults_h > $@.tmp
459 @if cmp -s $@.tmp $@ ; then : ; else \
464 include/asterisk/version.h:
465 @build_tools/make_version_h > $@.tmp
466 @if cmp -s $@.tmp $@ ; then : ; else \
471 include/asterisk/buildopts.h: menuselect.makeopts
472 @build_tools/make_buildopts_h > $@.tmp
473 @if cmp -s $@.tmp $@ ; then : ; else \
478 channel.o: CFLAGS+=$(ZAPTEL_INCLUDE)
480 asterisk: include/asterisk/buildopts.h editline/libedit.a db1-ast/libdb1.a $(OBJS)
481 build_tools/make_build_h > include/asterisk/build.h.tmp
482 if cmp -s include/asterisk/build.h.tmp include/asterisk/build.h ; then echo ; else \
483 mv include/asterisk/build.h.tmp include/asterisk/build.h ; \
485 rm -f include/asterisk/build.h.tmp
486 $(CC) -c -o buildinfo.o $(CFLAGS) buildinfo.c
487 $(CC) $(DEBUG) $(ASTOBJ) $(ASTLINK) $(OBJS) buildinfo.o $(LIBEDIT) db1-ast/libdb1.a $(LIBS)
490 $(CC) $(AUDIO_LIBS) -o muted muted.o
492 $(SUBDIRS_CLEAN_DEPEND):
493 @$(MAKE) -C $(@:-clean-depend=) clean-depend
496 @$(MAKE) -C $(@:-clean=) clean
498 clean-depend: $(SUBDIRS_CLEAN_DEPEND)
500 clean: $(SUBDIRS_CLEAN) clean-depend
501 rm -f *.o *.so asterisk
503 rm -f include/asterisk/build.h
504 rm -f include/asterisk/version.h
505 rm -f .tags-sources tags TAGS
506 rm -f .depend .tags-depend
507 @if [ -f editline/Makefile ]; then $(MAKE) -C editline distclean ; fi
508 @$(MAKE) -C db1-ast clean
509 @$(MAKE) -C stdtime clean
510 @$(MAKE) -C menuselect clean
512 distclean: dist-clean
515 @$(MAKE) -C mxml clean
516 @$(MAKE) -C menuselect dist-clean
517 @$(MAKE) -C sounds dist-clean
518 rm -f menuselect.makeopts makeopts makeopts.xml menuselect.makedeps
519 rm -f config.log config.status
520 rm -rf autom4te.cache
521 rm -f include/autoconfig.h
522 rm -f include/asterisk/buildopts.h
526 if [ x`$(ID) -un` = xroot ]; then sh build_tools/mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig; fi
527 # Should static HTTP be installed during make samples or even with its own target ala
528 # webvoicemail? There are portions here that *could* be customized but might also be
529 # improved a lot. I'll put it here for now.
530 mkdir -p $(DESTDIR)$(ASTDATADIR)/static-http
531 for x in static-http/*; do \
532 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/static-http ; \
534 mkdir -p $(DESTDIR)$(ASTDATADIR)/images
535 for x in images/*.jpg; do \
536 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/images ; \
538 mkdir -p $(DESTDIR)$(AGI_DIR)
539 $(MAKE) -C sounds install
542 @if [ -d .svn ]; then \
543 echo "Updating from Subversion..." ; \
544 svn update | tee update.out; \
546 if [ `grep -c ^C update.out` -gt 0 ]; then \
547 echo ; echo "The following files have conflicts:" ; \
548 grep ^C update.out | cut -b4- ; \
551 $(MAKE) clean-depend; \
553 echo "Not under version control"; \
556 NEWHEADERS=$(notdir $(wildcard include/asterisk/*.h))
557 OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h)))
560 mkdir -p $(DESTDIR)$(MODULES_DIR)
561 mkdir -p $(DESTDIR)$(ASTSBINDIR)
562 mkdir -p $(DESTDIR)$(ASTETCDIR)
563 mkdir -p $(DESTDIR)$(ASTBINDIR)
564 mkdir -p $(DESTDIR)$(ASTVARRUNDIR)
565 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail
566 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/dictate
567 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/system
568 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/tmp
569 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/meetme
570 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/monitor
571 if [ -f asterisk ]; then $(INSTALL) -m 755 asterisk $(DESTDIR)$(ASTSBINDIR)/; fi
572 if [ -f asterisk.dll ]; then $(INSTALL) -m 755 asterisk.dll $(DESTDIR)$(ASTSBINDIR)/; fi
573 $(LN) -sf asterisk $(DESTDIR)$(ASTSBINDIR)/rasterisk
574 $(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
575 $(INSTALL) -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/
576 if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \
577 cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;' > $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ;\
578 chmod 755 $(DESTDIR)$(ASTSBINDIR)/safe_asterisk;\
580 $(INSTALL) -d $(DESTDIR)$(ASTHEADERDIR)
581 $(INSTALL) -m 644 include/asterisk.h $(DESTDIR)$(includedir)
582 $(INSTALL) -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
583 if [ -n "$(OLDHEADERS)" ]; then \
584 rm -f $(addprefix $(DESTDIR)$(ASTHEADERDIR)/,$(OLDHEADERS)) ;\
586 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
587 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-custom
588 mkdir -p $(DESTDIR)$(ASTDATADIR)/keys
589 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware
590 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware/iax
591 mkdir -p $(DESTDIR)$(ASTMANDIR)/man8
592 $(INSTALL) -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTDATADIR)/keys
593 $(INSTALL) -m 644 keys/freeworlddialup.pub $(DESTDIR)$(ASTDATADIR)/keys
594 $(INSTALL) -m 644 asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
595 $(INSTALL) -m 644 contrib/scripts/astgenkey.8 $(DESTDIR)$(ASTMANDIR)/man8
596 $(INSTALL) -m 644 contrib/scripts/autosupport.8 $(DESTDIR)$(ASTMANDIR)/man8
597 $(INSTALL) -m 644 contrib/scripts/safe_asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
598 $(INSTALL) -m 644 contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTDATADIR)/firmware/iax/iaxy.bin; \
601 @$(MAKE) -C $(@:-install=) install
603 NEWMODS=$(notdir $(wildcard */*.so))
604 OLDMODS=$(filter-out $(NEWMODS),$(notdir $(wildcard $(DESTDIR)$(MODULES_DIR)/*.so)))
607 @if [ -n "$(OLDMODS)" ]; then \
608 echo " WARNING WARNING WARNING" ;\
610 echo " Your Asterisk modules directory, located at" ;\
611 echo " $(DESTDIR)$(MODULES_DIR)" ;\
612 echo " contains modules that were not installed by this " ;\
613 echo " version of Asterisk. Please ensure that these" ;\
614 echo " modules are compatible with this version before" ;\
615 echo " attempting to run Asterisk." ;\
617 for f in $(OLDMODS); do \
621 echo " WARNING WARNING WARNING" ;\
624 install: all datafiles bininstall $(SUBDIRS_INSTALL)
625 @if [ -x /usr/sbin/asterisk-post-install ]; then \
626 /usr/sbin/asterisk-post-install $(DESTDIR) . ; \
628 @echo " +---- Asterisk Installation Complete -------+"
630 @echo " + YOU MUST READ THE SECURITY DOCUMENT +"
632 @echo " + Asterisk has successfully been installed. +"
633 @echo " + If you would like to install the sample +"
634 @echo " + configuration files (overwriting any +"
635 @echo " + existing config files), run: +"
637 @echo " + $(MAKE) samples +"
639 @echo " +----------------- or ---------------------+"
641 @echo " + You can go ahead and install the asterisk +"
642 @echo " + program documentation now or later run: +"
644 @echo " + $(MAKE) progdocs +"
646 @echo " + **Note** This requires that you have +"
647 @echo " + doxygen installed on your local system +"
648 @echo " +-------------------------------------------+"
649 @$(MAKE) -s oldmodcheck
651 upgrade: all bininstall
654 mkdir -p $(DESTDIR)$(ASTETCDIR)
655 for x in configs/*.adsi; do \
656 if [ ! -f $(DESTDIR)$(ASTETCDIR)/$$x ]; then \
657 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x` ; \
662 mkdir -p $(DESTDIR)$(ASTETCDIR)
663 for x in configs/*.sample; do \
664 if [ -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ]; then \
665 if [ "$(OVERWRITE)" = "y" ]; then \
666 if cmp -s $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $$x ; then \
667 echo "Config file $$x is unchanged"; \
670 mv -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample`.old ; \
672 echo "Skipping config file $$x"; \
676 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ;\
678 if [ "$(OVERWRITE)" = "y" ] || [ ! -f $(DESTDIR)$(ASTCONFPATH) ]; then \
680 echo "[directories]" ; \
681 echo "astetcdir => $(ASTETCDIR)" ; \
682 echo "astmoddir => $(MODULES_DIR)" ; \
683 echo "astvarlibdir => $(ASTVARLIBDIR)" ; \
684 echo "astdatadir => $(ASTDATADIR)" ; \
685 echo "astagidir => $(AGI_DIR)" ; \
686 echo "astspooldir => $(ASTSPOOLDIR)" ; \
687 echo "astrundir => $(ASTVARRUNDIR)" ; \
688 echo "astlogdir => $(ASTLOGDIR)" ; \
690 echo "; Changing the following lines may compromise your security." ; \
692 echo ";astctlpermissions = 0660" ; \
693 echo ";astctlowner = root" ; \
694 echo ";astctlgroup = apache" ; \
695 echo ";astctl = asterisk.ctl" ; \
696 echo ";[options]" ; \
697 echo ";internal_timing = yes" ; \
698 ) > $(DESTDIR)$(ASTCONFPATH) ; \
700 echo "Skipping asterisk.conf creation"; \
702 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
703 :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm
704 for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isunavail; do \
705 cat $(DESTDIR)$(ASTDATADIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm ; \
707 :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm
708 for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isonphone; do \
709 cat $(DESTDIR)$(ASTDATADIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm ; \
713 @[ -d $(DESTDIR)$(HTTP_DOCSDIR)/ ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 )
714 @[ -d $(DESTDIR)$(HTTP_CGIDIR) ] || ( printf "cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit 1 )
715 $(INSTALL) -m 4755 -o root -g root contrib/scripts/vmail.cgi $(DESTDIR)$(HTTP_CGIDIR)/vmail.cgi
716 mkdir -p $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk
717 for x in images/*.gif; do \
718 $(INSTALL) -m 644 $$x $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk/; \
720 @echo " +--------- Asterisk Web Voicemail ----------+"
722 @echo " + Asterisk Web Voicemail is installed in +"
723 @echo " + your cgi-bin directory: +"
724 @echo " + $(DESTDIR)$(HTTP_CGIDIR)"
725 @echo " + IT USES A SETUID ROOT PERL SCRIPT, SO +"
726 @echo " + IF YOU DON'T LIKE THAT, UNINSTALL IT! +"
728 @echo " + Other static items have been stored in: +"
729 @echo " + $(DESTDIR)$(HTTP_DOCSDIR)"
731 @echo " + If these paths do not match your httpd +"
732 @echo " + installation, correct the definitions +"
733 @echo " + in your Makefile of HTTP_CGIDIR and +"
734 @echo " + HTTP_DOCSDIR +"
736 @echo " +-------------------------------------------+"
739 sed "s/^Version:.*/Version: $(RPMVERSION)/g" redhat/asterisk.spec > asterisk.spec ; \
743 __rpm: include/asterisk/version.h include/asterisk/buildopts.h spec
744 rm -rf /tmp/asterisk ; \
745 mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
746 $(MAKE) DESTDIR=/tmp/asterisk install ; \
747 $(MAKE) DESTDIR=/tmp/asterisk samples ; \
748 mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
749 cp -f contrib/init.d/rc.redhat.asterisk /tmp/asterisk/etc/rc.d/init.d/asterisk ; \
750 rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec
753 (cat contrib/asterisk-ng-doxygen; echo "HAVE_DOT=$(HAVEDOT)"; \
754 echo "PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen -
757 @if [ "${OSARCH}" = "Linux" ]; then \
758 if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \
759 $(INSTALL) -m 755 contrib/init.d/rc.redhat.asterisk /etc/rc.d/init.d/asterisk; \
760 /sbin/chkconfig --add asterisk; \
761 elif [ -f /etc/debian_version ]; then \
762 $(INSTALL) -m 755 contrib/init.d/rc.debian.asterisk /etc/init.d/asterisk; \
763 /usr/sbin/update-rc.d asterisk start 10 2 3 4 5 . stop 91 2 3 4 5 .; \
764 elif [ -f /etc/gentoo-release ]; then \
765 $(INSTALL) -m 755 contrib/init.d/rc.gentoo.asterisk /etc/init.d/asterisk; \
766 /sbin/rc-update add asterisk default; \
767 elif [ -f /etc/mandrake-release ]; then \
768 $(INSTALL) -m 755 contrib/init.d/rc.mandrake.asterisk /etc/rc.d/init.d/asterisk; \
769 /sbin/chkconfig --add asterisk; \
770 elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then \
771 $(INSTALL) -m 755 contrib/init.d/rc.suse.asterisk /etc/init.d/asterisk; \
772 /sbin/chkconfig --add asterisk; \
773 elif [ -f /etc/slackware-version ]; then \
774 echo "Slackware is not currently supported, although an init script does exist for it." \
776 echo "We could not install init scripts for your distribution."; \
779 echo "We could not install init scripts for your operating system."; \
784 valgrind: dont-optimize
786 $(MOD_SUBDIRS_DEPEND):
787 @CFLAGS="$(MOD_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $(@:-depend=) depend
789 $(OTHER_SUBDIRS_DEPEND):
790 @CFLAGS="$(OTHER_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $(@:-depend=) depend
792 depend: include/asterisk/version.h include/asterisk/buildopts.h .depend defaults.h $(SUBDIRS_DEPEND)
794 .depend: include/asterisk/version.h include/asterisk/buildopts.h defaults.h
795 build_tools/mkdep $(CFLAGS) $(wildcard *.c)
798 @echo -n ".tags-depend: " > $@
799 @$(FIND) . -maxdepth 1 -name \*.c -printf "\t%p \\\\\n" >> $@
800 @$(FIND) . -maxdepth 1 -name \*.h -printf "\t%p \\\\\n" >> $@
801 @$(FIND) $(SUBDIRS) -name \*.c -printf "\t%p \\\\\n" >> $@
802 @$(FIND) $(SUBDIRS) -name \*.h -printf "\t%p \\\\\n" >> $@
803 @$(FIND) include -name \*.h -printf "\t%p \\\\\n" >> $@
808 @$(FIND) . -maxdepth 1 -name \*.c -print >> $@
809 @$(FIND) . -maxdepth 1 -name \*.h -print >> $@
810 @$(FIND) $(SUBDIRS) -name \*.c -print >> $@
811 @$(FIND) $(SUBDIRS) -name \*.h -print >> $@
812 @$(FIND) include -name \*.h -print >> $@
814 tags: .tags-depend .tags-sources
815 ctags -L .tags-sources -o $@
819 TAGS: .tags-depend .tags-sources
820 etags -o $@ `cat .tags-sources`
825 $(MAKE) -C $(shell echo $@ | sed "s/_env//g") env
828 $(MAKE) -C sounds all
833 # If the cleancount has been changed, force a make clean.
834 # .cleancount is the global clean count, and .lastclean is the
835 # last clean count we had
838 @if cmp -s .cleancount .lastclean ; then echo ; else \
839 $(MAKE) clean; cp -f .cleancount .lastclean;\
843 $(SUBDIRS_UNINSTALL):
844 @$(MAKE) -C $(@:-uninstall=) uninstall
846 _uninstall: $(SUBDIRS_UNINSTALL)
847 rm -f $(DESTDIR)$(MODULES_DIR)/*
848 rm -f $(DESTDIR)$(ASTSBINDIR)/*asterisk*
849 rm -f $(DESTDIR)$(ASTSBINDIR)/astgenkey
850 rm -f $(DESTDIR)$(ASTSBINDIR)/autosupport
851 rm -rf $(DESTDIR)$(ASTHEADERDIR)
852 rm -rf $(DESTDIR)$(ASTDATADIR)/firmware
853 rm -rf $(DESTDIR)$(ASTMANDIR)/man8
854 $(MAKE) -C sounds uninstall
856 uninstall: _uninstall
857 @echo " +--------- Asterisk Uninstall Complete -----+"
858 @echo " + Asterisk binaries, sounds, man pages, +"
859 @echo " + headers, modules, and firmware builds, +"
860 @echo " + have all been uninstalled. +"
862 @echo " + To remove ALL traces of Asterisk, +"
863 @echo " + including configuration, spool +"
864 @echo " + directories, and logs, run the following +"
865 @echo " + command: +"
867 @echo " + $(MAKE) uninstall-all +"
868 @echo " +-------------------------------------------+"
870 uninstall-all: _uninstall
871 rm -rf $(DESTDIR)$(ASTLIBDIR)
872 rm -rf $(DESTDIR)$(ASTVARLIBDIR)
873 rm -rf $(DESTDIR)$(ASTDATADIR)
874 rm -rf $(DESTDIR)$(ASTSPOOLDIR)
875 rm -rf $(DESTDIR)$(ASTETCDIR)
876 rm -rf $(DESTDIR)$(ASTLOGDIR)
878 menuselect: menuselect/menuselect makeopts.xml
879 -@menuselect/menuselect ${GLOBAL_MAKEOPTS} ${USER_MAKEOPTS} menuselect.makeopts && echo "menuselect changes saved!" || echo "menuselect changes NOT saved!"
881 menuselect/menuselect: menuselect/menuselect.c menuselect/menuselect_curses.c menuselect/menuselect.h menuselect/linkedlists.h config.status mxml/libmxml.a $(MENUSELECT_OBJS)
882 @CFLAGS="-include ../include/asterisk/autoconfig.h" $(MAKE) -C menuselect menuselect
885 @cd mxml && unset CFLAGS LIBS && test -f config.h || ./configure
886 $(MAKE) -C mxml libmxml.a
888 makeopts.xml: $(foreach dir,$(MOD_SUBDIRS),$(dir)/*.c) build_tools/cflags.xml sounds/sounds.xml
889 @echo "Generating list of available modules ..."
890 @build_tools/prep_moduledeps > $@
892 .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)