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 # All Makefiles use the following variables:
16 # ASTCFLAGS - compiler options
17 # ASTLDFLAGS - linker flags (not libraries)
18 # AST_LIBS - libraries to build binaries XXX
19 # LIBS - additional libraries, at top-level for all links,
20 # on a single object just for that object
21 # SOLINK - linker flags used only for creating shared objects (.so files),
22 # used for all .so links
24 # Default values fo ASTCFLAGS and ASTLDFLAGS can be specified in the
25 # environment when running make, as follows:
27 # $ ASTCFLAGS="-Werror" make
30 export ASTERISKVERSION
31 export ASTERISKVERSIONNUM
48 export MENUSELECT_CFLAGS
72 # even though we could use '-include makeopts' here, use a wildcard
73 # lookup anyway, so that make won't try to build makeopts if it doesn't
74 # exist (other rules will force it to be built if needed)
75 ifneq ($(wildcard makeopts
),)
79 # Some build systems, such as the one in openwrt, like to pass custom target
80 # CFLAGS and LDFLAGS in the COPTS and LDOPTS variables.
84 #Uncomment this to see all build commands instead of 'quiet' output
87 # Create OPTIONS variable
91 space
:=$(empty
) $(empty
)
92 ASTTOPDIR
:=$(subst $(space
),\
$(space
),$(CURDIR
))
94 # Overwite config files on "make samples"
97 # Include debug and macro symbols in the executables (-g) and profiling info (-pg)
101 # Files are copied here temporarily during the install process
102 # For example, make DESTDIR=/tmp/asterisk woud put things in
103 # /tmp/asterisk/etc/asterisk
104 # !!! Watch out, put no spaces or comments after the value !!!
105 #DESTDIR?=/tmp/asterisk
107 # Define standard directories for various platforms
108 # These apply if they are not redefined in asterisk.conf
109 ifeq ($(OSARCH
),SunOS
)
110 ASTETCDIR
=/var
/etc
/asterisk
111 ASTLIBDIR
=/opt
/asterisk
/lib
112 ASTVARLIBDIR
=/var
/opt
/asterisk
113 ASTSPOOLDIR
=/var
/spool
/asterisk
114 ASTLOGDIR
=/var
/log
/asterisk
115 ASTHEADERDIR
=/opt
/asterisk
/include
116 ASTBINDIR
=/opt
/asterisk
/bin
117 ASTSBINDIR
=/opt
/asterisk
/sbin
118 ASTVARRUNDIR
=/var
/run
/asterisk
119 ASTMANDIR
=/opt
/asterisk
/man
121 ASTETCDIR
=$(sysconfdir
)/asterisk
122 ASTLIBDIR
=$(libdir)/asterisk
123 ASTHEADERDIR
=$(includedir)/asterisk
125 ASTSBINDIR
=$(sbindir
)
126 ASTSPOOLDIR
=$(localstatedir
)/spool
/asterisk
127 ASTLOGDIR
=$(localstatedir
)/log
/asterisk
128 ASTVARRUNDIR
=$(localstatedir
)/run
130 ifneq ($(findstring BSD
,$(OSARCH
)),)
131 ASTVARLIBDIR
=$(prefix)/share
/asterisk
132 ASTVARRUNDIR
=$(localstatedir
)/run
/asterisk
134 ASTVARLIBDIR
=$(localstatedir
)/lib
/asterisk
137 ifeq ($(ASTDATADIR
),)
138 ASTDATADIR
:=$(ASTVARLIBDIR
)
141 # Asterisk.conf is located in ASTETCDIR or by using the -C flag
142 # when starting Asterisk
143 ASTCONFPATH
=$(ASTETCDIR
)/asterisk.conf
144 MODULES_DIR
=$(ASTLIBDIR
)/modules
145 AGI_DIR
=$(ASTDATADIR
)/agi-bin
147 # If you use Apache, you may determine by a grep 'DocumentRoot' of your httpd.conf file
148 HTTP_DOCSDIR
=/var
/www
/html
149 # Determine by a grep 'ScriptAlias' of your Apache httpd.conf file
150 HTTP_CGIDIR
=/var
/www
/cgi-bin
152 # Uncomment this to use the older DSP routines
153 #ASTCFLAGS+=-DOLD_DSP_ROUTINES
155 # If the file .asterisk.makeopts is present in your home directory, you can
156 # include all of your favorite menuselect options so that every time you download
157 # a new version of Asterisk, you don't have to run menuselect to set them.
158 # The file /etc/asterisk.makeopts will also be included but can be overridden
159 # by the file in your home directory.
161 GLOBAL_MAKEOPTS
=$(wildcard /etc
/asterisk.makeopts
)
162 USER_MAKEOPTS
=$(wildcard ~
/.asterisk.makeopts
)
164 MOD_SUBDIR_CFLAGS
=-I
$(ASTTOPDIR
)/include
165 OTHER_SUBDIR_CFLAGS
=-I
$(ASTTOPDIR
)/include
167 ifeq ($(OSARCH
),linux-gnu
)
168 ifeq ($(PROC
),x86_64
)
169 # You must have GCC 3.4 to use k8, otherwise use athlon
174 ifeq ($(PROC
),sparc64
)
175 #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
176 #This works for even old (2.96) versions of gcc and provides a small boost either way.
177 #A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
178 #So we go lowest common available by gcc and go a step down, still a step up from
179 #the default as we now have a better instruction set to work with. - Belgarath
181 OPTIONS
+=$(shell if
$(CC
) -mtune
=$(PROC
) -S
-o
/dev
/null
-xc
/dev
/null
>/dev
/null
2>&1; then echo
"-mtune=$(PROC)"; fi
)
182 OPTIONS
+=$(shell if
$(CC
) -mcpu
=v8
-S
-o
/dev
/null
-xc
/dev
/null
>/dev
/null
2>&1; then echo
"-mcpu=v8"; fi
)
183 OPTIONS
+=-fomit-frame-pointer
187 # The Cirrus logic is the only heavily shipping arm processor with a real floating point unit
188 ifeq ($(SUB_PROC
),maverick
)
189 OPTIONS
+=-fsigned-char
-mcpu
=ep9312
191 ifeq ($(SUB_PROC
),xscale
)
192 OPTIONS
+=-fsigned-char
-mcpu
=xscale
194 OPTIONS
+=-fsigned-char
200 ifeq ($(findstring -save-temps
,$(ASTCFLAGS
)),)
204 ASTCFLAGS
+=-Wall
-Wstrict-prototypes
-Wmissing-prototypes
-Wmissing-declarations
$(DEBUG
)
206 ifeq ($(AST_DEVMODE
),yes
)
207 ASTCFLAGS
+=-Werror
-Wunused
$(AST_DECLARATION_AFTER_STATEMENT
)
210 ifneq ($(findstring BSD
,$(OSARCH
)),)
211 ASTCFLAGS
+=-I
/usr
/local
/include
212 ASTLDFLAGS
+=-L
/usr
/local
/lib
215 ifneq ($(PROC
),ultrasparc
)
216 ASTCFLAGS
+=$(shell if
$(CC
) -march
=$(PROC
) -S
-o
/dev
/null
-xc
/dev
/null
>/dev
/null
2>&1; then echo
"-march=$(PROC)"; fi
)
220 ASTCFLAGS
+=-fsigned-char
223 ifeq ($(OSARCH
),FreeBSD
)
224 # -V is understood by BSD Make, not by GNU make.
225 BSDVERSION
=$(shell make
-V OSVERSION
-f
/usr
/share
/mk
/bsd.port.subdir.mk
)
226 ASTCFLAGS
+=$(shell if
test $(BSDVERSION
) -lt
500016 ; then echo
"-D_THREAD_SAFE"; fi
)
227 AST_LIBS
+=$(shell if
test $(BSDVERSION
) -lt
502102 ; then echo
"-lc_r"; else echo
"-pthread"; fi
)
230 ifeq ($(OSARCH
),NetBSD
)
231 ASTCFLAGS
+=-pthread
-I
/usr
/pkg
/include
234 ifeq ($(OSARCH
),OpenBSD
)
238 ifeq ($(OSARCH
),SunOS
)
239 ASTCFLAGS
+=-Wcast-align
-DSOLARIS
-I..
/include/solaris-compat
-I
/opt
/ssl
/include -I
/usr
/local
/ssl
/include
242 ASTERISKVERSION
:=$(shell GREP
=$(GREP
) AWK
=$(AWK
) build_tools
/make_version .
)
244 ifneq ($(wildcard .version
),)
245 ASTERISKVERSIONNUM
:=$(shell $(AWK
) -F.
'{printf "%01d%02d%02d", $$1, $$2, $$3}' .version
)
248 ifneq ($(wildcard .svn
)$(wildcard .git
),)
249 ASTERISKVERSIONNUM
=999999
252 ASTCFLAGS
+=$(MALLOC_DEBUG
)$(BUSYDETECT
)$(OPTIONS
)
254 MOD_SUBDIRS
:=res channels pbx apps codecs formats cdr funcs main
255 OTHER_SUBDIRS
:=utils agi
256 SUBDIRS
:=$(OTHER_SUBDIRS
) $(MOD_SUBDIRS
)
257 SUBDIRS_INSTALL
:=$(SUBDIRS
:%=%-install)
258 SUBDIRS_CLEAN
:=$(SUBDIRS
:%=%-clean)
259 SUBDIRS_DIST_CLEAN
:=$(SUBDIRS
:%=%-dist-clean
)
260 SUBDIRS_UNINSTALL
:=$(SUBDIRS
:%=%-uninstall)
261 MOD_SUBDIRS_EMBED_LDSCRIPT
:=$(MOD_SUBDIRS
:%=%-embed-ldscript
)
262 MOD_SUBDIRS_EMBED_LDFLAGS
:=$(MOD_SUBDIRS
:%=%-embed-ldflags
)
263 MOD_SUBDIRS_EMBED_LIBS
:=$(MOD_SUBDIRS
:%=%-embed-libs
)
264 MOD_SUBDIRS_MENUSELECT_TREE
:=$(MOD_SUBDIRS
:%=%-menuselect-tree
)
266 ifneq ($(findstring darwin
,$(OSARCH
)),)
267 ASTCFLAGS
+=-D__Darwin__
268 AUDIO_LIBS
=-framework CoreAudio
269 SOLINK
=-dynamic
-bundle
-undefined suppress
-force_flat_namespace
271 # These are used for all but Darwin
272 SOLINK
=-shared
-Xlinker
-x
273 ifneq ($(findstring BSD
,$(OSARCH
)),)
274 LDFLAGS
+=-L
/usr
/local
/lib
278 ifeq ($(OSARCH
),SunOS
)
279 SOLINK
=-shared
-fpic
-L
/usr
/local
/ssl
/lib
-lrt
282 SUBMAKE
=$(MAKE
) --quiet
--no-print-directory
284 # This is used when generating the doxygen documentation
292 @echo
" +--------- Asterisk Build Complete ---------+"
293 @echo
" + Asterisk has successfully been built, and +"
294 @echo
" + can be installed by running: +"
296 ifeq ($(MAKE
), gmake
)
297 @echo
" + $(MAKE) install +"
299 @echo
" + $(MAKE) install +"
301 @echo
" +-------------------------------------------+"
303 _all
: cleantest
$(SUBDIRS
)
307 @echo
"**** The configure script must be executed before running '$(MAKE)'."
308 @echo
"**** Please run \"./configure\"."
312 menuselect.makeopts
: menuselect
/menuselect menuselect-tree
313 menuselect
/menuselect
--check-deps menuselect.makeopts
$(GLOBAL_MAKEOPTS
) $(USER_MAKEOPTS
)
315 $(MOD_SUBDIRS_EMBED_LDSCRIPT
):
316 @echo
"EMBED_LDSCRIPTS+="`$(SUBMAKE) -C $(@:-embed-ldscript=) SUBDIR=$(@:-embed-ldscript=) __embed_ldscript` >> makeopts.embed_rules
318 $(MOD_SUBDIRS_EMBED_LDFLAGS
):
319 @echo
"EMBED_LDFLAGS+="`$(SUBMAKE) -C $(@:-embed-ldflags=) SUBDIR=$(@:-embed-ldflags=) __embed_ldflags` >> makeopts.embed_rules
321 $(MOD_SUBDIRS_EMBED_LIBS
):
322 @echo
"EMBED_LIBS+="`$(SUBMAKE) -C $(@:-embed-libs=) SUBDIR=$(@:-embed-libs=) __embed_libs` >> makeopts.embed_rules
324 $(MOD_SUBDIRS_MENUSELECT_TREE
):
325 @
$(SUBMAKE
) -C
$(@
:-menuselect-tree
=) SUBDIR
=$(@
:-menuselect-tree
=) moduleinfo
326 @
$(SUBMAKE
) -C
$(@
:-menuselect-tree
=) SUBDIR
=$(@
:-menuselect-tree
=) makeopts
328 makeopts.embed_rules
: menuselect.makeopts
329 @echo
"Generating embedded module rules ..."
331 @
$(MAKE
) --no-print-directory
$(MOD_SUBDIRS_EMBED_LDSCRIPT
)
332 @
$(MAKE
) --no-print-directory
$(MOD_SUBDIRS_EMBED_LDFLAGS
)
333 @
$(MAKE
) --no-print-directory
$(MOD_SUBDIRS_EMBED_LIBS
)
335 $(SUBDIRS
): include/asterisk
/version.h
include/asterisk
/buildopts.h defaults.h makeopts.embed_rules
337 # ensure that all module subdirectories are processed before 'main' during
338 # a parallel build, since if there are modules selected to be embedded the
339 # directories containing them must be completed before the main Asterisk
340 # binary can be built
341 main
: $(filter-out main
,$(MOD_SUBDIRS
))
344 @ASTCFLAGS
="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS
="$(ASTLDFLAGS)" AST_LIBS
="$(AST_LIBS)" $(MAKE
) --no-builtin-rules
-C
$@ SUBDIR
=$@
all
347 @ASTCFLAGS
="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS
="$(ASTLDFLAGS)" AUDIO_LIBS
="$(AUDIO_LIBS)" $(MAKE
) --no-builtin-rules
-C
$@ SUBDIR
=$@
all
350 @build_tools
/make_defaults_h
> $@.tmp
351 @if cmp
-s
$@.tmp
$@
; then
: ; else \
356 include/asterisk
/version.h
: FORCE
357 @build_tools
/make_version_h
> $@.tmp
358 @if cmp
-s
$@.tmp
$@
; then
: ; else \
363 include/asterisk
/buildopts.h
: menuselect.makeopts
364 @build_tools
/make_buildopts_h
> $@.tmp
365 @if cmp
-s
$@.tmp
$@
; then
: ; else \
371 @
$(MAKE
) --no-print-directory
-C
$(@
:-clean=) clean
373 $(SUBDIRS_DIST_CLEAN
):
374 @
$(MAKE
) --no-print-directory
-C
$(@
:-dist-clean
=) dist-clean
376 clean: $(SUBDIRS_CLEAN
)
378 rm -f
include/asterisk
/build.h
379 rm -f
include/asterisk
/version.h
380 @
$(MAKE
) -C menuselect
clean
381 cp
-f .cleancount .lastclean
383 dist-clean
: distclean
385 distclean: $(SUBDIRS_DIST_CLEAN
) clean
386 @
$(MAKE
) -C menuselect dist-clean
387 @
$(MAKE
) -C sounds dist-clean
388 rm -f menuselect.makeopts makeopts menuselect-tree menuselect.makedeps
389 rm -f makeopts.embed_rules
390 rm -f config.log config.status config.cache
391 rm -rf autom4te.cache
392 rm -f
include/asterisk
/autoconfig.h
393 rm -f
include/asterisk
/buildopts.h
395 rm -f build_tools
/menuselect-deps
398 if
[ x
`$(ID) -un` = xroot
]; then CFLAGS
="$(ASTCFLAGS)" sh build_tools
/mkpkgconfig
$(DESTDIR
)/usr
/lib
/pkgconfig
; fi
399 # Should static HTTP be installed during make samples or even with its own target ala
400 # webvoicemail? There are portions here that *could* be customized but might also be
401 # improved a lot. I'll put it here for now.
402 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/static-http
403 for x in static-http
/*; do \
404 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTDATADIR
)/static-http
; \
406 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/images
407 for x in images
/*.jpg
; do \
408 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTDATADIR
)/images
; \
410 mkdir
-p
$(DESTDIR
)$(AGI_DIR
)
411 $(MAKE
) -C sounds
install
414 @if
[ -d .svn
]; then \
415 echo
"Updating from Subversion..." ; \
416 svn update | tee update.out
; \
418 if
[ `grep -c ^C update.out` -gt
0 ]; then \
419 echo
; echo
"The following files have conflicts:" ; \
420 grep ^C update.out | cut
-b4-
; \
424 echo
"Not under version control"; \
427 NEWHEADERS
=$(notdir $(wildcard include/asterisk
/*.h
))
428 OLDHEADERS
=$(filter-out $(NEWHEADERS
),$(notdir $(wildcard $(DESTDIR
)$(ASTHEADERDIR
)/*.h
)))
431 mkdir
-p
$(DESTDIR
)$(MODULES_DIR
)
432 mkdir
-p
$(DESTDIR
)$(ASTSBINDIR
)
433 mkdir
-p
$(DESTDIR
)$(ASTETCDIR
)
434 mkdir
-p
$(DESTDIR
)$(ASTBINDIR
)
435 mkdir
-p
$(DESTDIR
)$(ASTVARRUNDIR
)
436 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/voicemail
437 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/dictate
438 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/system
439 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/tmp
440 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/meetme
441 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/monitor
443 bininstall
: _all
installdirs $(SUBDIRS_INSTALL
)
444 $(INSTALL
) -m
755 main
/asterisk
$(DESTDIR
)$(ASTSBINDIR
)/
445 $(LN
) -sf asterisk
$(DESTDIR
)$(ASTSBINDIR
)/rasterisk
446 $(INSTALL
) -m
755 contrib
/scripts
/astgenkey
$(DESTDIR
)$(ASTSBINDIR
)/
447 $(INSTALL
) -m
755 contrib
/scripts
/autosupport
$(DESTDIR
)$(ASTSBINDIR
)/
448 if
[ ! -f
$(DESTDIR
)$(ASTSBINDIR
)/safe_asterisk
]; then \
449 cat contrib
/scripts
/safe_asterisk | sed
's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;' > $(DESTDIR
)$(ASTSBINDIR
)/safe_asterisk
;\
450 chmod
755 $(DESTDIR
)$(ASTSBINDIR
)/safe_asterisk
;\
452 $(INSTALL
) -d
$(DESTDIR
)$(ASTHEADERDIR
)
453 $(INSTALL
) -m
644 include/asterisk.h
$(DESTDIR
)$(includedir)
454 $(INSTALL
) -m
644 include/asterisk
/*.h
$(DESTDIR
)$(ASTHEADERDIR
)
455 if
[ -n
"$(OLDHEADERS)" ]; then \
456 rm -f
$(addprefix $(DESTDIR
)$(ASTHEADERDIR
)/,$(OLDHEADERS
)) ;\
458 mkdir
-p
$(DESTDIR
)$(ASTLOGDIR
)/cdr-csv
459 mkdir
-p
$(DESTDIR
)$(ASTLOGDIR
)/cdr-custom
460 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/keys
461 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/firmware
462 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/firmware
/iax
463 mkdir
-p
$(DESTDIR
)$(ASTMANDIR
)/man8
464 $(INSTALL
) -m
644 keys
/iaxtel.pub
$(DESTDIR
)$(ASTDATADIR
)/keys
465 $(INSTALL
) -m
644 keys
/freeworlddialup.pub
$(DESTDIR
)$(ASTDATADIR
)/keys
466 $(INSTALL
) -m
644 doc
/asterisk
.8 $(DESTDIR
)$(ASTMANDIR
)/man8
467 $(INSTALL
) -m
644 contrib
/scripts
/astgenkey
.8 $(DESTDIR
)$(ASTMANDIR
)/man8
468 $(INSTALL
) -m
644 contrib
/scripts
/autosupport
.8 $(DESTDIR
)$(ASTMANDIR
)/man8
469 $(INSTALL
) -m
644 contrib
/scripts
/safe_asterisk
.8 $(DESTDIR
)$(ASTMANDIR
)/man8
470 if
[ -f contrib
/firmware
/iax
/iaxy.bin
] ; then \
471 $(INSTALL
) -m
644 contrib
/firmware
/iax
/iaxy.bin
$(DESTDIR
)$(ASTDATADIR
)/firmware
/iax
/iaxy.bin
; \
475 @DESTDIR
="$(DESTDIR)" ASTSBINDIR
="$(ASTSBINDIR)" $(MAKE
) -C
$(@
:-install=) install
477 NEWMODS
=$(notdir $(wildcard */*.so
))
478 DEPMODS
=chan_zap.so app_zapras.so app_zapscan.so app_zapbarge.so codec_zap.so
479 OLDMODS
=$(filter-out $(NEWMODS
) $(DEPMODS
),$(notdir $(wildcard $(DESTDIR
)$(MODULES_DIR
)/*.so
)))
482 @for f in
$(DEPMODS
); do
rm -f
$(DESTDIR
)$(MODULES_DIR
)/$$f; done
483 @if
[ -n
"$(OLDMODS)" ]; then \
484 echo
" WARNING WARNING WARNING" ;\
486 echo
" Your Asterisk modules directory, located at" ;\
487 echo
" $(DESTDIR)$(MODULES_DIR)" ;\
488 echo
" contains modules that were not installed by this " ;\
489 echo
" version of Asterisk. Please ensure that these" ;\
490 echo
" modules are compatible with this version before" ;\
491 echo
" attempting to run Asterisk." ;\
493 for f in
$(OLDMODS
); do \
497 echo
" WARNING WARNING WARNING" ;\
501 ifneq ($(findstring ~
,$(DESTDIR
)),)
502 @echo
"Your shell doesn't do ~ expansion when expected (specifically, when doing \"make install DESTDIR=~/path\")."
503 @echo
"Try replacing ~ with \$$HOME, as in \"make install DESTDIR=\$$HOME/path\"."
507 install: badshell datafiles bininstall
508 @if
[ -x
/usr
/sbin
/asterisk-post-install
]; then \
509 /usr
/sbin
/asterisk-post-install
$(DESTDIR
) .
; \
511 @echo
" +---- Asterisk Installation Complete -------+"
513 @echo
" + YOU MUST READ THE SECURITY DOCUMENT +"
515 @echo
" + Asterisk has successfully been installed. +"
516 @echo
" + If you would like to install the sample +"
517 @echo
" + configuration files (overwriting any +"
518 @echo
" + existing config files), run: +"
520 ifeq ($(MAKE
), gmake
)
521 @echo
" + $(MAKE) samples +"
523 @echo
" + $(MAKE) samples +"
526 @echo
" +----------------- or ---------------------+"
528 @echo
" + You can go ahead and install the asterisk +"
529 @echo
" + program documentation now or later run: +"
531 ifeq ($(MAKE
), gmake
)
532 @echo
" + $(MAKE) progdocs +"
534 @echo
" + $(MAKE) progdocs +"
537 @echo
" + **Note** This requires that you have +"
538 @echo
" + doxygen installed on your local system +"
539 @echo
" +-------------------------------------------+"
540 @
$(MAKE
) -s oldmodcheck
545 mkdir
-p
$(DESTDIR
)$(ASTETCDIR
)
546 for x in configs
/*.adsi
; do \
547 if
[ ! -f
$(DESTDIR
)$(ASTETCDIR
)/$$x ]; then \
548 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTETCDIR
)/`$(BASENAME) $$x` ; \
553 mkdir
-p
$(DESTDIR
)$(ASTETCDIR
)
554 for x in configs
/*.sample
; do \
555 if
[ -f
$(DESTDIR
)$(ASTETCDIR
)/`$(BASENAME) $$x .sample` ]; then \
556 if
[ "$(OVERWRITE)" = "y" ]; then \
557 if cmp
-s
$(DESTDIR
)$(ASTETCDIR
)/`$(BASENAME) $$x .sample` $$x ; then \
558 echo
"Config file $$x is unchanged"; \
561 mv
-f
$(DESTDIR
)$(ASTETCDIR
)/`$(BASENAME) $$x .sample` $(DESTDIR
)$(ASTETCDIR
)/`$(BASENAME) $$x .sample`.old
; \
563 echo
"Skipping config file $$x"; \
567 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTETCDIR
)/`$(BASENAME) $$x .sample` ;\
569 if
[ "$(OVERWRITE)" = "y" ] ||
[ ! -f
$(DESTDIR
)$(ASTCONFPATH
) ]; then \
571 echo
"[directories]" ; \
572 echo
"astetcdir => $(ASTETCDIR)" ; \
573 echo
"astmoddir => $(MODULES_DIR)" ; \
574 echo
"astvarlibdir => $(ASTVARLIBDIR)" ; \
575 echo
"astdatadir => $(ASTDATADIR)" ; \
576 echo
"astagidir => $(AGI_DIR)" ; \
577 echo
"astspooldir => $(ASTSPOOLDIR)" ; \
578 echo
"astrundir => $(ASTVARRUNDIR)" ; \
579 echo
"astlogdir => $(ASTLOGDIR)" ; \
582 echo
"languageprefix = yes ; Use the new sound prefix path syntax" ; \
583 echo
";verbose = 3" ; \
584 echo
";debug = 3" ; \
585 echo
";alwaysfork = yes ; same as -F at startup" ; \
586 echo
";nofork = yes ; same as -f at startup" ; \
587 echo
";quiet = yes ; same as -q at startup" ; \
588 echo
";timestamp = yes ; same as -T at startup" ; \
589 echo
";execincludes = yes ; support #exec in config files" ; \
590 echo
";console = yes ; Run as console (same as -c at startup)" ; \
591 echo
";highpriority = yes ; Run realtime priority (same as -p at startup)" ; \
592 echo
";initcrypto = yes ; Initialize crypto keys (same as -i at startup)" ; \
593 echo
";nocolor = yes ; Disable console colors" ; \
594 echo
";dontwarn = yes ; Disable some warnings" ; \
595 echo
";dumpcore = yes ; Dump core on crash (same as -g at startup)" ; \
596 echo
";internal_timing = yes" ; \
597 echo
";systemname = my_system_name ; prefix uniqueid with a system name for global uniqueness issues" ; \
598 echo
";maxcalls = 10 ; Maximum amount of calls allowed" ; \
599 echo
";maxload = 0.9 ; Asterisk stops accepting new calls if the load average exceed this limit" ; \
600 echo
";cache_record_files = yes ; Cache recorded sound files to another directory during recording" ; \
601 echo
";record_cache_dir = /tmp ; Specify cache directory (used in cnjunction with cache_record_files)" ; \
602 echo
";transmit_silence_during_record = yes ; Transmit SLINEAR silence while a channel is being recorded" ; \
603 echo
";transmit_silence = yes ; Transmit SLINEAR silence while a channel is being recorded or DTMF is being generated" ; \
604 echo
";transcode_via_sln = yes ; Build transcode paths via SLINEAR, instead of directly" ; \
605 echo
";runuser = asterisk ; The user to run as" ; \
606 echo
";rungroup = asterisk ; The group to run as" ; \
607 echo
";dahdichanname = yes ; Channels created by chan_dahdi will be called 'DAHDI', otherwise 'Zap'" ; \
609 echo
"; Changing the following lines may compromise your security." ; \
611 echo
";astctlpermissions = 0660" ; \
612 echo
";astctlowner = root" ; \
613 echo
";astctlgroup = apache" ; \
614 echo
";astctl = asterisk.ctl" ; \
615 ) > $(DESTDIR
)$(ASTCONFPATH
) ; \
617 echo
"Skipping asterisk.conf creation"; \
619 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/voicemail
/default
/1234/INBOX
620 build_tools
/make_sample_voicemail
$(DESTDIR
)/$(ASTDATADIR
) $(DESTDIR
)/$(ASTSPOOLDIR
)
623 @
[ -d
$(DESTDIR
)$(HTTP_DOCSDIR
)/ ] ||
( printf
"http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit
1 )
624 @
[ -d
$(DESTDIR
)$(HTTP_CGIDIR
) ] ||
( printf
"cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit
1 )
625 $(INSTALL
) -m
4755 -o root
-g root contrib
/scripts
/vmail.cgi
$(DESTDIR
)$(HTTP_CGIDIR
)/vmail.cgi
626 mkdir
-p
$(DESTDIR
)$(HTTP_DOCSDIR
)/_asterisk
627 for x in images
/*.gif
; do \
628 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(HTTP_DOCSDIR
)/_asterisk
/; \
630 @echo
" +--------- Asterisk Web Voicemail ----------+"
632 @echo
" + Asterisk Web Voicemail is installed in +"
633 @echo
" + your cgi-bin directory: +"
634 @echo
" + $(DESTDIR)$(HTTP_CGIDIR)"
635 @echo
" + IT USES A SETUID ROOT PERL SCRIPT, SO +"
636 @echo
" + IF YOU DON'T LIKE THAT, UNINSTALL IT! +"
638 @echo
" + Other static items have been stored in: +"
639 @echo
" + $(DESTDIR)$(HTTP_DOCSDIR)"
641 @echo
" + If these paths do not match your httpd +"
642 @echo
" + installation, correct the definitions +"
643 @echo
" + in your Makefile of HTTP_CGIDIR and +"
644 @echo
" + HTTP_DOCSDIR +"
646 @echo
" +-------------------------------------------+"
649 (cat contrib
/asterisk-ng-doxygen
; echo
"HAVE_DOT=$(HAVEDOT)"; \
650 echo
"PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen
-
653 @if
[ "${OSARCH}" = "linux-gnu" ]; then \
654 if
[ -f
/etc
/redhat-release
-o
-f
/etc
/fedora-release
]; then \
655 $(INSTALL
) -m
755 contrib
/init.d
/rc.redhat.asterisk
$(DESTDIR
)/etc
/rc.d
/init.d
/asterisk
; \
656 if
[ -z
"$(DESTDIR)" ]; then
/sbin
/chkconfig
--add asterisk
; fi
; \
657 elif
[ -f
/etc
/debian_version
]; then \
658 $(INSTALL
) -m
755 contrib
/init.d
/rc.debian.asterisk
$(DESTDIR
)/etc
/init.d
/asterisk
; \
659 if
[ -z
"$(DESTDIR)" ]; then
/usr
/sbin
/update-rc.d asterisk start
50 2 3 4 5 . stop
91 2 3 4 5 .
; fi
; \
660 elif
[ -f
/etc
/gentoo-release
]; then \
661 $(INSTALL
) -m
755 contrib
/init.d
/rc.gentoo.asterisk
$(DESTDIR
)/etc
/init.d
/asterisk
; \
662 if
[ -z
"$(DESTDIR)" ]; then
/sbin
/rc-update add asterisk default
; fi
; \
663 elif
[ -f
/etc
/mandrake-release
-o
-f
/etc
/mandriva-release
]; then \
664 $(INSTALL
) -m
755 contrib
/init.d
/rc.mandrake.asterisk
$(DESTDIR
)/etc
/rc.d
/init.d
/asterisk
; \
665 if
[ -z
"$(DESTDIR)" ]; then
/sbin
/chkconfig
--add asterisk
; fi
; \
666 elif
[ -f
/etc
/SuSE-release
-o
-f
/etc
/novell-release
]; then \
667 $(INSTALL
) -m
755 contrib
/init.d
/rc.suse.asterisk
$(DESTDIR
)/etc
/init.d
/asterisk
; \
668 if
[ -z
"$(DESTDIR)" ]; then
/sbin
/chkconfig
--add asterisk
; fi
; \
669 elif
[ -f
/etc
/slackware-version
]; then \
670 echo
"Slackware is not currently supported, although an init script does exist for it." \
672 echo
"We could not install init scripts for your distribution."; \
675 echo
"We could not install init scripts for your operating system."; \
679 $(MAKE
) -C sounds
all
681 # If the cleancount has been changed, force a make clean.
682 # .cleancount is the global clean count, and .lastclean is the
683 # last clean count we had
686 @cmp
-s .cleancount .lastclean ||
$(MAKE
) clean
688 $(SUBDIRS_UNINSTALL
):
689 @
$(MAKE
) --no-print-directory
-C
$(@
:-uninstall=) uninstall
691 _uninstall
: $(SUBDIRS_UNINSTALL
)
692 rm -f
$(DESTDIR
)$(MODULES_DIR
)/*
693 rm -f
$(DESTDIR
)$(ASTSBINDIR
)/*asterisk
*
694 rm -f
$(DESTDIR
)$(ASTSBINDIR
)/astgenkey
695 rm -f
$(DESTDIR
)$(ASTSBINDIR
)/autosupport
696 rm -rf
$(DESTDIR
)$(ASTHEADERDIR
)
697 rm -rf
$(DESTDIR
)$(ASTDATADIR
)/firmware
698 rm -f
$(DESTDIR
)$(ASTMANDIR
)/man8
/asterisk
.8
699 rm -f
$(DESTDIR
)$(ASTMANDIR
)/man8
/astgenkey
.8
700 rm -f
$(DESTDIR
)$(ASTMANDIR
)/man8
/autosupport
.8
701 rm -f
$(DESTDIR
)$(ASTMANDIR
)/man8
/safe_asterisk
.8
702 $(MAKE
) -C sounds
uninstall
704 uninstall: _uninstall
705 @echo
" +--------- Asterisk Uninstall Complete -----+"
706 @echo
" + Asterisk binaries, sounds, man pages, +"
707 @echo
" + headers, modules, and firmware builds, +"
708 @echo
" + have all been uninstalled. +"
710 @echo
" + To remove ALL traces of Asterisk, +"
711 @echo
" + including configuration, spool +"
712 @echo
" + directories, and logs, run the following +"
713 @echo
" + command: +"
715 ifeq ($(MAKE
), gmake
)
716 @echo
" + $(MAKE) uninstall-all +"
718 @echo
" + $(MAKE) uninstall-all +"
720 @echo
" +-------------------------------------------+"
722 uninstall-all
: _uninstall
723 rm -rf
$(DESTDIR
)$(ASTLIBDIR
)
724 rm -rf
$(DESTDIR
)$(ASTVARLIBDIR
)
725 rm -rf
$(DESTDIR
)$(ASTDATADIR
)
726 rm -rf
$(DESTDIR
)$(ASTSPOOLDIR
)
727 rm -rf
$(DESTDIR
)$(ASTETCDIR
)
728 rm -rf
$(DESTDIR
)$(ASTLOGDIR
)
730 menuconfig
: menuselect
732 gmenuconfig
: gmenuselect
734 menuselect
: menuselect
/menuselect menuselect-tree
735 -@menuselect
/menuselect menuselect.makeopts
$(GLOBAL_MAKEOPTS
) $(USER_MAKEOPTS
) && (echo
"menuselect changes saved!"; rm -f channels
/h323
/Makefile.ast main
/asterisk
) || echo
"menuselect changes NOT saved!"
737 gmenuselect
: menuselect
/gmenuselect menuselect-tree
738 -@menuselect
/gmenuselect menuselect.makeopts
$(GLOBAL_MAKEOPTS
) $(USER_MAKEOPTS
) && (echo
"menuselect changes saved!"; rm -f channels
/h323
/Makefile.ast main
/asterisk
) || echo
"menuselect changes NOT saved!"
740 menuselect
/menuselect
: makeopts menuselect
/menuselect.c menuselect
/menuselect_curses.c menuselect
/menuselect_stub.c menuselect
/menuselect.h menuselect
/linkedlists.h makeopts
741 @CC
="$(HOST_CC)" LD
="" AR
="" RANLIB
="" CFLAGS
="" $(MAKE
) -C menuselect CONFIGURE_SILENT
="--silent"
743 menuselect
/gmenuselect
: makeopts menuselect
/menuselect.c menuselect
/menuselect_gtk.c menuselect
/menuselect_stub.c menuselect
/menuselect.h menuselect
/linkedlists.h makeopts
744 @CC
="$(HOST_CC)" CXX
="$(CXX)" LD
="" AR
="" RANLIB
="" CFLAGS
="" $(MAKE
) -C menuselect _gmenuselect CONFIGURE_SILENT
="--silent"
746 menuselect-tree
: $(foreach dir,$(filter-out main
,$(MOD_SUBDIRS
)),$(wildcard $(dir)/*.c
) $(wildcard $(dir)/*.
cc)) build_tools
/cflags.xml build_tools
/cflags-devmode.xml sounds
/sounds.xml build_tools
/embed_modules.xml configure
747 @echo
"Generating input for menuselect ..."
748 @echo
"<?xml version=\"1.0\"?>" > $@
750 @echo
"<menu name=\"Asterisk Module and Build Option Selection\">" >> $@
751 @for
dir in
$(sort $(filter-out main
,$(MOD_SUBDIRS
))); do
$(SUBMAKE
) -C
$${dir} SUBDIR
=$${dir} moduleinfo
>> $@
; done
752 @for
dir in
$(sort $(filter-out main
,$(MOD_SUBDIRS
))); do
$(SUBMAKE
) -C
$${dir} SUBDIR
=$${dir} makeopts
>> $@
; done
753 @cat build_tools
/cflags.xml
>> $@
754 @if
[ "${AST_DEVMODE}" = "yes" ]; then \
755 cat build_tools
/cflags-devmode.xml
>> $@
; \
757 @cat build_tools
/embed_modules.xml
>> $@
758 @cat sounds
/sounds.xml
>> $@
759 @echo
"</menu>" >> $@
761 .PHONY
: menuselect main sounds
clean dist-clean
distclean all prereqs cleantest
uninstall _uninstall uninstall-all dont-optimize
$(SUBDIRS_INSTALL
) $(SUBDIRS_DIST_CLEAN
) $(SUBDIRS_CLEAN
) $(SUBDIRS_UNINSTALL
) $(SUBDIRS
) $(MOD_SUBDIRS_EMBED_LDSCRIPT
) $(MOD_SUBDIRS_EMBED_LDFLAGS
) $(MOD_SUBDIRS_EMBED_LIBS
) badshell menuselect.makeopts
installdirs