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 # LIBS - additional libraries, at top-level for all links,
19 # on a single object just for that object
20 # SOLINK - linker flags used only for creating shared objects (.so files),
21 # used for all .so links
23 # Initial values for ASTCFLAGS and ASTLDFLAGS can be specified in the
24 # environment when running make, as follows:
26 # $ ASTCFLAGS="-Werror" make ...
28 # note that this is different from
30 # $ make ASTCFLAGS="-Werror" ...
32 # If you need to pass compiler/linker flags as 'make' variables, please use
34 # $ make COPTS="..." LDOPTS="..." ...
37 # You can add the path of local module subdirs from the command line with
38 # make LOCAL_MOD_SUBDIRS= ....
40 export ASTTOPDIR
# Top level dir, used in subdirs' Makefiles
41 export ASTERISKVERSION
42 export ASTERISKVERSIONNUM
44 #--- values used for default paths
46 # DESTDIR is the staging (or final) directory where files are copied
47 # during the install process. Define it before 'export', otherwise
48 # export will set it to the empty string making ?= fail.
49 # WARNING: do not put spaces or comments after the value.
50 DESTDIR?
=$(INSTALL_PATH
)
53 export INSTALL_PATH
# Additional prefix for the following paths
54 export ASTETCDIR
# Path for config files
70 export OSARCH
# Operating system
71 export PROC
# Processor type
73 export NOISY_BUILD
# Used in Makefile.rules
74 export MENUSELECT_CFLAGS
# Options selected in menuselect.
75 export AST_DEVMODE
# Set to "yes" for additional compiler
78 export SOLINK
# linker flags for shared objects
79 export STATIC_BUILD
# Additional cflags, set to -static
80 # for static builds. Probably
81 # should go directly to ASTLDFLAGS
83 #--- paths to various commands
96 # even though we could use '-include makeopts' here, use a wildcard
97 # lookup anyway, so that make won't try to build makeopts if it doesn't
98 # exist (other rules will force it to be built if needed)
99 ifneq ($(wildcard makeopts
),)
103 # Some build systems, such as the one in openwrt, like to pass custom target
104 # CFLAGS and LDFLAGS in the COPTS and LDOPTS variables.
106 ASTLDFLAGS
+=$(LDOPTS
)
108 #Uncomment this to see all build commands instead of 'quiet' output
112 space
:=$(empty
) $(empty
)
113 ASTTOPDIR
:=$(subst $(space
),\
$(space
),$(CURDIR
))
115 # Overwite config files on "make samples"
118 # Include debug and macro symbols in the executables (-g) and profiling info (-pg)
122 # Define standard directories for various platforms
123 # These apply if they are not redefined in asterisk.conf
124 ifeq ($(OSARCH
),SunOS
)
125 ASTETCDIR
=/var
/etc
/asterisk
126 ASTLIBDIR
=/opt
/asterisk
/lib
127 ASTVARLIBDIR
=/var
/opt
/asterisk
128 ASTDBDIR
=$(ASTVARLIBDIR
)
129 ASTKEYDIR
=$(ASTVARLIBDIR
)
130 ASTSPOOLDIR
=/var
/spool
/asterisk
131 ASTLOGDIR
=/var
/log
/asterisk
132 ASTHEADERDIR
=/opt
/asterisk
/include
133 ASTBINDIR
=/opt
/asterisk
/bin
134 ASTSBINDIR
=/opt
/asterisk
/sbin
135 ASTVARRUNDIR
=/var
/run
/asterisk
136 ASTMANDIR
=/opt
/asterisk
/man
138 ASTETCDIR
=$(sysconfdir
)/asterisk
139 ASTLIBDIR
=$(libdir)/asterisk
140 ASTHEADERDIR
=$(includedir)/asterisk
142 ASTSBINDIR
=$(sbindir
)
143 ASTSPOOLDIR
=$(localstatedir
)/spool
/asterisk
144 ASTLOGDIR
=$(localstatedir
)/log
/asterisk
145 ASTVARRUNDIR
=$(localstatedir
)/run
147 ifneq ($(findstring BSD
,$(OSARCH
)),)
148 ASTVARLIBDIR
=$(prefix)/share
/asterisk
149 ASTVARRUNDIR
=$(localstatedir
)/run
/asterisk
150 ASTDBDIR
=$(localstatedir
)/db
/asterisk
152 ASTVARLIBDIR
=$(localstatedir
)/lib
/asterisk
153 ASTDBDIR
=$(ASTVARLIBDIR
)
155 ASTKEYDIR
=$(ASTVARLIBDIR
)
157 ifeq ($(ASTDATADIR
),)
158 ASTDATADIR
:=$(ASTVARLIBDIR
)
161 # Asterisk.conf is located in ASTETCDIR or by using the -C flag
162 # when starting Asterisk
163 ASTCONFPATH
=$(ASTETCDIR
)/asterisk.conf
164 MODULES_DIR
=$(ASTLIBDIR
)/modules
165 AGI_DIR
=$(ASTDATADIR
)/agi-bin
167 # If you use Apache, you may determine by a grep 'DocumentRoot' of your httpd.conf file
168 HTTP_DOCSDIR
=/var
/www
/html
169 # Determine by a grep 'ScriptAlias' of your Apache httpd.conf file
170 HTTP_CGIDIR
=/var
/www
/cgi-bin
172 # Uncomment this to use the older DSP routines
173 #ASTCFLAGS+=-DOLD_DSP_ROUTINES
175 # If the file .asterisk.makeopts is present in your home directory, you can
176 # include all of your favorite menuselect options so that every time you download
177 # a new version of Asterisk, you don't have to run menuselect to set them.
178 # The file /etc/asterisk.makeopts will also be included but can be overridden
179 # by the file in your home directory.
181 GLOBAL_MAKEOPTS
=$(wildcard /etc
/asterisk.makeopts
)
182 USER_MAKEOPTS
=$(wildcard ~
/.asterisk.makeopts
)
184 MOD_SUBDIR_CFLAGS
=-I
$(ASTTOPDIR
)/include
185 OTHER_SUBDIR_CFLAGS
=-I
$(ASTTOPDIR
)/include
187 # Create OPTIONS variable, but probably we can assign directly to ASTCFLAGS
190 ifeq ($(OSARCH
),linux-gnu
)
191 ifeq ($(PROC
),x86_64
)
192 # You must have GCC 3.4 to use k8, otherwise use athlon
197 ifeq ($(PROC
),sparc64
)
198 #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
199 #This works for even old (2.96) versions of gcc and provides a small boost either way.
200 #A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
201 #So we go lowest common available by gcc and go a step down, still a step up from
202 #the default as we now have a better instruction set to work with. - Belgarath
204 OPTIONS
+=$(shell if
$(CC
) -mtune
=$(PROC
) -S
-o
/dev
/null
-xc
/dev
/null
>/dev
/null
2>&1; then echo
"-mtune=$(PROC)"; fi
)
205 OPTIONS
+=$(shell if
$(CC
) -mcpu
=v8
-S
-o
/dev
/null
-xc
/dev
/null
>/dev
/null
2>&1; then echo
"-mcpu=v8"; fi
)
206 OPTIONS
+=-fomit-frame-pointer
210 # The Cirrus logic is the only heavily shipping arm processor with a real floating point unit
211 ifeq ($(SUB_PROC
),maverick
)
212 OPTIONS
+=-fsigned-char
-mcpu
=ep9312
214 ifeq ($(SUB_PROC
),xscale
)
215 OPTIONS
+=-fsigned-char
-mcpu
=xscale
217 OPTIONS
+=-fsigned-char
223 ifeq ($(findstring -save-temps
,$(ASTCFLAGS
)),)
224 ifeq ($(findstring -pipe
,$(ASTCFLAGS
)),)
229 ifeq ($(findstring -Wall
,$(ASTCFLAGS
)),)
233 ASTCFLAGS
+=-Wstrict-prototypes
-Wmissing-prototypes
-Wmissing-declarations
$(DEBUG
)
235 ASTCFLAGS
+=-include $(ASTTOPDIR
)/include/asterisk
/autoconfig.h
237 ifeq ($(AST_DEVMODE
),yes
)
238 ASTCFLAGS
+=-Werror
-Wunused
-Wundef
$(AST_DECLARATION_AFTER_STATEMENT
) -Wmissing-format-attribute
-Wformat-security
#-Wformat=2
241 ifneq ($(findstring BSD
,$(OSARCH
)),)
242 ASTCFLAGS
+=-I
/usr
/local
/include
243 ASTLDFLAGS
+=-L
/usr
/local
/lib
246 ifeq ($(findstring -march
,$(ASTCFLAGS
)),)
247 ifneq ($(PROC
),ultrasparc
)
248 ASTCFLAGS
+=$(shell if
$(CC
) -march
=$(PROC
) -S
-o
/dev
/null
-xc
/dev
/null
>/dev
/null
2>&1; then echo
"-march=$(PROC)"; fi
)
253 ASTCFLAGS
+=-fsigned-char
256 ifeq ($(OSARCH
),FreeBSD
)
257 # -V is understood by BSD Make, not by GNU make.
258 BSDVERSION
=$(shell make
-V OSVERSION
-f
/usr
/share
/mk
/bsd.port.subdir.mk
)
259 ASTCFLAGS
+=$(shell if
test $(BSDVERSION
) -lt
500016 ; then echo
"-D_THREAD_SAFE"; fi
)
262 ifeq ($(OSARCH
),NetBSD
)
263 ASTCFLAGS
+=-pthread
-I
/usr
/pkg
/include
266 ifeq ($(OSARCH
),OpenBSD
)
270 ifeq ($(OSARCH
),SunOS
)
271 ASTCFLAGS
+=-Wcast-align
-DSOLARIS
-I..
/include/solaris-compat
-I
/opt
/ssl
/include -I
/usr
/local
/ssl
/include -D_XPG4_2
274 ASTERISKVERSION
:=$(shell GREP
=$(GREP
) AWK
=$(AWK
) build_tools
/make_version .
)
276 ifneq ($(wildcard .version
),)
277 ASTERISKVERSIONNUM
:=$(shell $(AWK
) -F.
'{printf "%01d%02d%02d", $$1, $$2, $$3}' .version
)
278 RPMVERSION
:=$(shell sed
's/[-\/:]/_/g' .version
)
283 ifneq ($(wildcard .svn
),)
284 ASTERISKVERSIONNUM
:=999999
287 # XXX MALLOC_DEBUG is probably unused, Makefile.moddir_rules adds the
288 # value directly to ASTCFLAGS
289 ASTCFLAGS
+=$(MALLOC_DEBUG
)$(OPTIONS
)
291 MOD_SUBDIRS
:=channels pbx apps codecs formats cdr funcs tests main res
$(LOCAL_MOD_SUBDIRS
)
292 OTHER_SUBDIRS
:=utils agi
293 SUBDIRS
:=$(OTHER_SUBDIRS
) $(MOD_SUBDIRS
)
294 SUBDIRS_INSTALL
:=$(SUBDIRS
:%=%-install)
295 SUBDIRS_CLEAN
:=$(SUBDIRS
:%=%-clean)
296 SUBDIRS_DIST_CLEAN
:=$(SUBDIRS
:%=%-dist-clean
)
297 SUBDIRS_UNINSTALL
:=$(SUBDIRS
:%=%-uninstall)
298 MOD_SUBDIRS_EMBED_LDSCRIPT
:=$(MOD_SUBDIRS
:%=%-embed-ldscript
)
299 MOD_SUBDIRS_EMBED_LDFLAGS
:=$(MOD_SUBDIRS
:%=%-embed-ldflags
)
300 MOD_SUBDIRS_EMBED_LIBS
:=$(MOD_SUBDIRS
:%=%-embed-libs
)
301 MOD_SUBDIRS_MENUSELECT_TREE
:=$(MOD_SUBDIRS
:%=%-menuselect-tree
)
303 ifneq ($(findstring darwin
,$(OSARCH
)),)
304 ASTCFLAGS
+=-D__Darwin__
305 SOLINK
=-dynamic
-bundle
-undefined suppress
-force_flat_namespace
307 # These are used for all but Darwin
308 SOLINK
=-shared
-Xlinker
-x
309 ifneq ($(findstring BSD
,$(OSARCH
)),)
310 LDFLAGS
+=-L
/usr
/local
/lib
314 ifeq ($(OSARCH
),SunOS
)
315 SOLINK
=-shared
-fpic
-L
/usr
/local
/ssl
/lib
-lrt
318 # comment to print directories during submakes
321 SILENTMAKE
:=$(MAKE
) --quiet
--no-print-directory
322 ifneq ($(PRINT_DIR
)$(NOISY_BUILD
),)
325 SUBMAKE
:=$(MAKE
) --quiet
--no-print-directory
328 # This is used when generating the doxygen documentation
335 # $(MAKE) is printed in several places, and we want it to be a
336 # fixed size string. Define a variable whose name has also the
337 # same size, so we can easily align text.
338 ifeq ($(MAKE
), gmake
)
345 @echo
" +--------- Asterisk Build Complete ---------+"
346 @echo
" + Asterisk has successfully been built, and +"
347 @echo
" + can be installed by running: +"
349 @echo
" + $(mK) install +"
350 @echo
" +-------------------------------------------+"
352 _all
: cleantest makeopts
$(SUBDIRS
)
356 @echo
"**** The configure script must be executed before running '$(MAKE)'."
357 @echo
"**** Please run \"./configure\"."
361 menuselect.makeopts
: menuselect
/menuselect menuselect-tree makeopts
362 menuselect
/menuselect
--check-deps menuselect.makeopts
$(GLOBAL_MAKEOPTS
) $(USER_MAKEOPTS
)
364 $(MOD_SUBDIRS_EMBED_LDSCRIPT
):
365 @echo
"EMBED_LDSCRIPTS+="`$(SILENTMAKE) -C $(@:-embed-ldscript=) SUBDIR=$(@:-embed-ldscript=) __embed_ldscript` >> makeopts.embed_rules
367 $(MOD_SUBDIRS_EMBED_LDFLAGS
):
368 @echo
"EMBED_LDFLAGS+="`$(SILENTMAKE) -C $(@:-embed-ldflags=) SUBDIR=$(@:-embed-ldflags=) __embed_ldflags` >> makeopts.embed_rules
370 $(MOD_SUBDIRS_EMBED_LIBS
):
371 @echo
"EMBED_LIBS+="`$(SILENTMAKE) -C $(@:-embed-libs=) SUBDIR=$(@:-embed-libs=) __embed_libs` >> makeopts.embed_rules
373 $(MOD_SUBDIRS_MENUSELECT_TREE
):
374 @
$(SUBMAKE
) -C
$(@
:-menuselect-tree
=) SUBDIR
=$(@
:-menuselect-tree
=) moduleinfo
375 @
$(SUBMAKE
) -C
$(@
:-menuselect-tree
=) SUBDIR
=$(@
:-menuselect-tree
=) makeopts
377 makeopts.embed_rules
: menuselect.makeopts
378 @echo
"Generating embedded module rules ..."
380 @
$(SUBMAKE
) $(MOD_SUBDIRS_EMBED_LDSCRIPT
)
381 @
$(SUBMAKE
) $(MOD_SUBDIRS_EMBED_LDFLAGS
)
382 @
$(SUBMAKE
) $(MOD_SUBDIRS_EMBED_LIBS
)
384 $(SUBDIRS
): main
/version.c
include/asterisk
/version.h
include/asterisk
/build.h
include/asterisk
/buildopts.h defaults.h makeopts.embed_rules
386 ifeq ($(findstring $(OSARCH
), mingw32 cygwin
),)
388 # ensure that all module subdirectories are processed before 'main' during
389 # a parallel build, since if there are modules selected to be embedded the
390 # directories containing them must be completed before the main Asterisk
391 # binary can be built
392 main
: $(filter-out main
,$(MOD_SUBDIRS
))
394 # Windows: we need to build main (i.e. the asterisk dll) first,
395 # followed by res, followed by the other directories, because
396 # dll symbols must be resolved during linking and not at runtime.
397 D1
:= $(filter-out main
,$(MOD_SUBDIRS
))
398 D1
:= $(filter-out res
,$(D1
))
405 @ASTCFLAGS
="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS
="$(ASTLDFLAGS)" $(SUBMAKE
) --no-builtin-rules
-C
$@ SUBDIR
=$@
all
408 @ASTCFLAGS
="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS
="$(ASTLDFLAGS)" $(SUBMAKE
) --no-builtin-rules
-C
$@ SUBDIR
=$@
all
411 @build_tools
/make_defaults_h
> $@.tmp
412 @cmp
-s
$@.tmp
$@ || mv
$@.tmp
$@
415 main
/version.c
: FORCE
416 @build_tools
/make_version_c
> $@.tmp
417 @cmp
-s
$@.tmp
$@ || mv
$@.tmp
$@
420 include/asterisk
/version.h
: FORCE
421 @build_tools
/make_version_h
> $@.tmp
422 @cmp
-s
$@.tmp
$@ || mv
$@.tmp
$@
425 include/asterisk
/buildopts.h
: menuselect.makeopts
426 @build_tools
/make_buildopts_h
> $@.tmp
427 @cmp
-s
$@.tmp
$@ || mv
$@.tmp
$@
430 include/asterisk
/build.h
:
431 @build_tools
/make_build_h
> $@.tmp
432 @cmp
-s
$@.tmp
$@ || mv
$@.tmp
$@
436 @
$(SUBMAKE
) -C
$(@
:-clean=) clean
438 $(SUBDIRS_DIST_CLEAN
):
439 @
$(SUBMAKE
) -C
$(@
:-dist-clean
=) dist-clean
441 clean: $(SUBDIRS_CLEAN
)
443 rm -f
include/asterisk
/build.h
445 rm -f
include/asterisk
/version.h
446 @
$(MAKE
) -C menuselect
clean
447 cp
-f .cleancount .lastclean
449 dist-clean
: distclean
451 distclean: $(SUBDIRS_DIST_CLEAN
) clean
452 @
$(MAKE
) -C menuselect dist-clean
453 @
$(MAKE
) -C sounds dist-clean
454 rm -f menuselect.makeopts makeopts menuselect-tree menuselect.makedeps
455 rm -f makeopts.embed_rules
456 rm -f config.log config.status config.cache
457 rm -rf autom4te.cache
458 rm -f
include/asterisk
/autoconfig.h
459 rm -f
include/asterisk
/buildopts.h
461 rm -f build_tools
/menuselect-deps
464 if
[ x
`$(ID) -un` = xroot
]; then CFLAGS
="$(ASTCFLAGS)" sh build_tools
/mkpkgconfig
$(DESTDIR
)/usr
/lib
/pkgconfig
; fi
465 # Should static HTTP be installed during make samples or even with its own target ala
466 # webvoicemail? There are portions here that *could* be customized but might also be
467 # improved a lot. I'll put it here for now.
468 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/static-http
469 for x in static-http
/*; do \
470 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTDATADIR
)/static-http
; \
472 if
[ -d doc
/tex/asterisk
] ; then \
473 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/static-http
/docs
; \
474 for n in doc
/tex/asterisk
/* ; do \
475 $(INSTALL
) -m
644 $$n $(DESTDIR
)$(ASTDATADIR
)/static-http
/docs
; \
478 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/images
479 for x in images
/*.jpg
; do \
480 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTDATADIR
)/images
; \
482 mkdir
-p
$(DESTDIR
)$(AGI_DIR
)
483 $(MAKE
) -C sounds
install
486 @if
[ -d .svn
]; then \
487 echo
"Updating from Subversion..." ; \
488 fromrev
="`svn info | $(AWK) '/Revision: / {print $$2}'`"; \
489 svn update | tee update.out
; \
490 torev
="`svn info | $(AWK) '/Revision: / {print $$2}'`"; \
491 echo
"`date` Updated from revision $${fromrev} to $${torev}." >> update.log
; \
493 if
[ `grep -c ^C update.out` -gt
0 ]; then \
494 echo
; echo
"The following files have conflicts:" ; \
495 grep ^C update.out | cut
-b4-
; \
499 echo
"Not under version control"; \
502 NEWHEADERS
=$(notdir $(wildcard include/asterisk
/*.h
))
503 OLDHEADERS
=$(filter-out $(NEWHEADERS
),$(notdir $(wildcard $(DESTDIR
)$(ASTHEADERDIR
)/*.h
)))
506 mkdir
-p
$(DESTDIR
)$(MODULES_DIR
)
507 mkdir
-p
$(DESTDIR
)$(ASTSBINDIR
)
508 mkdir
-p
$(DESTDIR
)$(ASTETCDIR
)
509 mkdir
-p
$(DESTDIR
)$(ASTBINDIR
)
510 mkdir
-p
$(DESTDIR
)$(ASTVARRUNDIR
)
511 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/voicemail
512 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/dictate
513 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/system
514 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/tmp
515 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/meetme
516 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/monitor
518 bininstall
: _all
installdirs $(SUBDIRS_INSTALL
)
519 $(INSTALL
) -m
755 main
/asterisk
$(DESTDIR
)$(ASTSBINDIR
)/
520 $(LN
) -sf asterisk
$(DESTDIR
)$(ASTSBINDIR
)/rasterisk
521 $(INSTALL
) -m
755 contrib
/scripts
/astgenkey
$(DESTDIR
)$(ASTSBINDIR
)/
522 $(INSTALL
) -m
755 contrib
/scripts
/autosupport
$(DESTDIR
)$(ASTSBINDIR
)/
523 if
[ ! -f
$(DESTDIR
)$(ASTSBINDIR
)/safe_asterisk
]; then \
524 cat contrib
/scripts
/safe_asterisk | sed
's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;' > $(DESTDIR
)$(ASTSBINDIR
)/safe_asterisk
;\
525 chmod
755 $(DESTDIR
)$(ASTSBINDIR
)/safe_asterisk
;\
527 $(INSTALL
) -d
$(DESTDIR
)$(ASTHEADERDIR
)
528 $(INSTALL
) -m
644 include/asterisk.h
$(DESTDIR
)$(includedir)
529 $(INSTALL
) -m
644 include/asterisk
/*.h
$(DESTDIR
)$(ASTHEADERDIR
)
530 if
[ -n
"$(OLDHEADERS)" ]; then \
531 rm -f
$(addprefix $(DESTDIR
)$(ASTHEADERDIR
)/,$(OLDHEADERS
)) ;\
533 mkdir
-p
$(DESTDIR
)$(ASTLOGDIR
)/cdr-csv
534 mkdir
-p
$(DESTDIR
)$(ASTLOGDIR
)/cdr-custom
535 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/keys
536 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/firmware
537 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/firmware
/iax
538 mkdir
-p
$(DESTDIR
)$(ASTMANDIR
)/man8
539 $(INSTALL
) -m
644 keys
/iaxtel.pub
$(DESTDIR
)$(ASTDATADIR
)/keys
540 $(INSTALL
) -m
644 keys
/freeworlddialup.pub
$(DESTDIR
)$(ASTDATADIR
)/keys
541 $(INSTALL
) -m
644 doc
/asterisk
.8 $(DESTDIR
)$(ASTMANDIR
)/man8
542 $(INSTALL
) -m
644 contrib
/scripts
/astgenkey
.8 $(DESTDIR
)$(ASTMANDIR
)/man8
543 $(INSTALL
) -m
644 contrib
/scripts
/autosupport
.8 $(DESTDIR
)$(ASTMANDIR
)/man8
544 $(INSTALL
) -m
644 contrib
/scripts
/safe_asterisk
.8 $(DESTDIR
)$(ASTMANDIR
)/man8
545 if
[ -f contrib
/firmware
/iax
/iaxy.bin
] ; then \
546 $(INSTALL
) -m
644 contrib
/firmware
/iax
/iaxy.bin
$(DESTDIR
)$(ASTDATADIR
)/firmware
/iax
/iaxy.bin
; \
550 @DESTDIR
="$(DESTDIR)" ASTSBINDIR
="$(ASTSBINDIR)" $(SUBMAKE
) -C
$(@
:-install=) install
552 NEWMODS
:=$(foreach d
,$(MOD_SUBDIRS
),$(notdir $(wildcard $(d
)/*.so
)))
553 OLDMODS
=$(filter-out $(NEWMODS
),$(notdir $(wildcard $(DESTDIR
)$(MODULES_DIR
)/*.so
)))
556 @if
[ -n
"$(OLDMODS)" ]; then \
557 echo
" WARNING WARNING WARNING" ;\
559 echo
" Your Asterisk modules directory, located at" ;\
560 echo
" $(DESTDIR)$(MODULES_DIR)" ;\
561 echo
" contains modules that were not installed by this " ;\
562 echo
" version of Asterisk. Please ensure that these" ;\
563 echo
" modules are compatible with this version before" ;\
564 echo
" attempting to run Asterisk." ;\
566 for f in
$(OLDMODS
); do \
570 echo
" WARNING WARNING WARNING" ;\
574 ifneq ($(findstring ~
,$(DESTDIR
)),)
575 @echo
"Your shell doesn't do ~ expansion when expected (specifically, when doing \"make install DESTDIR=~/path\")."
576 @echo
"Try replacing ~ with \$$HOME, as in \"make install DESTDIR=\$$HOME/path\"."
580 install: badshell datafiles bininstall
581 @if
[ -x
/usr
/sbin
/asterisk-post-install
]; then \
582 /usr
/sbin
/asterisk-post-install
$(DESTDIR
) .
; \
584 @echo
" +---- Asterisk Installation Complete -------+"
586 @echo
" + YOU MUST READ THE SECURITY DOCUMENT +"
588 @echo
" + Asterisk has successfully been installed. +"
589 @echo
" + If you would like to install the sample +"
590 @echo
" + configuration files (overwriting any +"
591 @echo
" + existing config files), run: +"
593 @echo
" + $(mK) samples +"
595 @echo
" +----------------- or ---------------------+"
597 @echo
" + You can go ahead and install the asterisk +"
598 @echo
" + program documentation now or later run: +"
600 @echo
" + $(mK) progdocs +"
602 @echo
" + **Note** This requires that you have +"
603 @echo
" + doxygen installed on your local system +"
604 @echo
" +-------------------------------------------+"
605 @
$(MAKE
) -s oldmodcheck
609 # XXX why *.adsi is installed first ?
611 @echo Installing adsi config files...
612 @mkdir
-p
$(DESTDIR
)$(ASTETCDIR
)
613 @for x in configs
/*.adsi
; do \
614 dst
="$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x`" ; \
615 if
[ -f
$${dst} ] ; then \
616 echo
"Overwriting $$x" ; \
618 echo
"Installing $$x" ; \
620 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTETCDIR
)/`$(BASENAME) $$x` ; \
624 @echo Installing other config files...
625 @mkdir
-p
$(DESTDIR
)$(ASTETCDIR
)
626 @for x in configs
/*.sample
; do \
627 dst
="$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample`" ; \
628 if
[ -f
$${dst} ]; then \
629 if
[ "$(OVERWRITE)" = "y" ]; then \
630 if cmp
-s
$${dst} $$x ; then \
631 echo
"Config file $$x is unchanged"; \
634 mv
-f
$${dst} $${dst}.old
; \
636 echo
"Skipping config file $$x"; \
640 echo
"Installing file $$x"; \
641 $(INSTALL
) -m
644 $$x $${dst} ;\
643 @if
[ "$(OVERWRITE)" = "y" ] ||
[ ! -f
$(DESTDIR
)$(ASTCONFPATH
) ]; then \
644 echo
"Creating asterisk.conf"; \
646 echo
"[directories](!) ; remove the (!) to enable this" ; \
647 echo
"astetcdir => $(ASTETCDIR)" ; \
648 echo
"astmoddir => $(MODULES_DIR)" ; \
649 echo
"astvarlibdir => $(ASTVARLIBDIR)" ; \
650 echo
"astdbdir => $(ASTDBDIR)" ; \
651 echo
"astkeydir => $(ASTKEYDIR)" ; \
652 echo
"astdatadir => $(ASTDATADIR)" ; \
653 echo
"astagidir => $(AGI_DIR)" ; \
654 echo
"astspooldir => $(ASTSPOOLDIR)" ; \
655 echo
"astrundir => $(ASTVARRUNDIR)" ; \
656 echo
"astlogdir => $(ASTLOGDIR)" ; \
658 echo
";[options]" ; \
659 echo
";verbose = 3" ; \
660 echo
";debug = 3" ; \
661 echo
";alwaysfork = yes ; same as -F at startup" ; \
662 echo
";nofork = yes ; same as -f at startup" ; \
663 echo
";quiet = yes ; same as -q at startup" ; \
664 echo
";timestamp = yes ; same as -T at startup" ; \
665 echo
";execincludes = yes ; support #exec in config files" ; \
666 echo
";console = yes ; Run as console (same as -c at startup)" ; \
667 echo
";highpriority = yes ; Run realtime priority (same as -p at startup)" ; \
668 echo
";initcrypto = yes ; Initialize crypto keys (same as -i at startup)" ; \
669 echo
";nocolor = yes ; Disable console colors" ; \
670 echo
";dontwarn = yes ; Disable some warnings" ; \
671 echo
";dumpcore = yes ; Dump core on crash (same as -g at startup)" ; \
672 echo
";languageprefix = yes ; Use the new sound prefix path syntax" ; \
673 echo
";internal_timing = yes" ; \
674 echo
";systemname = my_system_name ; prefix uniqueid with a system name for global uniqueness issues" ; \
675 echo
";autosystemname = yes ; automatically set systemname to hostname - uses 'localhost' on failure, or systemname if set" ; \
676 echo
";maxcalls = 10 ; Maximum amount of calls allowed" ; \
677 echo
";maxload = 0.9 ; Asterisk stops accepting new calls if the load average exceed this limit" ; \
678 echo
";maxfiles = 1000 ; Maximum amount of openfiles" ; \
679 echo
";minmemfree = 1 ; in MBs, Asterisk stops accepting new calls if the amount of free memory falls below this watermark" ; \
680 echo
";cache_record_files = yes ; Cache recorded sound files to another directory during recording" ; \
681 echo
";record_cache_dir = /tmp ; Specify cache directory (used in cnjunction with cache_record_files)" ; \
682 echo
";transmit_silence_during_record = yes ; Transmit SLINEAR silence while a channel is being recorded" ; \
683 echo
";transmit_silence = yes ; Transmit SLINEAR silence while a channel is being recorded or DTMF is being generated" ; \
684 echo
";transcode_via_sln = yes ; Build transcode paths via SLINEAR, instead of directly" ; \
685 echo
";runuser = asterisk ; The user to run as" ; \
686 echo
";rungroup = asterisk ; The group to run as" ; \
688 echo
"; Changing the following lines may compromise your security." ; \
690 echo
";astctlpermissions = 0660" ; \
691 echo
";astctlowner = root" ; \
692 echo
";astctlgroup = apache" ; \
693 echo
";astctl = asterisk.ctl" ; \
696 echo
"pbx_realtime=1.6" ; \
697 echo
"res_agi=1.6" ; \
698 echo
"app_set=1.6" ; \
699 ) > $(DESTDIR
)$(ASTCONFPATH
) ; \
701 echo
"Skipping asterisk.conf creation"; \
703 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/voicemail
/default
/1234/INBOX
704 build_tools
/make_sample_voicemail
$(DESTDIR
)/$(ASTDATADIR
) $(DESTDIR
)/$(ASTSPOOLDIR
)
705 @mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/phoneprov
706 @for x in phoneprov
/*; do \
707 dst
="$(DESTDIR)$(ASTDATADIR)/$$x" ; \
708 if
[ -f
$${dst} ]; then \
709 if
[ "$(OVERWRITE)" = "y" ]; then \
710 if cmp
-s
$${dst} $$x ; then \
711 echo
"Config file $$x is unchanged"; \
714 mv
-f
$${dst} $${dst}.old
; \
716 echo
"Skipping config file $$x"; \
720 echo
"Installing file $$x"; \
721 $(INSTALL
) -m
644 $$x $${dst} ;\
725 @
[ -d
$(DESTDIR
)$(HTTP_DOCSDIR
)/ ] ||
( printf
"http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit
1 )
726 @
[ -d
$(DESTDIR
)$(HTTP_CGIDIR
) ] ||
( printf
"cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit
1 )
727 $(INSTALL
) -m
4755 -o root
-g root contrib
/scripts
/vmail.cgi
$(DESTDIR
)$(HTTP_CGIDIR
)/vmail.cgi
728 mkdir
-p
$(DESTDIR
)$(HTTP_DOCSDIR
)/_asterisk
729 for x in images
/*.gif
; do \
730 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(HTTP_DOCSDIR
)/_asterisk
/; \
732 @echo
" +--------- Asterisk Web Voicemail ----------+"
734 @echo
" + Asterisk Web Voicemail is installed in +"
735 @echo
" + your cgi-bin directory: +"
736 @echo
" + $(DESTDIR)$(HTTP_CGIDIR)"
737 @echo
" + IT USES A SETUID ROOT PERL SCRIPT, SO +"
738 @echo
" + IF YOU DON'T LIKE THAT, UNINSTALL IT! +"
740 @echo
" + Other static items have been stored in: +"
741 @echo
" + $(DESTDIR)$(HTTP_DOCSDIR)"
743 @echo
" + If these paths do not match your httpd +"
744 @echo
" + installation, correct the definitions +"
745 @echo
" + in your Makefile of HTTP_CGIDIR and +"
746 @echo
" + HTTP_DOCSDIR +"
748 @echo
" +-------------------------------------------+"
751 sed
"s/^Version:.*/Version: $(RPMVERSION)/g" redhat
/asterisk.spec
> asterisk.spec
; \
755 __rpm
: main
/version.c
include/asterisk
/version.h
include/asterisk
/buildopts.h spec
756 rm -rf
/tmp
/asterisk
; \
757 mkdir
-p
/tmp
/asterisk
/redhat
/RPMS
/i386
; \
758 $(MAKE
) DESTDIR
=/tmp
/asterisk
install ; \
759 $(MAKE
) DESTDIR
=/tmp
/asterisk samples
; \
760 mkdir
-p
/tmp
/asterisk
/etc
/rc.d
/init.d
; \
761 cp
-f contrib
/init.d
/rc.redhat.asterisk
/tmp
/asterisk
/etc
/rc.d
/init.d
/asterisk
; \
762 rpmbuild
--rcfile
/usr
/lib
/rpm
/rpmrc
:redhat
/rpmrc
-bb asterisk.spec
765 (cat contrib
/asterisk-ng-doxygen
; echo
"HAVE_DOT=$(HAVEDOT)"; \
766 echo
"PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen
-
769 if
[ ! -d
$(ASTETCDIR
)/..
/logrotate.d
]; then \
770 mkdir
$(ASTETCDIR
)/..
/logrotate.d
; \
772 sed
's#__LOGDIR__#$(ASTLOGDIR)#g' < contrib
/scripts
/asterisk.logrotate | sed
's#__SBINDIR__#$(ASTSBINDIR)#g' > contrib
/scripts
/asterisk.logrotate.tmp
773 install -m
0644 contrib
/scripts
/asterisk.logrotate.tmp
$(ASTETCDIR
)/..
/logrotate.d
/asterisk
774 rm -f contrib
/scripts
/asterisk.logrotate.tmp
777 @if
[ "${OSARCH}" = "linux-gnu" ]; then \
778 if
[ -f
/etc
/redhat-release
-o
-f
/etc
/fedora-release
]; then \
779 $(INSTALL
) -m
755 contrib
/init.d
/rc.redhat.asterisk
$(DESTDIR
)/etc
/rc.d
/init.d
/asterisk
; \
780 if
[ -z
"$(DESTDIR)" ]; then
/sbin
/chkconfig
--add asterisk
; fi
; \
781 elif
[ -f
/etc
/debian_version
]; then \
782 $(INSTALL
) -m
755 contrib
/init.d
/rc.debian.asterisk
$(DESTDIR
)/etc
/init.d
/asterisk
; \
783 if
[ -z
"$(DESTDIR)" ]; then
/usr
/sbin
/update-rc.d asterisk start
50 2 3 4 5 . stop
91 2 3 4 5 .
; fi
; \
784 elif
[ -f
/etc
/gentoo-release
]; then \
785 $(INSTALL
) -m
755 contrib
/init.d
/rc.gentoo.asterisk
$(DESTDIR
)/etc
/init.d
/asterisk
; \
786 if
[ -z
"$(DESTDIR)" ]; then
/sbin
/rc-update add asterisk default
; fi
; \
787 elif
[ -f
/etc
/mandrake-release
-o
-f
/etc
/mandriva-release
]; then \
788 $(INSTALL
) -m
755 contrib
/init.d
/rc.mandriva.asterisk
$(DESTDIR
)/etc
/rc.d
/init.d
/asterisk
; \
789 if
[ -z
"$(DESTDIR)" ]; then
/sbin
/chkconfig
--add asterisk
; fi
; \
790 elif
[ -f
/etc
/SuSE-release
-o
-f
/etc
/novell-release
]; then \
791 $(INSTALL
) -m
755 contrib
/init.d
/rc.suse.asterisk
$(DESTDIR
)/etc
/init.d
/asterisk
; \
792 if
[ -z
"$(DESTDIR)" ]; then
/sbin
/chkconfig
--add asterisk
; fi
; \
793 elif
[ -f
/etc
/slackware-version
]; then \
794 echo
"Slackware is not currently supported, although an init script does exist for it." \
796 echo
"We could not install init scripts for your distribution."; \
799 echo
"We could not install init scripts for your operating system."; \
803 $(MAKE
) -C sounds
all
805 # If the cleancount has been changed, force a make clean.
806 # .cleancount is the global clean count, and .lastclean is the
807 # last clean count we had
810 @cmp
-s .cleancount .lastclean ||
$(MAKE
) clean
812 $(SUBDIRS_UNINSTALL
):
813 @
$(SUBMAKE
) -C
$(@
:-uninstall=) uninstall
815 _uninstall
: $(SUBDIRS_UNINSTALL
)
816 rm -f
$(DESTDIR
)$(MODULES_DIR
)/*
817 rm -f
$(DESTDIR
)$(ASTSBINDIR
)/*asterisk
*
818 rm -f
$(DESTDIR
)$(ASTSBINDIR
)/astgenkey
819 rm -f
$(DESTDIR
)$(ASTSBINDIR
)/autosupport
820 rm -rf
$(DESTDIR
)$(ASTHEADERDIR
)
821 rm -rf
$(DESTDIR
)$(ASTDATADIR
)/firmware
822 rm -f
$(DESTDIR
)$(ASTMANDIR
)/man8
/asterisk
.8
823 rm -f
$(DESTDIR
)$(ASTMANDIR
)/man8
/astgenkey
.8
824 rm -f
$(DESTDIR
)$(ASTMANDIR
)/man8
/autosupport
.8
825 rm -f
$(DESTDIR
)$(ASTMANDIR
)/man8
/safe_asterisk
.8
826 $(MAKE
) -C sounds
uninstall
828 uninstall: _uninstall
829 @echo
" +--------- Asterisk Uninstall Complete -----+"
830 @echo
" + Asterisk binaries, sounds, man pages, +"
831 @echo
" + headers, modules, and firmware builds, +"
832 @echo
" + have all been uninstalled. +"
834 @echo
" + To remove ALL traces of Asterisk, +"
835 @echo
" + including configuration, spool +"
836 @echo
" + directories, and logs, run the following +"
837 @echo
" + command: +"
839 @echo
" + $(mK) uninstall-all +"
840 @echo
" +-------------------------------------------+"
842 uninstall-all
: _uninstall
843 rm -rf
$(DESTDIR
)$(ASTLIBDIR
)
844 rm -rf
$(DESTDIR
)$(ASTVARLIBDIR
)
845 rm -rf
$(DESTDIR
)$(ASTDATADIR
)
846 rm -rf
$(DESTDIR
)$(ASTSPOOLDIR
)
847 rm -rf
$(DESTDIR
)$(ASTETCDIR
)
848 rm -rf
$(DESTDIR
)$(ASTLOGDIR
)
850 menuconfig
: menuselect
852 cmenuconfig
: cmenuselect
854 gmenuconfig
: gmenuselect
856 nmenuconfig
: nmenuselect
858 menuselect
: menuselect
/cmenuselect menuselect
/nmenuselect menuselect
/gmenuselect
859 @if
[ -x menuselect
/nmenuselect
]; then \
860 $(MAKE
) nmenuselect
; \
861 elif
[ -x menuselect
/cmenuselect
]; then \
862 $(MAKE
) cmenuselect
; \
863 elif
[ -x menuselect
/gmenuselect
]; then \
864 $(MAKE
) gmenuselect
; \
866 echo
"No menuselect user interface found. Install ncurses,"; \
867 echo
"newt or GTK libraries to build one and re-rerun"; \
868 echo
"'make menuselect'."; \
871 cmenuselect
: menuselect
/cmenuselect menuselect-tree
872 -@menuselect
/cmenuselect menuselect.makeopts
$(GLOBAL_MAKEOPTS
) $(USER_MAKEOPTS
) && (echo
"menuselect changes saved!"; rm -f channels
/h323
/Makefile.ast main
/asterisk
) || echo
"menuselect changes NOT saved!"
874 gmenuselect
: menuselect
/gmenuselect menuselect-tree
875 -@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!"
877 nmenuselect
: menuselect
/nmenuselect menuselect-tree
878 -@menuselect
/nmenuselect menuselect.makeopts
$(GLOBAL_MAKEOPTS
) $(USER_MAKEOPTS
) && (echo
"menuselect changes saved!"; rm -f channels
/h323
/Makefile.ast main
/asterisk
) || echo
"menuselect changes NOT saved!"
880 # options for make in menuselect/
881 MAKE_MENUSELECT
=CC
="$(HOST_CC)" CXX
="$(CXX)" LD
="" AR
="" RANLIB
="" CFLAGS
="" $(MAKE
) -C menuselect CONFIGURE_SILENT
="--silent"
883 menuselect
/menuselect
: menuselect
/makeopts
884 $(MAKE_MENUSELECT
) menuselect
886 menuselect
/cmenuselect
: menuselect
/makeopts
887 $(MAKE_MENUSELECT
) cmenuselect
889 menuselect
/gmenuselect
: menuselect
/makeopts
890 $(MAKE_MENUSELECT
) gmenuselect
892 menuselect
/nmenuselect
: menuselect
/makeopts
893 $(MAKE_MENUSELECT
) nmenuselect
895 menuselect
/makeopts
: makeopts
896 $(MAKE_MENUSELECT
) makeopts
898 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
899 @echo
"Generating input for menuselect ..."
900 @echo
"<?xml version=\"1.0\"?>" > $@
902 @echo
"<menu name=\"Asterisk Module and Build Option Selection\">" >> $@
903 @for
dir in
$(sort $(filter-out main
,$(MOD_SUBDIRS
))); do
$(SUBMAKE
) -C
$${dir} SUBDIR
=$${dir} moduleinfo
>> $@
; done
904 @cat build_tools
/cflags.xml
>> $@
905 @for
dir in
$(sort $(filter-out main
,$(MOD_SUBDIRS
))); do
$(SUBMAKE
) -C
$${dir} SUBDIR
=$${dir} makeopts
>> $@
; done
906 @if
[ "${AST_DEVMODE}" = "yes" ]; then \
907 cat build_tools
/cflags-devmode.xml
>> $@
; \
909 @cat build_tools
/embed_modules.xml
>> $@
910 @cat sounds
/sounds.xml
>> $@
911 @echo
"</menu>" >> $@
915 $(MAKE
) -C doc
/tex asterisk.pdf
917 .PHONY
: menuselect menuselect.makeopts main sounds
clean dist-clean
distclean all prereqs cleantest
uninstall _uninstall uninstall-all pdf 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
installdirs