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 ifeq ($(MENUSELECT_CFLAGS),)
138 MENUSELECT_CFLAGS:=$(shell grep MENUSELECT_CFLAGS $(GLOBAL_MAKEOPTS) .)
140 ifneq ($(MENUSELECT_CFLAGS),)
141 MENUSELECT_CFLAGS:=$(shell echo $(MENUSELECT_CFLAGS) | cut -f2 -d'=')
145 ifeq ($(findstring dont-optimize,$(MAKECMDGOALS)),$(findstring DONT_OPTIMIZE,$(MENUSELECT_CFLAGS)))
146 # More GSM codec optimization
147 # Uncomment to enable MMXTM optimizations for x86 architecture CPU's
148 # which support MMX instructions. This should be newer pentiums,
149 # ppro's, etc, as well as the AMD K6 and K7.
152 # Tell gcc to optimize the code
155 # Stack backtraces, while useful for debugging, are incompatible with optimizations
156 ifeq ($(OSARCH),Linux)
157 CFLAGS+=-DSTACK_BACKTRACES
161 # *CLI> show memory allocations [filename]
162 # *CLI> show memory summary [filename]
163 ifneq ($(findstring MALLOC_DEBUG,$(MENUSELECT_CFLAGS)),)
164 TOPDIR_CFLAGS+=-include include/asterisk/astmm.h
165 MOD_SUBDIR_CFLAGS+=-include ../include/asterisk/astmm.h
168 MOD_SUBDIR_CFLAGS+=-fPIC
170 ifeq ($(OSARCH),Linux)
171 ifeq ($(PROC),x86_64)
172 # You must have GCC 3.4 to use k8, otherwise use athlon
177 ifeq ($(PROC),sparc64)
178 #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
179 #This works for even old (2.96) versions of gcc and provides a small boost either way.
180 #A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
181 #So we go lowest common available by gcc and go a step down, still a step up from
182 #the default as we now have a better instruction set to work with. - Belgarath
184 OPTIONS+=$(shell if $(CC) -mtune=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mtune=$(PROC)"; fi)
185 OPTIONS+=$(shell if $(CC) -mcpu=v8 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mcpu=v8"; fi)
186 OPTIONS+=-fomit-frame-pointer
190 # The Cirrus logic is the only heavily shipping arm processor with a real floating point unit
191 ifeq ($(SUB_PROC),maverick)
192 OPTIONS+=-fsigned-char -mcpu=ep9312
194 ifeq ($(SUB_PROC),xscale)
195 OPTIONS+=-fsigned-char -mcpu=xscale
197 OPTIONS+=-fsigned-char
206 ifeq ($(OSARCH),SunOS)
207 GREP=/usr/xpg4/bin/grep
212 ASTCFLAGS+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG)
214 ASTCFLAGS+=$(OPTIMIZE)
217 ifeq ($(AST_DEVMODE),yes)
218 ASTCFLAGS+=-Werror -Wunused
221 ifeq ($(shell gcc -v 2>&1 | grep 'gcc version' | cut -f3 -d' ' | cut -f1 -d.),4)
222 ASTCFLAGS+=-Wno-pointer-sign
226 ifeq ($(findstring BSD,$(OSARCH)),BSD)
227 ASTCFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include -L$(CROSS_COMPILE_TARGET)/usr/local/lib
230 ifneq ($(PROC),ultrasparc)
231 ASTCFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
235 ASTCFLAGS+=-fsigned-char
238 ifeq ($(OSARCH),FreeBSD)
239 BSDVERSION=$(shell make -V OSVERSION -f $(CROSS_COMPILE_TARGET)/usr/share/mk/bsd.port.subdir.mk)
240 ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
241 LIBS+=$(shell if test $(BSDVERSION) -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi)
244 ifeq ($(OSARCH),NetBSD)
245 AST_CFLAGS+=-pthread -I$(CROSS_COMPILE_TARGET)/usr/pkg/include
248 ifeq ($(OSARCH),OpenBSD)
252 ifeq ($(OSARCH),SunOS)
253 ASTCFLAGS+=-Wcast-align -DSOLARIS -Iinclude/solaris-compat -I$(CROSS_COMPILE_TARGET)/usr/local/ssl/include
256 LIBEDIT=editline/libedit.a
258 ASTERISKVERSION:=$(shell build_tools/make_version .)
260 ifneq ($(wildcard .version),)
261 ASTERISKVERSIONNUM:=$(shell awk -F. '{printf "%02d%02d%02d", $$1, $$2, $$3}' .version)
262 RPMVERSION:=$(shell sed 's/[-\/:]/_/g' .version)
267 ifneq ($(wildcard .svn),)
268 ASTERISKVERSIONNUM=999999
271 ASTCFLAGS+=$(MALLOC_DEBUG)$(BUSYDETECT)$(OPTIONS)
273 MOD_SUBDIRS:=res channels pbx apps codecs formats cdr funcs
274 OTHER_SUBDIRS:=utils agi
275 SUBDIRS:=$(MOD_SUBDIRS) $(OTHER_SUBDIRS)
276 SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)
277 SUBDIRS_CLEAN:=$(SUBDIRS:%=%-clean)
278 SUBDIRS_CLEAN_DEPEND:=$(SUBDIRS:%=%-clean-depend)
279 MOD_SUBDIRS_DEPEND:=$(MOD_SUBDIRS:%=%-depend)
280 OTHER_SUBDIRS_DEPEND:=$(OTHER_SUBDIRS:%=%-depend)
281 SUBDIRS_DEPEND:=$(MOD_SUBDIRS_DEPEND) $(OTHER_SUBDIRS_DEPEND)
282 SUBDIRS_UNINSTALL:=$(SUBDIRS:%=%-uninstall)
284 OBJS=io.o sched.o logger.o frame.o loader.o config.o channel.o \
285 translate.o file.o pbx.o cli.o md5.o term.o \
286 ulaw.o alaw.o callerid.o fskmodem.o image.o app.o \
287 cdr.o tdd.o acl.o rtp.o udptl.o manager.o asterisk.o \
288 dsp.o chanvars.o indications.o autoservice.o db.o privacy.o \
289 astmm.o enum.o srv.o dns.o aescrypt.o aestab.o aeskey.o \
290 utils.o plc.o jitterbuf.o dnsmgr.o devicestate.o \
291 netsock.o slinfactory.o ast_expr2.o ast_expr2f.o \
292 cryptostub.o sha1.o http.o fixedjitterbuf.o abstract_jb.o
294 # we need to link in the objects statically, not as a library, because
295 # otherwise modules will not have them available if none of the static
297 OBJS+=stdtime/localtime.o
299 # At the moment say.o is an optional component which can be overridden
303 ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/sys/poll.h),)
305 ASTCFLAGS+=-DPOLLCOMPAT
308 ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/dlfcn.h),)
310 ASTCFLAGS+=-DDLFCNCOMPAT
313 ifeq ($(OSARCH),Linux)
314 LIBS+=-ldl -lpthread $(EDITLINE_LIB) -lm -lresolv #-lnjamd
316 LIBS+=$(EDITLINE_LIB) -lm
319 ifeq ($(OSARCH),Darwin)
321 ASTCFLAGS+=-D__Darwin__
322 AUDIO_LIBS=-framework CoreAudio
324 SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
325 # Mac on Intel CoreDuo does not need poll compatibility layer
328 ASTCFLAGS+=-DPOLLCOMPAT
331 # These are used for all but Darwin
333 SOLINK=-shared -Xlinker -x
334 ifeq ($(findstring BSD,$(OSARCH)),BSD)
335 SOLINK+=-L$(CROSS_COMPILE_TARGET)/usr/local/lib
339 ifeq ($(OSARCH),FreeBSD)
343 ifeq ($(OSARCH),NetBSD)
344 LIBS+=-lpthread -lcrypto -lm -L$(CROSS_COMPILE_TARGET)/usr/pkg/lib $(EDITLINE_LIB)
347 ifeq ($(OSARCH),OpenBSD)
348 LIBS+=-lcrypto -lpthread -lm $(EDITLINE_LIB)
351 ifeq ($(OSARCH),SunOS)
352 LIBS+=-lpthread -ldl -lnsl -lsocket -lresolv -L$(CROSS_COMPILE_TARGET)/usr/local/ssl/lib
354 MENUSELECT_OBJS+=strcompat.o
356 SOLINK=-shared -fpic -L$(CROSS_COMPILE_TARGET)/usr/local/ssl/lib
359 ifeq ($(MAKETOPLEVEL),$(MAKELEVEL))
360 CFLAGS+=$(TOPDIR_CFLAGS)$(ASTCFLAGS)
363 # This is used when generating the doxygen documentation
371 @echo " +--------- Asterisk Build Complete ---------+"
372 @echo " + Asterisk has successfully been built, but +"
373 @echo " + cannot be run before being installed by +"
374 @echo " + running: +"
376 @echo " + make install +"
377 @echo " +-------------------------------------------+"
379 all: cleantest config.status menuselect.makeopts depend asterisk $(SUBDIRS)
382 @CFLAGS="$(MOD_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $@
385 @CFLAGS="$(OTHER_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $@
387 config.status: configure
388 @CFLAGS="" ./configure
390 @echo "**** The configure script was just executed, so 'make' needs to be"
391 @echo "**** restarted."
396 @CFLAGS="" ./configure
398 @echo "**** The configure script was just executed, so 'make' needs to be"
399 @echo "**** restarted."
403 menuselect.makeopts menuselect.makedeps: menuselect/menuselect makeopts.xml
404 menuselect/menuselect --check-deps ${GLOBAL_MAKEOPTS} ${USER_MAKEOPTS} menuselect.makeopts
406 #ifneq ($(wildcard tags),)
410 ifneq ($(wildcard TAGS),)
415 cd editline && unset CFLAGS LIBS && CFLAGS="$(OPTIMIZE)" ./configure ; \
418 cd editline && unset CFLAGS LIBS && test -f config.h || CFLAGS="$(OPTIMIZE)" ./configure
419 $(MAKE) -C editline libedit.a
422 $(MAKE) -C db1-ast libdb1.a
424 ifneq ($(wildcard .depend),)
428 ifneq ($(wildcard .tags-depend),)
432 ast_expr2.c ast_expr2.h:
433 bison -o $@ -d --name-prefix=ast_yy ast_expr2.y
436 flex -o $@ --full ast_expr2.fl
438 testexpr2: config.status include/asterisk/buildopts.h ast_expr2f.c ast_expr2.c ast_expr2.h
439 $(CC) -g -c -Iinclude -DSTANDALONE ast_expr2f.c
440 $(CC) -g -c -Iinclude -DSTANDALONE ast_expr2.c
441 $(CC) -g -o testexpr2 ast_expr2f.o ast_expr2.o
442 rm ast_expr2.o ast_expr2f.o
446 asterisk.8: asterisk.sgml
448 docbook2man asterisk.sgml
451 asterisk.pdf: asterisk.sgml
452 docbook2pdf asterisk.sgml
454 asterisk.ps: asterisk.sgml
455 docbook2ps asterisk.sgml
457 asterisk.html: asterisk.sgml
458 docbook2html asterisk.sgml
459 mv r1.html asterisk.html
461 asterisk.txt: asterisk.sgml
462 docbook2txt asterisk.sgml
465 @build_tools/make_defaults_h > $@.tmp
466 @if cmp -s $@.tmp $@ ; then : ; else \
471 include/asterisk/version.h:
472 @build_tools/make_version_h > $@.tmp
473 @if cmp -s $@.tmp $@ ; then : ; else \
478 include/asterisk/buildopts.h: menuselect.makeopts
479 @build_tools/make_buildopts_h > $@.tmp
480 @if cmp -s $@.tmp $@ ; then : ; else \
485 channel.o: CFLAGS+=$(ZAPTEL_INCLUDE)
487 asterisk: include/asterisk/buildopts.h editline/libedit.a db1-ast/libdb1.a $(OBJS)
488 build_tools/make_build_h > include/asterisk/build.h.tmp
489 if cmp -s include/asterisk/build.h.tmp include/asterisk/build.h ; then echo ; else \
490 mv include/asterisk/build.h.tmp include/asterisk/build.h ; \
492 rm -f include/asterisk/build.h.tmp
493 $(CC) -c -o buildinfo.o $(CFLAGS) buildinfo.c
494 $(CC) $(DEBUG) $(ASTOBJ) $(ASTLINK) $(OBJS) buildinfo.o $(LIBEDIT) db1-ast/libdb1.a $(LIBS)
497 $(CC) $(AUDIO_LIBS) -o muted muted.o
499 $(SUBDIRS_CLEAN_DEPEND):
500 @$(MAKE) -C $(@:-clean-depend=) clean-depend
503 @$(MAKE) -C $(@:-clean=) clean
505 clean-depend: $(SUBDIRS_CLEAN_DEPEND)
507 clean: $(SUBDIRS_CLEAN) clean-depend
508 rm -f *.o *.so asterisk
510 rm -f include/asterisk/build.h
511 rm -f include/asterisk/version.h
512 rm -f .tags-sources tags TAGS
513 rm -f .depend .tags-depend
514 @if [ -f editline/Makefile ]; then $(MAKE) -C editline distclean ; fi
515 @$(MAKE) -C db1-ast clean
516 @$(MAKE) -C stdtime clean
517 @$(MAKE) -C menuselect clean
519 distclean: dist-clean
522 @$(MAKE) -C mxml clean
523 @$(MAKE) -C menuselect dist-clean
524 @$(MAKE) -C sounds dist-clean
525 rm -f menuselect.makeopts makeopts makeopts.xml menuselect.makedeps
526 rm -f config.log config.status
527 rm -rf autom4te.cache
528 rm -f include/autoconfig.h
529 rm -f include/asterisk/buildopts.h
533 if [ x`$(ID) -un` = xroot ]; then sh build_tools/mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig; fi
534 # Should static HTTP be installed during make samples or even with its own target ala
535 # webvoicemail? There are portions here that *could* be customized but might also be
536 # improved a lot. I'll put it here for now.
537 mkdir -p $(DESTDIR)$(ASTDATADIR)/static-http
538 for x in static-http/*; do \
539 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/static-http ; \
541 mkdir -p $(DESTDIR)$(ASTDATADIR)/images
542 for x in images/*.jpg; do \
543 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/images ; \
545 mkdir -p $(DESTDIR)$(AGI_DIR)
546 $(MAKE) -C sounds install
549 @if [ -d .svn ]; then \
550 echo "Updating from Subversion..." ; \
551 svn update | tee update.out; \
553 if [ `grep -c ^C update.out` -gt 0 ]; then \
554 echo ; echo "The following files have conflicts:" ; \
555 grep ^C update.out | cut -b4- ; \
558 $(MAKE) clean-depend; \
560 echo "Not under version control"; \
563 NEWHEADERS=$(notdir $(wildcard include/asterisk/*.h))
564 OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h)))
567 mkdir -p $(DESTDIR)$(MODULES_DIR)
568 mkdir -p $(DESTDIR)$(ASTSBINDIR)
569 mkdir -p $(DESTDIR)$(ASTETCDIR)
570 mkdir -p $(DESTDIR)$(ASTBINDIR)
571 mkdir -p $(DESTDIR)$(ASTVARRUNDIR)
572 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail
573 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/dictate
574 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/system
575 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/tmp
576 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/meetme
577 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/monitor
578 if [ -f asterisk ]; then $(INSTALL) -m 755 asterisk $(DESTDIR)$(ASTSBINDIR)/; fi
579 if [ -f asterisk.dll ]; then $(INSTALL) -m 755 asterisk.dll $(DESTDIR)$(ASTSBINDIR)/; fi
580 $(LN) -sf asterisk $(DESTDIR)$(ASTSBINDIR)/rasterisk
581 $(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
582 $(INSTALL) -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/
583 if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \
584 cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;' > $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ;\
585 chmod 755 $(DESTDIR)$(ASTSBINDIR)/safe_asterisk;\
587 $(INSTALL) -d $(DESTDIR)$(ASTHEADERDIR)
588 $(INSTALL) -m 644 include/asterisk.h $(DESTDIR)$(includedir)
589 $(INSTALL) -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
590 if [ -n "$(OLDHEADERS)" ]; then \
591 rm -f $(addprefix $(DESTDIR)$(ASTHEADERDIR)/,$(OLDHEADERS)) ;\
593 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
594 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-custom
595 mkdir -p $(DESTDIR)$(ASTDATADIR)/keys
596 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware
597 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware/iax
598 mkdir -p $(DESTDIR)$(ASTMANDIR)/man8
599 $(INSTALL) -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTDATADIR)/keys
600 $(INSTALL) -m 644 keys/freeworlddialup.pub $(DESTDIR)$(ASTDATADIR)/keys
601 $(INSTALL) -m 644 asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
602 $(INSTALL) -m 644 contrib/scripts/astgenkey.8 $(DESTDIR)$(ASTMANDIR)/man8
603 $(INSTALL) -m 644 contrib/scripts/autosupport.8 $(DESTDIR)$(ASTMANDIR)/man8
604 $(INSTALL) -m 644 contrib/scripts/safe_asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
605 $(INSTALL) -m 644 contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTDATADIR)/firmware/iax/iaxy.bin; \
608 @$(MAKE) -C $(@:-install=) install
610 NEWMODS=$(notdir $(wildcard */*.so))
611 OLDMODS=$(filter-out $(NEWMODS),$(notdir $(wildcard $(DESTDIR)$(MODULES_DIR)/*.so)))
614 @if [ -n "$(OLDMODS)" ]; then \
615 echo " WARNING WARNING WARNING" ;\
617 echo " Your Asterisk modules directory, located at" ;\
618 echo " $(DESTDIR)$(MODULES_DIR)" ;\
619 echo " contains modules that were not installed by this " ;\
620 echo " version of Asterisk. Please ensure that these" ;\
621 echo " modules are compatible with this version before" ;\
622 echo " attempting to run Asterisk." ;\
624 for f in $(OLDMODS); do \
628 echo " WARNING WARNING WARNING" ;\
631 install: all datafiles bininstall $(SUBDIRS_INSTALL)
632 @if [ -x /usr/sbin/asterisk-post-install ]; then \
633 /usr/sbin/asterisk-post-install $(DESTDIR) . ; \
635 @echo " +---- Asterisk Installation Complete -------+"
637 @echo " + YOU MUST READ THE SECURITY DOCUMENT +"
639 @echo " + Asterisk has successfully been installed. +"
640 @echo " + If you would like to install the sample +"
641 @echo " + configuration files (overwriting any +"
642 @echo " + existing config files), run: +"
644 @echo " + $(MAKE) samples +"
646 @echo " +----------------- or ---------------------+"
648 @echo " + You can go ahead and install the asterisk +"
649 @echo " + program documentation now or later run: +"
651 @echo " + $(MAKE) progdocs +"
653 @echo " + **Note** This requires that you have +"
654 @echo " + doxygen installed on your local system +"
655 @echo " +-------------------------------------------+"
656 @$(MAKE) -s oldmodcheck
658 upgrade: all bininstall
661 mkdir -p $(DESTDIR)$(ASTETCDIR)
662 for x in configs/*.adsi; do \
663 if [ ! -f $(DESTDIR)$(ASTETCDIR)/$$x ]; then \
664 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x` ; \
669 mkdir -p $(DESTDIR)$(ASTETCDIR)
670 for x in configs/*.sample; do \
671 if [ -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ]; then \
672 if [ "$(OVERWRITE)" = "y" ]; then \
673 if cmp -s $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $$x ; then \
674 echo "Config file $$x is unchanged"; \
677 mv -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample`.old ; \
679 echo "Skipping config file $$x"; \
683 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ;\
685 if [ "$(OVERWRITE)" = "y" ] || [ ! -f $(DESTDIR)$(ASTCONFPATH) ]; then \
687 echo "[directories]" ; \
688 echo "astetcdir => $(ASTETCDIR)" ; \
689 echo "astmoddir => $(MODULES_DIR)" ; \
690 echo "astvarlibdir => $(ASTVARLIBDIR)" ; \
691 echo "astdatadir => $(ASTDATADIR)" ; \
692 echo "astagidir => $(AGI_DIR)" ; \
693 echo "astspooldir => $(ASTSPOOLDIR)" ; \
694 echo "astrundir => $(ASTVARRUNDIR)" ; \
695 echo "astlogdir => $(ASTLOGDIR)" ; \
697 echo "; Changing the following lines may compromise your security." ; \
699 echo ";astctlpermissions = 0660" ; \
700 echo ";astctlowner = root" ; \
701 echo ";astctlgroup = apache" ; \
702 echo ";astctl = asterisk.ctl" ; \
703 echo ";[options]" ; \
704 echo ";internal_timing = yes" ; \
705 ) > $(DESTDIR)$(ASTCONFPATH) ; \
707 echo "Skipping asterisk.conf creation"; \
709 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
710 :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm
711 for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isunavail; do \
712 cat $(DESTDIR)$(ASTDATADIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm ; \
714 :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm
715 for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isonphone; do \
716 cat $(DESTDIR)$(ASTDATADIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm ; \
720 @[ -d $(DESTDIR)$(HTTP_DOCSDIR)/ ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 )
721 @[ -d $(DESTDIR)$(HTTP_CGIDIR) ] || ( printf "cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit 1 )
722 $(INSTALL) -m 4755 -o root -g root contrib/scripts/vmail.cgi $(DESTDIR)$(HTTP_CGIDIR)/vmail.cgi
723 mkdir -p $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk
724 for x in images/*.gif; do \
725 $(INSTALL) -m 644 $$x $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk/; \
727 @echo " +--------- Asterisk Web Voicemail ----------+"
729 @echo " + Asterisk Web Voicemail is installed in +"
730 @echo " + your cgi-bin directory: +"
731 @echo " + $(DESTDIR)$(HTTP_CGIDIR)"
732 @echo " + IT USES A SETUID ROOT PERL SCRIPT, SO +"
733 @echo " + IF YOU DON'T LIKE THAT, UNINSTALL IT! +"
735 @echo " + Other static items have been stored in: +"
736 @echo " + $(DESTDIR)$(HTTP_DOCSDIR)"
738 @echo " + If these paths do not match your httpd +"
739 @echo " + installation, correct the definitions +"
740 @echo " + in your Makefile of HTTP_CGIDIR and +"
741 @echo " + HTTP_DOCSDIR +"
743 @echo " +-------------------------------------------+"
746 sed "s/^Version:.*/Version: $(RPMVERSION)/g" redhat/asterisk.spec > asterisk.spec ; \
750 __rpm: include/asterisk/version.h include/asterisk/buildopts.h spec
751 rm -rf /tmp/asterisk ; \
752 mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
753 $(MAKE) DESTDIR=/tmp/asterisk install ; \
754 $(MAKE) DESTDIR=/tmp/asterisk samples ; \
755 mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
756 cp -f contrib/init.d/rc.redhat.asterisk /tmp/asterisk/etc/rc.d/init.d/asterisk ; \
757 rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec
760 (cat contrib/asterisk-ng-doxygen; echo "HAVE_DOT=$(HAVEDOT)"; \
761 echo "PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen -
764 @if [ "${OSARCH}" = "Linux" ]; then \
765 if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \
766 $(INSTALL) -m 755 contrib/init.d/rc.redhat.asterisk /etc/rc.d/init.d/asterisk; \
767 /sbin/chkconfig --add asterisk; \
768 elif [ -f /etc/debian_version ]; then \
769 $(INSTALL) -m 755 contrib/init.d/rc.debian.asterisk /etc/init.d/asterisk; \
770 /usr/sbin/update-rc.d asterisk start 10 2 3 4 5 . stop 91 2 3 4 5 .; \
771 elif [ -f /etc/gentoo-release ]; then \
772 $(INSTALL) -m 755 contrib/init.d/rc.gentoo.asterisk /etc/init.d/asterisk; \
773 /sbin/rc-update add asterisk default; \
774 elif [ -f /etc/mandrake-release ]; then \
775 $(INSTALL) -m 755 contrib/init.d/rc.mandrake.asterisk /etc/rc.d/init.d/asterisk; \
776 /sbin/chkconfig --add asterisk; \
777 elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then \
778 $(INSTALL) -m 755 contrib/init.d/rc.suse.asterisk /etc/init.d/asterisk; \
779 /sbin/chkconfig --add asterisk; \
780 elif [ -f /etc/slackware-version ]; then \
781 echo "Slackware is not currently supported, although an init script does exist for it." \
783 echo "We could not install init scripts for your distribution."; \
786 echo "We could not install init scripts for your operating system."; \
791 valgrind: dont-optimize
793 $(MOD_SUBDIRS_DEPEND):
794 @CFLAGS="$(MOD_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $(@:-depend=) depend
796 $(OTHER_SUBDIRS_DEPEND):
797 @CFLAGS="$(OTHER_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $(@:-depend=) depend
799 depend: include/asterisk/version.h include/asterisk/buildopts.h .depend defaults.h $(SUBDIRS_DEPEND)
801 .depend: include/asterisk/version.h include/asterisk/buildopts.h defaults.h
802 build_tools/mkdep $(CFLAGS) $(wildcard *.c)
805 @echo -n ".tags-depend: " > $@
806 @$(FIND) . -maxdepth 1 -name \*.c -printf "\t%p \\\\\n" >> $@
807 @$(FIND) . -maxdepth 1 -name \*.h -printf "\t%p \\\\\n" >> $@
808 @$(FIND) $(SUBDIRS) -name \*.c -printf "\t%p \\\\\n" >> $@
809 @$(FIND) $(SUBDIRS) -name \*.h -printf "\t%p \\\\\n" >> $@
810 @$(FIND) include -name \*.h -printf "\t%p \\\\\n" >> $@
815 @$(FIND) . -maxdepth 1 -name \*.c -print >> $@
816 @$(FIND) . -maxdepth 1 -name \*.h -print >> $@
817 @$(FIND) $(SUBDIRS) -name \*.c -print >> $@
818 @$(FIND) $(SUBDIRS) -name \*.h -print >> $@
819 @$(FIND) include -name \*.h -print >> $@
821 tags: .tags-depend .tags-sources
822 ctags -L .tags-sources -o $@
826 TAGS: .tags-depend .tags-sources
827 etags -o $@ `cat .tags-sources`
832 $(MAKE) -C $(shell echo $@ | sed "s/_env//g") env
835 $(MAKE) -C sounds all
840 # If the cleancount has been changed, force a make clean.
841 # .cleancount is the global clean count, and .lastclean is the
842 # last clean count we had
845 @if cmp -s .cleancount .lastclean ; then echo ; else \
846 $(MAKE) clean; cp -f .cleancount .lastclean;\
850 $(SUBDIRS_UNINSTALL):
851 @$(MAKE) -C $(@:-uninstall=) uninstall
853 _uninstall: $(SUBDIRS_UNINSTALL)
854 rm -f $(DESTDIR)$(MODULES_DIR)/*
855 rm -f $(DESTDIR)$(ASTSBINDIR)/*asterisk*
856 rm -f $(DESTDIR)$(ASTSBINDIR)/astgenkey
857 rm -f $(DESTDIR)$(ASTSBINDIR)/autosupport
858 rm -rf $(DESTDIR)$(ASTHEADERDIR)
859 rm -rf $(DESTDIR)$(ASTDATADIR)/firmware
860 rm -rf $(DESTDIR)$(ASTMANDIR)/man8
861 $(MAKE) -C sounds uninstall
863 uninstall: _uninstall
864 @echo " +--------- Asterisk Uninstall Complete -----+"
865 @echo " + Asterisk binaries, sounds, man pages, +"
866 @echo " + headers, modules, and firmware builds, +"
867 @echo " + have all been uninstalled. +"
869 @echo " + To remove ALL traces of Asterisk, +"
870 @echo " + including configuration, spool +"
871 @echo " + directories, and logs, run the following +"
872 @echo " + command: +"
874 @echo " + $(MAKE) uninstall-all +"
875 @echo " +-------------------------------------------+"
877 uninstall-all: _uninstall
878 rm -rf $(DESTDIR)$(ASTLIBDIR)
879 rm -rf $(DESTDIR)$(ASTVARLIBDIR)
880 rm -rf $(DESTDIR)$(ASTDATADIR)
881 rm -rf $(DESTDIR)$(ASTSPOOLDIR)
882 rm -rf $(DESTDIR)$(ASTETCDIR)
883 rm -rf $(DESTDIR)$(ASTLOGDIR)
885 menuselect: menuselect/menuselect makeopts.xml
886 -@menuselect/menuselect ${GLOBAL_MAKEOPTS} ${USER_MAKEOPTS} menuselect.makeopts && echo "menuselect changes saved!" || echo "menuselect changes NOT saved!"
888 menuselect/menuselect: menuselect/menuselect.c menuselect/menuselect_curses.c menuselect/menuselect.h menuselect/linkedlists.h config.status mxml/libmxml.a $(MENUSELECT_OBJS)
889 @CFLAGS="-include $(PWD)/include/asterisk/autoconfig.h" PARENTSRC="$(PWD)" $(MAKE) -C menuselect menuselect
892 @cd mxml && unset CFLAGS LIBS && test -f config.h || ./configure
893 $(MAKE) -C mxml libmxml.a
895 makeopts.xml: $(foreach dir,$(MOD_SUBDIRS),$(dir)/*.c) build_tools/cflags.xml sounds/sounds.xml
896 @echo "Generating list of available modules ..."
897 @build_tools/prep_moduledeps > $@
899 .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)