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 # Pentium Pro Optimize
30 # Pentium & VIA processors optimize
36 CC
=$(CROSS_COMPILE
)gcc
39 ifeq ($(CROSS_COMPILE
),)
40 OSARCH
=$(shell uname
-s
)
41 PROC?
=$(shell uname
-m
)
49 # Remember the MAKELEVEL at the top
50 MAKETOPLEVEL?
=$(MAKELEVEL
)
52 ifeq ($(findstring dont-optimize
,$(MAKECMDGOALS
)),)
53 # More GSM codec optimization
54 # Uncomment to enable MMXTM optimizations for x86 architecture CPU's
55 # which support MMX instructions. This should be newer pentiums,
56 # ppro's, etc, as well as the AMD K6 and K7.
59 # Tell gcc to optimize the code
62 # Stack backtraces, while useful for debugging, are incompatible with optimizations
63 ifeq (${OSARCH},Linux
)
64 CFLAGS
+=-DSTACK_BACKTRACES
68 # Overwite config files on "make samples"
71 # Include debug and macro symbols in the executables (-g) and profiling info (-pg)
74 # Set NOCRYPTO to yes if you do not want to have crypto support or dependencies
77 # If you are running a radio application, define RADIO_RELAX so that the DTMF
78 # will be received more reliably
79 #OPTIONS += -DRADIO_RELAX
81 # If you don't have a lot of memory (e.g. embedded Asterisk), define LOW_MEMORY
82 # to reduce the size of certain static buffers
83 #ifneq ($(CROSS_COMPILE),)
84 #OPTIONS += -DLOW_MEMORY
87 # Asterisk SMDI integration
90 # Optional debugging parameters
91 DEBUG_THREADS
= #-DDUMP_SCHEDULER #-DDEBUG_SCHEDULER #-DDEBUG_THREADS #-DDO_CRASH #-DDETECT_DEADLOCKS
93 # If you want to debug channel locking, try this (depends on code using
94 # ast_channel_lock and companions to work)
95 DEBUG_THREADS
+= #-DDEBUG_CHANNEL_LOCKS
97 # Uncomment next one to enable ast_frame tracing (for debugging)
98 TRACE_FRAMES
= #-DTRACE_FRAMES
100 # Where to install asterisk after compiling
101 # Default -> leave empty
105 # Files are copied here temporarily during the install process
106 # For example, make DESTDIR=/tmp/asterisk woud put things in
107 # /tmp/asterisk/etc/asterisk
108 # !!! Watch out, put no spaces or comments after the value !!!
110 #DESTDIR?=/tmp/asterisk
112 # Original busydetect routine
113 BUSYDETECT
= #-DBUSYDETECT
115 # Improved busydetect routine, comment the previous one if you use this one
116 BUSYDETECT
+= #-DBUSYDETECT_MARTIN
117 # Detect the busy signal looking only at tone lengths
118 # For example if you have 3 beeps 100ms tone, 100ms silence separated by 500 ms of silence
119 BUSYDETECT
+= #-DBUSYDETECT_TONEONLY
120 # Enforce the detection of busy signal (get rid of false hangups)
121 # Don't use together with -DBUSYDETECT_TONEONLY
122 BUSYDETECT
+= #-DBUSYDETECT_COMPARE_TONE_AND_SILENCE
124 # Define standard directories for various platforms
125 # These apply if they are not redefined in asterisk.conf
126 ifeq ($(OSARCH
),SunOS
)
127 ASTETCDIR
=$(INSTALL_PREFIX
)/etc
/opt
/asterisk
128 ASTLIBDIR
=$(INSTALL_PREFIX
)/opt
/asterisk
/lib
129 ASTVARLIBDIR
=$(INSTALL_PREFIX
)/var
/opt
/asterisk
/lib
130 ASTSPOOLDIR
=$(INSTALL_PREFIX
)/var
/opt
/asterisk
/spool
131 ASTLOGDIR
=$(INSTALL_PREFIX
)/var
/opt
/asterisk
/log
132 ASTHEADERDIR
=$(INSTALL_PREFIX
)/opt
/asterisk
/usr
/include/asterisk
133 ASTBINDIR
=$(INSTALL_PREFIX
)/opt
/asterisk
/usr
/bin
134 ASTSBINDIR
=$(INSTALL_PREFIX
)/opt
/asterisk
/usr
/sbin
135 ASTVARRUNDIR
=$(INSTALL_PREFIX
)/var
/opt
/asterisk
/run
136 ASTMANDIR
=$(INSTALL_PREFIX
)/opt
/asterisk
/usr
/share
/man
138 ifeq ($(OSARCH
),FreeBSD
)
140 ASTETCDIR
=$(INSTALL_PREFIX
)$(PREFIX
)/etc
/asterisk
141 ASTLIBDIR
=$(INSTALL_PREFIX
)$(PREFIX
)/lib
/asterisk
142 ASTVARLIBDIR
=$(INSTALL_PREFIX
)$(PREFIX
)/share
/asterisk
143 ASTSPOOLDIR
=$(INSTALL_PREFIX
)/var
/spool
/asterisk
144 ASTLOGDIR
=$(INSTALL_PREFIX
)/var
/log
/asterisk
145 ASTHEADERDIR
=$(INSTALL_PREFIX
)$(PREFIX
)/include/asterisk
146 ASTBINDIR
=$(INSTALL_PREFIX
)$(PREFIX
)/bin
147 ASTSBINDIR
=$(INSTALL_PREFIX
)$(PREFIX
)/sbin
148 ASTVARRUNDIR
=$(INSTALL_PREFIX
)/var
/run
149 ASTMANDIR
=$(INSTALL_PREFIX
)$(PREFIX
)/man
151 ASTETCDIR
=$(INSTALL_PREFIX
)/etc
/asterisk
152 ASTLIBDIR
=$(INSTALL_PREFIX
)/usr
/lib
/asterisk
153 ASTVARLIBDIR
=$(INSTALL_PREFIX
)/var
/lib
/asterisk
154 ASTSPOOLDIR
=$(INSTALL_PREFIX
)/var
/spool
/asterisk
155 ASTLOGDIR
=$(INSTALL_PREFIX
)/var
/log
/asterisk
156 ASTHEADERDIR
=$(INSTALL_PREFIX
)/usr
/include/asterisk
157 ASTBINDIR
=$(INSTALL_PREFIX
)/usr
/bin
158 ASTSBINDIR
=$(INSTALL_PREFIX
)/usr
/sbin
159 ASTVARRUNDIR
=$(INSTALL_PREFIX
)/var
/run
160 ASTMANDIR
=$(INSTALL_PREFIX
)/usr
/share
/man
163 ASTDATADIR?
=$(ASTVARLIBDIR
)
165 # Asterisk.conf is located in ASTETCDIR or by using the -C flag
166 # when starting Asterisk
167 ASTCONFPATH
=$(ASTETCDIR
)/asterisk.conf
168 MODULES_DIR
=$(ASTLIBDIR
)/modules
169 AGI_DIR
=$(ASTDATADIR
)/agi-bin
171 # If you use Apache, you may determine by a grep 'DocumentRoot' of your httpd.conf file
172 HTTP_DOCSDIR
=/var
/www
/html
173 # Determine by a grep 'ScriptAlias' of your Apache httpd.conf file
174 HTTP_CGIDIR
=/var
/www
/cgi-bin
178 # Uncomment this to use the older DSP routines
179 #ASTCFLAGS+=-DOLD_DSP_ROUTINES
181 # If the file .asterisk.makeopts is present in your home directory, you can
182 # include all of your favorite menuselect options so that every time you download
183 # a new version of Asterisk, you don't have to run menuselect to set them.
184 # The file /etc/asterisk.makeopts will also be included but can be overridden
185 # by the file in your home directory.
187 GLOBAL_MAKEOPTS
=$(wildcard /etc
/asterisk.makeopts
)
188 USER_MAKEOPTS
=$(wildcard ~
/.asterisk.makeopts
)
190 ifneq ($(wildcard menuselect.makeopts
),)
191 include menuselect.makeopts
194 ifneq ($(wildcard makeopts
),)
198 ASTCFLAGS
+=$(MENUSELECT_CFLAGS
)
199 TOPDIR_CFLAGS
=-include include/autoconfig.h
-Iinclude
200 MOD_SUBDIR_CFLAGS
=-include ..
/include/autoconfig.h
-I..
/include -I..
201 OTHER_SUBDIR_CFLAGS
=-include ..
/include/autoconfig.h
-I..
/include -I..
203 # *CLI> show memory allocations [filename]
204 # *CLI> show memory summary [filename]
205 ifneq ($(findstring -DMALLOC_DEBUG
,$(ASTCFLAGS
)),)
206 TOPDIR_CFLAGS
+=-include include/asterisk
/astmm.h
207 MOD_SUBDIR_CFLAGS
+=-include ..
/include/asterisk
/astmm.h
210 MOD_SUBDIR_CFLAGS
+=-fPIC
212 ifeq ($(OSARCH
),Linux
)
213 ifeq ($(PROC
),x86_64
)
214 # You must have GCC 3.4 to use k8, otherwise use athlon
219 ifeq ($(PROC
),sparc64
)
220 #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
221 #This works for even old (2.96) versions of gcc and provides a small boost either way.
222 #A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
223 #So we go lowest common available by gcc and go a step down, still a step up from
224 #the default as we now have a better instruction set to work with. - Belgarath
226 OPTIONS
+=$(shell if
$(CC
) -mtune
=$(PROC
) -S
-o
/dev
/null
-xc
/dev
/null
>/dev
/null
2>&1; then echo
"-mtune=$(PROC)"; fi
)
227 OPTIONS
+=$(shell if
$(CC
) -mcpu
=v8
-S
-o
/dev
/null
-xc
/dev
/null
>/dev
/null
2>&1; then echo
"-mcpu=v8"; fi
)
228 OPTIONS
+=-fomit-frame-pointer
232 # The Cirrus logic is the only heavily shipping arm processor with a real floating point unit
233 ifeq ($(SUB_PROC
),maverick
)
234 OPTIONS
+=-fsigned-char
-mcpu
=ep9312
236 ifeq ($(SUB_PROC
),xscale
)
237 OPTIONS
+=-fsigned-char
-mcpu
=xscale
239 OPTIONS
+=-fsigned-char
249 ifeq ($(OSARCH
),SunOS
)
250 GREP
=/usr
/xpg4
/bin
/grep
255 ASTCFLAGS
+=-pipe
-Wall
-Wstrict-prototypes
-Wmissing-prototypes
-Wmissing-declarations
$(DEBUG
) $(INCLUDE
) #-DMAKE_VALGRIND_HAPPY
256 ASTCFLAGS
+=$(OPTIMIZE
)
258 ifeq ($(AST_DEVMODE
),yes
)
259 ASTCFLAGS
+=-Werror
-Wunused
262 ifeq ($(shell gcc
-v
2>&1 | grep
'gcc version' | cut
-f3
-d
' ' | cut
-f1
-d.
),4)
263 ASTCFLAGS
+= -Wno-pointer-sign
267 ifeq ($(findstring BSD
,$(OSARCH
)),BSD
)
268 ASTCFLAGS
+=-I
$(CROSS_COMPILE_TARGET
)/usr
/local
/include -L
$(CROSS_COMPILE_TARGET
)/usr
/local
/lib
271 ifneq ($(PROC
),ultrasparc
)
272 ASTCFLAGS
+=$(shell if
$(CC
) -march
=$(PROC
) -S
-o
/dev
/null
-xc
/dev
/null
>/dev
/null
2>&1; then echo
"-march=$(PROC)"; fi
)
276 ASTCFLAGS
+=-fsigned-char
279 ifeq ($(OSARCH
),FreeBSD
)
280 BSDVERSION
=$(shell make
-V OSVERSION
-f
$(CROSS_COMPILE_TARGET
)/usr
/share
/mk
/bsd.port.subdir.mk
)
281 ASTCFLAGS
+=$(shell if
test $(BSDVERSION
) -lt
500016 ; then echo
"-D_THREAD_SAFE"; fi
)
282 LIBS
+=$(shell if
test $(BSDVERSION
) -lt
502102 ; then echo
"-lc_r"; else echo
"-pthread"; fi
)
283 ifneq ($(wildcard $(CROSS_COMPILE_TARGET
)/usr
/local
/include/spandsp
),)
284 ASTCFLAGS
+=-I
$(CROSS_COMPILE_TARGET
)/usr
/local
/include/spandsp
289 ifeq ($(OSARCH
),NetBSD
)
291 INCLUDE
+=-I
$(CROSS_COMPILE_TARGET
)/usr
/pkg
/include
295 ifeq ($(OSARCH
),OpenBSD
)
299 ifeq ($(OSARCH
),SunOS
)
300 ASTCFLAGS
+=-Wcast-align
-DSOLARIS
301 INCLUDE
+=-Iinclude
/solaris-compat
-I
$(CROSS_COMPILE_TARGET
)/usr
/local
/ssl
/include
304 LIBEDIT
=editline
/libedit.a
306 ASTERISKVERSION
:=$(shell build_tools
/make_version .
)
308 ifneq ($(wildcard .version
),)
309 ASTERISKVERSIONNUM
:=$(shell awk
-F.
'{printf "%02d%02d%02d", $$1, $$2, $$3}' .version
)
310 RPMVERSION
:=$(shell sed
's/[-\/:]/_/g' .version
)
315 # CVS mirrors of SVN have .svnrevision files showing
316 # which SVN revision they are based on, and .svnbranch
317 # showing the branch they are made from
318 ifneq ($(wildcard .svnrevision
),)
319 ASTERISKVERSIONNUM
=999999
321 ifneq ($(wildcard .svn
),)
322 ASTERISKVERSIONNUM
=999999
326 ASTCFLAGS
+= $(DEBUG_THREADS
)
327 ASTCFLAGS
+= $(TRACE_FRAMES
)
328 ASTCFLAGS
+= $(MALLOC_DEBUG
)
329 ASTCFLAGS
+= $(BUSYDETECT
)
330 ASTCFLAGS
+= $(OPTIONS
)
331 ifeq ($(findstring dont-optimize
,$(MAKECMDGOALS
)),)
332 ASTCFLAGS
+= -fomit-frame-pointer
335 MOD_SUBDIRS
=res channels pbx apps codecs formats cdr funcs
336 SUBDIRS
:=$(MOD_SUBDIRS
) utils stdtime agi
338 OBJS
=io.o sched.o logger.o frame.o loader.o config.o channel.o \
339 translate.o file.o pbx.o cli.o md5.o term.o \
340 ulaw.o alaw.o callerid.o fskmodem.o image.o app.o \
341 cdr.o tdd.o acl.o rtp.o udptl.o manager.o asterisk.o \
342 dsp.o chanvars.o indications.o autoservice.o db.o privacy.o \
343 astmm.o enum.o srv.o dns.o aescrypt.o aestab.o aeskey.o \
344 utils.o plc.o jitterbuf.o dnsmgr.o devicestate.o \
345 netsock.o slinfactory.o ast_expr2.o ast_expr2f.o \
346 cryptostub.o sha1.o http.o
348 # we need to link in the objects statically, not as a library, because
349 # otherwise modules will not have them available if none of the static
351 OBJS
+= stdtime
/localtime.o
353 # At the moment say.o is an optional component which can be overridden
357 ifeq ($(wildcard $(CROSS_COMPILE_TARGET
)/usr
/include/sys
/poll.h
),)
359 ASTCFLAGS
+=-DPOLLCOMPAT
362 ifeq ($(wildcard $(CROSS_COMPILE_TARGET
)/usr
/include/dlfcn.h
),)
364 ASTCFLAGS
+=-DDLFCNCOMPAT
367 ifeq ($(OSARCH
),Linux
)
368 LIBS
+=-ldl
-lpthread
$(EDITLINE_LIBS
) -lm
-lresolv
#-lnjamd
370 LIBS
+=$(EDITLINE_LIBS
) -lm
373 ifeq ($(OSARCH
),Darwin
)
375 ASTCFLAGS
+=-D__Darwin__
376 AUDIO_LIBS
=-framework CoreAudio
378 SOLINK
=-dynamic
-bundle
-undefined suppress
-force_flat_namespace
379 # Mac on Intel CoreDuo does not need poll compatibility layer
382 ASTCFLAGS
+=-DPOLLCOMPAT
385 # These are used for all but Darwin
387 SOLINK
=-shared
-Xlinker
-x
388 ifeq ($(findstring BSD
,$(OSARCH
)),BSD
)
389 SOLINK
+=-L
$(CROSS_COMPILE_TARGET
)/usr
/local
/lib
393 ifeq ($(OSARCH
),FreeBSD
)
397 ifeq ($(OSARCH
),NetBSD
)
398 LIBS
+=-lpthread
-lcrypto
-lm
-L
$(CROSS_COMPILE_TARGET
)/usr
/pkg
/lib
$(EDITLINE_LIBS
)
401 ifeq ($(OSARCH
),OpenBSD
)
402 LIBS
+=-lcrypto
-lpthread
-lm
$(EDITLINE_LIBS
)
405 ifeq ($(OSARCH
),SunOS
)
406 LIBS
+=-lpthread
-ldl
-lnsl
-lsocket
-lresolv
-L
$(CROSS_COMPILE_TARGET
)/usr
/local
/ssl
/lib
408 MENUSELECT_OBJS
+=strcompat.o
410 SOLINK
=-shared
-fpic
-L
$(CROSS_COMPILE_TARGET
)/usr
/local
/ssl
/lib
413 ifeq ($(MAKETOPLEVEL
),$(MAKELEVEL
))
414 CFLAGS
+=$(TOPDIR_CFLAGS
) $(ASTCFLAGS
)
417 # This is used when generating the doxygen documentation
427 @echo
" +--------- Asterisk Build Complete ---------+"
428 @echo
" + Asterisk has successfully been built, but +"
429 @echo
" + cannot be run before being installed by +"
430 @echo
" + running: +"
432 @echo
" + make install +"
433 @echo
" +-------------------------------------------+"
435 all: config.status menuselect.makeopts cleantest depend asterisk subdirs
437 config.status
: configure
438 @CFLAGS
="" .
/configure
440 @echo
"**** The configure script was just executed, so 'make' needs to be"
441 @echo
"**** restarted."
446 @CFLAGS
="" .
/configure
448 @echo
"**** The configure script was just executed, so 'make' needs to be"
449 @echo
"**** restarted."
453 menuselect.makeopts
: build_tools
/menuselect makeopts.xml
454 @build_tools
/menuselect
--check-deps
${GLOBAL_MAKEOPTS} ${USER_MAKEOPTS} $@
456 #ifneq ($(wildcard tags),)
460 ifneq ($(wildcard TAGS
),)
465 cd editline
&& unset CFLAGS LIBS
&& CFLAGS
="$(OPTIMIZE)" .
/configure
; \
468 cd editline
&& unset CFLAGS LIBS
&& test -f config.h || CFLAGS
="$(OPTIMIZE)" .
/configure
469 $(MAKE
) -C editline libedit.a
472 $(MAKE
) -C db1-ast libdb1.a
474 ifneq ($(wildcard .depend
),)
478 ifneq ($(wildcard .tags-depend
),)
483 bison
-o
$@
-d
--name-prefix
=ast_yy ast_expr2.y
486 flex
-o
$@
--full ast_expr2.fl
488 testexpr2
: ast_expr2f.c ast_expr2.c ast_expr2.h
489 gcc
-g
-c
-DSTANDALONE ast_expr2f.c
490 gcc
-g
-c
-DSTANDALONE ast_expr2.c
491 gcc
-g
-o testexpr2 ast_expr2f.o ast_expr2.o
492 rm ast_expr2.o ast_expr2f.o
496 asterisk
.8: asterisk.sgml
498 docbook2man asterisk.sgml
501 asterisk.pdf
: asterisk.sgml
502 docbook2pdf asterisk.sgml
504 asterisk.ps
: asterisk.sgml
505 docbook2ps asterisk.sgml
507 asterisk.html
: asterisk.sgml
508 docbook2html asterisk.sgml
509 mv r1.html asterisk.html
511 asterisk.txt
: asterisk.sgml
512 docbook2txt asterisk.sgml
515 build_tools
/make_defaults_h
> $@.tmp
516 if cmp
-s
$@.tmp
$@
; then echo
; else \
521 include/asterisk
/version.h
:
522 build_tools
/make_version_h
> $@.tmp
523 if cmp
-s
$@.tmp
$@
; then echo
; else \
529 CFLAGS
="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" $(MAKE
) -C stdtime libtime.a
531 asterisk
: editline
/libedit.a db1-ast
/libdb1.a stdtime
/libtime.a
$(OBJS
)
532 build_tools
/make_build_h
> include/asterisk
/build.h.tmp
533 if cmp
-s
include/asterisk
/build.h.tmp
include/asterisk
/build.h
; then echo
; else \
534 mv
include/asterisk
/build.h.tmp
include/asterisk
/build.h
; \
536 rm -f
include/asterisk
/build.h.tmp
537 $(CC
) -c
-o buildinfo.o
$(CFLAGS
) buildinfo.c
538 $(CC
) $(DEBUG
) $(ASTOBJ
) $(ASTLINK
) $(OBJS
) buildinfo.o
$(LIBEDIT
) db1-ast
/libdb1.a stdtime
/libtime.a
$(LIBS
)
541 $(CC
) $(AUDIO_LIBS
) -o muted muted.o
544 @for x in
$(MOD_SUBDIRS
); do CFLAGS
="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" $(MAKE
) -C
$$x || exit
1 ; done
545 @CFLAGS
="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" $(MAKE
) -C utils
546 @CFLAGS
="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" $(MAKE
) -C agi
549 @for x in
$(SUBDIRS
); do
$(MAKE
) -C
$$x clean-depend || exit
1 ; done
550 rm -f .depend .tags-depend
553 @for x in
$(SUBDIRS
); do
$(MAKE
) -C
$$x clean || exit
1 ; done
554 rm -f
*.o
*.so asterisk
556 rm -f
include/asterisk
/build.h
557 rm -f
include/asterisk
/version.h
558 rm -f .tags-sources
tags TAGS
559 @if
[ -f editline
/Makefile
]; then
$(MAKE
) -C editline
distclean ; fi
560 @if
[ -d mpg123-0.59r
]; then
$(MAKE
) -C mpg123-0.59r
clean; fi
561 $(MAKE
) -C db1-ast
clean
562 $(MAKE
) -C stdtime
clean
564 distclean: dist-clean
567 rm -f menuselect.makeopts makeopts makeopts.xml
568 rm -f config.log config.status
569 rm -f
include/autoconfig.h
570 $(MAKE
) -C mxml
clean
571 $(MAKE
) -C build_tools dist-clean
574 if
[ x
`$(ID) -un` = xroot
]; then sh build_tools
/mkpkgconfig
$(DESTDIR
)/usr
/lib
/pkgconfig
; fi
575 # Should static HTTP be installed during make samples or even with its own target ala
576 # webvoicemail? There are portions here that *could* be customized but might also be
577 # improved a lot. I'll put it here for now.
578 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/static-http
579 for x in static-http
/*; do \
580 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTDATADIR
)/static-http
; \
582 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/sounds
/digits
583 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/sounds
/priv-callerintros
584 for x in sounds
/digits
/*.gsm
; do \
585 if
$(GREP
) -q
"^%`basename $$x`%" sounds.txt
; then \
586 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTDATADIR
)/sounds
/digits
; \
588 echo
"No description for $$x"; \
592 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/sounds
/dictate
593 for x in sounds
/dictate
/*.gsm
; do \
594 if
$(GREP
) -q
"^%`basename $$x`%" sounds.txt
; then \
595 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTDATADIR
)/sounds
/dictate
; \
597 echo
"No description for $$x"; \
601 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/sounds
/letters
602 for x in sounds
/letters
/*.gsm
; do \
603 if
$(GREP
) -q
"^%`basename $$x`%" sounds.txt
; then \
604 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTDATADIR
)/sounds
/letters
; \
606 echo
"No description for $$x"; \
610 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/sounds
/phonetic
611 for x in sounds
/phonetic
/*.gsm
; do \
612 if
$(GREP
) -q
"^%`basename $$x`%" sounds.txt
; then \
613 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTDATADIR
)/sounds
/phonetic
; \
615 echo
"No description for $$x"; \
619 for x in sounds
/demo-
* sounds
/vm-
* sounds
/transfer
* sounds
/pbx-
* sounds
/ss-
* sounds
/beep
* sounds
/dir-
* sounds
/conf-
* sounds
/agent-
* sounds
/invalid
* sounds
/tt-
* sounds
/auth-
* sounds
/privacy-
* sounds
/queue-
* sounds
/spy-
* sounds
/priv-
* sounds
/screen-
* sounds
/hello-
*; do \
620 if
$(GREP
) -q
"^%`basename $$x`%" sounds.txt
; then \
621 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTDATADIR
)/sounds
; \
623 echo
"No description for $$x"; \
627 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/mohmp3
628 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/images
629 for x in images
/*.jpg
; do \
630 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTDATADIR
)/images
; \
632 mkdir
-p
$(DESTDIR
)$(AGI_DIR
)
635 @if
[ -d .svn
]; then \
636 echo
"Updating from Subversion..." ; \
637 svn update | tee update.out
; \
639 if
[ `grep -c ^C update.out` -gt
0 ]; then \
640 echo
; echo
"The following files have conflicts:" ; \
641 grep ^C update.out | cut
-b4-
; \
644 $(MAKE
) clean-depend
; \
645 elif
[ -d CVS
]; then \
646 echo
"Updating from CVS..." ; \
647 cvs
-q
-z3 update
-Pd | tee update.out
; \
649 if
[ `grep -c ^C update.out` -gt
0 ]; then \
650 echo
; echo
"The following files have conflicts:" ; \
651 grep ^C update.out | cut
-d
' ' -f2-
; \
654 $(MAKE
) clean-depend
; \
656 echo
"Not under version control"; \
659 NEWHEADERS
=$(notdir $(wildcard include/asterisk
/*.h
))
660 OLDHEADERS
=$(filter-out $(NEWHEADERS
),$(notdir $(wildcard $(DESTDIR
)$(ASTHEADERDIR
)/*.h
)))
663 mkdir
-p
$(DESTDIR
)$(MODULES_DIR
)
664 mkdir
-p
$(DESTDIR
)$(ASTSBINDIR
)
665 mkdir
-p
$(DESTDIR
)$(ASTETCDIR
)
666 mkdir
-p
$(DESTDIR
)$(ASTBINDIR
)
667 mkdir
-p
$(DESTDIR
)$(ASTVARRUNDIR
)
668 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/voicemail
669 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/dictate
670 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/system
671 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/tmp
672 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/meetme
673 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/monitor
674 if
[ -f asterisk
]; then
$(INSTALL
) -m
755 asterisk
$(DESTDIR
)$(ASTSBINDIR
)/; fi
675 if
[ -f asterisk.dll
]; then
$(INSTALL
) -m
755 asterisk.dll
$(DESTDIR
)$(ASTSBINDIR
)/; fi
676 ln
-sf asterisk
$(DESTDIR
)$(ASTSBINDIR
)/rasterisk
677 $(INSTALL
) -m
755 contrib
/scripts
/astgenkey
$(DESTDIR
)$(ASTSBINDIR
)/
678 $(INSTALL
) -m
755 contrib
/scripts
/autosupport
$(DESTDIR
)$(ASTSBINDIR
)/
679 if
[ ! -f
$(DESTDIR
)$(ASTSBINDIR
)/safe_asterisk
]; then \
680 cat contrib
/scripts
/safe_asterisk | sed
's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;' > $(DESTDIR
)$(ASTSBINDIR
)/safe_asterisk
;\
681 chmod
755 $(DESTDIR
)$(ASTSBINDIR
)/safe_asterisk
;\
683 $(INSTALL
) -d
$(DESTDIR
)$(ASTHEADERDIR
)
684 $(INSTALL
) -m
644 include/asterisk
/*.h
$(DESTDIR
)$(ASTHEADERDIR
)
685 if
[ -n
"$(OLDHEADERS)" ]; then \
686 rm -f
$(addprefix $(DESTDIR
)$(ASTHEADERDIR
)/,$(OLDHEADERS
)) ;\
688 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/sounds
689 mkdir
-p
$(DESTDIR
)$(ASTLOGDIR
)/cdr-csv
690 mkdir
-p
$(DESTDIR
)$(ASTLOGDIR
)/cdr-custom
691 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/keys
692 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/firmware
693 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/firmware
/iax
694 mkdir
-p
$(DESTDIR
)$(ASTMANDIR
)/man8
695 $(INSTALL
) -m
644 keys
/iaxtel.pub
$(DESTDIR
)$(ASTDATADIR
)/keys
696 $(INSTALL
) -m
644 keys
/freeworlddialup.pub
$(DESTDIR
)$(ASTDATADIR
)/keys
697 $(INSTALL
) -m
644 asterisk
.8 $(DESTDIR
)$(ASTMANDIR
)/man8
698 $(INSTALL
) -m
644 contrib
/scripts
/astgenkey
.8 $(DESTDIR
)$(ASTMANDIR
)/man8
699 $(INSTALL
) -m
644 contrib
/scripts
/autosupport
.8 $(DESTDIR
)$(ASTMANDIR
)/man8
700 $(INSTALL
) -m
644 contrib
/scripts
/safe_asterisk
.8 $(DESTDIR
)$(ASTMANDIR
)/man8
701 if
[ -d contrib
/firmware
/iax
]; then \
702 $(INSTALL
) -m
644 contrib
/firmware
/iax
/iaxy.bin
$(DESTDIR
)$(ASTDATADIR
)/firmware
/iax
/iaxy.bin
; \
704 echo
"You need to do cvs update -d not just cvs update" ; \
706 if
[ -f mpg123-0.59r
/mpg123
]; then
$(MAKE
) -C mpg123-0.59r
install; fi
709 @for x in
$(SUBDIRS
); do
$(MAKE
) -C
$$x install || exit
1 ; done
711 NEWMODS
=$(notdir $(wildcard */*.so
))
712 OLDMODS
=$(filter-out $(NEWMODS
),$(notdir $(wildcard $(DESTDIR
)$(MODULES_DIR
)/*.so
)))
715 @if
[ -n
"$(OLDMODS)" ]; then \
716 echo
" WARNING WARNING WARNING" ;\
718 echo
" Your Asterisk modules directory, located at" ;\
719 echo
" $(DESTDIR)$(MODULES_DIR)" ;\
720 echo
" contains modules that were not installed by this " ;\
721 echo
" version of Asterisk. Please ensure that these" ;\
722 echo
" modules are compatible with this version before" ;\
723 echo
" attempting to run Asterisk." ;\
725 for f in
$(OLDMODS
); do \
729 echo
" WARNING WARNING WARNING" ;\
732 install: all datafiles bininstall install-subdirs
733 @if
[ -x
/usr
/sbin
/asterisk-post-install
]; then \
734 /usr
/sbin
/asterisk-post-install
$(DESTDIR
) .
; \
736 @echo
" +---- Asterisk Installation Complete -------+"
738 @echo
" + YOU MUST READ THE SECURITY DOCUMENT +"
740 @echo
" + Asterisk has successfully been installed. +"
741 @echo
" + If you would like to install the sample +"
742 @echo
" + configuration files (overwriting any +"
743 @echo
" + existing config files), run: +"
745 @echo
" + $(MAKE) samples +"
747 @echo
" +----------------- or ---------------------+"
749 @echo
" + You can go ahead and install the asterisk +"
750 @echo
" + program documentation now or later run: +"
752 @echo
" + $(MAKE) progdocs +"
754 @echo
" + **Note** This requires that you have +"
755 @echo
" + doxygen installed on your local system +"
756 @echo
" +-------------------------------------------+"
757 @
$(MAKE
) -s oldmodcheck
759 upgrade
: all bininstall
762 mkdir
-p
$(DESTDIR
)$(ASTETCDIR
)
763 for x in configs
/*.adsi
; do \
764 if
[ ! -f
$(DESTDIR
)$(ASTETCDIRX
)/$$x ]; then \
765 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTETCDIR
)/`basename $$x` ; \
770 mkdir
-p
$(DESTDIR
)$(ASTETCDIR
)
771 for x in configs
/*.sample
; do \
772 if
[ -f
$(DESTDIR
)$(ASTETCDIR
)/`basename $$x .sample` ]; then \
773 if
[ "$(OVERWRITE)" = "y" ]; then \
774 if cmp
-s
$(DESTDIR
)$(ASTETCDIR
)/`basename $$x .sample` $$x ; then \
775 echo
"Config file $$x is unchanged"; \
778 mv
-f
$(DESTDIR
)$(ASTETCDIR
)/`basename $$x .sample` $(DESTDIR
)$(ASTETCDIR
)/`basename $$x .sample`.old
; \
780 echo
"Skipping config file $$x"; \
784 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTETCDIR
)/`basename $$x .sample` ;\
786 if
[ "$(OVERWRITE)" = "y" ] ||
[ ! -f
$(DESTDIR
)$(ASTCONFPATH
) ]; then \
788 echo
"[directories]" ; \
789 echo
"astetcdir => $(ASTETCDIR)" ; \
790 echo
"astmoddir => $(MODULES_DIR)" ; \
791 echo
"astvarlibdir => $(ASTVARLIBDIR)" ; \
792 echo
"astdatadir => $(ASTDATADIR)" ; \
793 echo
"astagidir => $(AGI_DIR)" ; \
794 echo
"astspooldir => $(ASTSPOOLDIR)" ; \
795 echo
"astrundir => $(ASTVARRUNDIR)" ; \
796 echo
"astlogdir => $(ASTLOGDIR)" ; \
798 echo
"; Changing the following lines may compromise your security." ; \
800 echo
";astctlpermissions = 0660" ; \
801 echo
";astctlowner = root" ; \
802 echo
";astctlgroup = apache" ; \
803 echo
";astctl = asterisk.ctl" ; \
804 echo
";[options]" ; \
805 echo
";internal_timing = yes" ; \
806 ) > $(DESTDIR
)$(ASTCONFPATH
) ; \
808 echo
"Skipping asterisk.conf creation"; \
810 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/sounds
; \
811 for x in sounds
/demo-
*; do \
812 if
$(GREP
) -q
"^%`basename $$x`%" sounds.txt
; then \
813 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTDATADIR
)/sounds
; \
815 echo
"No description for $$x"; \
819 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/mohmp3
; \
820 for x in sounds
/*.mp3
; do \
821 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTDATADIR
)/mohmp3
; \
823 rm -f
$(DESTDIR
)$(ASTDATADIR
)/mohmp3
/sample-hold.mp3
824 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/voicemail
/default
/1234/INBOX
825 :> $(DESTDIR
)$(ASTSPOOLDIR
)/voicemail
/default
/1234/unavail.gsm
826 for x in vm-theperson digits
/1 digits
/2 digits
/3 digits
/4 vm-isunavail
; do \
827 cat
$(DESTDIR
)$(ASTDATADIR
)/sounds
/$$x.gsm
>> $(DESTDIR
)$(ASTSPOOLDIR
)/voicemail
/default
/1234/unavail.gsm
; \
829 :> $(DESTDIR
)$(ASTSPOOLDIR
)/voicemail
/default
/1234/busy.gsm
830 for x in vm-theperson digits
/1 digits
/2 digits
/3 digits
/4 vm-isonphone
; do \
831 cat
$(DESTDIR
)$(ASTDATADIR
)/sounds
/$$x.gsm
>> $(DESTDIR
)$(ASTSPOOLDIR
)/voicemail
/default
/1234/busy.gsm
; \
835 @
[ -d
$(DESTDIR
)$(HTTP_DOCSDIR
)/ ] ||
( printf
"http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit
1 )
836 @
[ -d
$(DESTDIR
)$(HTTP_CGIDIR
) ] ||
( printf
"cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit
1 )
837 $(INSTALL
) -m
4755 -o root
-g root contrib
/scripts
/vmail.cgi
$(DESTDIR
)$(HTTP_CGIDIR
)/vmail.cgi
838 mkdir
-p
$(DESTDIR
)$(HTTP_DOCSDIR
)/_asterisk
839 for x in images
/*.gif
; do \
840 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(HTTP_DOCSDIR
)/_asterisk
/; \
842 @echo
" +--------- Asterisk Web Voicemail ----------+"
844 @echo
" + Asterisk Web Voicemail is installed in +"
845 @echo
" + your cgi-bin directory: +"
846 @echo
" + $(DESTDIR)$(HTTP_CGIDIR)"
847 @echo
" + IT USES A SETUID ROOT PERL SCRIPT, SO +"
848 @echo
" + IF YOU DON'T LIKE THAT, UNINSTALL IT! +"
850 @echo
" + Other static items have been stored in: +"
851 @echo
" + $(DESTDIR)$(HTTP_DOCSDIR)"
853 @echo
" + If these paths do not match your httpd +"
854 @echo
" + installation, correct the definitions +"
855 @echo
" + in your Makefile of HTTP_CGIDIR and +"
856 @echo
" + HTTP_DOCSDIR +"
858 @echo
" +-------------------------------------------+"
861 sed
"s/^Version:.*/Version: $(RPMVERSION)/g" redhat
/asterisk.spec
> asterisk.spec
; \
865 __rpm
: include/asterisk
/version.h spec
866 rm -rf
/tmp
/asterisk
; \
867 mkdir
-p
/tmp
/asterisk
/redhat
/RPMS
/i386
; \
868 $(MAKE
) DESTDIR
=/tmp
/asterisk
install ; \
869 $(MAKE
) DESTDIR
=/tmp
/asterisk samples
; \
870 mkdir
-p
/tmp
/asterisk
/etc
/rc.d
/init.d
; \
871 cp
-f contrib
/init.d
/rc.redhat.asterisk
/tmp
/asterisk
/etc
/rc.d
/init.d
/asterisk
; \
872 rpmbuild
--rcfile
/usr
/lib
/rpm
/rpmrc
:redhat
/rpmrc
-bb asterisk.spec
875 (cat contrib
/asterisk-ng-doxygen
; echo
"HAVE_DOT=$(HAVEDOT)"; \
876 echo
"PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen
-
879 @wget
-V
>/dev
/null ||
(echo
"You need wget" ; false
)
880 [ -f mpg123-0.59r.
tar.gz
] || wget http
://www.mpg123.de
/mpg123
/mpg123-0.59r.
tar.gz
881 [ -d mpg123-0.59r
] ||
tar xfz mpg123-0.59r.
tar.gz
882 $(MAKE
) -C mpg123-0.59r
$(MPG123TARG
)
885 @if
[ "${OSARCH}" = "Linux" ]; then \
886 if
[ -f
/etc
/redhat-release
-o
-f
/etc
/fedora-release
]; then \
887 $(INSTALL
) -m
755 contrib
/init.d
/rc.redhat.asterisk
/etc
/rc.d
/init.d
/asterisk
; \
888 /sbin
/chkconfig
--add asterisk
; \
889 elif
[ -f
/etc
/debian_version
]; then \
890 $(INSTALL
) -m
755 contrib
/init.d
/rc.debian.asterisk
/etc
/init.d
/asterisk
; \
891 /usr
/sbin
/update-rc.d asterisk start
10 2 3 4 5 . stop
91 2 3 4 5 .
; \
892 elif
[ -f
/etc
/gentoo-release
]; then \
893 $(INSTALL
) -m
755 contrib
/init.d
/rc.gentoo.asterisk
/etc
/init.d
/asterisk
; \
894 /sbin
/rc-update add asterisk default
; \
895 elif
[ -f
/etc
/mandrake-release
]; then \
896 $(INSTALL
) -m
755 contrib
/init.d
/rc.mandrake.asterisk
/etc
/rc.d
/init.d
/asterisk
; \
897 /sbin
/chkconfig
--add asterisk
; \
898 elif
[ -f
/etc
/SuSE-release
-o
-f
/etc
/novell-release
]; then \
899 $(INSTALL
) -m
755 contrib
/init.d
/rc.suse.asterisk
/etc
/init.d
/asterisk
; \
900 /sbin
/chkconfig
--add asterisk
; \
901 elif
[ -f
/etc
/slackware-version
]; then \
902 echo
"Slackware is not currently supported, although an init script does exist for it." \
904 echo
"We could not install init scripts for your distribution."; \
907 echo
"We could not install init scripts for your operating system."; \
912 valgrind
: dont-optimize
914 depend
: include/asterisk
/version.h .depend defaults.h
915 @for x in
$(SUBDIRS
); do
$(MAKE
) -C
$$x depend || exit
1 ; done
917 .depend
: include/asterisk
/version.h defaults.h
918 build_tools
/mkdep
$(CFLAGS
) $(wildcard *.c
)
921 @echo
-n
".tags-depend: " > $@
922 @find .
-maxdepth
1 -name \
*.c
-printf
"\t%p \\\\\n" >> $@
923 @find .
-maxdepth
1 -name \
*.h
-printf
"\t%p \\\\\n" >> $@
924 @find
$(SUBDIRS
) -name \
*.c
-printf
"\t%p \\\\\n" >> $@
925 @find
$(SUBDIRS
) -name \
*.h
-printf
"\t%p \\\\\n" >> $@
926 @find
include -name \
*.h
-printf
"\t%p \\\\\n" >> $@
931 @find .
-maxdepth
1 -name \
*.c
-print >> $@
932 @find .
-maxdepth
1 -name \
*.h
-print >> $@
933 @find
$(SUBDIRS
) -name \
*.c
-print >> $@
934 @find
$(SUBDIRS
) -name \
*.h
-print >> $@
935 @find
include -name \
*.h
-print >> $@
937 tags: .tags-depend .tags-sources
938 ctags
-L .tags-sources
-o
$@
942 TAGS
: .tags-depend .tags-sources
943 etags
-o
$@
`cat .tags-sources`
950 $(MAKE
) -C
$(shell echo
$@ | sed
"s/_env//g") env
955 # If the cleancount has been changed, force a make clean.
956 # .cleancount is the global clean count, and .lastclean is the
957 # last clean count we had
960 if cmp
-s .cleancount .lastclean
; then echo
; else \
961 $(MAKE
) clean; cp
-f .cleancount .lastclean
;\
965 rm -f
$(DESTDIR
)$(MODULES_DIR
)/*
966 rm -f
$(DESTDIR
)$(ASTSBINDIR
)/*asterisk
*
967 rm -f
$(DESTDIR
)$(ASTSBINDIR
)/astgenkey
968 rm -f
$(DESTDIR
)$(ASTSBINDIR
)/autosupport
969 rm -rf
$(DESTDIR
)$(ASTHEADERDIR
)
970 rm -rf
$(DESTDIR
)$(ASTDATADIR
)/sounds
971 rm -rf
$(DESTDIR
)$(ASTDATADIR
)/firmware
972 rm -rf
$(DESTDIR
)$(ASTMANDIR
)/man8
973 for x in
$(SUBDIRS
); do
$(MAKE
) -C
$$x uninstall || exit
1 ; done
975 uninstall: _uninstall
976 @echo
" +--------- Asterisk Uninstall Complete -----+"
977 @echo
" + Asterisk binaries, sounds, man pages, +"
978 @echo
" + headers, modules, and firmware builds, +"
979 @echo
" + have all been uninstalled. +"
981 @echo
" + To remove ALL traces of Asterisk, +"
982 @echo
" + including configuration, spool +"
983 @echo
" + directories, and logs, run the following +"
984 @echo
" + command: +"
986 @echo
" + $(MAKE) uninstall-all +"
987 @echo
" +-------------------------------------------+"
989 uninstall-all
: _uninstall
990 rm -rf
$(DESTDIR
)$(ASTLIBDIR
)
991 rm -rf
$(DESTDIR
)$(ASTVARLIBDIR
)
992 rm -rf
$(DESTDIR
)$(ASTDATADIR
)
993 rm -rf
$(DESTDIR
)$(ASTSPOOLDIR
)
994 rm -rf
$(DESTDIR
)$(ASTETCDIR
)
995 rm -rf
$(DESTDIR
)$(ASTLOGDIR
)
997 menuselect
: build_tools
/menuselect makeopts.xml
998 -@build_tools
/menuselect
${GLOBAL_MAKEOPTS} ${USER_MAKEOPTS} menuselect.makeopts
&& echo
"menuselect changes saved!" || echo
"menuselect changes NOT saved!"
1000 build_tools
/menuselect
: build_tools
/menuselect.c build_tools
/menuselect_curses.c build_tools
/menuselect.h
include/autoconfig.h mxml
/libmxml.a
$(MENUSELECT_OBJS
)
1001 $(MAKE
) -C build_tools menuselect
1004 @cd mxml
&& unset CFLAGS LIBS
&& test -f config.h || .
/configure
1005 $(MAKE
) -C mxml libmxml.a
1007 makeopts.xml
: $(foreach dir,$(MOD_SUBDIRS
),$(dir)/*.c
) build_tools
/cflags.xml
1008 @echo
"Generating list of available modules ..."
1009 @build_tools
/prep_moduledeps
> $@