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
)),)
227 ASTCFLAGS
+=-Wall
-Wstrict-prototypes
-Wmissing-prototypes
-Wmissing-declarations
$(DEBUG
)
229 ASTCFLAGS
+=-include $(ASTTOPDIR
)/include/asterisk
/autoconfig.h
231 ifeq ($(AST_DEVMODE
),yes
)
232 ASTCFLAGS
+=-Werror
-Wunused
-Wundef
$(AST_DECLARATION_AFTER_STATEMENT
) -Wmissing-format-attribute
-Wformat-security
#-Wformat=2
235 ifneq ($(findstring BSD
,$(OSARCH
)),)
236 ASTCFLAGS
+=-I
/usr
/local
/include
237 ASTLDFLAGS
+=-L
/usr
/local
/lib
240 ifneq ($(PROC
),ultrasparc
)
241 ASTCFLAGS
+=$(shell if
$(CC
) -march
=$(PROC
) -S
-o
/dev
/null
-xc
/dev
/null
>/dev
/null
2>&1; then echo
"-march=$(PROC)"; fi
)
245 ASTCFLAGS
+=-fsigned-char
248 ifeq ($(OSARCH
),FreeBSD
)
249 # -V is understood by BSD Make, not by GNU make.
250 BSDVERSION
=$(shell make
-V OSVERSION
-f
/usr
/share
/mk
/bsd.port.subdir.mk
)
251 ASTCFLAGS
+=$(shell if
test $(BSDVERSION
) -lt
500016 ; then echo
"-D_THREAD_SAFE"; fi
)
254 ifeq ($(OSARCH
),NetBSD
)
255 ASTCFLAGS
+=-pthread
-I
/usr
/pkg
/include
258 ifeq ($(OSARCH
),OpenBSD
)
262 ifeq ($(OSARCH
),SunOS
)
263 ASTCFLAGS
+=-Wcast-align
-DSOLARIS
-I..
/include/solaris-compat
-I
/opt
/ssl
/include -I
/usr
/local
/ssl
/include -D_XPG4_2
266 ASTERISKVERSION
:=$(shell GREP
=$(GREP
) AWK
=$(AWK
) build_tools
/make_version .
)
268 ifneq ($(wildcard .version
),)
269 ASTERISKVERSIONNUM
:=$(shell $(AWK
) -F.
'{printf "%01d%02d%02d", $$1, $$2, $$3}' .version
)
270 RPMVERSION
:=$(shell sed
's/[-\/:]/_/g' .version
)
275 ifneq ($(wildcard .svn
),)
276 ASTERISKVERSIONNUM
:=999999
279 # XXX MALLOC_DEBUG is probably unused, Makefile.moddir_rules adds the
280 # value directly to ASTCFLAGS
281 ASTCFLAGS
+=$(MALLOC_DEBUG
)$(OPTIONS
)
283 MOD_SUBDIRS
:=channels pbx apps codecs formats cdr funcs tests main res
$(LOCAL_MOD_SUBDIRS
)
284 OTHER_SUBDIRS
:=utils agi
285 SUBDIRS
:=$(OTHER_SUBDIRS
) $(MOD_SUBDIRS
)
286 SUBDIRS_INSTALL
:=$(SUBDIRS
:%=%-install)
287 SUBDIRS_CLEAN
:=$(SUBDIRS
:%=%-clean)
288 SUBDIRS_DIST_CLEAN
:=$(SUBDIRS
:%=%-dist-clean
)
289 SUBDIRS_UNINSTALL
:=$(SUBDIRS
:%=%-uninstall)
290 MOD_SUBDIRS_EMBED_LDSCRIPT
:=$(MOD_SUBDIRS
:%=%-embed-ldscript
)
291 MOD_SUBDIRS_EMBED_LDFLAGS
:=$(MOD_SUBDIRS
:%=%-embed-ldflags
)
292 MOD_SUBDIRS_EMBED_LIBS
:=$(MOD_SUBDIRS
:%=%-embed-libs
)
293 MOD_SUBDIRS_MENUSELECT_TREE
:=$(MOD_SUBDIRS
:%=%-menuselect-tree
)
295 ifneq ($(findstring darwin
,$(OSARCH
)),)
296 ASTCFLAGS
+=-D__Darwin__
297 SOLINK
=-dynamic
-bundle
-undefined suppress
-force_flat_namespace
299 # These are used for all but Darwin
300 SOLINK
=-shared
-Xlinker
-x
301 ifneq ($(findstring BSD
,$(OSARCH
)),)
302 LDFLAGS
+=-L
/usr
/local
/lib
306 ifeq ($(OSARCH
),SunOS
)
307 SOLINK
=-shared
-fpic
-L
/usr
/local
/ssl
/lib
310 # comment to print directories during submakes
313 SILENTMAKE
:=$(MAKE
) --quiet
--no-print-directory
314 ifneq ($(PRINT_DIR
)$(NOISY_BUILD
),)
315 SUBMAKE
:=$(MAKE
) --quiet
317 SUBMAKE
:=$(MAKE
) --quiet
--no-print-directory
320 # This is used when generating the doxygen documentation
327 # $(MAKE) is printed in several places, and we want it to be a
328 # fixed size string. Define a variable whose name has also the
329 # same size, so we can easily align text.
330 ifeq ($(MAKE
), gmake
)
337 @echo
" +--------- Asterisk Build Complete ---------+"
338 @echo
" + Asterisk has successfully been built, and +"
339 @echo
" + can be installed by running: +"
341 @echo
" + $(mK) install +"
342 @echo
" +-------------------------------------------+"
344 _all
: cleantest makeopts
$(SUBDIRS
)
348 @echo
"**** The configure script must be executed before running '$(MAKE)'."
349 @echo
"**** Please run \"./configure\"."
353 menuselect.makeopts
: menuselect
/menuselect menuselect-tree makeopts
354 menuselect
/menuselect
--check-deps menuselect.makeopts
$(GLOBAL_MAKEOPTS
) $(USER_MAKEOPTS
)
356 $(MOD_SUBDIRS_EMBED_LDSCRIPT
):
357 @echo
"EMBED_LDSCRIPTS+="`$(SILENTMAKE) -C $(@:-embed-ldscript=) SUBDIR=$(@:-embed-ldscript=) __embed_ldscript` >> makeopts.embed_rules
359 $(MOD_SUBDIRS_EMBED_LDFLAGS
):
360 @echo
"EMBED_LDFLAGS+="`$(SILENTMAKE) -C $(@:-embed-ldflags=) SUBDIR=$(@:-embed-ldflags=) __embed_ldflags` >> makeopts.embed_rules
362 $(MOD_SUBDIRS_EMBED_LIBS
):
363 @echo
"EMBED_LIBS+="`$(SILENTMAKE) -C $(@:-embed-libs=) SUBDIR=$(@:-embed-libs=) __embed_libs` >> makeopts.embed_rules
365 $(MOD_SUBDIRS_MENUSELECT_TREE
):
366 @
$(SUBMAKE
) -C
$(@
:-menuselect-tree
=) SUBDIR
=$(@
:-menuselect-tree
=) moduleinfo
367 @
$(SUBMAKE
) -C
$(@
:-menuselect-tree
=) SUBDIR
=$(@
:-menuselect-tree
=) makeopts
369 makeopts.embed_rules
: menuselect.makeopts
370 @echo
"Generating embedded module rules ..."
372 @
$(MAKE
) $(PRINT_DIR
) $(MOD_SUBDIRS_EMBED_LDSCRIPT
)
373 @
$(MAKE
) $(PRINT_DIR
) $(MOD_SUBDIRS_EMBED_LDFLAGS
)
374 @
$(MAKE
) $(PRINT_DIR
) $(MOD_SUBDIRS_EMBED_LIBS
)
376 $(SUBDIRS
): main
/version.c
include/asterisk
/version.h
include/asterisk
/build.h
include/asterisk
/buildopts.h defaults.h makeopts.embed_rules
378 ifeq ($(findstring $(OSARCH
), mingw32 cygwin
),)
380 # ensure that all module subdirectories are processed before 'main' during
381 # a parallel build, since if there are modules selected to be embedded the
382 # directories containing them must be completed before the main Asterisk
383 # binary can be built
384 main
: $(filter-out main
,$(MOD_SUBDIRS
))
386 # Windows: we need to build main (i.e. the asterisk dll) first,
387 # followed by res, followed by the other directories, because
388 # dll symbols must be resolved during linking and not at runtime.
389 D1
:= $(filter-out main
,$(MOD_SUBDIRS
))
390 D1
:= $(filter-out res
,$(D1
))
397 @ASTCFLAGS
="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS
="$(ASTLDFLAGS)" $(MAKE
) $(PRINT_DIR
) --no-builtin-rules
-C
$@ SUBDIR
=$@
all
400 @ASTCFLAGS
="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS
="$(ASTLDFLAGS)" $(MAKE
) $(PRINT_DIR
) --no-builtin-rules
-C
$@ SUBDIR
=$@
all
403 @build_tools
/make_defaults_h
> $@.tmp
404 @cmp
-s
$@.tmp
$@ || mv
$@.tmp
$@
408 @build_tools
/make_version_c
> $@.tmp
409 @cmp
-s
$@.tmp
$@ || mv
$@.tmp
$@
412 include/asterisk
/version.h
:
413 @build_tools
/make_version_h
> $@.tmp
414 @cmp
-s
$@.tmp
$@ || mv
$@.tmp
$@
417 include/asterisk
/buildopts.h
: menuselect.makeopts
418 @build_tools
/make_buildopts_h
> $@.tmp
419 @cmp
-s
$@.tmp
$@ || mv
$@.tmp
$@
422 include/asterisk
/build.h
:
423 @build_tools
/make_build_h
> $@.tmp
424 @cmp
-s
$@.tmp
$@ || mv
$@.tmp
$@
428 @
$(MAKE
) $(PRINT_DIR
) -C
$(@
:-clean=) clean
430 $(SUBDIRS_DIST_CLEAN
):
431 @
$(MAKE
) $(PRINT_DIR
) -C
$(@
:-dist-clean
=) dist-clean
433 clean: $(SUBDIRS_CLEAN
)
435 rm -f
include/asterisk
/build.h
437 rm -f
include/asterisk
/version.h
438 @
$(MAKE
) -C menuselect
clean
439 cp
-f .cleancount .lastclean
441 dist-clean
: distclean
443 distclean: $(SUBDIRS_DIST_CLEAN
) clean
444 @
$(MAKE
) -C menuselect dist-clean
445 @
$(MAKE
) -C sounds dist-clean
446 rm -f menuselect.makeopts makeopts menuselect-tree menuselect.makedeps
447 rm -f makeopts.embed_rules
448 rm -f config.log config.status config.cache
449 rm -rf autom4te.cache
450 rm -f
include/asterisk
/autoconfig.h
451 rm -f
include/asterisk
/buildopts.h
453 rm -f build_tools
/menuselect-deps
456 if
[ x
`$(ID) -un` = xroot
]; then CFLAGS
="$(ASTCFLAGS)" sh build_tools
/mkpkgconfig
$(DESTDIR
)/usr
/lib
/pkgconfig
; fi
457 # Should static HTTP be installed during make samples or even with its own target ala
458 # webvoicemail? There are portions here that *could* be customized but might also be
459 # improved a lot. I'll put it here for now.
460 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/phoneprov
461 for x in phoneprov
/*; do \
462 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTDATADIR
)/phoneprov
; \
464 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/static-http
465 for x in static-http
/*; do \
466 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTDATADIR
)/static-http
; \
468 if
[ -d doc
/tex/asterisk
] ; then \
469 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/static-http
/docs
; \
470 for n in doc
/tex/asterisk
/* ; do \
471 $(INSTALL
) -m
644 $$n $(DESTDIR
)$(ASTDATADIR
)/static-http
/docs
; \
474 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/images
475 for x in images
/*.jpg
; do \
476 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTDATADIR
)/images
; \
478 mkdir
-p
$(DESTDIR
)$(AGI_DIR
)
479 $(MAKE
) -C sounds
install
482 @if
[ -d .svn
]; then \
483 echo
"Updating from Subversion..." ; \
484 fromrev
="`svn info | $(AWK) '/Revision: / {print $$2}'`"; \
485 svn update | tee update.out
; \
486 torev
="`svn info | $(AWK) '/Revision: / {print $$2}'`"; \
487 echo
"`date` Updated from revision $${fromrev} to $${torev}." >> update.log
; \
489 if
[ `grep -c ^C update.out` -gt
0 ]; then \
490 echo
; echo
"The following files have conflicts:" ; \
491 grep ^C update.out | cut
-b4-
; \
495 echo
"Not under version control"; \
498 NEWHEADERS
=$(notdir $(wildcard include/asterisk
/*.h
))
499 OLDHEADERS
=$(filter-out $(NEWHEADERS
),$(notdir $(wildcard $(DESTDIR
)$(ASTHEADERDIR
)/*.h
)))
502 mkdir
-p
$(DESTDIR
)$(MODULES_DIR
)
503 mkdir
-p
$(DESTDIR
)$(ASTSBINDIR
)
504 mkdir
-p
$(DESTDIR
)$(ASTETCDIR
)
505 mkdir
-p
$(DESTDIR
)$(ASTBINDIR
)
506 mkdir
-p
$(DESTDIR
)$(ASTVARRUNDIR
)
507 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/voicemail
508 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/dictate
509 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/system
510 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/tmp
511 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/meetme
512 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/monitor
514 bininstall
: _all
installdirs $(SUBDIRS_INSTALL
)
515 $(INSTALL
) -m
755 main
/asterisk
$(DESTDIR
)$(ASTSBINDIR
)/
516 $(LN
) -sf asterisk
$(DESTDIR
)$(ASTSBINDIR
)/rasterisk
517 $(INSTALL
) -m
755 contrib
/scripts
/astgenkey
$(DESTDIR
)$(ASTSBINDIR
)/
518 $(INSTALL
) -m
755 contrib
/scripts
/autosupport
$(DESTDIR
)$(ASTSBINDIR
)/
519 if
[ ! -f
$(DESTDIR
)$(ASTSBINDIR
)/safe_asterisk
]; then \
520 cat contrib
/scripts
/safe_asterisk | sed
's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;' > $(DESTDIR
)$(ASTSBINDIR
)/safe_asterisk
;\
521 chmod
755 $(DESTDIR
)$(ASTSBINDIR
)/safe_asterisk
;\
523 $(INSTALL
) -d
$(DESTDIR
)$(ASTHEADERDIR
)
524 $(INSTALL
) -m
644 include/asterisk.h
$(DESTDIR
)$(includedir)
525 $(INSTALL
) -m
644 include/asterisk
/*.h
$(DESTDIR
)$(ASTHEADERDIR
)
526 if
[ -n
"$(OLDHEADERS)" ]; then \
527 rm -f
$(addprefix $(DESTDIR
)$(ASTHEADERDIR
)/,$(OLDHEADERS
)) ;\
529 mkdir
-p
$(DESTDIR
)$(ASTLOGDIR
)/cdr-csv
530 mkdir
-p
$(DESTDIR
)$(ASTLOGDIR
)/cdr-custom
531 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/keys
532 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/firmware
533 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/firmware
/iax
534 mkdir
-p
$(DESTDIR
)$(ASTMANDIR
)/man8
535 $(INSTALL
) -m
644 keys
/iaxtel.pub
$(DESTDIR
)$(ASTDATADIR
)/keys
536 $(INSTALL
) -m
644 keys
/freeworlddialup.pub
$(DESTDIR
)$(ASTDATADIR
)/keys
537 $(INSTALL
) -m
644 doc
/asterisk
.8 $(DESTDIR
)$(ASTMANDIR
)/man8
538 $(INSTALL
) -m
644 contrib
/scripts
/astgenkey
.8 $(DESTDIR
)$(ASTMANDIR
)/man8
539 $(INSTALL
) -m
644 contrib
/scripts
/autosupport
.8 $(DESTDIR
)$(ASTMANDIR
)/man8
540 $(INSTALL
) -m
644 contrib
/scripts
/safe_asterisk
.8 $(DESTDIR
)$(ASTMANDIR
)/man8
541 if
[ -f contrib
/firmware
/iax
/iaxy.bin
] ; then \
542 $(INSTALL
) -m
644 contrib
/firmware
/iax
/iaxy.bin
$(DESTDIR
)$(ASTDATADIR
)/firmware
/iax
/iaxy.bin
; \
546 @DESTDIR
="$(DESTDIR)" ASTSBINDIR
="$(ASTSBINDIR)" $(MAKE
) --quiet
$(PRINT_DIR
) -C
$(@
:-install=) install
548 NEWMODS
:=$(foreach d
,$(MOD_SUBDIRS
),$(notdir $(wildcard $(d
)/*.so
)))
549 OLDMODS
=$(filter-out $(NEWMODS
),$(notdir $(wildcard $(DESTDIR
)$(MODULES_DIR
)/*.so
)))
552 @if
[ -n
"$(OLDMODS)" ]; then \
553 echo
" WARNING WARNING WARNING" ;\
555 echo
" Your Asterisk modules directory, located at" ;\
556 echo
" $(DESTDIR)$(MODULES_DIR)" ;\
557 echo
" contains modules that were not installed by this " ;\
558 echo
" version of Asterisk. Please ensure that these" ;\
559 echo
" modules are compatible with this version before" ;\
560 echo
" attempting to run Asterisk." ;\
562 for f in
$(OLDMODS
); do \
566 echo
" WARNING WARNING WARNING" ;\
570 ifneq ($(findstring ~
,$(DESTDIR
)),)
571 @echo
"Your shell doesn't do ~ expansion when expected (specifically, when doing \"make install DESTDIR=~/path\")."
572 @echo
"Try replacing ~ with \$$HOME, as in \"make install DESTDIR=\$$HOME/path\"."
576 install: badshell datafiles bininstall
577 @if
[ -x
/usr
/sbin
/asterisk-post-install
]; then \
578 /usr
/sbin
/asterisk-post-install
$(DESTDIR
) .
; \
580 @echo
" +---- Asterisk Installation Complete -------+"
582 @echo
" + YOU MUST READ THE SECURITY DOCUMENT +"
584 @echo
" + Asterisk has successfully been installed. +"
585 @echo
" + If you would like to install the sample +"
586 @echo
" + configuration files (overwriting any +"
587 @echo
" + existing config files), run: +"
589 @echo
" + $(mK) samples +"
591 @echo
" +----------------- or ---------------------+"
593 @echo
" + You can go ahead and install the asterisk +"
594 @echo
" + program documentation now or later run: +"
596 @echo
" + $(mK) progdocs +"
598 @echo
" + **Note** This requires that you have +"
599 @echo
" + doxygen installed on your local system +"
600 @echo
" +-------------------------------------------+"
601 @
$(MAKE
) -s oldmodcheck
605 # XXX why *.adsi is installed first ?
607 @echo Installing adsi config files...
608 @mkdir
-p
$(DESTDIR
)$(ASTETCDIR
)
609 @for x in configs
/*.adsi
; do \
610 dst
="$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x`" ; \
611 if
[ -f
$${dst} ] ; then \
612 echo
"Overwriting $$x" ; \
614 echo
"Installing $$x" ; \
616 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTETCDIR
)/`$(BASENAME) $$x` ; \
620 @echo Installing other config files...
621 @mkdir
-p
$(DESTDIR
)$(ASTETCDIR
)
622 @for x in configs
/*.sample
; do \
623 dst
="$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample`" ; \
624 if
[ -f
$${dst} ]; then \
625 if
[ "$(OVERWRITE)" = "y" ]; then \
626 if cmp
-s
$${dst} $$x ; then \
627 echo
"Config file $$x is unchanged"; \
630 mv
-f
$${dst} $${dst}.old
; \
632 echo
"Skipping config file $$x"; \
636 echo
"Installing file $$x"; \
637 $(INSTALL
) -m
644 $$x $${dst} ;\
639 @if
[ "$(OVERWRITE)" = "y" ] ||
[ ! -f
$(DESTDIR
)$(ASTCONFPATH
) ]; then \
640 echo
"Creating asterisk.conf"; \
642 echo
"[directories](!) ; remove the (!) to enable this" ; \
643 echo
"astetcdir => $(ASTETCDIR)" ; \
644 echo
"astmoddir => $(MODULES_DIR)" ; \
645 echo
"astvarlibdir => $(ASTVARLIBDIR)" ; \
646 echo
"astdbdir => $(ASTDBDIR)" ; \
647 echo
"astkeydir => $(ASTKEYDIR)" ; \
648 echo
"astdatadir => $(ASTDATADIR)" ; \
649 echo
"astagidir => $(AGI_DIR)" ; \
650 echo
"astspooldir => $(ASTSPOOLDIR)" ; \
651 echo
"astrundir => $(ASTVARRUNDIR)" ; \
652 echo
"astlogdir => $(ASTLOGDIR)" ; \
654 echo
";[options]" ; \
655 echo
";verbose = 3" ; \
656 echo
";debug = 3" ; \
657 echo
";alwaysfork = yes ; same as -F at startup" ; \
658 echo
";nofork = yes ; same as -f at startup" ; \
659 echo
";quiet = yes ; same as -q at startup" ; \
660 echo
";timestamp = yes ; same as -T at startup" ; \
661 echo
";execincludes = yes ; support #exec in config files" ; \
662 echo
";console = yes ; Run as console (same as -c at startup)" ; \
663 echo
";highpriority = yes ; Run realtime priority (same as -p at startup)" ; \
664 echo
";initcrypto = yes ; Initialize crypto keys (same as -i at startup)" ; \
665 echo
";nocolor = yes ; Disable console colors" ; \
666 echo
";dontwarn = yes ; Disable some warnings" ; \
667 echo
";dumpcore = yes ; Dump core on crash (same as -g at startup)" ; \
668 echo
";languageprefix = yes ; Use the new sound prefix path syntax" ; \
669 echo
";internal_timing = yes" ; \
670 echo
";systemname = my_system_name ; prefix uniqueid with a system name for global uniqueness issues" ; \
671 echo
";autosystemname = yes ; automatically set systemname to hostname - uses 'localhost' on failure, or systemname if set" ; \
672 echo
";maxcalls = 10 ; Maximum amount of calls allowed" ; \
673 echo
";maxload = 0.9 ; Asterisk stops accepting new calls if the load average exceed this limit" ; \
674 echo
";maxfiles = 1000 ; Maximum amount of openfiles" ; \
675 echo
";minmemfree = 1 ; in MBs, Asterisk stops accepting new calls if the amount of free memory falls below this watermark" ; \
676 echo
";cache_record_files = yes ; Cache recorded sound files to another directory during recording" ; \
677 echo
";record_cache_dir = /tmp ; Specify cache directory (used in cnjunction with cache_record_files)" ; \
678 echo
";transmit_silence_during_record = yes ; Transmit SLINEAR silence while a channel is being recorded" ; \
679 echo
";transmit_silence = yes ; Transmit SLINEAR silence while a channel is being recorded or DTMF is being generated" ; \
680 echo
";transcode_via_sln = yes ; Build transcode paths via SLINEAR, instead of directly" ; \
681 echo
";runuser = asterisk ; The user to run as" ; \
682 echo
";rungroup = asterisk ; The group to run as" ; \
684 echo
"; Changing the following lines may compromise your security." ; \
686 echo
";astctlpermissions = 0660" ; \
687 echo
";astctlowner = root" ; \
688 echo
";astctlgroup = apache" ; \
689 echo
";astctl = asterisk.ctl" ; \
690 ) > $(DESTDIR
)$(ASTCONFPATH
) ; \
692 echo
"Skipping asterisk.conf creation"; \
694 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/voicemail
/default
/1234/INBOX
695 build_tools
/make_sample_voicemail
$(DESTDIR
)/$(ASTDATADIR
) $(DESTDIR
)/$(ASTSPOOLDIR
)
698 @
[ -d
$(DESTDIR
)$(HTTP_DOCSDIR
)/ ] ||
( printf
"http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit
1 )
699 @
[ -d
$(DESTDIR
)$(HTTP_CGIDIR
) ] ||
( printf
"cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit
1 )
700 $(INSTALL
) -m
4755 -o root
-g root contrib
/scripts
/vmail.cgi
$(DESTDIR
)$(HTTP_CGIDIR
)/vmail.cgi
701 mkdir
-p
$(DESTDIR
)$(HTTP_DOCSDIR
)/_asterisk
702 for x in images
/*.gif
; do \
703 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(HTTP_DOCSDIR
)/_asterisk
/; \
705 @echo
" +--------- Asterisk Web Voicemail ----------+"
707 @echo
" + Asterisk Web Voicemail is installed in +"
708 @echo
" + your cgi-bin directory: +"
709 @echo
" + $(DESTDIR)$(HTTP_CGIDIR)"
710 @echo
" + IT USES A SETUID ROOT PERL SCRIPT, SO +"
711 @echo
" + IF YOU DON'T LIKE THAT, UNINSTALL IT! +"
713 @echo
" + Other static items have been stored in: +"
714 @echo
" + $(DESTDIR)$(HTTP_DOCSDIR)"
716 @echo
" + If these paths do not match your httpd +"
717 @echo
" + installation, correct the definitions +"
718 @echo
" + in your Makefile of HTTP_CGIDIR and +"
719 @echo
" + HTTP_DOCSDIR +"
721 @echo
" +-------------------------------------------+"
724 sed
"s/^Version:.*/Version: $(RPMVERSION)/g" redhat
/asterisk.spec
> asterisk.spec
; \
728 __rpm
: main
/version.c
include/asterisk
/version.h
include/asterisk
/buildopts.h spec
729 rm -rf
/tmp
/asterisk
; \
730 mkdir
-p
/tmp
/asterisk
/redhat
/RPMS
/i386
; \
731 $(MAKE
) DESTDIR
=/tmp
/asterisk
install ; \
732 $(MAKE
) DESTDIR
=/tmp
/asterisk samples
; \
733 mkdir
-p
/tmp
/asterisk
/etc
/rc.d
/init.d
; \
734 cp
-f contrib
/init.d
/rc.redhat.asterisk
/tmp
/asterisk
/etc
/rc.d
/init.d
/asterisk
; \
735 rpmbuild
--rcfile
/usr
/lib
/rpm
/rpmrc
:redhat
/rpmrc
-bb asterisk.spec
738 (cat contrib
/asterisk-ng-doxygen
; echo
"HAVE_DOT=$(HAVEDOT)"; \
739 echo
"PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen
-
742 @if
[ "${OSARCH}" = "linux-gnu" ]; then \
743 if
[ -f
/etc
/redhat-release
-o
-f
/etc
/fedora-release
]; then \
744 $(INSTALL
) -m
755 contrib
/init.d
/rc.redhat.asterisk
$(DESTDIR
)/etc
/rc.d
/init.d
/asterisk
; \
745 if
[ -z
"$(DESTDIR)" ]; then
/sbin
/chkconfig
--add asterisk
; fi
; \
746 elif
[ -f
/etc
/debian_version
]; then \
747 $(INSTALL
) -m
755 contrib
/init.d
/rc.debian.asterisk
$(DESTDIR
)/etc
/init.d
/asterisk
; \
748 if
[ -z
"$(DESTDIR)" ]; then
/usr
/sbin
/update-rc.d asterisk start
50 2 3 4 5 . stop
91 2 3 4 5 .
; fi
; \
749 elif
[ -f
/etc
/gentoo-release
]; then \
750 $(INSTALL
) -m
755 contrib
/init.d
/rc.gentoo.asterisk
$(DESTDIR
)/etc
/init.d
/asterisk
; \
751 if
[ -z
"$(DESTDIR)" ]; then
/sbin
/rc-update add asterisk default
; fi
; \
752 elif
[ -f
/etc
/mandrake-release
-o
-f
/etc
/mandriva-release
]; then \
753 $(INSTALL
) -m
755 contrib
/init.d
/rc.mandrake.asterisk
$(DESTDIR
)/etc
/rc.d
/init.d
/asterisk
; \
754 if
[ -z
"$(DESTDIR)" ]; then
/sbin
/chkconfig
--add asterisk
; fi
; \
755 elif
[ -f
/etc
/SuSE-release
-o
-f
/etc
/novell-release
]; then \
756 $(INSTALL
) -m
755 contrib
/init.d
/rc.suse.asterisk
$(DESTDIR
)/etc
/init.d
/asterisk
; \
757 if
[ -z
"$(DESTDIR)" ]; then
/sbin
/chkconfig
--add asterisk
; fi
; \
758 elif
[ -f
/etc
/slackware-version
]; then \
759 echo
"Slackware is not currently supported, although an init script does exist for it." \
761 echo
"We could not install init scripts for your distribution."; \
764 echo
"We could not install init scripts for your operating system."; \
768 $(MAKE
) -C sounds
all
770 # If the cleancount has been changed, force a make clean.
771 # .cleancount is the global clean count, and .lastclean is the
772 # last clean count we had
775 @cmp
-s .cleancount .lastclean ||
$(MAKE
) clean
777 $(SUBDIRS_UNINSTALL
):
778 @
$(MAKE
) $(PRINT_DIR
) -C
$(@
:-uninstall=) uninstall
780 _uninstall
: $(SUBDIRS_UNINSTALL
)
781 rm -f
$(DESTDIR
)$(MODULES_DIR
)/*
782 rm -f
$(DESTDIR
)$(ASTSBINDIR
)/*asterisk
*
783 rm -f
$(DESTDIR
)$(ASTSBINDIR
)/astgenkey
784 rm -f
$(DESTDIR
)$(ASTSBINDIR
)/autosupport
785 rm -rf
$(DESTDIR
)$(ASTHEADERDIR
)
786 rm -rf
$(DESTDIR
)$(ASTDATADIR
)/firmware
787 rm -f
$(DESTDIR
)$(ASTMANDIR
)/man8
/asterisk
.8
788 rm -f
$(DESTDIR
)$(ASTMANDIR
)/man8
/astgenkey
.8
789 rm -f
$(DESTDIR
)$(ASTMANDIR
)/man8
/autosupport
.8
790 rm -f
$(DESTDIR
)$(ASTMANDIR
)/man8
/safe_asterisk
.8
791 $(MAKE
) -C sounds
uninstall
793 uninstall: _uninstall
794 @echo
" +--------- Asterisk Uninstall Complete -----+"
795 @echo
" + Asterisk binaries, sounds, man pages, +"
796 @echo
" + headers, modules, and firmware builds, +"
797 @echo
" + have all been uninstalled. +"
799 @echo
" + To remove ALL traces of Asterisk, +"
800 @echo
" + including configuration, spool +"
801 @echo
" + directories, and logs, run the following +"
802 @echo
" + command: +"
804 @echo
" + $(mK) uninstall-all +"
805 @echo
" +-------------------------------------------+"
807 uninstall-all
: _uninstall
808 rm -rf
$(DESTDIR
)$(ASTLIBDIR
)
809 rm -rf
$(DESTDIR
)$(ASTVARLIBDIR
)
810 rm -rf
$(DESTDIR
)$(ASTDATADIR
)
811 rm -rf
$(DESTDIR
)$(ASTSPOOLDIR
)
812 rm -rf
$(DESTDIR
)$(ASTETCDIR
)
813 rm -rf
$(DESTDIR
)$(ASTLOGDIR
)
815 menuconfig
: menuselect
817 cmenuconfig
: cmenuselect
819 gmenuconfig
: gmenuselect
821 nmenuconfig
: nmenuselect
823 menuselect
: menuselect
/menuselect menuselect-tree
824 -@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!"
826 cmenuselect
: menuselect
/cmenuselect menuselect-tree
827 -@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!"
829 gmenuselect
: menuselect
/gmenuselect menuselect-tree
830 -@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!"
832 nmenuselect
: menuselect
/nmenuselect menuselect-tree
833 -@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!"
835 # options for make in menuselect/
836 MAKE_MENUSELECT
=CC
="$(HOST_CC)" CXX
="$(CXX)" LD
="" AR
="" RANLIB
="" CFLAGS
="" $(MAKE
) -C menuselect CONFIGURE_SILENT
="--silent"
838 menuselect
/menuselect
: menuselect
/makeopts
841 menuselect
/cmenuselect
: menuselect
/makeopts
842 $(MAKE_MENUSELECT
) cmenuselect
844 menuselect
/gmenuselect
: menuselect
/makeopts
845 $(MAKE_MENUSELECT
) gmenuselect
847 menuselect
/nmenuselect
: menuselect
/makeopts
848 $(MAKE_MENUSELECT
) nmenuselect
850 menuselect
/makeopts
: makeopts
851 $(MAKE_MENUSELECT
) makeopts
853 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
854 @echo
"Generating input for menuselect ..."
855 @echo
"<?xml version=\"1.0\"?>" > $@
857 @echo
"<menu name=\"Asterisk Module and Build Option Selection\">" >> $@
858 @for
dir in
$(sort $(filter-out main
,$(MOD_SUBDIRS
))); do
$(SUBMAKE
) -C
$${dir} SUBDIR
=$${dir} moduleinfo
>> $@
; done
859 @for
dir in
$(sort $(filter-out main
,$(MOD_SUBDIRS
))); do
$(SUBMAKE
) -C
$${dir} SUBDIR
=$${dir} makeopts
>> $@
; done
860 @cat build_tools
/cflags.xml
>> $@
861 @if
[ "${AST_DEVMODE}" = "yes" ]; then \
862 cat build_tools
/cflags-devmode.xml
>> $@
; \
864 @cat build_tools
/embed_modules.xml
>> $@
865 @cat sounds
/sounds.xml
>> $@
866 @echo
"</menu>" >> $@
870 $(MAKE
) -C doc
/tex asterisk.pdf
872 .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 main
/version.c
include/asterisk
/version.h
installdirs