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
:
18 # Create OPTIONS variable
21 # If cross compiling, define these to suit
22 #CROSS_COMPILE=/opt/montavista/pro/devkit/arm/xscale_be/bin/xscale_be-
23 #CROSS_COMPILE_BIN=/opt/montavista/pro/devkit/arm/xscale_be/bin/
24 #CROSS_COMPILE_TARGET=/opt/montavista/pro/devkit/arm/xscale_be/target
27 #SUB_PROC=xscale # or maverick
29 ifeq ($(CROSS_COMPILE
),)
30 OSARCH
=$(shell uname
-s
)
31 PROC?
=$(shell uname
-m
)
39 # Remember the MAKELEVEL at the top
40 MAKETOPLEVEL?
=$(MAKELEVEL
)
42 # Overwite config files on "make samples"
45 # Include debug and macro symbols in the executables (-g) and profiling info (-pg)
49 # Files are copied here temporarily during the install process
50 # For example, make DESTDIR=/tmp/asterisk woud put things in
51 # /tmp/asterisk/etc/asterisk
52 # !!! Watch out, put no spaces or comments after the value !!!
54 #DESTDIR?=/tmp/asterisk
56 # Original busydetect routine
57 #BUSYDETECT = -DBUSYDETECT
59 # Improved busydetect routine, comment the previous one if you use this one
60 #BUSYDETECT+= -DBUSYDETECT_MARTIN
61 # Detect the busy signal looking only at tone lengths
62 # For example if you have 3 beeps 100ms tone, 100ms silence separated by 500 ms of silence
63 #BUSYDETECT+= -DBUSYDETECT_TONEONLY
64 # Enforce the detection of busy signal (get rid of false hangups)
65 # Don't use together with -DBUSYDETECT_TONEONLY
66 #BUSYDETECT+= -DBUSYDETECT_COMPARE_TONE_AND_SILENCE
68 # Define standard directories for various platforms
69 # These apply if they are not redefined in asterisk.conf
70 ifeq ($(OSARCH
),SunOS
)
71 ASTETCDIR
=/etc
/opt
/asterisk
72 ASTLIBDIR
=/opt
/asterisk
/lib
73 ASTVARLIBDIR
=/var
/opt
/asterisk
/lib
74 ASTSPOOLDIR
=/var
/opt
/asterisk
/spool
75 ASTLOGDIR
=/var
/opt
/asterisk
/log
76 ASTHEADERDIR
=/opt
/asterisk
/usr
/include/asterisk
77 ASTBINDIR
=/opt
/asterisk
/usr
/bin
78 ASTSBINDIR
=/opt
/asterisk
/usr
/sbin
79 ASTVARRUNDIR
=/var
/opt
/asterisk
/run
80 ASTMANDIR
=/opt
/asterisk
/usr
/share
/man
82 ASTETCDIR
=$(sysconfdir
)/asterisk
83 ASTLIBDIR
=$(libdir)/asterisk
84 ASTHEADERDIR
=$(includedir)/asterisk
87 ASTSPOOLDIR
=$(localstatedir
)/spool
/asterisk
88 ASTLOGDIR
=$(localstatedir
)/log
/asterisk
89 ASTVARRUNDIR
=$(localstatedir
)/run
91 ifeq ($(OSARCH
),FreeBSD
)
92 ASTVARLIBDIR
=$(prefix)/share
/asterisk
94 ASTVARLIBDIR
=$(localstatedir
)/lib
/asterisk
97 ASTDATADIR?
=$(ASTVARLIBDIR
)
99 # Asterisk.conf is located in ASTETCDIR or by using the -C flag
100 # when starting Asterisk
101 ASTCONFPATH
=$(ASTETCDIR
)/asterisk.conf
102 MODULES_DIR
=$(ASTLIBDIR
)/modules
103 AGI_DIR
=$(ASTDATADIR
)/agi-bin
105 # If you use Apache, you may determine by a grep 'DocumentRoot' of your httpd.conf file
106 HTTP_DOCSDIR
=/var
/www
/html
107 # Determine by a grep 'ScriptAlias' of your Apache httpd.conf file
108 HTTP_CGIDIR
=/var
/www
/cgi-bin
112 # Uncomment this to use the older DSP routines
113 #ASTCFLAGS+=-DOLD_DSP_ROUTINES
115 # If the file .asterisk.makeopts is present in your home directory, you can
116 # include all of your favorite menuselect options so that every time you download
117 # a new version of Asterisk, you don't have to run menuselect to set them.
118 # The file /etc/asterisk.makeopts will also be included but can be overridden
119 # by the file in your home directory.
121 GLOBAL_MAKEOPTS
=$(wildcard /etc
/asterisk.makeopts
)
122 USER_MAKEOPTS
=$(wildcard ~
/.asterisk.makeopts
)
124 ifneq ($(wildcard menuselect.makeopts
),)
125 include menuselect.makeopts
128 ifneq ($(wildcard makeopts
),)
132 TOPDIR_CFLAGS
=-Iinclude
133 MOD_SUBDIR_CFLAGS
=-I..
/include -I..
134 OTHER_SUBDIR_CFLAGS
=-I..
/include -I..
136 ifeq ($(findstring dont-optimize
,$(MAKECMDGOALS
)),)
137 ifeq ($(findstring DONT_OPTIMIZE
,$(MENUSELECT_CFLAGS
)),)
138 # More GSM codec optimization
139 # Uncomment to enable MMXTM optimizations for x86 architecture CPU's
140 # which support MMX instructions. This should be newer pentiums,
141 # ppro's, etc, as well as the AMD K6 and K7.
144 # Tell gcc to optimize the code
147 # Stack backtraces, while useful for debugging, are incompatible with optimizations
148 ifeq (${OSARCH},Linux
)
149 CFLAGS
+=-DSTACK_BACKTRACES
153 # Stack backtraces, while useful for debugging, are incompatible with optimizations
154 ifeq (${OSARCH},Linux
)
155 CFLAGS
+=-DSTACK_BACKTRACES
159 # *CLI> show memory allocations [filename]
160 # *CLI> show memory summary [filename]
161 ifneq ($(findstring MALLOC_DEBUG
,$(MENUSELECT_CFLAGS
)),)
162 TOPDIR_CFLAGS
+=-include include/asterisk
/astmm.h
163 MOD_SUBDIR_CFLAGS
+=-include ..
/include/asterisk
/astmm.h
166 MOD_SUBDIR_CFLAGS
+=-fPIC
168 ifeq ($(OSARCH
),Linux
)
169 ifeq ($(PROC
),x86_64
)
170 # You must have GCC 3.4 to use k8, otherwise use athlon
175 ifeq ($(PROC
),sparc64
)
176 #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
177 #This works for even old (2.96) versions of gcc and provides a small boost either way.
178 #A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
179 #So we go lowest common available by gcc and go a step down, still a step up from
180 #the default as we now have a better instruction set to work with. - Belgarath
182 OPTIONS
+=$(shell if
$(CC
) -mtune
=$(PROC
) -S
-o
/dev
/null
-xc
/dev
/null
>/dev
/null
2>&1; then echo
"-mtune=$(PROC)"; fi
)
183 OPTIONS
+=$(shell if
$(CC
) -mcpu
=v8
-S
-o
/dev
/null
-xc
/dev
/null
>/dev
/null
2>&1; then echo
"-mcpu=v8"; fi
)
184 OPTIONS
+=-fomit-frame-pointer
188 # The Cirrus logic is the only heavily shipping arm processor with a real floating point unit
189 ifeq ($(SUB_PROC
),maverick
)
190 OPTIONS
+=-fsigned-char
-mcpu
=ep9312
192 ifeq ($(SUB_PROC
),xscale
)
193 OPTIONS
+=-fsigned-char
-mcpu
=xscale
195 OPTIONS
+=-fsigned-char
204 ifeq ($(OSARCH
),SunOS
)
205 GREP
=/usr
/xpg4
/bin
/grep
210 ASTCFLAGS
+=-pipe
-Wall
-Wstrict-prototypes
-Wmissing-prototypes
-Wmissing-declarations
$(DEBUG
)
211 ASTCFLAGS
+=$(OPTIMIZE
)
213 ifeq ($(AST_DEVMODE
),yes
)
214 ASTCFLAGS
+=-Werror
-Wunused
217 ifeq ($(shell gcc
-v
2>&1 | grep
'gcc version' | cut
-f3
-d
' ' | cut
-f1
-d.
),4)
218 ASTCFLAGS
+=-Wno-pointer-sign
222 ifeq ($(findstring BSD
,$(OSARCH
)),BSD
)
223 ASTCFLAGS
+=-I
$(CROSS_COMPILE_TARGET
)/usr
/local
/include -L
$(CROSS_COMPILE_TARGET
)/usr
/local
/lib
226 ifneq ($(PROC
),ultrasparc
)
227 ASTCFLAGS
+=$(shell if
$(CC
) -march
=$(PROC
) -S
-o
/dev
/null
-xc
/dev
/null
>/dev
/null
2>&1; then echo
"-march=$(PROC)"; fi
)
231 ASTCFLAGS
+=-fsigned-char
234 ifeq ($(OSARCH
),FreeBSD
)
235 BSDVERSION
=$(shell make
-V OSVERSION
-f
$(CROSS_COMPILE_TARGET
)/usr
/share
/mk
/bsd.port.subdir.mk
)
236 ASTCFLAGS
+=$(shell if
test $(BSDVERSION
) -lt
500016 ; then echo
"-D_THREAD_SAFE"; fi
)
237 LIBS
+=$(shell if
test $(BSDVERSION
) -lt
502102 ; then echo
"-lc_r"; else echo
"-pthread"; fi
)
238 ifneq ($(wildcard $(CROSS_COMPILE_TARGET
)/usr
/local
/include/spandsp
),)
239 ASTCFLAGS
+=-I
$(CROSS_COMPILE_TARGET
)/usr
/local
/include/spandsp
243 ifeq ($(OSARCH
),NetBSD
)
244 AST_CFLAGS
+=-pthread
-I
$(CROSS_COMPILE_TARGET
)/usr
/pkg
/include
247 ifeq ($(OSARCH
),OpenBSD
)
251 ifeq ($(OSARCH
),SunOS
)
252 ASTCFLAGS
+=-Wcast-align
-DSOLARIS
-Iinclude
/solaris-compat
-I
$(CROSS_COMPILE_TARGET
)/usr
/local
/ssl
/include
255 LIBEDIT
=editline
/libedit.a
257 ASTERISKVERSION
:=$(shell build_tools
/make_version .
)
259 ifneq ($(wildcard .version
),)
260 ASTERISKVERSIONNUM
:=$(shell awk
-F.
'{printf "%02d%02d%02d", $$1, $$2, $$3}' .version
)
261 RPMVERSION
:=$(shell sed
's/[-\/:]/_/g' .version
)
266 # CVS mirrors of SVN have .svnrevision files showing
267 # which SVN revision they are based on, and .svnbranch
268 # showing the branch they are made from
269 ifneq ($(wildcard .svnrevision
),)
270 ASTERISKVERSIONNUM
=999999
272 ifneq ($(wildcard .svn
),)
273 ASTERISKVERSIONNUM
=999999
277 ASTCFLAGS
+=$(MALLOC_DEBUG
)$(BUSYDETECT
)$(OPTIONS
)
279 MOD_SUBDIRS
=res channels pbx apps codecs formats cdr funcs
280 OTHER_SUBDIRS
=utils stdtime agi
281 SUBDIRS
:=$(MOD_SUBDIRS
) $(OTHER_SUBDIRS
)
283 OBJS
=io.o sched.o logger.o frame.o loader.o config.o channel.o \
284 translate.o file.o pbx.o cli.o md5.o term.o \
285 ulaw.o alaw.o callerid.o fskmodem.o image.o app.o \
286 cdr.o tdd.o acl.o rtp.o udptl.o manager.o asterisk.o \
287 dsp.o chanvars.o indications.o autoservice.o db.o privacy.o \
288 astmm.o enum.o srv.o dns.o aescrypt.o aestab.o aeskey.o \
289 utils.o plc.o jitterbuf.o dnsmgr.o devicestate.o \
290 netsock.o slinfactory.o ast_expr2.o ast_expr2f.o \
291 cryptostub.o sha1.o http.o fixedjitterbuf.o abstract_jb.o
293 # we need to link in the objects statically, not as a library, because
294 # otherwise modules will not have them available if none of the static
296 OBJS
+=stdtime
/localtime.o
298 # At the moment say.o is an optional component which can be overridden
302 ifeq ($(wildcard $(CROSS_COMPILE_TARGET
)/usr
/include/sys
/poll.h
),)
304 ASTCFLAGS
+=-DPOLLCOMPAT
307 ifeq ($(wildcard $(CROSS_COMPILE_TARGET
)/usr
/include/dlfcn.h
),)
309 ASTCFLAGS
+=-DDLFCNCOMPAT
312 ifeq ($(OSARCH
),Linux
)
313 LIBS
+=-ldl
-lpthread
$(EDITLINE_LIBS
) -lm
-lresolv
#-lnjamd
315 LIBS
+=$(EDITLINE_LIBS
) -lm
318 ifeq ($(OSARCH
),Darwin
)
320 ASTCFLAGS
+=-D__Darwin__
321 AUDIO_LIBS
=-framework CoreAudio
323 SOLINK
=-dynamic
-bundle
-undefined suppress
-force_flat_namespace
324 # Mac on Intel CoreDuo does not need poll compatibility layer
327 ASTCFLAGS
+=-DPOLLCOMPAT
330 # These are used for all but Darwin
332 SOLINK
=-shared
-Xlinker
-x
333 ifeq ($(findstring BSD
,$(OSARCH
)),BSD
)
334 SOLINK
+=-L
$(CROSS_COMPILE_TARGET
)/usr
/local
/lib
338 ifeq ($(OSARCH
),FreeBSD
)
342 ifeq ($(OSARCH
),NetBSD
)
343 LIBS
+=-lpthread
-lcrypto
-lm
-L
$(CROSS_COMPILE_TARGET
)/usr
/pkg
/lib
$(EDITLINE_LIBS
)
346 ifeq ($(OSARCH
),OpenBSD
)
347 LIBS
+=-lcrypto
-lpthread
-lm
$(EDITLINE_LIBS
)
350 ifeq ($(OSARCH
),SunOS
)
351 LIBS
+=-lpthread
-ldl
-lnsl
-lsocket
-lresolv
-L
$(CROSS_COMPILE_TARGET
)/usr
/local
/ssl
/lib
353 MENUSELECT_OBJS
+=strcompat.o
355 SOLINK
=-shared
-fpic
-L
$(CROSS_COMPILE_TARGET
)/usr
/local
/ssl
/lib
358 ifeq ($(MAKETOPLEVEL
),$(MAKELEVEL
))
359 CFLAGS
+=$(TOPDIR_CFLAGS
)$(ASTCFLAGS
)
362 # This is used when generating the doxygen documentation
372 @echo
" +--------- Asterisk Build Complete ---------+"
373 @echo
" + Asterisk has successfully been built, but +"
374 @echo
" + cannot be run before being installed by +"
375 @echo
" + running: +"
377 @echo
" + make install +"
378 @echo
" +-------------------------------------------+"
380 all: cleantest config.status menuselect.makeopts depend asterisk subdirs
382 config.status
: configure
383 @CFLAGS
="" .
/configure
385 @echo
"**** The configure script was just executed, so 'make' needs to be"
386 @echo
"**** restarted."
391 @CFLAGS
="" .
/configure
393 @echo
"**** The configure script was just executed, so 'make' needs to be"
394 @echo
"**** restarted."
398 menuselect.makeopts
: build_tools
/menuselect makeopts.xml
399 @build_tools
/menuselect
--check-deps
${GLOBAL_MAKEOPTS} ${USER_MAKEOPTS} $@
401 #ifneq ($(wildcard tags),)
405 ifneq ($(wildcard TAGS
),)
410 cd editline
&& unset CFLAGS LIBS
&& CFLAGS
="$(OPTIMIZE)" .
/configure
; \
413 cd editline
&& unset CFLAGS LIBS
&& test -f config.h || CFLAGS
="$(OPTIMIZE)" .
/configure
414 $(MAKE
) -C editline libedit.a
417 $(MAKE
) -C db1-ast libdb1.a
419 ifneq ($(wildcard .depend
),)
423 ifneq ($(wildcard .tags-depend
),)
427 ast_expr2.c ast_expr2.h
:
428 bison
-o
$@
-d
--name-prefix
=ast_yy ast_expr2.y
431 flex
-o
$@
--full ast_expr2.fl
433 testexpr2
: ast_expr2f.c ast_expr2.c ast_expr2.h
434 gcc
-g
-c
-DSTANDALONE ast_expr2f.c
435 gcc
-g
-c
-DSTANDALONE ast_expr2.c
436 gcc
-g
-o testexpr2 ast_expr2f.o ast_expr2.o
437 rm ast_expr2.o ast_expr2f.o
441 asterisk
.8: asterisk.sgml
443 docbook2man asterisk.sgml
446 asterisk.pdf
: asterisk.sgml
447 docbook2pdf asterisk.sgml
449 asterisk.ps
: asterisk.sgml
450 docbook2ps asterisk.sgml
452 asterisk.html
: asterisk.sgml
453 docbook2html asterisk.sgml
454 mv r1.html asterisk.html
456 asterisk.txt
: asterisk.sgml
457 docbook2txt asterisk.sgml
460 @build_tools
/make_defaults_h
> $@.tmp
461 @if cmp
-s
$@.tmp
$@
; then echo
; else \
466 include/asterisk
/version.h
:
467 @build_tools
/make_version_h
> $@.tmp
468 @if cmp
-s
$@.tmp
$@
; then echo
; else \
473 include/asterisk
/buildopts.h
: menuselect.makeopts
474 @build_tools
/make_buildopts_h
> $@.tmp
475 @if cmp
-s
$@.tmp
$@
; then echo
; else \
481 CFLAGS
="$(MOD_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE
) -C stdtime libtime.a
483 asterisk
: include/asterisk
/buildopts.h editline
/libedit.a db1-ast
/libdb1.a stdtime
/libtime.a
$(OBJS
)
484 build_tools
/make_build_h
> include/asterisk
/build.h.tmp
485 if cmp
-s
include/asterisk
/build.h.tmp
include/asterisk
/build.h
; then echo
; else \
486 mv
include/asterisk
/build.h.tmp
include/asterisk
/build.h
; \
488 rm -f
include/asterisk
/build.h.tmp
489 $(CC
) -c
-o buildinfo.o
$(CFLAGS
) buildinfo.c
490 $(CC
) $(DEBUG
) $(ASTOBJ
) $(ASTLINK
) $(OBJS
) buildinfo.o
$(LIBEDIT
) db1-ast
/libdb1.a stdtime
/libtime.a
$(LIBS
)
493 $(CC
) $(AUDIO_LIBS
) -o muted muted.o
496 @for x in
$(MOD_SUBDIRS
); do CFLAGS
="$(MOD_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE
) -C
$$x || exit
1 ; done
497 @CFLAGS
="$(OTHER_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE
) -C utils
498 @CFLAGS
="$(OTHER_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE
) -C agi
501 @for x in
$(SUBDIRS
); do
$(MAKE
) -C
$$x clean-depend || exit
1 ; done
502 rm -f .depend .tags-depend
505 @for x in
$(SUBDIRS
); do
$(MAKE
) -C
$$x clean || exit
1 ; done
506 rm -f
*.o
*.so asterisk
508 rm -f
include/asterisk
/build.h
509 rm -f
include/asterisk
/version.h
510 rm -f .tags-sources
tags TAGS
511 @if
[ -f editline
/Makefile
]; then
$(MAKE
) -C editline
distclean ; fi
512 $(MAKE
) -C db1-ast
clean
513 $(MAKE
) -C stdtime
clean
515 distclean: dist-clean
518 $(MAKE
) -C mxml
clean
519 $(MAKE
) -C build_tools dist-clean
520 $(MAKE
) -C sounds dist-clean
521 rm -f menuselect.makeopts makeopts makeopts.xml
522 rm -f config.log config.status
523 rm -f
include/autoconfig.h
524 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
; \
553 elif
[ -d CVS
]; then \
554 echo
"Updating from CVS..." ; \
555 cvs
-q
-z3 update
-Pd | tee update.out
; \
557 if
[ `grep -c ^C update.out` -gt
0 ]; then \
558 echo
; echo
"The following files have conflicts:" ; \
559 grep ^C update.out | cut
-d
' ' -f2-
; \
562 $(MAKE
) clean-depend
; \
564 echo
"Not under version control"; \
567 NEWHEADERS
=$(notdir $(wildcard include/asterisk
/*.h
))
568 OLDHEADERS
=$(filter-out $(NEWHEADERS
),$(notdir $(wildcard $(DESTDIR
)$(ASTHEADERDIR
)/*.h
)))
571 mkdir
-p
$(DESTDIR
)$(MODULES_DIR
)
572 mkdir
-p
$(DESTDIR
)$(ASTSBINDIR
)
573 mkdir
-p
$(DESTDIR
)$(ASTETCDIR
)
574 mkdir
-p
$(DESTDIR
)$(ASTBINDIR
)
575 mkdir
-p
$(DESTDIR
)$(ASTVARRUNDIR
)
576 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/voicemail
577 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/dictate
578 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/system
579 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/tmp
580 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/meetme
581 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/monitor
582 if
[ -f asterisk
]; then
$(INSTALL
) -m
755 asterisk
$(DESTDIR
)$(ASTSBINDIR
)/; fi
583 if
[ -f asterisk.dll
]; then
$(INSTALL
) -m
755 asterisk.dll
$(DESTDIR
)$(ASTSBINDIR
)/; fi
584 ln
-sf asterisk
$(DESTDIR
)$(ASTSBINDIR
)/rasterisk
585 $(INSTALL
) -m
755 contrib
/scripts
/astgenkey
$(DESTDIR
)$(ASTSBINDIR
)/
586 $(INSTALL
) -m
755 contrib
/scripts
/autosupport
$(DESTDIR
)$(ASTSBINDIR
)/
587 if
[ ! -f
$(DESTDIR
)$(ASTSBINDIR
)/safe_asterisk
]; then \
588 cat contrib
/scripts
/safe_asterisk | sed
's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;' > $(DESTDIR
)$(ASTSBINDIR
)/safe_asterisk
;\
589 chmod
755 $(DESTDIR
)$(ASTSBINDIR
)/safe_asterisk
;\
591 $(INSTALL
) -d
$(DESTDIR
)$(ASTHEADERDIR
)
592 $(INSTALL
) -m
644 include/asterisk.h
$(DESTDIR
)$(includedir)
593 $(INSTALL
) -m
644 include/asterisk
/*.h
$(DESTDIR
)$(ASTHEADERDIR
)
594 if
[ -n
"$(OLDHEADERS)" ]; then \
595 rm -f
$(addprefix $(DESTDIR
)$(ASTHEADERDIR
)/,$(OLDHEADERS
)) ;\
597 mkdir
-p
$(DESTDIR
)$(ASTLOGDIR
)/cdr-csv
598 mkdir
-p
$(DESTDIR
)$(ASTLOGDIR
)/cdr-custom
599 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/keys
600 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/firmware
601 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/firmware
/iax
602 mkdir
-p
$(DESTDIR
)$(ASTMANDIR
)/man8
603 $(INSTALL
) -m
644 keys
/iaxtel.pub
$(DESTDIR
)$(ASTDATADIR
)/keys
604 $(INSTALL
) -m
644 keys
/freeworlddialup.pub
$(DESTDIR
)$(ASTDATADIR
)/keys
605 $(INSTALL
) -m
644 asterisk
.8 $(DESTDIR
)$(ASTMANDIR
)/man8
606 $(INSTALL
) -m
644 contrib
/scripts
/astgenkey
.8 $(DESTDIR
)$(ASTMANDIR
)/man8
607 $(INSTALL
) -m
644 contrib
/scripts
/autosupport
.8 $(DESTDIR
)$(ASTMANDIR
)/man8
608 $(INSTALL
) -m
644 contrib
/scripts
/safe_asterisk
.8 $(DESTDIR
)$(ASTMANDIR
)/man8
609 if
[ -d contrib
/firmware
/iax
]; then \
610 $(INSTALL
) -m
644 contrib
/firmware
/iax
/iaxy.bin
$(DESTDIR
)$(ASTDATADIR
)/firmware
/iax
/iaxy.bin
; \
612 echo
"You need to do cvs update -d not just cvs update" ; \
616 @for x in
$(SUBDIRS
); do
$(MAKE
) -C
$$x install || exit
1 ; done
618 NEWMODS
=$(notdir $(wildcard */*.so
))
619 OLDMODS
=$(filter-out $(NEWMODS
),$(notdir $(wildcard $(DESTDIR
)$(MODULES_DIR
)/*.so
)))
622 @if
[ -n
"$(OLDMODS)" ]; then \
623 echo
" WARNING WARNING WARNING" ;\
625 echo
" Your Asterisk modules directory, located at" ;\
626 echo
" $(DESTDIR)$(MODULES_DIR)" ;\
627 echo
" contains modules that were not installed by this " ;\
628 echo
" version of Asterisk. Please ensure that these" ;\
629 echo
" modules are compatible with this version before" ;\
630 echo
" attempting to run Asterisk." ;\
632 for f in
$(OLDMODS
); do \
636 echo
" WARNING WARNING WARNING" ;\
639 install: all datafiles bininstall install-subdirs
640 @if
[ -x
/usr
/sbin
/asterisk-post-install
]; then \
641 /usr
/sbin
/asterisk-post-install
$(DESTDIR
) .
; \
643 @echo
" +---- Asterisk Installation Complete -------+"
645 @echo
" + YOU MUST READ THE SECURITY DOCUMENT +"
647 @echo
" + Asterisk has successfully been installed. +"
648 @echo
" + If you would like to install the sample +"
649 @echo
" + configuration files (overwriting any +"
650 @echo
" + existing config files), run: +"
652 @echo
" + $(MAKE) samples +"
654 @echo
" +----------------- or ---------------------+"
656 @echo
" + You can go ahead and install the asterisk +"
657 @echo
" + program documentation now or later run: +"
659 @echo
" + $(MAKE) progdocs +"
661 @echo
" + **Note** This requires that you have +"
662 @echo
" + doxygen installed on your local system +"
663 @echo
" +-------------------------------------------+"
664 @
$(MAKE
) -s oldmodcheck
666 upgrade
: all bininstall
669 mkdir
-p
$(DESTDIR
)$(ASTETCDIR
)
670 for x in configs
/*.adsi
; do \
671 if
[ ! -f
$(DESTDIR
)$(ASTETCDIRX
)/$$x ]; then \
672 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTETCDIR
)/`basename $$x` ; \
677 mkdir
-p
$(DESTDIR
)$(ASTETCDIR
)
678 for x in configs
/*.sample
; do \
679 if
[ -f
$(DESTDIR
)$(ASTETCDIR
)/`basename $$x .sample` ]; then \
680 if
[ "$(OVERWRITE)" = "y" ]; then \
681 if cmp
-s
$(DESTDIR
)$(ASTETCDIR
)/`basename $$x .sample` $$x ; then \
682 echo
"Config file $$x is unchanged"; \
685 mv
-f
$(DESTDIR
)$(ASTETCDIR
)/`basename $$x .sample` $(DESTDIR
)$(ASTETCDIR
)/`basename $$x .sample`.old
; \
687 echo
"Skipping config file $$x"; \
691 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTETCDIR
)/`basename $$x .sample` ;\
693 if
[ "$(OVERWRITE)" = "y" ] ||
[ ! -f
$(DESTDIR
)$(ASTCONFPATH
) ]; then \
695 echo
"[directories]" ; \
696 echo
"astetcdir => $(ASTETCDIR)" ; \
697 echo
"astmoddir => $(MODULES_DIR)" ; \
698 echo
"astvarlibdir => $(ASTVARLIBDIR)" ; \
699 echo
"astdatadir => $(ASTDATADIR)" ; \
700 echo
"astagidir => $(AGI_DIR)" ; \
701 echo
"astspooldir => $(ASTSPOOLDIR)" ; \
702 echo
"astrundir => $(ASTVARRUNDIR)" ; \
703 echo
"astlogdir => $(ASTLOGDIR)" ; \
705 echo
"; Changing the following lines may compromise your security." ; \
707 echo
";astctlpermissions = 0660" ; \
708 echo
";astctlowner = root" ; \
709 echo
";astctlgroup = apache" ; \
710 echo
";astctl = asterisk.ctl" ; \
711 echo
";[options]" ; \
712 echo
";internal_timing = yes" ; \
713 ) > $(DESTDIR
)$(ASTCONFPATH
) ; \
715 echo
"Skipping asterisk.conf creation"; \
717 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/voicemail
/default
/1234/INBOX
718 :> $(DESTDIR
)$(ASTSPOOLDIR
)/voicemail
/default
/1234/unavail.gsm
719 for x in vm-theperson digits
/1 digits
/2 digits
/3 digits
/4 vm-isunavail
; do \
720 cat
$(DESTDIR
)$(ASTDATADIR
)/sounds
/$$x.gsm
>> $(DESTDIR
)$(ASTSPOOLDIR
)/voicemail
/default
/1234/unavail.gsm
; \
722 :> $(DESTDIR
)$(ASTSPOOLDIR
)/voicemail
/default
/1234/busy.gsm
723 for x in vm-theperson digits
/1 digits
/2 digits
/3 digits
/4 vm-isonphone
; do \
724 cat
$(DESTDIR
)$(ASTDATADIR
)/sounds
/$$x.gsm
>> $(DESTDIR
)$(ASTSPOOLDIR
)/voicemail
/default
/1234/busy.gsm
; \
728 @
[ -d
$(DESTDIR
)$(HTTP_DOCSDIR
)/ ] ||
( printf
"http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit
1 )
729 @
[ -d
$(DESTDIR
)$(HTTP_CGIDIR
) ] ||
( printf
"cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit
1 )
730 $(INSTALL
) -m
4755 -o root
-g root contrib
/scripts
/vmail.cgi
$(DESTDIR
)$(HTTP_CGIDIR
)/vmail.cgi
731 mkdir
-p
$(DESTDIR
)$(HTTP_DOCSDIR
)/_asterisk
732 for x in images
/*.gif
; do \
733 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(HTTP_DOCSDIR
)/_asterisk
/; \
735 @echo
" +--------- Asterisk Web Voicemail ----------+"
737 @echo
" + Asterisk Web Voicemail is installed in +"
738 @echo
" + your cgi-bin directory: +"
739 @echo
" + $(DESTDIR)$(HTTP_CGIDIR)"
740 @echo
" + IT USES A SETUID ROOT PERL SCRIPT, SO +"
741 @echo
" + IF YOU DON'T LIKE THAT, UNINSTALL IT! +"
743 @echo
" + Other static items have been stored in: +"
744 @echo
" + $(DESTDIR)$(HTTP_DOCSDIR)"
746 @echo
" + If these paths do not match your httpd +"
747 @echo
" + installation, correct the definitions +"
748 @echo
" + in your Makefile of HTTP_CGIDIR and +"
749 @echo
" + HTTP_DOCSDIR +"
751 @echo
" +-------------------------------------------+"
754 sed
"s/^Version:.*/Version: $(RPMVERSION)/g" redhat
/asterisk.spec
> asterisk.spec
; \
758 __rpm
: include/asterisk
/version.h
include/asterisk
/buildopts.h spec
759 rm -rf
/tmp
/asterisk
; \
760 mkdir
-p
/tmp
/asterisk
/redhat
/RPMS
/i386
; \
761 $(MAKE
) DESTDIR
=/tmp
/asterisk
install ; \
762 $(MAKE
) DESTDIR
=/tmp
/asterisk samples
; \
763 mkdir
-p
/tmp
/asterisk
/etc
/rc.d
/init.d
; \
764 cp
-f contrib
/init.d
/rc.redhat.asterisk
/tmp
/asterisk
/etc
/rc.d
/init.d
/asterisk
; \
765 rpmbuild
--rcfile
/usr
/lib
/rpm
/rpmrc
:redhat
/rpmrc
-bb asterisk.spec
768 (cat contrib
/asterisk-ng-doxygen
; echo
"HAVE_DOT=$(HAVEDOT)"; \
769 echo
"PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen
-
772 @if
[ "${OSARCH}" = "Linux" ]; then \
773 if
[ -f
/etc
/redhat-release
-o
-f
/etc
/fedora-release
]; then \
774 $(INSTALL
) -m
755 contrib
/init.d
/rc.redhat.asterisk
/etc
/rc.d
/init.d
/asterisk
; \
775 /sbin
/chkconfig
--add asterisk
; \
776 elif
[ -f
/etc
/debian_version
]; then \
777 $(INSTALL
) -m
755 contrib
/init.d
/rc.debian.asterisk
/etc
/init.d
/asterisk
; \
778 /usr
/sbin
/update-rc.d asterisk start
10 2 3 4 5 . stop
91 2 3 4 5 .
; \
779 elif
[ -f
/etc
/gentoo-release
]; then \
780 $(INSTALL
) -m
755 contrib
/init.d
/rc.gentoo.asterisk
/etc
/init.d
/asterisk
; \
781 /sbin
/rc-update add asterisk default
; \
782 elif
[ -f
/etc
/mandrake-release
]; then \
783 $(INSTALL
) -m
755 contrib
/init.d
/rc.mandrake.asterisk
/etc
/rc.d
/init.d
/asterisk
; \
784 /sbin
/chkconfig
--add asterisk
; \
785 elif
[ -f
/etc
/SuSE-release
-o
-f
/etc
/novell-release
]; then \
786 $(INSTALL
) -m
755 contrib
/init.d
/rc.suse.asterisk
/etc
/init.d
/asterisk
; \
787 /sbin
/chkconfig
--add asterisk
; \
788 elif
[ -f
/etc
/slackware-version
]; then \
789 echo
"Slackware is not currently supported, although an init script does exist for it." \
791 echo
"We could not install init scripts for your distribution."; \
794 echo
"We could not install init scripts for your operating system."; \
799 valgrind
: dont-optimize
801 depend
: include/asterisk
/version.h
include/asterisk
/buildopts.h .depend defaults.h
802 @for x in
$(MOD_SUBDIRS
); do CFLAGS
="$(MOD_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE
) -C
$$x depend || exit
1 ; done
803 @for x in
$(OTHER_SUBDIRS
); do CFLAGS
="$(OTHER_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE
) -C
$$x depend || exit
1 ; done
805 .depend
: include/asterisk
/version.h
include/asterisk
/buildopts.h defaults.h
806 build_tools
/mkdep
$(CFLAGS
) $(wildcard *.c
)
809 @echo
-n
".tags-depend: " > $@
810 @find .
-maxdepth
1 -name \
*.c
-printf
"\t%p \\\\\n" >> $@
811 @find .
-maxdepth
1 -name \
*.h
-printf
"\t%p \\\\\n" >> $@
812 @find
$(SUBDIRS
) -name \
*.c
-printf
"\t%p \\\\\n" >> $@
813 @find
$(SUBDIRS
) -name \
*.h
-printf
"\t%p \\\\\n" >> $@
814 @find
include -name \
*.h
-printf
"\t%p \\\\\n" >> $@
819 @find .
-maxdepth
1 -name \
*.c
-print >> $@
820 @find .
-maxdepth
1 -name \
*.h
-print >> $@
821 @find
$(SUBDIRS
) -name \
*.c
-print >> $@
822 @find
$(SUBDIRS
) -name \
*.h
-print >> $@
823 @find
include -name \
*.h
-print >> $@
825 tags: .tags-depend .tags-sources
826 ctags
-L .tags-sources
-o
$@
830 TAGS
: .tags-depend .tags-sources
831 etags
-o
$@
`cat .tags-sources`
838 $(MAKE
) -C
$(shell echo
$@ | sed
"s/_env//g") env
841 $(MAKE
) -C sounds
all
846 # If the cleancount has been changed, force a make clean.
847 # .cleancount is the global clean count, and .lastclean is the
848 # last clean count we had
851 @if cmp
-s .cleancount .lastclean
; then echo
; else \
852 $(MAKE
) clean; cp
-f .cleancount .lastclean
;\
857 rm -f
$(DESTDIR
)$(MODULES_DIR
)/*
858 rm -f
$(DESTDIR
)$(ASTSBINDIR
)/*asterisk
*
859 rm -f
$(DESTDIR
)$(ASTSBINDIR
)/astgenkey
860 rm -f
$(DESTDIR
)$(ASTSBINDIR
)/autosupport
861 rm -rf
$(DESTDIR
)$(ASTHEADERDIR
)
862 rm -rf
$(DESTDIR
)$(ASTDATADIR
)/firmware
863 rm -rf
$(DESTDIR
)$(ASTMANDIR
)/man8
864 for x in
$(SUBDIRS
); do
$(MAKE
) -C
$$x uninstall || exit
1 ; done
865 $(MAKE
) -C sounds
uninstall
867 uninstall: _uninstall
868 @echo
" +--------- Asterisk Uninstall Complete -----+"
869 @echo
" + Asterisk binaries, sounds, man pages, +"
870 @echo
" + headers, modules, and firmware builds, +"
871 @echo
" + have all been uninstalled. +"
873 @echo
" + To remove ALL traces of Asterisk, +"
874 @echo
" + including configuration, spool +"
875 @echo
" + directories, and logs, run the following +"
876 @echo
" + command: +"
878 @echo
" + $(MAKE) uninstall-all +"
879 @echo
" +-------------------------------------------+"
881 uninstall-all
: _uninstall
882 rm -rf
$(DESTDIR
)$(ASTLIBDIR
)
883 rm -rf
$(DESTDIR
)$(ASTVARLIBDIR
)
884 rm -rf
$(DESTDIR
)$(ASTDATADIR
)
885 rm -rf
$(DESTDIR
)$(ASTSPOOLDIR
)
886 rm -rf
$(DESTDIR
)$(ASTETCDIR
)
887 rm -rf
$(DESTDIR
)$(ASTLOGDIR
)
889 menuselect
: build_tools
/menuselect makeopts.xml
890 -@build_tools
/menuselect
${GLOBAL_MAKEOPTS} ${USER_MAKEOPTS} menuselect.makeopts
&& echo
"menuselect changes saved!" || echo
"menuselect changes NOT saved!"
892 build_tools
/menuselect
: build_tools
/menuselect.c build_tools
/menuselect_curses.c build_tools
/menuselect.h config.status mxml
/libmxml.a
$(MENUSELECT_OBJS
)
893 $(MAKE
) -C build_tools menuselect
896 @cd mxml
&& unset CFLAGS LIBS
&& test -f config.h || .
/configure
897 $(MAKE
) -C mxml libmxml.a
899 makeopts.xml
: $(foreach dir,$(MOD_SUBDIRS
),$(dir)/*.c
) build_tools
/cflags.xml sounds
/sounds.xml
900 @echo
"Generating list of available modules ..."
901 @build_tools
/prep_moduledeps
> $@