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 ($(origin MENUSELECT_CFLAGS),undefined)
136 MENUSELECT_CFLAGS:=$(shell grep MENUSELECT_CFLAGS $(USER_MAKEOPTS) . | cut -f2 -d'=')
137 MENUSELECT_CFLAGS?=$(shell grep MENUSELECT_CFLAGS $(GLOBAL_MAKEOPTS) . | cut -f2 -d'=')
140 ifeq ($(findstring dont-optimize,$(MAKECMDGOALS)),$(findstring DONT_OPTIMIZE,$(MENUSELECT_CFLAGS)),)
141 # More GSM codec optimization
142 # Uncomment to enable MMXTM optimizations for x86 architecture CPU's
143 # which support MMX instructions. This should be newer pentiums,
144 # ppro's, etc, as well as the AMD K6 and K7.
147 # Tell gcc to optimize the code
150 # Stack backtraces, while useful for debugging, are incompatible with optimizations
151 ifeq ($(OSARCH),Linux)
152 CFLAGS+=-DSTACK_BACKTRACES
156 # *CLI> show memory allocations [filename]
157 # *CLI> show memory summary [filename]
158 ifneq ($(findstring MALLOC_DEBUG,$(MENUSELECT_CFLAGS)),)
159 TOPDIR_CFLAGS+=-include include/asterisk/astmm.h
160 MOD_SUBDIR_CFLAGS+=-include ../include/asterisk/astmm.h
163 MOD_SUBDIR_CFLAGS+=-fPIC
165 ifeq ($(OSARCH),Linux)
166 ifeq ($(PROC),x86_64)
167 # You must have GCC 3.4 to use k8, otherwise use athlon
172 ifeq ($(PROC),sparc64)
173 #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
174 #This works for even old (2.96) versions of gcc and provides a small boost either way.
175 #A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
176 #So we go lowest common available by gcc and go a step down, still a step up from
177 #the default as we now have a better instruction set to work with. - Belgarath
179 OPTIONS+=$(shell if $(CC) -mtune=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mtune=$(PROC)"; fi)
180 OPTIONS+=$(shell if $(CC) -mcpu=v8 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mcpu=v8"; fi)
181 OPTIONS+=-fomit-frame-pointer
185 # The Cirrus logic is the only heavily shipping arm processor with a real floating point unit
186 ifeq ($(SUB_PROC),maverick)
187 OPTIONS+=-fsigned-char -mcpu=ep9312
189 ifeq ($(SUB_PROC),xscale)
190 OPTIONS+=-fsigned-char -mcpu=xscale
192 OPTIONS+=-fsigned-char
201 ifeq ($(OSARCH),SunOS)
202 GREP=/usr/xpg4/bin/grep
207 ASTCFLAGS+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG)
209 ASTCFLAGS+=$(OPTIMIZE)
212 ifeq ($(AST_DEVMODE),yes)
213 ASTCFLAGS+=-Werror -Wunused
216 ifeq ($(shell gcc -v 2>&1 | grep 'gcc version' | cut -f3 -d' ' | cut -f1 -d.),4)
217 ASTCFLAGS+=-Wno-pointer-sign
221 ifeq ($(findstring BSD,$(OSARCH)),BSD)
222 ASTCFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include -L$(CROSS_COMPILE_TARGET)/usr/local/lib
225 ifneq ($(PROC),ultrasparc)
226 ASTCFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
230 ASTCFLAGS+=-fsigned-char
233 ifeq ($(OSARCH),FreeBSD)
234 BSDVERSION=$(shell make -V OSVERSION -f $(CROSS_COMPILE_TARGET)/usr/share/mk/bsd.port.subdir.mk)
235 ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
236 LIBS+=$(shell if test $(BSDVERSION) -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi)
239 ifeq ($(OSARCH),NetBSD)
240 AST_CFLAGS+=-pthread -I$(CROSS_COMPILE_TARGET)/usr/pkg/include
243 ifeq ($(OSARCH),OpenBSD)
247 ifeq ($(OSARCH),SunOS)
248 ASTCFLAGS+=-Wcast-align -DSOLARIS -Iinclude/solaris-compat -I$(CROSS_COMPILE_TARGET)/usr/local/ssl/include
251 LIBEDIT=editline/libedit.a
253 ASTERISKVERSION:=$(shell build_tools/make_version .)
255 ifneq ($(wildcard .version),)
256 ASTERISKVERSIONNUM:=$(shell awk -F. '{printf "%02d%02d%02d", $$1, $$2, $$3}' .version)
257 RPMVERSION:=$(shell sed 's/[-\/:]/_/g' .version)
262 ifneq ($(wildcard .svn),)
263 ASTERISKVERSIONNUM=999999
266 ASTCFLAGS+=$(MALLOC_DEBUG)$(BUSYDETECT)$(OPTIONS)
268 MOD_SUBDIRS:=res channels pbx apps codecs formats cdr funcs
269 OTHER_SUBDIRS:=utils agi
270 SUBDIRS:=$(MOD_SUBDIRS) $(OTHER_SUBDIRS)
271 SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)
272 SUBDIRS_CLEAN:=$(SUBDIRS:%=%-clean)
273 SUBDIRS_CLEAN_DEPEND:=$(SUBDIRS:%=%-clean-depend)
274 MOD_SUBDIRS_DEPEND:=$(MOD_SUBDIRS:%=%-depend)
275 OTHER_SUBDIRS_DEPEND:=$(OTHER_SUBDIRS:%=%-depend)
276 SUBDIRS_DEPEND:=$(MOD_SUBDIRS_DEPEND) $(OTHER_SUBDIRS_DEPEND)
277 SUBDIRS_UNINSTALL:=$(SUBDIRS:%=%-uninstall)
279 OBJS=io.o sched.o logger.o frame.o loader.o config.o channel.o \
280 translate.o file.o pbx.o cli.o md5.o term.o \
281 ulaw.o alaw.o callerid.o fskmodem.o image.o app.o \
282 cdr.o tdd.o acl.o rtp.o udptl.o manager.o asterisk.o \
283 dsp.o chanvars.o indications.o autoservice.o db.o privacy.o \
284 astmm.o enum.o srv.o dns.o aescrypt.o aestab.o aeskey.o \
285 utils.o plc.o jitterbuf.o dnsmgr.o devicestate.o \
286 netsock.o slinfactory.o ast_expr2.o ast_expr2f.o \
287 cryptostub.o sha1.o http.o fixedjitterbuf.o abstract_jb.o
289 # we need to link in the objects statically, not as a library, because
290 # otherwise modules will not have them available if none of the static
292 OBJS+=stdtime/localtime.o
294 # At the moment say.o is an optional component which can be overridden
298 ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/sys/poll.h),)
300 ASTCFLAGS+=-DPOLLCOMPAT
303 ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/dlfcn.h),)
305 ASTCFLAGS+=-DDLFCNCOMPAT
308 ifeq ($(OSARCH),Linux)
309 LIBS+=-ldl -lpthread $(EDITLINE_LIB) -lm -lresolv #-lnjamd
311 LIBS+=$(EDITLINE_LIB) -lm
314 ifeq ($(OSARCH),Darwin)
316 ASTCFLAGS+=-D__Darwin__
317 AUDIO_LIBS=-framework CoreAudio
319 SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
320 # Mac on Intel CoreDuo does not need poll compatibility layer
323 ASTCFLAGS+=-DPOLLCOMPAT
326 # These are used for all but Darwin
328 SOLINK=-shared -Xlinker -x
329 ifeq ($(findstring BSD,$(OSARCH)),BSD)
330 SOLINK+=-L$(CROSS_COMPILE_TARGET)/usr/local/lib
334 ifeq ($(OSARCH),FreeBSD)
338 ifeq ($(OSARCH),NetBSD)
339 LIBS+=-lpthread -lcrypto -lm -L$(CROSS_COMPILE_TARGET)/usr/pkg/lib $(EDITLINE_LIB)
342 ifeq ($(OSARCH),OpenBSD)
343 LIBS+=-lcrypto -lpthread -lm $(EDITLINE_LIB)
346 ifeq ($(OSARCH),SunOS)
347 LIBS+=-lpthread -ldl -lnsl -lsocket -lresolv -L$(CROSS_COMPILE_TARGET)/usr/local/ssl/lib
349 MENUSELECT_OBJS+=strcompat.o
351 SOLINK=-shared -fpic -L$(CROSS_COMPILE_TARGET)/usr/local/ssl/lib
354 ifeq ($(MAKETOPLEVEL),$(MAKELEVEL))
355 CFLAGS+=$(TOPDIR_CFLAGS)$(ASTCFLAGS)
358 # This is used when generating the doxygen documentation
366 @echo " +--------- Asterisk Build Complete ---------+"
367 @echo " + Asterisk has successfully been built, but +"
368 @echo " + cannot be run before being installed by +"
369 @echo " + running: +"
371 @echo " + make install +"
372 @echo " +-------------------------------------------+"
374 all: cleantest config.status menuselect.makeopts depend asterisk $(SUBDIRS)
377 @CFLAGS="$(MOD_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $@
380 @CFLAGS="$(OTHER_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $@
382 config.status: configure
383 @CFLAGS="" ./configure
385 @echo "**** The configure script was just executed, so 'make' needs to be"
386 @echo "**** restarted."
391 @CFLAGS="" ./configure
393 @echo "**** The configure script was just executed, so 'make' needs to be"
394 @echo "**** restarted."
398 menuselect.makeopts menuselect.makedeps: menuselect/menuselect makeopts.xml
399 menuselect/menuselect --check-deps ${GLOBAL_MAKEOPTS} ${USER_MAKEOPTS} menuselect.makeopts
401 #ifneq ($(wildcard tags),)
405 ifneq ($(wildcard TAGS),)
410 cd editline && unset CFLAGS LIBS && CFLAGS="$(OPTIMIZE)" ./configure ; \
413 cd editline && unset CFLAGS LIBS && test -f config.h || CFLAGS="$(OPTIMIZE)" ./configure
414 $(MAKE) -C editline libedit.a
417 $(MAKE) -C db1-ast libdb1.a
419 ifneq ($(wildcard .depend),)
423 ifneq ($(wildcard .tags-depend),)
427 ast_expr2.c ast_expr2.h:
428 bison -o $@ -d --name-prefix=ast_yy ast_expr2.y
431 flex -o $@ --full ast_expr2.fl
433 testexpr2: config.status include/asterisk/buildopts.h ast_expr2f.c ast_expr2.c ast_expr2.h
434 $(CC) -g -c -Iinclude -DSTANDALONE ast_expr2f.c
435 $(CC) -g -c -Iinclude -DSTANDALONE ast_expr2.c
436 $(CC) -g -o testexpr2 ast_expr2f.o ast_expr2.o
437 rm ast_expr2.o ast_expr2f.o
441 asterisk.8: asterisk.sgml
443 docbook2man asterisk.sgml
446 asterisk.pdf: asterisk.sgml
447 docbook2pdf asterisk.sgml
449 asterisk.ps: asterisk.sgml
450 docbook2ps asterisk.sgml
452 asterisk.html: asterisk.sgml
453 docbook2html asterisk.sgml
454 mv r1.html asterisk.html
456 asterisk.txt: asterisk.sgml
457 docbook2txt asterisk.sgml
460 @build_tools/make_defaults_h > $@.tmp
461 @if cmp -s $@.tmp $@ ; then : ; else \
466 include/asterisk/version.h:
467 @build_tools/make_version_h > $@.tmp
468 @if cmp -s $@.tmp $@ ; then : ; else \
473 include/asterisk/buildopts.h: menuselect.makeopts
474 @build_tools/make_buildopts_h > $@.tmp
475 @if cmp -s $@.tmp $@ ; then : ; else \
480 channel.o: CFLAGS+=$(ZAPTEL_INCLUDE)
482 asterisk: include/asterisk/buildopts.h editline/libedit.a db1-ast/libdb1.a $(OBJS)
483 build_tools/make_build_h > include/asterisk/build.h.tmp
484 if cmp -s include/asterisk/build.h.tmp include/asterisk/build.h ; then echo ; else \
485 mv include/asterisk/build.h.tmp include/asterisk/build.h ; \
487 rm -f include/asterisk/build.h.tmp
488 $(CC) -c -o buildinfo.o $(CFLAGS) buildinfo.c
489 $(CC) $(DEBUG) $(ASTOBJ) $(ASTLINK) $(OBJS) buildinfo.o $(LIBEDIT) db1-ast/libdb1.a $(LIBS)
492 $(CC) $(AUDIO_LIBS) -o muted muted.o
494 $(SUBDIRS_CLEAN_DEPEND):
495 @$(MAKE) -C $(@:-clean-depend=) clean-depend
498 @$(MAKE) -C $(@:-clean=) clean
500 clean-depend: $(SUBDIRS_CLEAN_DEPEND)
502 clean: $(SUBDIRS_CLEAN) clean-depend
503 rm -f *.o *.so asterisk
505 rm -f include/asterisk/build.h
506 rm -f include/asterisk/version.h
507 rm -f .tags-sources tags TAGS
508 rm -f .depend .tags-depend
509 @if [ -f editline/Makefile ]; then $(MAKE) -C editline distclean ; fi
510 @$(MAKE) -C db1-ast clean
511 @$(MAKE) -C stdtime clean
512 @$(MAKE) -C menuselect clean
514 distclean: dist-clean
517 @$(MAKE) -C mxml clean
518 @$(MAKE) -C menuselect dist-clean
519 @$(MAKE) -C sounds dist-clean
520 rm -f menuselect.makeopts makeopts makeopts.xml menuselect.makedeps
521 rm -f config.log config.status
522 rm -rf autom4te.cache
523 rm -f include/autoconfig.h
524 rm -f include/asterisk/buildopts.h
528 if [ x`$(ID) -un` = xroot ]; then sh build_tools/mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig; fi
529 # Should static HTTP be installed during make samples or even with its own target ala
530 # webvoicemail? There are portions here that *could* be customized but might also be
531 # improved a lot. I'll put it here for now.
532 mkdir -p $(DESTDIR)$(ASTDATADIR)/static-http
533 for x in static-http/*; do \
534 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/static-http ; \
536 mkdir -p $(DESTDIR)$(ASTDATADIR)/images
537 for x in images/*.jpg; do \
538 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/images ; \
540 mkdir -p $(DESTDIR)$(AGI_DIR)
541 $(MAKE) -C sounds install
544 @if [ -d .svn ]; then \
545 echo "Updating from Subversion..." ; \
546 svn update | tee update.out; \
548 if [ `grep -c ^C update.out` -gt 0 ]; then \
549 echo ; echo "The following files have conflicts:" ; \
550 grep ^C update.out | cut -b4- ; \
553 $(MAKE) clean-depend; \
555 echo "Not under version control"; \
558 NEWHEADERS=$(notdir $(wildcard include/asterisk/*.h))
559 OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h)))
562 mkdir -p $(DESTDIR)$(MODULES_DIR)
563 mkdir -p $(DESTDIR)$(ASTSBINDIR)
564 mkdir -p $(DESTDIR)$(ASTETCDIR)
565 mkdir -p $(DESTDIR)$(ASTBINDIR)
566 mkdir -p $(DESTDIR)$(ASTVARRUNDIR)
567 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail
568 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/dictate
569 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/system
570 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/tmp
571 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/meetme
572 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/monitor
573 if [ -f asterisk ]; then $(INSTALL) -m 755 asterisk $(DESTDIR)$(ASTSBINDIR)/; fi
574 if [ -f asterisk.dll ]; then $(INSTALL) -m 755 asterisk.dll $(DESTDIR)$(ASTSBINDIR)/; fi
575 $(LN) -sf asterisk $(DESTDIR)$(ASTSBINDIR)/rasterisk
576 $(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
577 $(INSTALL) -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/
578 if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \
579 cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;' > $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ;\
580 chmod 755 $(DESTDIR)$(ASTSBINDIR)/safe_asterisk;\
582 $(INSTALL) -d $(DESTDIR)$(ASTHEADERDIR)
583 $(INSTALL) -m 644 include/asterisk.h $(DESTDIR)$(includedir)
584 $(INSTALL) -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
585 if [ -n "$(OLDHEADERS)" ]; then \
586 rm -f $(addprefix $(DESTDIR)$(ASTHEADERDIR)/,$(OLDHEADERS)) ;\
588 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
589 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-custom
590 mkdir -p $(DESTDIR)$(ASTDATADIR)/keys
591 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware
592 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware/iax
593 mkdir -p $(DESTDIR)$(ASTMANDIR)/man8
594 $(INSTALL) -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTDATADIR)/keys
595 $(INSTALL) -m 644 keys/freeworlddialup.pub $(DESTDIR)$(ASTDATADIR)/keys
596 $(INSTALL) -m 644 asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
597 $(INSTALL) -m 644 contrib/scripts/astgenkey.8 $(DESTDIR)$(ASTMANDIR)/man8
598 $(INSTALL) -m 644 contrib/scripts/autosupport.8 $(DESTDIR)$(ASTMANDIR)/man8
599 $(INSTALL) -m 644 contrib/scripts/safe_asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
600 $(INSTALL) -m 644 contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTDATADIR)/firmware/iax/iaxy.bin; \
603 @$(MAKE) -C $(@:-install=) install
605 NEWMODS=$(notdir $(wildcard */*.so))
606 OLDMODS=$(filter-out $(NEWMODS),$(notdir $(wildcard $(DESTDIR)$(MODULES_DIR)/*.so)))
609 @if [ -n "$(OLDMODS)" ]; then \
610 echo " WARNING WARNING WARNING" ;\
612 echo " Your Asterisk modules directory, located at" ;\
613 echo " $(DESTDIR)$(MODULES_DIR)" ;\
614 echo " contains modules that were not installed by this " ;\
615 echo " version of Asterisk. Please ensure that these" ;\
616 echo " modules are compatible with this version before" ;\
617 echo " attempting to run Asterisk." ;\
619 for f in $(OLDMODS); do \
623 echo " WARNING WARNING WARNING" ;\
626 install: all datafiles bininstall $(SUBDIRS_INSTALL)
627 @if [ -x /usr/sbin/asterisk-post-install ]; then \
628 /usr/sbin/asterisk-post-install $(DESTDIR) . ; \
630 @echo " +---- Asterisk Installation Complete -------+"
632 @echo " + YOU MUST READ THE SECURITY DOCUMENT +"
634 @echo " + Asterisk has successfully been installed. +"
635 @echo " + If you would like to install the sample +"
636 @echo " + configuration files (overwriting any +"
637 @echo " + existing config files), run: +"
639 @echo " + $(MAKE) samples +"
641 @echo " +----------------- or ---------------------+"
643 @echo " + You can go ahead and install the asterisk +"
644 @echo " + program documentation now or later run: +"
646 @echo " + $(MAKE) progdocs +"
648 @echo " + **Note** This requires that you have +"
649 @echo " + doxygen installed on your local system +"
650 @echo " +-------------------------------------------+"
651 @$(MAKE) -s oldmodcheck
653 upgrade: all bininstall
656 mkdir -p $(DESTDIR)$(ASTETCDIR)
657 for x in configs/*.adsi; do \
658 if [ ! -f $(DESTDIR)$(ASTETCDIR)/$$x ]; then \
659 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x` ; \
664 mkdir -p $(DESTDIR)$(ASTETCDIR)
665 for x in configs/*.sample; do \
666 if [ -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ]; then \
667 if [ "$(OVERWRITE)" = "y" ]; then \
668 if cmp -s $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $$x ; then \
669 echo "Config file $$x is unchanged"; \
672 mv -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample`.old ; \
674 echo "Skipping config file $$x"; \
678 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ;\
680 if [ "$(OVERWRITE)" = "y" ] || [ ! -f $(DESTDIR)$(ASTCONFPATH) ]; then \
682 echo "[directories]" ; \
683 echo "astetcdir => $(ASTETCDIR)" ; \
684 echo "astmoddir => $(MODULES_DIR)" ; \
685 echo "astvarlibdir => $(ASTVARLIBDIR)" ; \
686 echo "astdatadir => $(ASTDATADIR)" ; \
687 echo "astagidir => $(AGI_DIR)" ; \
688 echo "astspooldir => $(ASTSPOOLDIR)" ; \
689 echo "astrundir => $(ASTVARRUNDIR)" ; \
690 echo "astlogdir => $(ASTLOGDIR)" ; \
692 echo "; Changing the following lines may compromise your security." ; \
694 echo ";astctlpermissions = 0660" ; \
695 echo ";astctlowner = root" ; \
696 echo ";astctlgroup = apache" ; \
697 echo ";astctl = asterisk.ctl" ; \
698 echo ";[options]" ; \
699 echo ";internal_timing = yes" ; \
700 ) > $(DESTDIR)$(ASTCONFPATH) ; \
702 echo "Skipping asterisk.conf creation"; \
704 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
705 :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm
706 for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isunavail; do \
707 cat $(DESTDIR)$(ASTDATADIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm ; \
709 :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm
710 for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isonphone; do \
711 cat $(DESTDIR)$(ASTDATADIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm ; \
715 @[ -d $(DESTDIR)$(HTTP_DOCSDIR)/ ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 )
716 @[ -d $(DESTDIR)$(HTTP_CGIDIR) ] || ( printf "cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit 1 )
717 $(INSTALL) -m 4755 -o root -g root contrib/scripts/vmail.cgi $(DESTDIR)$(HTTP_CGIDIR)/vmail.cgi
718 mkdir -p $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk
719 for x in images/*.gif; do \
720 $(INSTALL) -m 644 $$x $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk/; \
722 @echo " +--------- Asterisk Web Voicemail ----------+"
724 @echo " + Asterisk Web Voicemail is installed in +"
725 @echo " + your cgi-bin directory: +"
726 @echo " + $(DESTDIR)$(HTTP_CGIDIR)"
727 @echo " + IT USES A SETUID ROOT PERL SCRIPT, SO +"
728 @echo " + IF YOU DON'T LIKE THAT, UNINSTALL IT! +"
730 @echo " + Other static items have been stored in: +"
731 @echo " + $(DESTDIR)$(HTTP_DOCSDIR)"
733 @echo " + If these paths do not match your httpd +"
734 @echo " + installation, correct the definitions +"
735 @echo " + in your Makefile of HTTP_CGIDIR and +"
736 @echo " + HTTP_DOCSDIR +"
738 @echo " +-------------------------------------------+"
741 sed "s/^Version:.*/Version: $(RPMVERSION)/g" redhat/asterisk.spec > asterisk.spec ; \
745 __rpm: include/asterisk/version.h include/asterisk/buildopts.h spec
746 rm -rf /tmp/asterisk ; \
747 mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
748 $(MAKE) DESTDIR=/tmp/asterisk install ; \
749 $(MAKE) DESTDIR=/tmp/asterisk samples ; \
750 mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
751 cp -f contrib/init.d/rc.redhat.asterisk /tmp/asterisk/etc/rc.d/init.d/asterisk ; \
752 rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec
755 (cat contrib/asterisk-ng-doxygen; echo "HAVE_DOT=$(HAVEDOT)"; \
756 echo "PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen -
759 @if [ "${OSARCH}" = "Linux" ]; then \
760 if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \
761 $(INSTALL) -m 755 contrib/init.d/rc.redhat.asterisk /etc/rc.d/init.d/asterisk; \
762 /sbin/chkconfig --add asterisk; \
763 elif [ -f /etc/debian_version ]; then \
764 $(INSTALL) -m 755 contrib/init.d/rc.debian.asterisk /etc/init.d/asterisk; \
765 /usr/sbin/update-rc.d asterisk start 10 2 3 4 5 . stop 91 2 3 4 5 .; \
766 elif [ -f /etc/gentoo-release ]; then \
767 $(INSTALL) -m 755 contrib/init.d/rc.gentoo.asterisk /etc/init.d/asterisk; \
768 /sbin/rc-update add asterisk default; \
769 elif [ -f /etc/mandrake-release ]; then \
770 $(INSTALL) -m 755 contrib/init.d/rc.mandrake.asterisk /etc/rc.d/init.d/asterisk; \
771 /sbin/chkconfig --add asterisk; \
772 elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then \
773 $(INSTALL) -m 755 contrib/init.d/rc.suse.asterisk /etc/init.d/asterisk; \
774 /sbin/chkconfig --add asterisk; \
775 elif [ -f /etc/slackware-version ]; then \
776 echo "Slackware is not currently supported, although an init script does exist for it." \
778 echo "We could not install init scripts for your distribution."; \
781 echo "We could not install init scripts for your operating system."; \
786 valgrind: dont-optimize
788 $(MOD_SUBDIRS_DEPEND):
789 @CFLAGS="$(MOD_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $(@:-depend=) depend
791 $(OTHER_SUBDIRS_DEPEND):
792 @CFLAGS="$(OTHER_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $(@:-depend=) depend
794 depend: include/asterisk/version.h include/asterisk/buildopts.h .depend defaults.h $(SUBDIRS_DEPEND)
796 .depend: include/asterisk/version.h include/asterisk/buildopts.h defaults.h
797 build_tools/mkdep $(CFLAGS) $(wildcard *.c)
800 @echo -n ".tags-depend: " > $@
801 @$(FIND) . -maxdepth 1 -name \*.c -printf "\t%p \\\\\n" >> $@
802 @$(FIND) . -maxdepth 1 -name \*.h -printf "\t%p \\\\\n" >> $@
803 @$(FIND) $(SUBDIRS) -name \*.c -printf "\t%p \\\\\n" >> $@
804 @$(FIND) $(SUBDIRS) -name \*.h -printf "\t%p \\\\\n" >> $@
805 @$(FIND) include -name \*.h -printf "\t%p \\\\\n" >> $@
810 @$(FIND) . -maxdepth 1 -name \*.c -print >> $@
811 @$(FIND) . -maxdepth 1 -name \*.h -print >> $@
812 @$(FIND) $(SUBDIRS) -name \*.c -print >> $@
813 @$(FIND) $(SUBDIRS) -name \*.h -print >> $@
814 @$(FIND) include -name \*.h -print >> $@
816 tags: .tags-depend .tags-sources
817 ctags -L .tags-sources -o $@
821 TAGS: .tags-depend .tags-sources
822 etags -o $@ `cat .tags-sources`
827 $(MAKE) -C $(shell echo $@ | sed "s/_env//g") env
830 $(MAKE) -C sounds all
835 # If the cleancount has been changed, force a make clean.
836 # .cleancount is the global clean count, and .lastclean is the
837 # last clean count we had
840 @if cmp -s .cleancount .lastclean ; then echo ; else \
841 $(MAKE) clean; cp -f .cleancount .lastclean;\
845 $(SUBDIRS_UNINSTALL):
846 @$(MAKE) -C $(@:-uninstall=) uninstall
848 _uninstall: $(SUBDIRS_UNINSTALL)
849 rm -f $(DESTDIR)$(MODULES_DIR)/*
850 rm -f $(DESTDIR)$(ASTSBINDIR)/*asterisk*
851 rm -f $(DESTDIR)$(ASTSBINDIR)/astgenkey
852 rm -f $(DESTDIR)$(ASTSBINDIR)/autosupport
853 rm -rf $(DESTDIR)$(ASTHEADERDIR)
854 rm -rf $(DESTDIR)$(ASTDATADIR)/firmware
855 rm -rf $(DESTDIR)$(ASTMANDIR)/man8
856 $(MAKE) -C sounds uninstall
858 uninstall: _uninstall
859 @echo " +--------- Asterisk Uninstall Complete -----+"
860 @echo " + Asterisk binaries, sounds, man pages, +"
861 @echo " + headers, modules, and firmware builds, +"
862 @echo " + have all been uninstalled. +"
864 @echo " + To remove ALL traces of Asterisk, +"
865 @echo " + including configuration, spool +"
866 @echo " + directories, and logs, run the following +"
867 @echo " + command: +"
869 @echo " + $(MAKE) uninstall-all +"
870 @echo " +-------------------------------------------+"
872 uninstall-all: _uninstall
873 rm -rf $(DESTDIR)$(ASTLIBDIR)
874 rm -rf $(DESTDIR)$(ASTVARLIBDIR)
875 rm -rf $(DESTDIR)$(ASTDATADIR)
876 rm -rf $(DESTDIR)$(ASTSPOOLDIR)
877 rm -rf $(DESTDIR)$(ASTETCDIR)
878 rm -rf $(DESTDIR)$(ASTLOGDIR)
880 menuselect: menuselect/menuselect makeopts.xml
881 -@menuselect/menuselect ${GLOBAL_MAKEOPTS} ${USER_MAKEOPTS} menuselect.makeopts && echo "menuselect changes saved!" || echo "menuselect changes NOT saved!"
883 menuselect/menuselect: menuselect/menuselect.c menuselect/menuselect_curses.c menuselect/menuselect.h menuselect/linkedlists.h config.status mxml/libmxml.a $(MENUSELECT_OBJS)
884 @CFLAGS="-include $(PWD)/include/asterisk/autoconfig.h" PARENTSRC="$(PWD)" $(MAKE) -C menuselect menuselect
887 @cd mxml && unset CFLAGS LIBS && test -f config.h || ./configure
888 $(MAKE) -C mxml libmxml.a
890 makeopts.xml: $(foreach dir,$(MOD_SUBDIRS),$(dir)/*.c) build_tools/cflags.xml sounds/sounds.xml
891 @echo "Generating list of available modules ..."
892 @build_tools/prep_moduledeps > $@
894 .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)