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) .)
137 MENUSELECT_CFLAGS?=$(shell grep MENUSELECT_CFLAGS $(GLOBAL_MAKEOPTS) .)
138 ifneq ($(MENUSELECT_CFLAGS),)
139 MENUSELECT_CFLAGS:=$(shell echo $(MENUSELECT_CFLAGS) | cut -f2 -d'=')
143 ifeq ($(findstring dont-optimize,$(MAKECMDGOALS)),$(findstring DONT_OPTIMIZE,$(MENUSELECT_CFLAGS)))
144 # More GSM codec optimization
145 # Uncomment to enable MMXTM optimizations for x86 architecture CPU's
146 # which support MMX instructions. This should be newer pentiums,
147 # ppro's, etc, as well as the AMD K6 and K7.
150 # Tell gcc to optimize the code
153 # Stack backtraces, while useful for debugging, are incompatible with optimizations
154 ifeq ($(OSARCH),Linux)
155 CFLAGS+=-DSTACK_BACKTRACES
159 # *CLI> show memory allocations [filename]
160 # *CLI> show memory summary [filename]
161 ifneq ($(findstring MALLOC_DEBUG,$(MENUSELECT_CFLAGS)),)
162 TOPDIR_CFLAGS+=-include include/asterisk/astmm.h
163 MOD_SUBDIR_CFLAGS+=-include ../include/asterisk/astmm.h
166 MOD_SUBDIR_CFLAGS+=-fPIC
168 ifeq ($(OSARCH),Linux)
169 ifeq ($(PROC),x86_64)
170 # You must have GCC 3.4 to use k8, otherwise use athlon
175 ifeq ($(PROC),sparc64)
176 #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
177 #This works for even old (2.96) versions of gcc and provides a small boost either way.
178 #A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
179 #So we go lowest common available by gcc and go a step down, still a step up from
180 #the default as we now have a better instruction set to work with. - Belgarath
182 OPTIONS+=$(shell if $(CC) -mtune=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mtune=$(PROC)"; fi)
183 OPTIONS+=$(shell if $(CC) -mcpu=v8 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mcpu=v8"; fi)
184 OPTIONS+=-fomit-frame-pointer
188 # The Cirrus logic is the only heavily shipping arm processor with a real floating point unit
189 ifeq ($(SUB_PROC),maverick)
190 OPTIONS+=-fsigned-char -mcpu=ep9312
192 ifeq ($(SUB_PROC),xscale)
193 OPTIONS+=-fsigned-char -mcpu=xscale
195 OPTIONS+=-fsigned-char
204 ifeq ($(OSARCH),SunOS)
205 GREP=/usr/xpg4/bin/grep
210 ASTCFLAGS+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG)
212 ASTCFLAGS+=$(OPTIMIZE)
215 ifeq ($(AST_DEVMODE),yes)
216 ASTCFLAGS+=-Werror -Wunused
219 ifeq ($(shell gcc -v 2>&1 | grep 'gcc version' | cut -f3 -d' ' | cut -f1 -d.),4)
220 ASTCFLAGS+=-Wno-pointer-sign
224 ifeq ($(findstring BSD,$(OSARCH)),BSD)
225 ASTCFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include -L$(CROSS_COMPILE_TARGET)/usr/local/lib
228 ifneq ($(PROC),ultrasparc)
229 ASTCFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
233 ASTCFLAGS+=-fsigned-char
236 ifeq ($(OSARCH),FreeBSD)
237 BSDVERSION=$(shell make -V OSVERSION -f $(CROSS_COMPILE_TARGET)/usr/share/mk/bsd.port.subdir.mk)
238 ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
239 LIBS+=$(shell if test $(BSDVERSION) -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi)
242 ifeq ($(OSARCH),NetBSD)
243 AST_CFLAGS+=-pthread -I$(CROSS_COMPILE_TARGET)/usr/pkg/include
246 ifeq ($(OSARCH),OpenBSD)
250 ifeq ($(OSARCH),SunOS)
251 ASTCFLAGS+=-Wcast-align -DSOLARIS -Iinclude/solaris-compat -I$(CROSS_COMPILE_TARGET)/usr/local/ssl/include
254 LIBEDIT=editline/libedit.a
256 ASTERISKVERSION:=$(shell build_tools/make_version .)
258 ifneq ($(wildcard .version),)
259 ASTERISKVERSIONNUM:=$(shell awk -F. '{printf "%02d%02d%02d", $$1, $$2, $$3}' .version)
260 RPMVERSION:=$(shell sed 's/[-\/:]/_/g' .version)
265 ifneq ($(wildcard .svn),)
266 ASTERISKVERSIONNUM=999999
269 ASTCFLAGS+=$(MALLOC_DEBUG)$(BUSYDETECT)$(OPTIONS)
271 MOD_SUBDIRS:=res channels pbx apps codecs formats cdr funcs
272 OTHER_SUBDIRS:=utils agi
273 SUBDIRS:=$(MOD_SUBDIRS) $(OTHER_SUBDIRS)
274 SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)
275 SUBDIRS_CLEAN:=$(SUBDIRS:%=%-clean)
276 SUBDIRS_CLEAN_DEPEND:=$(SUBDIRS:%=%-clean-depend)
277 MOD_SUBDIRS_DEPEND:=$(MOD_SUBDIRS:%=%-depend)
278 OTHER_SUBDIRS_DEPEND:=$(OTHER_SUBDIRS:%=%-depend)
279 SUBDIRS_DEPEND:=$(MOD_SUBDIRS_DEPEND) $(OTHER_SUBDIRS_DEPEND)
280 SUBDIRS_UNINSTALL:=$(SUBDIRS:%=%-uninstall)
282 OBJS=io.o sched.o logger.o frame.o loader.o config.o channel.o \
283 translate.o file.o pbx.o cli.o md5.o term.o \
284 ulaw.o alaw.o callerid.o fskmodem.o image.o app.o \
285 cdr.o tdd.o acl.o rtp.o udptl.o manager.o asterisk.o \
286 dsp.o chanvars.o indications.o autoservice.o db.o privacy.o \
287 astmm.o enum.o srv.o dns.o aescrypt.o aestab.o aeskey.o \
288 utils.o plc.o jitterbuf.o dnsmgr.o devicestate.o \
289 netsock.o slinfactory.o ast_expr2.o ast_expr2f.o \
290 cryptostub.o sha1.o http.o fixedjitterbuf.o abstract_jb.o
292 # we need to link in the objects statically, not as a library, because
293 # otherwise modules will not have them available if none of the static
295 OBJS+=stdtime/localtime.o
297 # At the moment say.o is an optional component which can be overridden
301 ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/sys/poll.h),)
303 ASTCFLAGS+=-DPOLLCOMPAT
306 ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/dlfcn.h),)
308 ASTCFLAGS+=-DDLFCNCOMPAT
311 ifeq ($(OSARCH),Linux)
312 LIBS+=-ldl -lpthread $(EDITLINE_LIB) -lm -lresolv #-lnjamd
314 LIBS+=$(EDITLINE_LIB) -lm
317 ifeq ($(OSARCH),Darwin)
319 ASTCFLAGS+=-D__Darwin__
320 AUDIO_LIBS=-framework CoreAudio
322 SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
323 # Mac on Intel CoreDuo does not need poll compatibility layer
326 ASTCFLAGS+=-DPOLLCOMPAT
329 # These are used for all but Darwin
331 SOLINK=-shared -Xlinker -x
332 ifeq ($(findstring BSD,$(OSARCH)),BSD)
333 SOLINK+=-L$(CROSS_COMPILE_TARGET)/usr/local/lib
337 ifeq ($(OSARCH),FreeBSD)
341 ifeq ($(OSARCH),NetBSD)
342 LIBS+=-lpthread -lcrypto -lm -L$(CROSS_COMPILE_TARGET)/usr/pkg/lib $(EDITLINE_LIB)
345 ifeq ($(OSARCH),OpenBSD)
346 LIBS+=-lcrypto -lpthread -lm $(EDITLINE_LIB)
349 ifeq ($(OSARCH),SunOS)
350 LIBS+=-lpthread -ldl -lnsl -lsocket -lresolv -L$(CROSS_COMPILE_TARGET)/usr/local/ssl/lib
352 MENUSELECT_OBJS+=strcompat.o
354 SOLINK=-shared -fpic -L$(CROSS_COMPILE_TARGET)/usr/local/ssl/lib
357 ifeq ($(MAKETOPLEVEL),$(MAKELEVEL))
358 CFLAGS+=$(TOPDIR_CFLAGS)$(ASTCFLAGS)
361 # This is used when generating the doxygen documentation
369 @echo " +--------- Asterisk Build Complete ---------+"
370 @echo " + Asterisk has successfully been built, but +"
371 @echo " + cannot be run before being installed by +"
372 @echo " + running: +"
374 @echo " + make install +"
375 @echo " +-------------------------------------------+"
377 all: cleantest config.status menuselect.makeopts depend asterisk $(SUBDIRS)
380 @CFLAGS="$(MOD_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $@
383 @CFLAGS="$(OTHER_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $@
385 config.status: configure
386 @CFLAGS="" ./configure
388 @echo "**** The configure script was just executed, so 'make' needs to be"
389 @echo "**** restarted."
394 @CFLAGS="" ./configure
396 @echo "**** The configure script was just executed, so 'make' needs to be"
397 @echo "**** restarted."
401 menuselect.makeopts menuselect.makedeps: menuselect/menuselect makeopts.xml
402 menuselect/menuselect --check-deps ${GLOBAL_MAKEOPTS} ${USER_MAKEOPTS} menuselect.makeopts
404 #ifneq ($(wildcard tags),)
408 ifneq ($(wildcard TAGS),)
413 cd editline && unset CFLAGS LIBS && CFLAGS="$(OPTIMIZE)" ./configure ; \
416 cd editline && unset CFLAGS LIBS && test -f config.h || CFLAGS="$(OPTIMIZE)" ./configure
417 $(MAKE) -C editline libedit.a
420 $(MAKE) -C db1-ast libdb1.a
422 ifneq ($(wildcard .depend),)
426 ifneq ($(wildcard .tags-depend),)
430 ast_expr2.c ast_expr2.h:
431 bison -o $@ -d --name-prefix=ast_yy ast_expr2.y
434 flex -o $@ --full ast_expr2.fl
436 testexpr2: config.status include/asterisk/buildopts.h ast_expr2f.c ast_expr2.c ast_expr2.h
437 $(CC) -g -c -Iinclude -DSTANDALONE ast_expr2f.c
438 $(CC) -g -c -Iinclude -DSTANDALONE ast_expr2.c
439 $(CC) -g -o testexpr2 ast_expr2f.o ast_expr2.o
440 rm ast_expr2.o ast_expr2f.o
444 asterisk.8: asterisk.sgml
446 docbook2man asterisk.sgml
449 asterisk.pdf: asterisk.sgml
450 docbook2pdf asterisk.sgml
452 asterisk.ps: asterisk.sgml
453 docbook2ps asterisk.sgml
455 asterisk.html: asterisk.sgml
456 docbook2html asterisk.sgml
457 mv r1.html asterisk.html
459 asterisk.txt: asterisk.sgml
460 docbook2txt asterisk.sgml
463 @build_tools/make_defaults_h > $@.tmp
464 @if cmp -s $@.tmp $@ ; then : ; else \
469 include/asterisk/version.h:
470 @build_tools/make_version_h > $@.tmp
471 @if cmp -s $@.tmp $@ ; then : ; else \
476 include/asterisk/buildopts.h: menuselect.makeopts
477 @build_tools/make_buildopts_h > $@.tmp
478 @if cmp -s $@.tmp $@ ; then : ; else \
483 channel.o: CFLAGS+=$(ZAPTEL_INCLUDE)
485 asterisk: include/asterisk/buildopts.h editline/libedit.a db1-ast/libdb1.a $(OBJS)
486 build_tools/make_build_h > include/asterisk/build.h.tmp
487 if cmp -s include/asterisk/build.h.tmp include/asterisk/build.h ; then echo ; else \
488 mv include/asterisk/build.h.tmp include/asterisk/build.h ; \
490 rm -f include/asterisk/build.h.tmp
491 $(CC) -c -o buildinfo.o $(CFLAGS) buildinfo.c
492 $(CC) $(DEBUG) $(ASTOBJ) $(ASTLINK) $(OBJS) buildinfo.o $(LIBEDIT) db1-ast/libdb1.a $(LIBS)
495 $(CC) $(AUDIO_LIBS) -o muted muted.o
497 $(SUBDIRS_CLEAN_DEPEND):
498 @$(MAKE) -C $(@:-clean-depend=) clean-depend
501 @$(MAKE) -C $(@:-clean=) clean
503 clean-depend: $(SUBDIRS_CLEAN_DEPEND)
505 clean: $(SUBDIRS_CLEAN) clean-depend
506 rm -f *.o *.so asterisk
508 rm -f include/asterisk/build.h
509 rm -f include/asterisk/version.h
510 rm -f .tags-sources tags TAGS
511 rm -f .depend .tags-depend
512 @if [ -f editline/Makefile ]; then $(MAKE) -C editline distclean ; fi
513 @$(MAKE) -C db1-ast clean
514 @$(MAKE) -C stdtime clean
515 @$(MAKE) -C menuselect clean
517 distclean: dist-clean
520 @$(MAKE) -C mxml clean
521 @$(MAKE) -C menuselect dist-clean
522 @$(MAKE) -C sounds dist-clean
523 rm -f menuselect.makeopts makeopts makeopts.xml menuselect.makedeps
524 rm -f config.log config.status
525 rm -rf autom4te.cache
526 rm -f include/autoconfig.h
527 rm -f include/asterisk/buildopts.h
531 if [ x`$(ID) -un` = xroot ]; then sh build_tools/mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig; fi
532 # Should static HTTP be installed during make samples or even with its own target ala
533 # webvoicemail? There are portions here that *could* be customized but might also be
534 # improved a lot. I'll put it here for now.
535 mkdir -p $(DESTDIR)$(ASTDATADIR)/static-http
536 for x in static-http/*; do \
537 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/static-http ; \
539 mkdir -p $(DESTDIR)$(ASTDATADIR)/images
540 for x in images/*.jpg; do \
541 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/images ; \
543 mkdir -p $(DESTDIR)$(AGI_DIR)
544 $(MAKE) -C sounds install
547 @if [ -d .svn ]; then \
548 echo "Updating from Subversion..." ; \
549 svn update | tee update.out; \
551 if [ `grep -c ^C update.out` -gt 0 ]; then \
552 echo ; echo "The following files have conflicts:" ; \
553 grep ^C update.out | cut -b4- ; \
556 $(MAKE) clean-depend; \
558 echo "Not under version control"; \
561 NEWHEADERS=$(notdir $(wildcard include/asterisk/*.h))
562 OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h)))
565 mkdir -p $(DESTDIR)$(MODULES_DIR)
566 mkdir -p $(DESTDIR)$(ASTSBINDIR)
567 mkdir -p $(DESTDIR)$(ASTETCDIR)
568 mkdir -p $(DESTDIR)$(ASTBINDIR)
569 mkdir -p $(DESTDIR)$(ASTVARRUNDIR)
570 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail
571 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/dictate
572 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/system
573 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/tmp
574 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/meetme
575 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/monitor
576 if [ -f asterisk ]; then $(INSTALL) -m 755 asterisk $(DESTDIR)$(ASTSBINDIR)/; fi
577 if [ -f asterisk.dll ]; then $(INSTALL) -m 755 asterisk.dll $(DESTDIR)$(ASTSBINDIR)/; fi
578 $(LN) -sf asterisk $(DESTDIR)$(ASTSBINDIR)/rasterisk
579 $(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
580 $(INSTALL) -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/
581 if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \
582 cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;' > $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ;\
583 chmod 755 $(DESTDIR)$(ASTSBINDIR)/safe_asterisk;\
585 $(INSTALL) -d $(DESTDIR)$(ASTHEADERDIR)
586 $(INSTALL) -m 644 include/asterisk.h $(DESTDIR)$(includedir)
587 $(INSTALL) -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
588 if [ -n "$(OLDHEADERS)" ]; then \
589 rm -f $(addprefix $(DESTDIR)$(ASTHEADERDIR)/,$(OLDHEADERS)) ;\
591 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
592 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-custom
593 mkdir -p $(DESTDIR)$(ASTDATADIR)/keys
594 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware
595 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware/iax
596 mkdir -p $(DESTDIR)$(ASTMANDIR)/man8
597 $(INSTALL) -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTDATADIR)/keys
598 $(INSTALL) -m 644 keys/freeworlddialup.pub $(DESTDIR)$(ASTDATADIR)/keys
599 $(INSTALL) -m 644 asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
600 $(INSTALL) -m 644 contrib/scripts/astgenkey.8 $(DESTDIR)$(ASTMANDIR)/man8
601 $(INSTALL) -m 644 contrib/scripts/autosupport.8 $(DESTDIR)$(ASTMANDIR)/man8
602 $(INSTALL) -m 644 contrib/scripts/safe_asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
603 $(INSTALL) -m 644 contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTDATADIR)/firmware/iax/iaxy.bin; \
606 @$(MAKE) -C $(@:-install=) install
608 NEWMODS=$(notdir $(wildcard */*.so))
609 OLDMODS=$(filter-out $(NEWMODS),$(notdir $(wildcard $(DESTDIR)$(MODULES_DIR)/*.so)))
612 @if [ -n "$(OLDMODS)" ]; then \
613 echo " WARNING WARNING WARNING" ;\
615 echo " Your Asterisk modules directory, located at" ;\
616 echo " $(DESTDIR)$(MODULES_DIR)" ;\
617 echo " contains modules that were not installed by this " ;\
618 echo " version of Asterisk. Please ensure that these" ;\
619 echo " modules are compatible with this version before" ;\
620 echo " attempting to run Asterisk." ;\
622 for f in $(OLDMODS); do \
626 echo " WARNING WARNING WARNING" ;\
629 install: all datafiles bininstall $(SUBDIRS_INSTALL)
630 @if [ -x /usr/sbin/asterisk-post-install ]; then \
631 /usr/sbin/asterisk-post-install $(DESTDIR) . ; \
633 @echo " +---- Asterisk Installation Complete -------+"
635 @echo " + YOU MUST READ THE SECURITY DOCUMENT +"
637 @echo " + Asterisk has successfully been installed. +"
638 @echo " + If you would like to install the sample +"
639 @echo " + configuration files (overwriting any +"
640 @echo " + existing config files), run: +"
642 @echo " + $(MAKE) samples +"
644 @echo " +----------------- or ---------------------+"
646 @echo " + You can go ahead and install the asterisk +"
647 @echo " + program documentation now or later run: +"
649 @echo " + $(MAKE) progdocs +"
651 @echo " + **Note** This requires that you have +"
652 @echo " + doxygen installed on your local system +"
653 @echo " +-------------------------------------------+"
654 @$(MAKE) -s oldmodcheck
656 upgrade: all bininstall
659 mkdir -p $(DESTDIR)$(ASTETCDIR)
660 for x in configs/*.adsi; do \
661 if [ ! -f $(DESTDIR)$(ASTETCDIR)/$$x ]; then \
662 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x` ; \
667 mkdir -p $(DESTDIR)$(ASTETCDIR)
668 for x in configs/*.sample; do \
669 if [ -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ]; then \
670 if [ "$(OVERWRITE)" = "y" ]; then \
671 if cmp -s $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $$x ; then \
672 echo "Config file $$x is unchanged"; \
675 mv -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample`.old ; \
677 echo "Skipping config file $$x"; \
681 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ;\
683 if [ "$(OVERWRITE)" = "y" ] || [ ! -f $(DESTDIR)$(ASTCONFPATH) ]; then \
685 echo "[directories]" ; \
686 echo "astetcdir => $(ASTETCDIR)" ; \
687 echo "astmoddir => $(MODULES_DIR)" ; \
688 echo "astvarlibdir => $(ASTVARLIBDIR)" ; \
689 echo "astdatadir => $(ASTDATADIR)" ; \
690 echo "astagidir => $(AGI_DIR)" ; \
691 echo "astspooldir => $(ASTSPOOLDIR)" ; \
692 echo "astrundir => $(ASTVARRUNDIR)" ; \
693 echo "astlogdir => $(ASTLOGDIR)" ; \
695 echo "; Changing the following lines may compromise your security." ; \
697 echo ";astctlpermissions = 0660" ; \
698 echo ";astctlowner = root" ; \
699 echo ";astctlgroup = apache" ; \
700 echo ";astctl = asterisk.ctl" ; \
701 echo ";[options]" ; \
702 echo ";internal_timing = yes" ; \
703 ) > $(DESTDIR)$(ASTCONFPATH) ; \
705 echo "Skipping asterisk.conf creation"; \
707 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
708 :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm
709 for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isunavail; do \
710 cat $(DESTDIR)$(ASTDATADIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm ; \
712 :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm
713 for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isonphone; do \
714 cat $(DESTDIR)$(ASTDATADIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm ; \
718 @[ -d $(DESTDIR)$(HTTP_DOCSDIR)/ ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 )
719 @[ -d $(DESTDIR)$(HTTP_CGIDIR) ] || ( printf "cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit 1 )
720 $(INSTALL) -m 4755 -o root -g root contrib/scripts/vmail.cgi $(DESTDIR)$(HTTP_CGIDIR)/vmail.cgi
721 mkdir -p $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk
722 for x in images/*.gif; do \
723 $(INSTALL) -m 644 $$x $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk/; \
725 @echo " +--------- Asterisk Web Voicemail ----------+"
727 @echo " + Asterisk Web Voicemail is installed in +"
728 @echo " + your cgi-bin directory: +"
729 @echo " + $(DESTDIR)$(HTTP_CGIDIR)"
730 @echo " + IT USES A SETUID ROOT PERL SCRIPT, SO +"
731 @echo " + IF YOU DON'T LIKE THAT, UNINSTALL IT! +"
733 @echo " + Other static items have been stored in: +"
734 @echo " + $(DESTDIR)$(HTTP_DOCSDIR)"
736 @echo " + If these paths do not match your httpd +"
737 @echo " + installation, correct the definitions +"
738 @echo " + in your Makefile of HTTP_CGIDIR and +"
739 @echo " + HTTP_DOCSDIR +"
741 @echo " +-------------------------------------------+"
744 sed "s/^Version:.*/Version: $(RPMVERSION)/g" redhat/asterisk.spec > asterisk.spec ; \
748 __rpm: include/asterisk/version.h include/asterisk/buildopts.h spec
749 rm -rf /tmp/asterisk ; \
750 mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
751 $(MAKE) DESTDIR=/tmp/asterisk install ; \
752 $(MAKE) DESTDIR=/tmp/asterisk samples ; \
753 mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
754 cp -f contrib/init.d/rc.redhat.asterisk /tmp/asterisk/etc/rc.d/init.d/asterisk ; \
755 rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec
758 (cat contrib/asterisk-ng-doxygen; echo "HAVE_DOT=$(HAVEDOT)"; \
759 echo "PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen -
762 @if [ "${OSARCH}" = "Linux" ]; then \
763 if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \
764 $(INSTALL) -m 755 contrib/init.d/rc.redhat.asterisk /etc/rc.d/init.d/asterisk; \
765 /sbin/chkconfig --add asterisk; \
766 elif [ -f /etc/debian_version ]; then \
767 $(INSTALL) -m 755 contrib/init.d/rc.debian.asterisk /etc/init.d/asterisk; \
768 /usr/sbin/update-rc.d asterisk start 10 2 3 4 5 . stop 91 2 3 4 5 .; \
769 elif [ -f /etc/gentoo-release ]; then \
770 $(INSTALL) -m 755 contrib/init.d/rc.gentoo.asterisk /etc/init.d/asterisk; \
771 /sbin/rc-update add asterisk default; \
772 elif [ -f /etc/mandrake-release ]; then \
773 $(INSTALL) -m 755 contrib/init.d/rc.mandrake.asterisk /etc/rc.d/init.d/asterisk; \
774 /sbin/chkconfig --add asterisk; \
775 elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then \
776 $(INSTALL) -m 755 contrib/init.d/rc.suse.asterisk /etc/init.d/asterisk; \
777 /sbin/chkconfig --add asterisk; \
778 elif [ -f /etc/slackware-version ]; then \
779 echo "Slackware is not currently supported, although an init script does exist for it." \
781 echo "We could not install init scripts for your distribution."; \
784 echo "We could not install init scripts for your operating system."; \
789 valgrind: dont-optimize
791 $(MOD_SUBDIRS_DEPEND):
792 @CFLAGS="$(MOD_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $(@:-depend=) depend
794 $(OTHER_SUBDIRS_DEPEND):
795 @CFLAGS="$(OTHER_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $(@:-depend=) depend
797 depend: include/asterisk/version.h include/asterisk/buildopts.h .depend defaults.h $(SUBDIRS_DEPEND)
799 .depend: include/asterisk/version.h include/asterisk/buildopts.h defaults.h
800 build_tools/mkdep $(CFLAGS) $(wildcard *.c)
803 @echo -n ".tags-depend: " > $@
804 @$(FIND) . -maxdepth 1 -name \*.c -printf "\t%p \\\\\n" >> $@
805 @$(FIND) . -maxdepth 1 -name \*.h -printf "\t%p \\\\\n" >> $@
806 @$(FIND) $(SUBDIRS) -name \*.c -printf "\t%p \\\\\n" >> $@
807 @$(FIND) $(SUBDIRS) -name \*.h -printf "\t%p \\\\\n" >> $@
808 @$(FIND) include -name \*.h -printf "\t%p \\\\\n" >> $@
813 @$(FIND) . -maxdepth 1 -name \*.c -print >> $@
814 @$(FIND) . -maxdepth 1 -name \*.h -print >> $@
815 @$(FIND) $(SUBDIRS) -name \*.c -print >> $@
816 @$(FIND) $(SUBDIRS) -name \*.h -print >> $@
817 @$(FIND) include -name \*.h -print >> $@
819 tags: .tags-depend .tags-sources
820 ctags -L .tags-sources -o $@
824 TAGS: .tags-depend .tags-sources
825 etags -o $@ `cat .tags-sources`
830 $(MAKE) -C $(shell echo $@ | sed "s/_env//g") env
833 $(MAKE) -C sounds all
838 # If the cleancount has been changed, force a make clean.
839 # .cleancount is the global clean count, and .lastclean is the
840 # last clean count we had
843 @if cmp -s .cleancount .lastclean ; then echo ; else \
844 $(MAKE) clean; cp -f .cleancount .lastclean;\
848 $(SUBDIRS_UNINSTALL):
849 @$(MAKE) -C $(@:-uninstall=) uninstall
851 _uninstall: $(SUBDIRS_UNINSTALL)
852 rm -f $(DESTDIR)$(MODULES_DIR)/*
853 rm -f $(DESTDIR)$(ASTSBINDIR)/*asterisk*
854 rm -f $(DESTDIR)$(ASTSBINDIR)/astgenkey
855 rm -f $(DESTDIR)$(ASTSBINDIR)/autosupport
856 rm -rf $(DESTDIR)$(ASTHEADERDIR)
857 rm -rf $(DESTDIR)$(ASTDATADIR)/firmware
858 rm -rf $(DESTDIR)$(ASTMANDIR)/man8
859 $(MAKE) -C sounds uninstall
861 uninstall: _uninstall
862 @echo " +--------- Asterisk Uninstall Complete -----+"
863 @echo " + Asterisk binaries, sounds, man pages, +"
864 @echo " + headers, modules, and firmware builds, +"
865 @echo " + have all been uninstalled. +"
867 @echo " + To remove ALL traces of Asterisk, +"
868 @echo " + including configuration, spool +"
869 @echo " + directories, and logs, run the following +"
870 @echo " + command: +"
872 @echo " + $(MAKE) uninstall-all +"
873 @echo " +-------------------------------------------+"
875 uninstall-all: _uninstall
876 rm -rf $(DESTDIR)$(ASTLIBDIR)
877 rm -rf $(DESTDIR)$(ASTVARLIBDIR)
878 rm -rf $(DESTDIR)$(ASTDATADIR)
879 rm -rf $(DESTDIR)$(ASTSPOOLDIR)
880 rm -rf $(DESTDIR)$(ASTETCDIR)
881 rm -rf $(DESTDIR)$(ASTLOGDIR)
883 menuselect: menuselect/menuselect makeopts.xml
884 -@menuselect/menuselect ${GLOBAL_MAKEOPTS} ${USER_MAKEOPTS} menuselect.makeopts && echo "menuselect changes saved!" || echo "menuselect changes NOT saved!"
886 menuselect/menuselect: menuselect/menuselect.c menuselect/menuselect_curses.c menuselect/menuselect.h menuselect/linkedlists.h config.status mxml/libmxml.a $(MENUSELECT_OBJS)
887 @CFLAGS="-include $(PWD)/include/asterisk/autoconfig.h" PARENTSRC="$(PWD)" $(MAKE) -C menuselect menuselect
890 @cd mxml && unset CFLAGS LIBS && test -f config.h || ./configure
891 $(MAKE) -C mxml libmxml.a
893 makeopts.xml: $(foreach dir,$(MOD_SUBDIRS),$(dir)/*.c) build_tools/cflags.xml sounds/sounds.xml
894 @echo "Generating list of available modules ..."
895 @build_tools/prep_moduledeps > $@
897 .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)