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 echo $(or $(shell grep MENUSELECT_CFLAGS $(USER_MAKEOPTS) .),$(shell grep MENUSELECT_CFLAGS $(GLOBAL_MAKEOPTS) .)) | cut -f2 -d'=')
139 ifeq ($(or $(findstring dont-optimize,$(MAKECMDGOALS)),$(findstring DONT_OPTIMIZE,$(MENUSELECT_CFLAGS))),)
140 # More GSM codec optimization
141 # Uncomment to enable MMXTM optimizations for x86 architecture CPU's
142 # which support MMX instructions. This should be newer pentiums,
143 # ppro's, etc, as well as the AMD K6 and K7.
146 # Tell gcc to optimize the code
149 # Stack backtraces, while useful for debugging, are incompatible with optimizations
150 ifeq ($(OSARCH),Linux)
151 CFLAGS+=-DSTACK_BACKTRACES
155 # *CLI> show memory allocations [filename]
156 # *CLI> show memory summary [filename]
157 ifneq ($(findstring MALLOC_DEBUG,$(MENUSELECT_CFLAGS)),)
158 TOPDIR_CFLAGS+=-include include/asterisk/astmm.h
159 MOD_SUBDIR_CFLAGS+=-include ../include/asterisk/astmm.h
162 MOD_SUBDIR_CFLAGS+=-fPIC
164 ifeq ($(OSARCH),Linux)
165 ifeq ($(PROC),x86_64)
166 # You must have GCC 3.4 to use k8, otherwise use athlon
171 ifeq ($(PROC),sparc64)
172 #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
173 #This works for even old (2.96) versions of gcc and provides a small boost either way.
174 #A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
175 #So we go lowest common available by gcc and go a step down, still a step up from
176 #the default as we now have a better instruction set to work with. - Belgarath
178 OPTIONS+=$(shell if $(CC) -mtune=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mtune=$(PROC)"; fi)
179 OPTIONS+=$(shell if $(CC) -mcpu=v8 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mcpu=v8"; fi)
180 OPTIONS+=-fomit-frame-pointer
184 # The Cirrus logic is the only heavily shipping arm processor with a real floating point unit
185 ifeq ($(SUB_PROC),maverick)
186 OPTIONS+=-fsigned-char -mcpu=ep9312
188 ifeq ($(SUB_PROC),xscale)
189 OPTIONS+=-fsigned-char -mcpu=xscale
191 OPTIONS+=-fsigned-char
200 ifeq ($(OSARCH),SunOS)
201 GREP=/usr/xpg4/bin/grep
206 ASTCFLAGS+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG)
208 ASTCFLAGS+=$(OPTIMIZE)
211 ifeq ($(AST_DEVMODE),yes)
212 ASTCFLAGS+=-Werror -Wunused
215 ifeq ($(shell gcc -v 2>&1 | grep 'gcc version' | cut -f3 -d' ' | cut -f1 -d.),4)
216 ASTCFLAGS+=-Wno-pointer-sign
220 ifeq ($(findstring BSD,$(OSARCH)),BSD)
221 ASTCFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include -L$(CROSS_COMPILE_TARGET)/usr/local/lib
224 ifneq ($(PROC),ultrasparc)
225 ASTCFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
229 ASTCFLAGS+=-fsigned-char
232 ifeq ($(OSARCH),FreeBSD)
233 BSDVERSION=$(shell make -V OSVERSION -f $(CROSS_COMPILE_TARGET)/usr/share/mk/bsd.port.subdir.mk)
234 ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
235 LIBS+=$(shell if test $(BSDVERSION) -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi)
238 ifeq ($(OSARCH),NetBSD)
239 AST_CFLAGS+=-pthread -I$(CROSS_COMPILE_TARGET)/usr/pkg/include
242 ifeq ($(OSARCH),OpenBSD)
246 ifeq ($(OSARCH),SunOS)
247 ASTCFLAGS+=-Wcast-align -DSOLARIS -Iinclude/solaris-compat -I$(CROSS_COMPILE_TARGET)/usr/local/ssl/include
250 LIBEDIT=editline/libedit.a
252 ASTERISKVERSION:=$(shell build_tools/make_version .)
254 ifneq ($(wildcard .version),)
255 ASTERISKVERSIONNUM:=$(shell awk -F. '{printf "%02d%02d%02d", $$1, $$2, $$3}' .version)
256 RPMVERSION:=$(shell sed 's/[-\/:]/_/g' .version)
261 ifneq ($(wildcard .svn),)
262 ASTERISKVERSIONNUM=999999
265 ASTCFLAGS+=$(MALLOC_DEBUG)$(BUSYDETECT)$(OPTIONS)
267 MOD_SUBDIRS:=res channels pbx apps codecs formats cdr funcs
268 OTHER_SUBDIRS:=utils agi
269 SUBDIRS:=$(MOD_SUBDIRS) $(OTHER_SUBDIRS)
270 SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)
271 SUBDIRS_CLEAN:=$(SUBDIRS:%=%-clean)
272 SUBDIRS_CLEAN_DEPEND:=$(SUBDIRS:%=%-clean-depend)
273 MOD_SUBDIRS_DEPEND:=$(MOD_SUBDIRS:%=%-depend)
274 OTHER_SUBDIRS_DEPEND:=$(OTHER_SUBDIRS:%=%-depend)
275 SUBDIRS_DEPEND:=$(MOD_SUBDIRS_DEPEND) $(OTHER_SUBDIRS_DEPEND)
276 SUBDIRS_UNINSTALL:=$(SUBDIRS:%=%-uninstall)
278 OBJS=io.o sched.o logger.o frame.o loader.o config.o channel.o \
279 translate.o file.o pbx.o cli.o md5.o term.o \
280 ulaw.o alaw.o callerid.o fskmodem.o image.o app.o \
281 cdr.o tdd.o acl.o rtp.o udptl.o manager.o asterisk.o \
282 dsp.o chanvars.o indications.o autoservice.o db.o privacy.o \
283 astmm.o enum.o srv.o dns.o aescrypt.o aestab.o aeskey.o \
284 utils.o plc.o jitterbuf.o dnsmgr.o devicestate.o \
285 netsock.o slinfactory.o ast_expr2.o ast_expr2f.o \
286 cryptostub.o sha1.o http.o fixedjitterbuf.o abstract_jb.o
288 # we need to link in the objects statically, not as a library, because
289 # otherwise modules will not have them available if none of the static
291 OBJS+=stdtime/localtime.o
293 # At the moment say.o is an optional component which can be overridden
297 ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/sys/poll.h),)
299 ASTCFLAGS+=-DPOLLCOMPAT
302 ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/dlfcn.h),)
304 ASTCFLAGS+=-DDLFCNCOMPAT
307 ifeq ($(OSARCH),Linux)
308 LIBS+=-ldl -lpthread $(EDITLINE_LIB) -lm -lresolv #-lnjamd
310 LIBS+=$(EDITLINE_LIB) -lm
313 ifeq ($(OSARCH),Darwin)
315 ASTCFLAGS+=-D__Darwin__
316 AUDIO_LIBS=-framework CoreAudio
318 SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
319 # Mac on Intel CoreDuo does not need poll compatibility layer
322 ASTCFLAGS+=-DPOLLCOMPAT
325 # These are used for all but Darwin
327 SOLINK=-shared -Xlinker -x
328 ifeq ($(findstring BSD,$(OSARCH)),BSD)
329 SOLINK+=-L$(CROSS_COMPILE_TARGET)/usr/local/lib
333 ifeq ($(OSARCH),FreeBSD)
337 ifeq ($(OSARCH),NetBSD)
338 LIBS+=-lpthread -lcrypto -lm -L$(CROSS_COMPILE_TARGET)/usr/pkg/lib $(EDITLINE_LIB)
341 ifeq ($(OSARCH),OpenBSD)
342 LIBS+=-lcrypto -lpthread -lm $(EDITLINE_LIB)
345 ifeq ($(OSARCH),SunOS)
346 LIBS+=-lpthread -ldl -lnsl -lsocket -lresolv -L$(CROSS_COMPILE_TARGET)/usr/local/ssl/lib
348 MENUSELECT_OBJS+=strcompat.o
350 SOLINK=-shared -fpic -L$(CROSS_COMPILE_TARGET)/usr/local/ssl/lib
353 ifeq ($(MAKETOPLEVEL),$(MAKELEVEL))
354 CFLAGS+=$(TOPDIR_CFLAGS)$(ASTCFLAGS)
357 # This is used when generating the doxygen documentation
365 @echo " +--------- Asterisk Build Complete ---------+"
366 @echo " + Asterisk has successfully been built, but +"
367 @echo " + cannot be run before being installed by +"
368 @echo " + running: +"
370 @echo " + make install +"
371 @echo " +-------------------------------------------+"
373 all: cleantest config.status menuselect.makeopts depend asterisk $(SUBDIRS)
376 @CFLAGS="$(MOD_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $@
379 @CFLAGS="$(OTHER_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $@
381 config.status: configure
382 @CFLAGS="" ./configure
384 @echo "**** The configure script was just executed, so 'make' needs to be"
385 @echo "**** restarted."
390 @CFLAGS="" ./configure
392 @echo "**** The configure script was just executed, so 'make' needs to be"
393 @echo "**** restarted."
397 menuselect.makeopts menuselect.makedeps: menuselect/menuselect makeopts.xml
398 menuselect/menuselect --check-deps ${GLOBAL_MAKEOPTS} ${USER_MAKEOPTS} menuselect.makeopts
400 #ifneq ($(wildcard tags),)
404 ifneq ($(wildcard TAGS),)
409 cd editline && unset CFLAGS LIBS && CFLAGS="$(OPTIMIZE)" ./configure ; \
412 cd editline && unset CFLAGS LIBS && test -f config.h || CFLAGS="$(OPTIMIZE)" ./configure
413 $(MAKE) -C editline libedit.a
416 $(MAKE) -C db1-ast libdb1.a
418 ifneq ($(wildcard .depend),)
422 ifneq ($(wildcard .tags-depend),)
426 ast_expr2.c ast_expr2.h:
427 bison -o $@ -d --name-prefix=ast_yy ast_expr2.y
430 flex -o $@ --full ast_expr2.fl
432 testexpr2: config.status include/asterisk/buildopts.h ast_expr2f.c ast_expr2.c ast_expr2.h
433 $(CC) -g -c -Iinclude -DSTANDALONE ast_expr2f.c
434 $(CC) -g -c -Iinclude -DSTANDALONE ast_expr2.c
435 $(CC) -g -o testexpr2 ast_expr2f.o ast_expr2.o
436 rm ast_expr2.o ast_expr2f.o
440 asterisk.8: asterisk.sgml
442 docbook2man asterisk.sgml
445 asterisk.pdf: asterisk.sgml
446 docbook2pdf asterisk.sgml
448 asterisk.ps: asterisk.sgml
449 docbook2ps asterisk.sgml
451 asterisk.html: asterisk.sgml
452 docbook2html asterisk.sgml
453 mv r1.html asterisk.html
455 asterisk.txt: asterisk.sgml
456 docbook2txt asterisk.sgml
459 @build_tools/make_defaults_h > $@.tmp
460 @if cmp -s $@.tmp $@ ; then : ; else \
465 include/asterisk/version.h:
466 @build_tools/make_version_h > $@.tmp
467 @if cmp -s $@.tmp $@ ; then : ; else \
472 include/asterisk/buildopts.h: menuselect.makeopts
473 @build_tools/make_buildopts_h > $@.tmp
474 @if cmp -s $@.tmp $@ ; then : ; else \
479 channel.o: CFLAGS+=$(ZAPTEL_INCLUDE)
481 asterisk: include/asterisk/buildopts.h editline/libedit.a db1-ast/libdb1.a $(OBJS)
482 build_tools/make_build_h > include/asterisk/build.h.tmp
483 if cmp -s include/asterisk/build.h.tmp include/asterisk/build.h ; then echo ; else \
484 mv include/asterisk/build.h.tmp include/asterisk/build.h ; \
486 rm -f include/asterisk/build.h.tmp
487 $(CC) -c -o buildinfo.o $(CFLAGS) buildinfo.c
488 $(CC) $(DEBUG) $(ASTOBJ) $(ASTLINK) $(OBJS) buildinfo.o $(LIBEDIT) db1-ast/libdb1.a $(LIBS)
491 $(CC) $(AUDIO_LIBS) -o muted muted.o
493 $(SUBDIRS_CLEAN_DEPEND):
494 @$(MAKE) -C $(@:-clean-depend=) clean-depend
497 @$(MAKE) -C $(@:-clean=) clean
499 clean-depend: $(SUBDIRS_CLEAN_DEPEND)
501 clean: $(SUBDIRS_CLEAN) clean-depend
502 rm -f *.o *.so asterisk
504 rm -f include/asterisk/build.h
505 rm -f include/asterisk/version.h
506 rm -f .tags-sources tags TAGS
507 rm -f .depend .tags-depend
508 @if [ -f editline/Makefile ]; then $(MAKE) -C editline distclean ; fi
509 @$(MAKE) -C db1-ast clean
510 @$(MAKE) -C stdtime clean
511 @$(MAKE) -C menuselect clean
513 distclean: dist-clean
516 @$(MAKE) -C mxml clean
517 @$(MAKE) -C menuselect dist-clean
518 @$(MAKE) -C sounds dist-clean
519 rm -f menuselect.makeopts makeopts makeopts.xml menuselect.makedeps
520 rm -f config.log config.status
521 rm -rf autom4te.cache
522 rm -f include/autoconfig.h
523 rm -f include/asterisk/buildopts.h
527 if [ x`$(ID) -un` = xroot ]; then sh build_tools/mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig; fi
528 # Should static HTTP be installed during make samples or even with its own target ala
529 # webvoicemail? There are portions here that *could* be customized but might also be
530 # improved a lot. I'll put it here for now.
531 mkdir -p $(DESTDIR)$(ASTDATADIR)/static-http
532 for x in static-http/*; do \
533 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/static-http ; \
535 mkdir -p $(DESTDIR)$(ASTDATADIR)/images
536 for x in images/*.jpg; do \
537 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/images ; \
539 mkdir -p $(DESTDIR)$(AGI_DIR)
540 $(MAKE) -C sounds install
543 @if [ -d .svn ]; then \
544 echo "Updating from Subversion..." ; \
545 svn update | tee update.out; \
547 if [ `grep -c ^C update.out` -gt 0 ]; then \
548 echo ; echo "The following files have conflicts:" ; \
549 grep ^C update.out | cut -b4- ; \
552 $(MAKE) clean-depend; \
554 echo "Not under version control"; \
557 NEWHEADERS=$(notdir $(wildcard include/asterisk/*.h))
558 OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h)))
561 mkdir -p $(DESTDIR)$(MODULES_DIR)
562 mkdir -p $(DESTDIR)$(ASTSBINDIR)
563 mkdir -p $(DESTDIR)$(ASTETCDIR)
564 mkdir -p $(DESTDIR)$(ASTBINDIR)
565 mkdir -p $(DESTDIR)$(ASTVARRUNDIR)
566 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail
567 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/dictate
568 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/system
569 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/tmp
570 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/meetme
571 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/monitor
572 if [ -f asterisk ]; then $(INSTALL) -m 755 asterisk $(DESTDIR)$(ASTSBINDIR)/; fi
573 if [ -f asterisk.dll ]; then $(INSTALL) -m 755 asterisk.dll $(DESTDIR)$(ASTSBINDIR)/; fi
574 $(LN) -sf asterisk $(DESTDIR)$(ASTSBINDIR)/rasterisk
575 $(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
576 $(INSTALL) -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/
577 if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \
578 cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;' > $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ;\
579 chmod 755 $(DESTDIR)$(ASTSBINDIR)/safe_asterisk;\
581 $(INSTALL) -d $(DESTDIR)$(ASTHEADERDIR)
582 $(INSTALL) -m 644 include/asterisk.h $(DESTDIR)$(includedir)
583 $(INSTALL) -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
584 if [ -n "$(OLDHEADERS)" ]; then \
585 rm -f $(addprefix $(DESTDIR)$(ASTHEADERDIR)/,$(OLDHEADERS)) ;\
587 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
588 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-custom
589 mkdir -p $(DESTDIR)$(ASTDATADIR)/keys
590 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware
591 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware/iax
592 mkdir -p $(DESTDIR)$(ASTMANDIR)/man8
593 $(INSTALL) -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTDATADIR)/keys
594 $(INSTALL) -m 644 keys/freeworlddialup.pub $(DESTDIR)$(ASTDATADIR)/keys
595 $(INSTALL) -m 644 asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
596 $(INSTALL) -m 644 contrib/scripts/astgenkey.8 $(DESTDIR)$(ASTMANDIR)/man8
597 $(INSTALL) -m 644 contrib/scripts/autosupport.8 $(DESTDIR)$(ASTMANDIR)/man8
598 $(INSTALL) -m 644 contrib/scripts/safe_asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
599 $(INSTALL) -m 644 contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTDATADIR)/firmware/iax/iaxy.bin; \
602 @$(MAKE) -C $(@:-install=) install
604 NEWMODS=$(notdir $(wildcard */*.so))
605 OLDMODS=$(filter-out $(NEWMODS),$(notdir $(wildcard $(DESTDIR)$(MODULES_DIR)/*.so)))
608 @if [ -n "$(OLDMODS)" ]; then \
609 echo " WARNING WARNING WARNING" ;\
611 echo " Your Asterisk modules directory, located at" ;\
612 echo " $(DESTDIR)$(MODULES_DIR)" ;\
613 echo " contains modules that were not installed by this " ;\
614 echo " version of Asterisk. Please ensure that these" ;\
615 echo " modules are compatible with this version before" ;\
616 echo " attempting to run Asterisk." ;\
618 for f in $(OLDMODS); do \
622 echo " WARNING WARNING WARNING" ;\
625 install: all datafiles bininstall $(SUBDIRS_INSTALL)
626 @if [ -x /usr/sbin/asterisk-post-install ]; then \
627 /usr/sbin/asterisk-post-install $(DESTDIR) . ; \
629 @echo " +---- Asterisk Installation Complete -------+"
631 @echo " + YOU MUST READ THE SECURITY DOCUMENT +"
633 @echo " + Asterisk has successfully been installed. +"
634 @echo " + If you would like to install the sample +"
635 @echo " + configuration files (overwriting any +"
636 @echo " + existing config files), run: +"
638 @echo " + $(MAKE) samples +"
640 @echo " +----------------- or ---------------------+"
642 @echo " + You can go ahead and install the asterisk +"
643 @echo " + program documentation now or later run: +"
645 @echo " + $(MAKE) progdocs +"
647 @echo " + **Note** This requires that you have +"
648 @echo " + doxygen installed on your local system +"
649 @echo " +-------------------------------------------+"
650 @$(MAKE) -s oldmodcheck
652 upgrade: all bininstall
655 mkdir -p $(DESTDIR)$(ASTETCDIR)
656 for x in configs/*.adsi; do \
657 if [ ! -f $(DESTDIR)$(ASTETCDIR)/$$x ]; then \
658 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x` ; \
663 mkdir -p $(DESTDIR)$(ASTETCDIR)
664 for x in configs/*.sample; do \
665 if [ -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ]; then \
666 if [ "$(OVERWRITE)" = "y" ]; then \
667 if cmp -s $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $$x ; then \
668 echo "Config file $$x is unchanged"; \
671 mv -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample`.old ; \
673 echo "Skipping config file $$x"; \
677 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ;\
679 if [ "$(OVERWRITE)" = "y" ] || [ ! -f $(DESTDIR)$(ASTCONFPATH) ]; then \
681 echo "[directories]" ; \
682 echo "astetcdir => $(ASTETCDIR)" ; \
683 echo "astmoddir => $(MODULES_DIR)" ; \
684 echo "astvarlibdir => $(ASTVARLIBDIR)" ; \
685 echo "astdatadir => $(ASTDATADIR)" ; \
686 echo "astagidir => $(AGI_DIR)" ; \
687 echo "astspooldir => $(ASTSPOOLDIR)" ; \
688 echo "astrundir => $(ASTVARRUNDIR)" ; \
689 echo "astlogdir => $(ASTLOGDIR)" ; \
691 echo "; Changing the following lines may compromise your security." ; \
693 echo ";astctlpermissions = 0660" ; \
694 echo ";astctlowner = root" ; \
695 echo ";astctlgroup = apache" ; \
696 echo ";astctl = asterisk.ctl" ; \
697 echo ";[options]" ; \
698 echo ";internal_timing = yes" ; \
699 ) > $(DESTDIR)$(ASTCONFPATH) ; \
701 echo "Skipping asterisk.conf creation"; \
703 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
704 :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm
705 for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isunavail; do \
706 cat $(DESTDIR)$(ASTDATADIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm ; \
708 :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm
709 for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isonphone; do \
710 cat $(DESTDIR)$(ASTDATADIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm ; \
714 @[ -d $(DESTDIR)$(HTTP_DOCSDIR)/ ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 )
715 @[ -d $(DESTDIR)$(HTTP_CGIDIR) ] || ( printf "cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit 1 )
716 $(INSTALL) -m 4755 -o root -g root contrib/scripts/vmail.cgi $(DESTDIR)$(HTTP_CGIDIR)/vmail.cgi
717 mkdir -p $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk
718 for x in images/*.gif; do \
719 $(INSTALL) -m 644 $$x $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk/; \
721 @echo " +--------- Asterisk Web Voicemail ----------+"
723 @echo " + Asterisk Web Voicemail is installed in +"
724 @echo " + your cgi-bin directory: +"
725 @echo " + $(DESTDIR)$(HTTP_CGIDIR)"
726 @echo " + IT USES A SETUID ROOT PERL SCRIPT, SO +"
727 @echo " + IF YOU DON'T LIKE THAT, UNINSTALL IT! +"
729 @echo " + Other static items have been stored in: +"
730 @echo " + $(DESTDIR)$(HTTP_DOCSDIR)"
732 @echo " + If these paths do not match your httpd +"
733 @echo " + installation, correct the definitions +"
734 @echo " + in your Makefile of HTTP_CGIDIR and +"
735 @echo " + HTTP_DOCSDIR +"
737 @echo " +-------------------------------------------+"
740 sed "s/^Version:.*/Version: $(RPMVERSION)/g" redhat/asterisk.spec > asterisk.spec ; \
744 __rpm: include/asterisk/version.h include/asterisk/buildopts.h spec
745 rm -rf /tmp/asterisk ; \
746 mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
747 $(MAKE) DESTDIR=/tmp/asterisk install ; \
748 $(MAKE) DESTDIR=/tmp/asterisk samples ; \
749 mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
750 cp -f contrib/init.d/rc.redhat.asterisk /tmp/asterisk/etc/rc.d/init.d/asterisk ; \
751 rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec
754 (cat contrib/asterisk-ng-doxygen; echo "HAVE_DOT=$(HAVEDOT)"; \
755 echo "PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen -
758 @if [ "${OSARCH}" = "Linux" ]; then \
759 if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \
760 $(INSTALL) -m 755 contrib/init.d/rc.redhat.asterisk /etc/rc.d/init.d/asterisk; \
761 /sbin/chkconfig --add asterisk; \
762 elif [ -f /etc/debian_version ]; then \
763 $(INSTALL) -m 755 contrib/init.d/rc.debian.asterisk /etc/init.d/asterisk; \
764 /usr/sbin/update-rc.d asterisk start 10 2 3 4 5 . stop 91 2 3 4 5 .; \
765 elif [ -f /etc/gentoo-release ]; then \
766 $(INSTALL) -m 755 contrib/init.d/rc.gentoo.asterisk /etc/init.d/asterisk; \
767 /sbin/rc-update add asterisk default; \
768 elif [ -f /etc/mandrake-release ]; then \
769 $(INSTALL) -m 755 contrib/init.d/rc.mandrake.asterisk /etc/rc.d/init.d/asterisk; \
770 /sbin/chkconfig --add asterisk; \
771 elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then \
772 $(INSTALL) -m 755 contrib/init.d/rc.suse.asterisk /etc/init.d/asterisk; \
773 /sbin/chkconfig --add asterisk; \
774 elif [ -f /etc/slackware-version ]; then \
775 echo "Slackware is not currently supported, although an init script does exist for it." \
777 echo "We could not install init scripts for your distribution."; \
780 echo "We could not install init scripts for your operating system."; \
785 valgrind: dont-optimize
787 $(MOD_SUBDIRS_DEPEND):
788 @CFLAGS="$(MOD_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $(@:-depend=) depend
790 $(OTHER_SUBDIRS_DEPEND):
791 @CFLAGS="$(OTHER_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $(@:-depend=) depend
793 depend: include/asterisk/version.h include/asterisk/buildopts.h .depend defaults.h $(SUBDIRS_DEPEND)
795 .depend: include/asterisk/version.h include/asterisk/buildopts.h defaults.h
796 build_tools/mkdep $(CFLAGS) $(wildcard *.c)
799 @echo -n ".tags-depend: " > $@
800 @$(FIND) . -maxdepth 1 -name \*.c -printf "\t%p \\\\\n" >> $@
801 @$(FIND) . -maxdepth 1 -name \*.h -printf "\t%p \\\\\n" >> $@
802 @$(FIND) $(SUBDIRS) -name \*.c -printf "\t%p \\\\\n" >> $@
803 @$(FIND) $(SUBDIRS) -name \*.h -printf "\t%p \\\\\n" >> $@
804 @$(FIND) include -name \*.h -printf "\t%p \\\\\n" >> $@
809 @$(FIND) . -maxdepth 1 -name \*.c -print >> $@
810 @$(FIND) . -maxdepth 1 -name \*.h -print >> $@
811 @$(FIND) $(SUBDIRS) -name \*.c -print >> $@
812 @$(FIND) $(SUBDIRS) -name \*.h -print >> $@
813 @$(FIND) include -name \*.h -print >> $@
815 tags: .tags-depend .tags-sources
816 ctags -L .tags-sources -o $@
820 TAGS: .tags-depend .tags-sources
821 etags -o $@ `cat .tags-sources`
826 $(MAKE) -C $(shell echo $@ | sed "s/_env//g") env
829 $(MAKE) -C sounds all
834 # If the cleancount has been changed, force a make clean.
835 # .cleancount is the global clean count, and .lastclean is the
836 # last clean count we had
839 @if cmp -s .cleancount .lastclean ; then echo ; else \
840 $(MAKE) clean; cp -f .cleancount .lastclean;\
844 $(SUBDIRS_UNINSTALL):
845 @$(MAKE) -C $(@:-uninstall=) uninstall
847 _uninstall: $(SUBDIRS_UNINSTALL)
848 rm -f $(DESTDIR)$(MODULES_DIR)/*
849 rm -f $(DESTDIR)$(ASTSBINDIR)/*asterisk*
850 rm -f $(DESTDIR)$(ASTSBINDIR)/astgenkey
851 rm -f $(DESTDIR)$(ASTSBINDIR)/autosupport
852 rm -rf $(DESTDIR)$(ASTHEADERDIR)
853 rm -rf $(DESTDIR)$(ASTDATADIR)/firmware
854 rm -rf $(DESTDIR)$(ASTMANDIR)/man8
855 $(MAKE) -C sounds uninstall
857 uninstall: _uninstall
858 @echo " +--------- Asterisk Uninstall Complete -----+"
859 @echo " + Asterisk binaries, sounds, man pages, +"
860 @echo " + headers, modules, and firmware builds, +"
861 @echo " + have all been uninstalled. +"
863 @echo " + To remove ALL traces of Asterisk, +"
864 @echo " + including configuration, spool +"
865 @echo " + directories, and logs, run the following +"
866 @echo " + command: +"
868 @echo " + $(MAKE) uninstall-all +"
869 @echo " +-------------------------------------------+"
871 uninstall-all: _uninstall
872 rm -rf $(DESTDIR)$(ASTLIBDIR)
873 rm -rf $(DESTDIR)$(ASTVARLIBDIR)
874 rm -rf $(DESTDIR)$(ASTDATADIR)
875 rm -rf $(DESTDIR)$(ASTSPOOLDIR)
876 rm -rf $(DESTDIR)$(ASTETCDIR)
877 rm -rf $(DESTDIR)$(ASTLOGDIR)
879 menuselect: menuselect/menuselect makeopts.xml
880 -@menuselect/menuselect ${GLOBAL_MAKEOPTS} ${USER_MAKEOPTS} menuselect.makeopts && echo "menuselect changes saved!" || echo "menuselect changes NOT saved!"
882 menuselect/menuselect: menuselect/menuselect.c menuselect/menuselect_curses.c menuselect/menuselect.h menuselect/linkedlists.h config.status mxml/libmxml.a $(MENUSELECT_OBJS)
883 @CFLAGS="-include ../include/asterisk/autoconfig.h" $(MAKE) -C menuselect menuselect
886 @cd mxml && unset CFLAGS LIBS && test -f config.h || ./configure
887 $(MAKE) -C mxml libmxml.a
889 makeopts.xml: $(foreach dir,$(MOD_SUBDIRS),$(dir)/*.c) build_tools/cflags.xml sounds/sounds.xml
890 @echo "Generating list of available modules ..."
891 @build_tools/prep_moduledeps > $@
893 .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)