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 ifeq ($(findstring dont-optimize
,$(MAKECMDGOALS
)),)
41 # More GSM codec optimization
42 # Uncomment to enable MMXTM optimizations for x86 architecture CPU's
43 # which support MMX instructions. This should be newer pentiums,
44 # ppro's, etc, as well as the AMD K6 and K7.
47 # Tell gcc to optimize the code
50 # Stack backtraces, while useful for debugging, are incompatible with optimizations
51 ifeq (${OSARCH},Linux
)
52 CFLAGS
+=-DSTACK_BACKTRACES
56 # Overwite config files on "make samples"
59 # Include debug and macro symbols in the executables (-g) and profiling info (-pg)
63 # Files are copied here temporarily during the install process
64 # For example, make DESTDIR=/tmp/asterisk woud put things in
65 # /tmp/asterisk/etc/asterisk
66 # !!! Watch out, put no spaces or comments after the value !!!
68 #DESTDIR?=/tmp/asterisk
70 # Original busydetect routine
71 #BUSYDETECT = -DBUSYDETECT
73 # Improved busydetect routine, comment the previous one if you use this one
74 #BUSYDETECT+= -DBUSYDETECT_MARTIN
75 # Detect the busy signal looking only at tone lengths
76 # For example if you have 3 beeps 100ms tone, 100ms silence separated by 500 ms of silence
77 #BUSYDETECT+= -DBUSYDETECT_TONEONLY
78 # Enforce the detection of busy signal (get rid of false hangups)
79 # Don't use together with -DBUSYDETECT_TONEONLY
80 #BUSYDETECT+= -DBUSYDETECT_COMPARE_TONE_AND_SILENCE
82 # Define standard directories for various platforms
83 # These apply if they are not redefined in asterisk.conf
84 ifeq ($(OSARCH
),SunOS
)
85 ASTETCDIR
=/etc
/opt
/asterisk
86 ASTLIBDIR
=/opt
/asterisk
/lib
87 ASTVARLIBDIR
=/var
/opt
/asterisk
/lib
88 ASTSPOOLDIR
=/var
/opt
/asterisk
/spool
89 ASTLOGDIR
=/var
/opt
/asterisk
/log
90 ASTHEADERDIR
=/opt
/asterisk
/usr
/include/asterisk
91 ASTBINDIR
=/opt
/asterisk
/usr
/bin
92 ASTSBINDIR
=/opt
/asterisk
/usr
/sbin
93 ASTVARRUNDIR
=/var
/opt
/asterisk
/run
94 ASTMANDIR
=/opt
/asterisk
/usr
/share
/man
96 ASTETCDIR
=$(sysconfdir
)/asterisk
97 ASTLIBDIR
=$(libdir)/asterisk
98 ASTHEADERDIR
=$(includedir)/asterisk
100 ASTSBINDIR
=$(sbindir
)
101 ASTSPOOLDIR
=$(localstatedir
)/spool
/asterisk
102 ASTLOGDIR
=$(localstatedir
)/log
/asterisk
103 ASTVARRUNDIR
=$(localstatedir
)/run
105 ifeq ($(OSARCH
),FreeBSD
)
106 ASTVARLIBDIR
=$(prefix)/share
/asterisk
108 ASTVARLIBDIR
=$(localstatedir
)/lib
/asterisk
111 ASTDATADIR?
=$(ASTVARLIBDIR
)
113 # Asterisk.conf is located in ASTETCDIR or by using the -C flag
114 # when starting Asterisk
115 ASTCONFPATH
=$(ASTETCDIR
)/asterisk.conf
116 MODULES_DIR
=$(ASTLIBDIR
)/modules
117 AGI_DIR
=$(ASTDATADIR
)/agi-bin
119 # If you use Apache, you may determine by a grep 'DocumentRoot' of your httpd.conf file
120 HTTP_DOCSDIR
=/var
/www
/html
121 # Determine by a grep 'ScriptAlias' of your Apache httpd.conf file
122 HTTP_CGIDIR
=/var
/www
/cgi-bin
126 # Uncomment this to use the older DSP routines
127 #ASTCFLAGS+=-DOLD_DSP_ROUTINES
129 # If the file .asterisk.makeopts is present in your home directory, you can
130 # include all of your favorite menuselect options so that every time you download
131 # a new version of Asterisk, you don't have to run menuselect to set them.
132 # The file /etc/asterisk.makeopts will also be included but can be overridden
133 # by the file in your home directory.
135 GLOBAL_MAKEOPTS
=$(wildcard /etc
/asterisk.makeopts
)
136 USER_MAKEOPTS
=$(wildcard ~
/.asterisk.makeopts
)
138 ifneq ($(wildcard menuselect.makeopts
),)
139 include menuselect.makeopts
142 ifneq ($(wildcard makeopts
),)
146 TOPDIR_CFLAGS
=-include include/autoconfig.h
-Iinclude
147 MOD_SUBDIR_CFLAGS
=-include ..
/include/autoconfig.h
-I..
/include -I..
148 OTHER_SUBDIR_CFLAGS
=-include ..
/include/autoconfig.h
-I..
/include -I..
150 # *CLI> show memory allocations [filename]
151 # *CLI> show memory summary [filename]
152 ifneq ($(findstring MALLOC_DEBUG
,$(MENUSELECT_CFLAGS
)),)
153 TOPDIR_CFLAGS
+=-include include/asterisk
/astmm.h
154 MOD_SUBDIR_CFLAGS
+=-include ..
/include/asterisk
/astmm.h
157 MOD_SUBDIR_CFLAGS
+=-fPIC
159 ifeq ($(OSARCH
),Linux
)
160 ifeq ($(PROC
),x86_64
)
161 # You must have GCC 3.4 to use k8, otherwise use athlon
166 ifeq ($(PROC
),sparc64
)
167 #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
168 #This works for even old (2.96) versions of gcc and provides a small boost either way.
169 #A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
170 #So we go lowest common available by gcc and go a step down, still a step up from
171 #the default as we now have a better instruction set to work with. - Belgarath
173 OPTIONS
+=$(shell if
$(CC
) -mtune
=$(PROC
) -S
-o
/dev
/null
-xc
/dev
/null
>/dev
/null
2>&1; then echo
"-mtune=$(PROC)"; fi
)
174 OPTIONS
+=$(shell if
$(CC
) -mcpu
=v8
-S
-o
/dev
/null
-xc
/dev
/null
>/dev
/null
2>&1; then echo
"-mcpu=v8"; fi
)
175 OPTIONS
+=-fomit-frame-pointer
179 # The Cirrus logic is the only heavily shipping arm processor with a real floating point unit
180 ifeq ($(SUB_PROC
),maverick
)
181 OPTIONS
+=-fsigned-char
-mcpu
=ep9312
183 ifeq ($(SUB_PROC
),xscale
)
184 OPTIONS
+=-fsigned-char
-mcpu
=xscale
186 OPTIONS
+=-fsigned-char
196 ifeq ($(OSARCH
),SunOS
)
197 GREP
=/usr
/xpg4
/bin
/grep
202 ASTCFLAGS
+=-pipe
-Wall
-Wstrict-prototypes
-Wmissing-prototypes
-Wmissing-declarations
$(DEBUG
)
203 ASTCFLAGS
+=$(OPTIMIZE
)
205 ifeq ($(AST_DEVMODE
),yes
)
206 ASTCFLAGS
+=-Werror
-Wunused
209 ifeq ($(shell gcc
-v
2>&1 | grep
'gcc version' | cut
-f3
-d
' ' | cut
-f1
-d.
),4)
210 ASTCFLAGS
+=-Wno-pointer-sign
214 ifeq ($(findstring BSD
,$(OSARCH
)),BSD
)
215 ASTCFLAGS
+=-I
$(CROSS_COMPILE_TARGET
)/usr
/local
/include -L
$(CROSS_COMPILE_TARGET
)/usr
/local
/lib
218 ifneq ($(PROC
),ultrasparc
)
219 ASTCFLAGS
+=$(shell if
$(CC
) -march
=$(PROC
) -S
-o
/dev
/null
-xc
/dev
/null
>/dev
/null
2>&1; then echo
"-march=$(PROC)"; fi
)
223 ASTCFLAGS
+=-fsigned-char
226 ifeq ($(OSARCH
),FreeBSD
)
227 BSDVERSION
=$(shell make
-V OSVERSION
-f
$(CROSS_COMPILE_TARGET
)/usr
/share
/mk
/bsd.port.subdir.mk
)
228 ASTCFLAGS
+=$(shell if
test $(BSDVERSION
) -lt
500016 ; then echo
"-D_THREAD_SAFE"; fi
)
229 LIBS
+=$(shell if
test $(BSDVERSION
) -lt
502102 ; then echo
"-lc_r"; else echo
"-pthread"; fi
)
230 ifneq ($(wildcard $(CROSS_COMPILE_TARGET
)/usr
/local
/include/spandsp
),)
231 ASTCFLAGS
+=-I
$(CROSS_COMPILE_TARGET
)/usr
/local
/include/spandsp
236 ifeq ($(OSARCH
),NetBSD
)
237 AST_CFLAGS
+=-pthread
-I
$(CROSS_COMPILE_TARGET
)/usr
/pkg
/include
241 ifeq ($(OSARCH
),OpenBSD
)
245 ifeq ($(OSARCH
),SunOS
)
246 ASTCFLAGS
+=-Wcast-align
-DSOLARIS
-Iinclude
/solaris-compat
-I
$(CROSS_COMPILE_TARGET
)/usr
/local
/ssl
/include
249 LIBEDIT
=editline
/libedit.a
251 ASTERISKVERSION
:=$(shell build_tools
/make_version .
)
253 ifneq ($(wildcard .version
),)
254 ASTERISKVERSIONNUM
:=$(shell awk
-F.
'{printf "%02d%02d%02d", $$1, $$2, $$3}' .version
)
255 RPMVERSION
:=$(shell sed
's/[-\/:]/_/g' .version
)
260 # CVS mirrors of SVN have .svnrevision files showing
261 # which SVN revision they are based on, and .svnbranch
262 # showing the branch they are made from
263 ifneq ($(wildcard .svnrevision
),)
264 ASTERISKVERSIONNUM
=999999
266 ifneq ($(wildcard .svn
),)
267 ASTERISKVERSIONNUM
=999999
271 ASTCFLAGS
+=$(MALLOC_DEBUG
)$(BUSYDETECT
)$(OPTIONS
)
273 MOD_SUBDIRS
=res channels pbx apps codecs formats cdr funcs
274 OTHER_SUBDIRS
=utils stdtime agi
275 SUBDIRS
:=$(MOD_SUBDIRS
) $(OTHER_SUBDIRS
)
277 OBJS
=io.o sched.o logger.o frame.o loader.o config.o channel.o \
278 translate.o file.o pbx.o cli.o md5.o term.o \
279 ulaw.o alaw.o callerid.o fskmodem.o image.o app.o \
280 cdr.o tdd.o acl.o rtp.o udptl.o manager.o asterisk.o \
281 dsp.o chanvars.o indications.o autoservice.o db.o privacy.o \
282 astmm.o enum.o srv.o dns.o aescrypt.o aestab.o aeskey.o \
283 utils.o plc.o jitterbuf.o dnsmgr.o devicestate.o \
284 netsock.o slinfactory.o ast_expr2.o ast_expr2f.o \
285 cryptostub.o sha1.o http.o
287 # we need to link in the objects statically, not as a library, because
288 # otherwise modules will not have them available if none of the static
290 OBJS
+=stdtime
/localtime.o
292 # At the moment say.o is an optional component which can be overridden
296 ifeq ($(wildcard $(CROSS_COMPILE_TARGET
)/usr
/include/sys
/poll.h
),)
298 ASTCFLAGS
+=-DPOLLCOMPAT
301 ifeq ($(wildcard $(CROSS_COMPILE_TARGET
)/usr
/include/dlfcn.h
),)
303 ASTCFLAGS
+=-DDLFCNCOMPAT
306 ifeq ($(OSARCH
),Linux
)
307 LIBS
+=-ldl
-lpthread
$(EDITLINE_LIBS
) -lm
-lresolv
#-lnjamd
309 LIBS
+=$(EDITLINE_LIBS
) -lm
312 ifeq ($(OSARCH
),Darwin
)
314 ASTCFLAGS
+=-D__Darwin__
315 AUDIO_LIBS
=-framework CoreAudio
317 SOLINK
=-dynamic
-bundle
-undefined suppress
-force_flat_namespace
318 # Mac on Intel CoreDuo does not need poll compatibility layer
321 ASTCFLAGS
+=-DPOLLCOMPAT
324 # These are used for all but Darwin
326 SOLINK
=-shared
-Xlinker
-x
327 ifeq ($(findstring BSD
,$(OSARCH
)),BSD
)
328 SOLINK
+=-L
$(CROSS_COMPILE_TARGET
)/usr
/local
/lib
332 ifeq ($(OSARCH
),FreeBSD
)
336 ifeq ($(OSARCH
),NetBSD
)
337 LIBS
+=-lpthread
-lcrypto
-lm
-L
$(CROSS_COMPILE_TARGET
)/usr
/pkg
/lib
$(EDITLINE_LIBS
)
340 ifeq ($(OSARCH
),OpenBSD
)
341 LIBS
+=-lcrypto
-lpthread
-lm
$(EDITLINE_LIBS
)
344 ifeq ($(OSARCH
),SunOS
)
345 LIBS
+=-lpthread
-ldl
-lnsl
-lsocket
-lresolv
-L
$(CROSS_COMPILE_TARGET
)/usr
/local
/ssl
/lib
347 MENUSELECT_OBJS
+=strcompat.o
349 SOLINK
=-shared
-fpic
-L
$(CROSS_COMPILE_TARGET
)/usr
/local
/ssl
/lib
352 ifeq ($(MAKETOPLEVEL
),$(MAKELEVEL
))
353 CFLAGS
+=$(TOPDIR_CFLAGS
)$(ASTCFLAGS
)
356 # This is used when generating the doxygen documentation
366 @echo
" +--------- Asterisk Build Complete ---------+"
367 @echo
" + Asterisk has successfully been built, but +"
368 @echo
" + cannot be run before being installed by +"
369 @echo
" + running: +"
371 @echo
" + make install +"
372 @echo
" +-------------------------------------------+"
374 all: cleantest defaults.h config.status menuselect.makeopts depend asterisk subdirs
376 config.status
: configure
377 @CFLAGS
="" .
/configure
379 @echo
"**** The configure script was just executed, so 'make' needs to be"
380 @echo
"**** restarted."
385 @CFLAGS
="" .
/configure
387 @echo
"**** The configure script was just executed, so 'make' needs to be"
388 @echo
"**** restarted."
392 menuselect.makeopts
: build_tools
/menuselect makeopts.xml
393 @build_tools
/menuselect
--check-deps
${GLOBAL_MAKEOPTS} ${USER_MAKEOPTS} $@
395 #ifneq ($(wildcard tags),)
399 ifneq ($(wildcard TAGS
),)
404 cd editline
&& unset CFLAGS LIBS
&& CFLAGS
="$(OPTIMIZE)" .
/configure
; \
407 cd editline
&& unset CFLAGS LIBS
&& test -f config.h || CFLAGS
="$(OPTIMIZE)" .
/configure
408 $(MAKE
) -C editline libedit.a
411 $(MAKE
) -C db1-ast libdb1.a
413 ifneq ($(wildcard .depend
),)
417 ifneq ($(wildcard .tags-depend
),)
421 ast_expr2.c ast_expr2.h
:
422 bison
-o
$@
-d
--name-prefix
=ast_yy ast_expr2.y
425 flex
-o
$@
--full ast_expr2.fl
427 testexpr2
: ast_expr2f.c ast_expr2.c ast_expr2.h
428 gcc
-g
-c
-DSTANDALONE ast_expr2f.c
429 gcc
-g
-c
-DSTANDALONE ast_expr2.c
430 gcc
-g
-o testexpr2 ast_expr2f.o ast_expr2.o
431 rm ast_expr2.o ast_expr2f.o
435 asterisk
.8: asterisk.sgml
437 docbook2man asterisk.sgml
440 asterisk.pdf
: asterisk.sgml
441 docbook2pdf asterisk.sgml
443 asterisk.ps
: asterisk.sgml
444 docbook2ps asterisk.sgml
446 asterisk.html
: asterisk.sgml
447 docbook2html asterisk.sgml
448 mv r1.html asterisk.html
450 asterisk.txt
: asterisk.sgml
451 docbook2txt asterisk.sgml
454 @build_tools
/make_defaults_h
> $@.tmp
455 @if cmp
-s
$@.tmp
$@
; then echo
; else \
460 include/asterisk
/version.h
:
461 @build_tools
/make_version_h
> $@.tmp
462 @if cmp
-s
$@.tmp
$@
; then echo
; else \
467 include/asterisk
/buildopts.h
: menuselect.makeopts
468 @build_tools
/make_buildopts_h
> $@.tmp
469 @if cmp
-s
$@.tmp
$@
; then echo
; else \
475 CFLAGS
="$(MOD_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE
) -C stdtime libtime.a
477 asterisk
: include/asterisk
/buildopts.h editline
/libedit.a db1-ast
/libdb1.a stdtime
/libtime.a
$(OBJS
)
478 build_tools
/make_build_h
> include/asterisk
/build.h.tmp
479 if cmp
-s
include/asterisk
/build.h.tmp
include/asterisk
/build.h
; then echo
; else \
480 mv
include/asterisk
/build.h.tmp
include/asterisk
/build.h
; \
482 rm -f
include/asterisk
/build.h.tmp
483 $(CC
) -c
-o buildinfo.o
$(CFLAGS
) buildinfo.c
484 $(CC
) $(DEBUG
) $(ASTOBJ
) $(ASTLINK
) $(OBJS
) buildinfo.o
$(LIBEDIT
) db1-ast
/libdb1.a stdtime
/libtime.a
$(LIBS
)
487 $(CC
) $(AUDIO_LIBS
) -o muted muted.o
490 @for x in
$(MOD_SUBDIRS
); do CFLAGS
="$(MOD_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE
) -C
$$x || exit
1 ; done
491 @CFLAGS
="$(OTHER_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE
) -C utils
492 @CFLAGS
="$(OTHER_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE
) -C agi
495 @for x in
$(SUBDIRS
); do
$(MAKE
) -C
$$x clean-depend || exit
1 ; done
496 rm -f .depend .tags-depend
499 @for x in
$(SUBDIRS
); do
$(MAKE
) -C
$$x clean || exit
1 ; done
500 rm -f
*.o
*.so asterisk
502 rm -f
include/asterisk
/build.h
503 rm -f
include/asterisk
/version.h
504 rm -f .tags-sources
tags TAGS
505 @if
[ -f editline
/Makefile
]; then
$(MAKE
) -C editline
distclean ; fi
506 @if
[ -d mpg123-0.59r
]; then
$(MAKE
) -C mpg123-0.59r
clean; fi
507 $(MAKE
) -C db1-ast
clean
508 $(MAKE
) -C stdtime
clean
510 distclean: dist-clean
513 rm -f menuselect.makeopts makeopts makeopts.xml
514 rm -f config.log config.status
515 rm -f
include/autoconfig.h
516 rm -f
include/asterisk
/buildopts.h
517 $(MAKE
) -C mxml
clean
518 $(MAKE
) -C build_tools dist-clean
521 if
[ x
`$(ID) -un` = xroot
]; then sh build_tools
/mkpkgconfig
$(DESTDIR
)/usr
/lib
/pkgconfig
; fi
522 # Should static HTTP be installed during make samples or even with its own target ala
523 # webvoicemail? There are portions here that *could* be customized but might also be
524 # improved a lot. I'll put it here for now.
525 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/static-http
526 for x in static-http
/*; do \
527 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTDATADIR
)/static-http
; \
529 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/sounds
/digits
530 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/sounds
/priv-callerintros
531 for x in sounds
/digits
/*.gsm
; do \
532 if
$(GREP
) -q
"^%`basename $$x`%" sounds.txt
; then \
533 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTDATADIR
)/sounds
/digits
; \
535 echo
"No description for $$x"; \
539 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/sounds
/dictate
540 for x in sounds
/dictate
/*.gsm
; do \
541 if
$(GREP
) -q
"^%`basename $$x`%" sounds.txt
; then \
542 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTDATADIR
)/sounds
/dictate
; \
544 echo
"No description for $$x"; \
548 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/sounds
/letters
549 for x in sounds
/letters
/*.gsm
; do \
550 if
$(GREP
) -q
"^%`basename $$x`%" sounds.txt
; then \
551 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTDATADIR
)/sounds
/letters
; \
553 echo
"No description for $$x"; \
557 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/sounds
/phonetic
558 for x in sounds
/phonetic
/*.gsm
; do \
559 if
$(GREP
) -q
"^%`basename $$x`%" sounds.txt
; then \
560 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTDATADIR
)/sounds
/phonetic
; \
562 echo
"No description for $$x"; \
566 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 \
567 if
$(GREP
) -q
"^%`basename $$x`%" sounds.txt
; then \
568 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTDATADIR
)/sounds
; \
570 echo
"No description for $$x"; \
574 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/mohmp3
575 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/images
576 for x in images
/*.jpg
; do \
577 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTDATADIR
)/images
; \
579 mkdir
-p
$(DESTDIR
)$(AGI_DIR
)
582 @if
[ -d .svn
]; then \
583 echo
"Updating from Subversion..." ; \
584 svn update | tee update.out
; \
586 if
[ `grep -c ^C update.out` -gt
0 ]; then \
587 echo
; echo
"The following files have conflicts:" ; \
588 grep ^C update.out | cut
-b4-
; \
591 $(MAKE
) clean-depend
; \
592 elif
[ -d CVS
]; then \
593 echo
"Updating from CVS..." ; \
594 cvs
-q
-z3 update
-Pd | tee update.out
; \
596 if
[ `grep -c ^C update.out` -gt
0 ]; then \
597 echo
; echo
"The following files have conflicts:" ; \
598 grep ^C update.out | cut
-d
' ' -f2-
; \
601 $(MAKE
) clean-depend
; \
603 echo
"Not under version control"; \
606 NEWHEADERS
=$(notdir $(wildcard include/asterisk
/*.h
))
607 OLDHEADERS
=$(filter-out $(NEWHEADERS
),$(notdir $(wildcard $(DESTDIR
)$(ASTHEADERDIR
)/*.h
)))
610 mkdir
-p
$(DESTDIR
)$(MODULES_DIR
)
611 mkdir
-p
$(DESTDIR
)$(ASTSBINDIR
)
612 mkdir
-p
$(DESTDIR
)$(ASTETCDIR
)
613 mkdir
-p
$(DESTDIR
)$(ASTBINDIR
)
614 mkdir
-p
$(DESTDIR
)$(ASTVARRUNDIR
)
615 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/voicemail
616 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/dictate
617 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/system
618 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/tmp
619 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/meetme
620 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/monitor
621 if
[ -f asterisk
]; then
$(INSTALL
) -m
755 asterisk
$(DESTDIR
)$(ASTSBINDIR
)/; fi
622 if
[ -f asterisk.dll
]; then
$(INSTALL
) -m
755 asterisk.dll
$(DESTDIR
)$(ASTSBINDIR
)/; fi
623 ln
-sf asterisk
$(DESTDIR
)$(ASTSBINDIR
)/rasterisk
624 $(INSTALL
) -m
755 contrib
/scripts
/astgenkey
$(DESTDIR
)$(ASTSBINDIR
)/
625 $(INSTALL
) -m
755 contrib
/scripts
/autosupport
$(DESTDIR
)$(ASTSBINDIR
)/
626 if
[ ! -f
$(DESTDIR
)$(ASTSBINDIR
)/safe_asterisk
]; then \
627 cat contrib
/scripts
/safe_asterisk | sed
's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;' > $(DESTDIR
)$(ASTSBINDIR
)/safe_asterisk
;\
628 chmod
755 $(DESTDIR
)$(ASTSBINDIR
)/safe_asterisk
;\
630 $(INSTALL
) -d
$(DESTDIR
)$(ASTHEADERDIR
)
631 $(INSTALL
) -m
644 include/asterisk
/*.h
$(DESTDIR
)$(ASTHEADERDIR
)
632 if
[ -n
"$(OLDHEADERS)" ]; then \
633 rm -f
$(addprefix $(DESTDIR
)$(ASTHEADERDIR
)/,$(OLDHEADERS
)) ;\
635 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/sounds
636 mkdir
-p
$(DESTDIR
)$(ASTLOGDIR
)/cdr-csv
637 mkdir
-p
$(DESTDIR
)$(ASTLOGDIR
)/cdr-custom
638 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/keys
639 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/firmware
640 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/firmware
/iax
641 mkdir
-p
$(DESTDIR
)$(ASTMANDIR
)/man8
642 $(INSTALL
) -m
644 keys
/iaxtel.pub
$(DESTDIR
)$(ASTDATADIR
)/keys
643 $(INSTALL
) -m
644 keys
/freeworlddialup.pub
$(DESTDIR
)$(ASTDATADIR
)/keys
644 $(INSTALL
) -m
644 asterisk
.8 $(DESTDIR
)$(ASTMANDIR
)/man8
645 $(INSTALL
) -m
644 contrib
/scripts
/astgenkey
.8 $(DESTDIR
)$(ASTMANDIR
)/man8
646 $(INSTALL
) -m
644 contrib
/scripts
/autosupport
.8 $(DESTDIR
)$(ASTMANDIR
)/man8
647 $(INSTALL
) -m
644 contrib
/scripts
/safe_asterisk
.8 $(DESTDIR
)$(ASTMANDIR
)/man8
648 if
[ -d contrib
/firmware
/iax
]; then \
649 $(INSTALL
) -m
644 contrib
/firmware
/iax
/iaxy.bin
$(DESTDIR
)$(ASTDATADIR
)/firmware
/iax
/iaxy.bin
; \
651 echo
"You need to do cvs update -d not just cvs update" ; \
653 if
[ -f mpg123-0.59r
/mpg123
]; then
$(MAKE
) -C mpg123-0.59r
install; fi
656 @for x in
$(SUBDIRS
); do
$(MAKE
) -C
$$x install || exit
1 ; done
658 NEWMODS
=$(notdir $(wildcard */*.so
))
659 OLDMODS
=$(filter-out $(NEWMODS
),$(notdir $(wildcard $(DESTDIR
)$(MODULES_DIR
)/*.so
)))
662 @if
[ -n
"$(OLDMODS)" ]; then \
663 echo
" WARNING WARNING WARNING" ;\
665 echo
" Your Asterisk modules directory, located at" ;\
666 echo
" $(DESTDIR)$(MODULES_DIR)" ;\
667 echo
" contains modules that were not installed by this " ;\
668 echo
" version of Asterisk. Please ensure that these" ;\
669 echo
" modules are compatible with this version before" ;\
670 echo
" attempting to run Asterisk." ;\
672 for f in
$(OLDMODS
); do \
676 echo
" WARNING WARNING WARNING" ;\
679 install: all datafiles bininstall install-subdirs
680 @if
[ -x
/usr
/sbin
/asterisk-post-install
]; then \
681 /usr
/sbin
/asterisk-post-install
$(DESTDIR
) .
; \
683 @echo
" +---- Asterisk Installation Complete -------+"
685 @echo
" + YOU MUST READ THE SECURITY DOCUMENT +"
687 @echo
" + Asterisk has successfully been installed. +"
688 @echo
" + If you would like to install the sample +"
689 @echo
" + configuration files (overwriting any +"
690 @echo
" + existing config files), run: +"
692 @echo
" + $(MAKE) samples +"
694 @echo
" +----------------- or ---------------------+"
696 @echo
" + You can go ahead and install the asterisk +"
697 @echo
" + program documentation now or later run: +"
699 @echo
" + $(MAKE) progdocs +"
701 @echo
" + **Note** This requires that you have +"
702 @echo
" + doxygen installed on your local system +"
703 @echo
" +-------------------------------------------+"
704 @
$(MAKE
) -s oldmodcheck
706 upgrade
: all bininstall
709 mkdir
-p
$(DESTDIR
)$(ASTETCDIR
)
710 for x in configs
/*.adsi
; do \
711 if
[ ! -f
$(DESTDIR
)$(ASTETCDIRX
)/$$x ]; then \
712 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTETCDIR
)/`basename $$x` ; \
717 mkdir
-p
$(DESTDIR
)$(ASTETCDIR
)
718 for x in configs
/*.sample
; do \
719 if
[ -f
$(DESTDIR
)$(ASTETCDIR
)/`basename $$x .sample` ]; then \
720 if
[ "$(OVERWRITE)" = "y" ]; then \
721 if cmp
-s
$(DESTDIR
)$(ASTETCDIR
)/`basename $$x .sample` $$x ; then \
722 echo
"Config file $$x is unchanged"; \
725 mv
-f
$(DESTDIR
)$(ASTETCDIR
)/`basename $$x .sample` $(DESTDIR
)$(ASTETCDIR
)/`basename $$x .sample`.old
; \
727 echo
"Skipping config file $$x"; \
731 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTETCDIR
)/`basename $$x .sample` ;\
733 if
[ "$(OVERWRITE)" = "y" ] ||
[ ! -f
$(DESTDIR
)$(ASTCONFPATH
) ]; then \
735 echo
"[directories]" ; \
736 echo
"astetcdir => $(ASTETCDIR)" ; \
737 echo
"astmoddir => $(MODULES_DIR)" ; \
738 echo
"astvarlibdir => $(ASTVARLIBDIR)" ; \
739 echo
"astdatadir => $(ASTDATADIR)" ; \
740 echo
"astagidir => $(AGI_DIR)" ; \
741 echo
"astspooldir => $(ASTSPOOLDIR)" ; \
742 echo
"astrundir => $(ASTVARRUNDIR)" ; \
743 echo
"astlogdir => $(ASTLOGDIR)" ; \
745 echo
"; Changing the following lines may compromise your security." ; \
747 echo
";astctlpermissions = 0660" ; \
748 echo
";astctlowner = root" ; \
749 echo
";astctlgroup = apache" ; \
750 echo
";astctl = asterisk.ctl" ; \
751 echo
";[options]" ; \
752 echo
";internal_timing = yes" ; \
753 ) > $(DESTDIR
)$(ASTCONFPATH
) ; \
755 echo
"Skipping asterisk.conf creation"; \
757 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/sounds
; \
758 for x in sounds
/demo-
*; do \
759 if
$(GREP
) -q
"^%`basename $$x`%" sounds.txt
; then \
760 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTDATADIR
)/sounds
; \
762 echo
"No description for $$x"; \
766 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/mohmp3
; \
767 for x in sounds
/*.mp3
; do \
768 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTDATADIR
)/mohmp3
; \
770 rm -f
$(DESTDIR
)$(ASTDATADIR
)/mohmp3
/sample-hold.mp3
771 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/voicemail
/default
/1234/INBOX
772 :> $(DESTDIR
)$(ASTSPOOLDIR
)/voicemail
/default
/1234/unavail.gsm
773 for x in vm-theperson digits
/1 digits
/2 digits
/3 digits
/4 vm-isunavail
; do \
774 cat
$(DESTDIR
)$(ASTDATADIR
)/sounds
/$$x.gsm
>> $(DESTDIR
)$(ASTSPOOLDIR
)/voicemail
/default
/1234/unavail.gsm
; \
776 :> $(DESTDIR
)$(ASTSPOOLDIR
)/voicemail
/default
/1234/busy.gsm
777 for x in vm-theperson digits
/1 digits
/2 digits
/3 digits
/4 vm-isonphone
; do \
778 cat
$(DESTDIR
)$(ASTDATADIR
)/sounds
/$$x.gsm
>> $(DESTDIR
)$(ASTSPOOLDIR
)/voicemail
/default
/1234/busy.gsm
; \
782 @
[ -d
$(DESTDIR
)$(HTTP_DOCSDIR
)/ ] ||
( printf
"http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit
1 )
783 @
[ -d
$(DESTDIR
)$(HTTP_CGIDIR
) ] ||
( printf
"cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit
1 )
784 $(INSTALL
) -m
4755 -o root
-g root contrib
/scripts
/vmail.cgi
$(DESTDIR
)$(HTTP_CGIDIR
)/vmail.cgi
785 mkdir
-p
$(DESTDIR
)$(HTTP_DOCSDIR
)/_asterisk
786 for x in images
/*.gif
; do \
787 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(HTTP_DOCSDIR
)/_asterisk
/; \
789 @echo
" +--------- Asterisk Web Voicemail ----------+"
791 @echo
" + Asterisk Web Voicemail is installed in +"
792 @echo
" + your cgi-bin directory: +"
793 @echo
" + $(DESTDIR)$(HTTP_CGIDIR)"
794 @echo
" + IT USES A SETUID ROOT PERL SCRIPT, SO +"
795 @echo
" + IF YOU DON'T LIKE THAT, UNINSTALL IT! +"
797 @echo
" + Other static items have been stored in: +"
798 @echo
" + $(DESTDIR)$(HTTP_DOCSDIR)"
800 @echo
" + If these paths do not match your httpd +"
801 @echo
" + installation, correct the definitions +"
802 @echo
" + in your Makefile of HTTP_CGIDIR and +"
803 @echo
" + HTTP_DOCSDIR +"
805 @echo
" +-------------------------------------------+"
808 sed
"s/^Version:.*/Version: $(RPMVERSION)/g" redhat
/asterisk.spec
> asterisk.spec
; \
812 __rpm
: include/asterisk
/version.h
include/asterisk
/buildopts.h spec
813 rm -rf
/tmp
/asterisk
; \
814 mkdir
-p
/tmp
/asterisk
/redhat
/RPMS
/i386
; \
815 $(MAKE
) DESTDIR
=/tmp
/asterisk
install ; \
816 $(MAKE
) DESTDIR
=/tmp
/asterisk samples
; \
817 mkdir
-p
/tmp
/asterisk
/etc
/rc.d
/init.d
; \
818 cp
-f contrib
/init.d
/rc.redhat.asterisk
/tmp
/asterisk
/etc
/rc.d
/init.d
/asterisk
; \
819 rpmbuild
--rcfile
/usr
/lib
/rpm
/rpmrc
:redhat
/rpmrc
-bb asterisk.spec
822 (cat contrib
/asterisk-ng-doxygen
; echo
"HAVE_DOT=$(HAVEDOT)"; \
823 echo
"PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen
-
826 @wget
-V
>/dev
/null ||
(echo
"You need wget" ; false
)
827 [ -f mpg123-0.59r.
tar.gz
] || wget http
://www.mpg123.de
/mpg123
/mpg123-0.59r.
tar.gz
828 [ -d mpg123-0.59r
] ||
tar xfz mpg123-0.59r.
tar.gz
829 $(MAKE
) -C mpg123-0.59r
$(MPG123TARG
)
832 @if
[ "${OSARCH}" = "Linux" ]; then \
833 if
[ -f
/etc
/redhat-release
-o
-f
/etc
/fedora-release
]; then \
834 $(INSTALL
) -m
755 contrib
/init.d
/rc.redhat.asterisk
/etc
/rc.d
/init.d
/asterisk
; \
835 /sbin
/chkconfig
--add asterisk
; \
836 elif
[ -f
/etc
/debian_version
]; then \
837 $(INSTALL
) -m
755 contrib
/init.d
/rc.debian.asterisk
/etc
/init.d
/asterisk
; \
838 /usr
/sbin
/update-rc.d asterisk start
10 2 3 4 5 . stop
91 2 3 4 5 .
; \
839 elif
[ -f
/etc
/gentoo-release
]; then \
840 $(INSTALL
) -m
755 contrib
/init.d
/rc.gentoo.asterisk
/etc
/init.d
/asterisk
; \
841 /sbin
/rc-update add asterisk default
; \
842 elif
[ -f
/etc
/mandrake-release
]; then \
843 $(INSTALL
) -m
755 contrib
/init.d
/rc.mandrake.asterisk
/etc
/rc.d
/init.d
/asterisk
; \
844 /sbin
/chkconfig
--add asterisk
; \
845 elif
[ -f
/etc
/SuSE-release
-o
-f
/etc
/novell-release
]; then \
846 $(INSTALL
) -m
755 contrib
/init.d
/rc.suse.asterisk
/etc
/init.d
/asterisk
; \
847 /sbin
/chkconfig
--add asterisk
; \
848 elif
[ -f
/etc
/slackware-version
]; then \
849 echo
"Slackware is not currently supported, although an init script does exist for it." \
851 echo
"We could not install init scripts for your distribution."; \
854 echo
"We could not install init scripts for your operating system."; \
859 valgrind
: dont-optimize
861 depend
: include/asterisk
/version.h
include/asterisk
/buildopts.h .depend defaults.h
862 @for x in
$(MOD_SUBDIRS
); do CFLAGS
="$(MOD_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE
) -C
$$x depend || exit
1 ; done
863 @for x in
$(OTHER_SUBDIRS
); do CFLAGS
="$(OTHER_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE
) -C
$$x depend || exit
1 ; done
865 .depend
: include/asterisk
/version.h
include/asterisk
/buildopts.h defaults.h
866 build_tools
/mkdep
$(CFLAGS
) $(wildcard *.c
)
869 @echo
-n
".tags-depend: " > $@
870 @find .
-maxdepth
1 -name \
*.c
-printf
"\t%p \\\\\n" >> $@
871 @find .
-maxdepth
1 -name \
*.h
-printf
"\t%p \\\\\n" >> $@
872 @find
$(SUBDIRS
) -name \
*.c
-printf
"\t%p \\\\\n" >> $@
873 @find
$(SUBDIRS
) -name \
*.h
-printf
"\t%p \\\\\n" >> $@
874 @find
include -name \
*.h
-printf
"\t%p \\\\\n" >> $@
879 @find .
-maxdepth
1 -name \
*.c
-print >> $@
880 @find .
-maxdepth
1 -name \
*.h
-print >> $@
881 @find
$(SUBDIRS
) -name \
*.c
-print >> $@
882 @find
$(SUBDIRS
) -name \
*.h
-print >> $@
883 @find
include -name \
*.h
-print >> $@
885 tags: .tags-depend .tags-sources
886 ctags
-L .tags-sources
-o
$@
890 TAGS
: .tags-depend .tags-sources
891 etags
-o
$@
`cat .tags-sources`
898 $(MAKE
) -C
$(shell echo
$@ | sed
"s/_env//g") env
903 # If the cleancount has been changed, force a make clean.
904 # .cleancount is the global clean count, and .lastclean is the
905 # last clean count we had
908 @if cmp
-s .cleancount .lastclean
; then echo
; else \
909 $(MAKE
) clean; cp
-f .cleancount .lastclean
;\
913 rm -f
$(DESTDIR
)$(MODULES_DIR
)/*
914 rm -f
$(DESTDIR
)$(ASTSBINDIR
)/*asterisk
*
915 rm -f
$(DESTDIR
)$(ASTSBINDIR
)/astgenkey
916 rm -f
$(DESTDIR
)$(ASTSBINDIR
)/autosupport
917 rm -rf
$(DESTDIR
)$(ASTHEADERDIR
)
918 rm -rf
$(DESTDIR
)$(ASTDATADIR
)/sounds
919 rm -rf
$(DESTDIR
)$(ASTDATADIR
)/firmware
920 rm -rf
$(DESTDIR
)$(ASTMANDIR
)/man8
921 for x in
$(SUBDIRS
); do
$(MAKE
) -C
$$x uninstall || exit
1 ; done
923 uninstall: _uninstall
924 @echo
" +--------- Asterisk Uninstall Complete -----+"
925 @echo
" + Asterisk binaries, sounds, man pages, +"
926 @echo
" + headers, modules, and firmware builds, +"
927 @echo
" + have all been uninstalled. +"
929 @echo
" + To remove ALL traces of Asterisk, +"
930 @echo
" + including configuration, spool +"
931 @echo
" + directories, and logs, run the following +"
932 @echo
" + command: +"
934 @echo
" + $(MAKE) uninstall-all +"
935 @echo
" +-------------------------------------------+"
937 uninstall-all
: _uninstall
938 rm -rf
$(DESTDIR
)$(ASTLIBDIR
)
939 rm -rf
$(DESTDIR
)$(ASTVARLIBDIR
)
940 rm -rf
$(DESTDIR
)$(ASTDATADIR
)
941 rm -rf
$(DESTDIR
)$(ASTSPOOLDIR
)
942 rm -rf
$(DESTDIR
)$(ASTETCDIR
)
943 rm -rf
$(DESTDIR
)$(ASTLOGDIR
)
945 menuselect
: build_tools
/menuselect makeopts.xml
946 -@build_tools
/menuselect
${GLOBAL_MAKEOPTS} ${USER_MAKEOPTS} menuselect.makeopts
&& echo
"menuselect changes saved!" || echo
"menuselect changes NOT saved!"
948 build_tools
/menuselect
: build_tools
/menuselect.c build_tools
/menuselect_curses.c build_tools
/menuselect.h config.status mxml
/libmxml.a
$(MENUSELECT_OBJS
)
949 $(MAKE
) -C build_tools menuselect
952 @cd mxml
&& unset CFLAGS LIBS
&& test -f config.h || .
/configure
953 $(MAKE
) -C mxml libmxml.a
955 makeopts.xml
: $(foreach dir,$(MOD_SUBDIRS
),$(dir)/*.c
) build_tools
/cflags.xml
956 @echo
"Generating list of available modules ..."
957 @build_tools
/prep_moduledeps
> $@