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
90 ASTTOPDIR
:=$(shell pwd
)
92 # Overwite config files on "make samples"
95 # Include debug and macro symbols in the executables (-g) and profiling info (-pg)
99 # Files are copied here temporarily during the install process
100 # For example, make DESTDIR=/tmp/asterisk woud put things in
101 # /tmp/asterisk/etc/asterisk
102 # !!! Watch out, put no spaces or comments after the value !!!
103 #DESTDIR?=/tmp/asterisk
105 # Define standard directories for various platforms
106 # These apply if they are not redefined in asterisk.conf
107 ifeq ($(OSARCH
),SunOS
)
108 ASTETCDIR
=/var
/etc
/asterisk
109 ASTLIBDIR
=/opt
/asterisk
/lib
110 ASTVARLIBDIR
=/var
/opt
/asterisk
111 ASTSPOOLDIR
=/var
/spool
/asterisk
112 ASTLOGDIR
=/var
/log
/asterisk
113 ASTHEADERDIR
=/opt
/asterisk
/include
114 ASTBINDIR
=/opt
/asterisk
/bin
115 ASTSBINDIR
=/opt
/asterisk
/sbin
116 ASTVARRUNDIR
=/var
/run
/asterisk
117 ASTMANDIR
=/opt
/asterisk
/man
119 ASTETCDIR
=$(sysconfdir
)/asterisk
120 ASTLIBDIR
=$(libdir)/asterisk
121 ASTHEADERDIR
=$(includedir)/asterisk
123 ASTSBINDIR
=$(sbindir
)
124 ASTSPOOLDIR
=$(localstatedir
)/spool
/asterisk
125 ASTLOGDIR
=$(localstatedir
)/log
/asterisk
126 ASTVARRUNDIR
=$(localstatedir
)/run
128 ifneq ($(findstring BSD
,$(OSARCH
)),)
129 ASTVARLIBDIR
=$(prefix)/share
/asterisk
130 ASTVARRUNDIR
=$(localstatedir
)/run
/asterisk
132 ASTVARLIBDIR
=$(localstatedir
)/lib
/asterisk
135 ifeq ($(ASTDATADIR
),)
136 ASTDATADIR
:=$(ASTVARLIBDIR
)
139 # Asterisk.conf is located in ASTETCDIR or by using the -C flag
140 # when starting Asterisk
141 ASTCONFPATH
=$(ASTETCDIR
)/asterisk.conf
142 MODULES_DIR
=$(ASTLIBDIR
)/modules
143 AGI_DIR
=$(ASTDATADIR
)/agi-bin
145 # If you use Apache, you may determine by a grep 'DocumentRoot' of your httpd.conf file
146 HTTP_DOCSDIR
=/var
/www
/html
147 # Determine by a grep 'ScriptAlias' of your Apache httpd.conf file
148 HTTP_CGIDIR
=/var
/www
/cgi-bin
150 # Uncomment this to use the older DSP routines
151 #ASTCFLAGS+=-DOLD_DSP_ROUTINES
153 # If the file .asterisk.makeopts is present in your home directory, you can
154 # include all of your favorite menuselect options so that every time you download
155 # a new version of Asterisk, you don't have to run menuselect to set them.
156 # The file /etc/asterisk.makeopts will also be included but can be overridden
157 # by the file in your home directory.
159 GLOBAL_MAKEOPTS
=$(wildcard /etc
/asterisk.makeopts
)
160 USER_MAKEOPTS
=$(wildcard ~
/.asterisk.makeopts
)
162 MOD_SUBDIR_CFLAGS
=-I
$(ASTTOPDIR
)/include
163 OTHER_SUBDIR_CFLAGS
=-I
$(ASTTOPDIR
)/include
165 ifeq ($(OSARCH
),linux-gnu
)
166 ifeq ($(PROC
),x86_64
)
167 # You must have GCC 3.4 to use k8, otherwise use athlon
172 ifeq ($(PROC
),sparc64
)
173 #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
174 #This works for even old (2.96) versions of gcc and provides a small boost either way.
175 #A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
176 #So we go lowest common available by gcc and go a step down, still a step up from
177 #the default as we now have a better instruction set to work with. - Belgarath
179 OPTIONS
+=$(shell if
$(CC
) -mtune
=$(PROC
) -S
-o
/dev
/null
-xc
/dev
/null
>/dev
/null
2>&1; then echo
"-mtune=$(PROC)"; fi
)
180 OPTIONS
+=$(shell if
$(CC
) -mcpu
=v8
-S
-o
/dev
/null
-xc
/dev
/null
>/dev
/null
2>&1; then echo
"-mcpu=v8"; fi
)
181 OPTIONS
+=-fomit-frame-pointer
185 # The Cirrus logic is the only heavily shipping arm processor with a real floating point unit
186 ifeq ($(SUB_PROC
),maverick
)
187 OPTIONS
+=-fsigned-char
-mcpu
=ep9312
189 ifeq ($(SUB_PROC
),xscale
)
190 OPTIONS
+=-fsigned-char
-mcpu
=xscale
192 OPTIONS
+=-fsigned-char
198 ifeq ($(findstring -save-temps
,$(ASTCFLAGS
)),)
202 ASTCFLAGS
+=-Wall
-Wstrict-prototypes
-Wmissing-prototypes
-Wmissing-declarations
$(DEBUG
)
204 ASTCFLAGS
+=-include $(ASTTOPDIR
)/include/asterisk
/autoconfig.h
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
)
246 RPMVERSION
:=$(shell sed
's/[-\/:]/_/g' .version
)
251 ifneq ($(wildcard .svn
),)
252 ASTERISKVERSIONNUM
=999999
255 ASTCFLAGS
+=$(MALLOC_DEBUG
)$(BUSYDETECT
)$(OPTIONS
)
257 MOD_SUBDIRS
:=res channels pbx apps codecs formats cdr funcs main
258 OTHER_SUBDIRS
:=utils agi
259 SUBDIRS
:=$(OTHER_SUBDIRS
) $(MOD_SUBDIRS
)
260 SUBDIRS_INSTALL
:=$(SUBDIRS
:%=%-install)
261 SUBDIRS_CLEAN
:=$(SUBDIRS
:%=%-clean)
262 SUBDIRS_DIST_CLEAN
:=$(SUBDIRS
:%=%-dist-clean
)
263 SUBDIRS_UNINSTALL
:=$(SUBDIRS
:%=%-uninstall)
264 MOD_SUBDIRS_EMBED_LDSCRIPT
:=$(MOD_SUBDIRS
:%=%-embed-ldscript
)
265 MOD_SUBDIRS_EMBED_LDFLAGS
:=$(MOD_SUBDIRS
:%=%-embed-ldflags
)
266 MOD_SUBDIRS_EMBED_LIBS
:=$(MOD_SUBDIRS
:%=%-embed-libs
)
267 MOD_SUBDIRS_MENUSELECT_TREE
:=$(MOD_SUBDIRS
:%=%-menuselect-tree
)
269 ifneq ($(findstring darwin
,$(OSARCH
)),)
270 ASTCFLAGS
+=-D__Darwin__
271 AUDIO_LIBS
=-framework CoreAudio
272 SOLINK
=-dynamic
-bundle
-undefined suppress
-force_flat_namespace
274 # These are used for all but Darwin
275 SOLINK
=-shared
-Xlinker
-x
276 ifneq ($(findstring BSD
,$(OSARCH
)),)
277 LDFLAGS
+=-L
/usr
/local
/lib
281 ifeq ($(OSARCH
),SunOS
)
282 SOLINK
=-shared
-fpic
-L
/usr
/local
/ssl
/lib
285 SUBMAKE
=$(MAKE
) --quiet
--no-print-directory
287 # This is used when generating the doxygen documentation
295 @echo
" +--------- Asterisk Build Complete ---------+"
296 @echo
" + Asterisk has successfully been built, and +"
297 @echo
" + can be installed by running: +"
299 ifeq ($(MAKE
), gmake
)
300 @echo
" + $(MAKE) install +"
302 @echo
" + $(MAKE) install +"
304 @echo
" +-------------------------------------------+"
306 _all
: cleantest
$(SUBDIRS
)
310 @echo
"**** The configure script must be executed before running '$(MAKE)'."
311 @echo
"**** Please run \"./configure\"."
315 menuselect.makeopts
: menuselect
/menuselect menuselect-tree
316 menuselect
/menuselect
--check-deps
$(GLOBAL_MAKEOPTS
) $(USER_MAKEOPTS
) menuselect.makeopts
318 $(MOD_SUBDIRS_EMBED_LDSCRIPT
):
319 @echo
"EMBED_LDSCRIPTS+="`$(SUBMAKE) -C $(@:-embed-ldscript=) SUBDIR=$(@:-embed-ldscript=) __embed_ldscript` >> makeopts.embed_rules
321 $(MOD_SUBDIRS_EMBED_LDFLAGS
):
322 @echo
"EMBED_LDFLAGS+="`$(SUBMAKE) -C $(@:-embed-ldflags=) SUBDIR=$(@:-embed-ldflags=) __embed_ldflags` >> makeopts.embed_rules
324 $(MOD_SUBDIRS_EMBED_LIBS
):
325 @echo
"EMBED_LIBS+="`$(SUBMAKE) -C $(@:-embed-libs=) SUBDIR=$(@:-embed-libs=) __embed_libs` >> makeopts.embed_rules
327 $(MOD_SUBDIRS_MENUSELECT_TREE
):
328 @
$(SUBMAKE
) -C
$(@
:-menuselect-tree
=) SUBDIR
=$(@
:-menuselect-tree
=) moduleinfo
329 @
$(SUBMAKE
) -C
$(@
:-menuselect-tree
=) SUBDIR
=$(@
:-menuselect-tree
=) makeopts
331 makeopts.embed_rules
: menuselect.makeopts
332 @echo
"Generating embedded module rules ..."
334 @
$(MAKE
) --no-print-directory
$(MOD_SUBDIRS_EMBED_LDSCRIPT
)
335 @
$(MAKE
) --no-print-directory
$(MOD_SUBDIRS_EMBED_LDFLAGS
)
336 @
$(MAKE
) --no-print-directory
$(MOD_SUBDIRS_EMBED_LIBS
)
338 $(SUBDIRS
): include/asterisk
/version.h
include/asterisk
/buildopts.h defaults.h makeopts.embed_rules
340 # ensure that all module subdirectories are processed before 'main' during
341 # a parallel build, since if there are modules selected to be embedded the
342 # directories containing them must be completed before the main Asterisk
343 # binary can be built
344 main
: $(filter-out main
,$(MOD_SUBDIRS
))
347 @ASTCFLAGS
="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS
="$(ASTLDFLAGS)" AST_LIBS
="$(AST_LIBS)" $(MAKE
) --no-print-directory
--no-builtin-rules
-C
$@ SUBDIR
=$@
all
350 @ASTCFLAGS
="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS
="$(ASTLDFLAGS)" AUDIO_LIBS
="$(AUDIO_LIBS)" $(MAKE
) --no-print-directory
--no-builtin-rules
-C
$@ SUBDIR
=$@
all
353 @build_tools
/make_defaults_h
> $@.tmp
354 @if cmp
-s
$@.tmp
$@
; then
: ; else \
359 include/asterisk
/version.h
:
360 @build_tools
/make_version_h
> $@.tmp
361 @if cmp
-s
$@.tmp
$@
; then
: ; else \
366 include/asterisk
/buildopts.h
: menuselect.makeopts
367 @build_tools
/make_buildopts_h
> $@.tmp
368 @if cmp
-s
$@.tmp
$@
; then
: ; else \
374 @
$(MAKE
) --no-print-directory
-C
$(@
:-clean=) clean
376 $(SUBDIRS_DIST_CLEAN
):
377 @
$(MAKE
) --no-print-directory
-C
$(@
:-dist-clean
=) dist-clean
379 clean: $(SUBDIRS_CLEAN
)
381 rm -f
include/asterisk
/build.h
382 rm -f
include/asterisk
/version.h
383 @
$(MAKE
) -C menuselect
clean
384 cp
-f .cleancount .lastclean
386 dist-clean
: distclean
388 distclean: $(SUBDIRS_DIST_CLEAN
) clean
389 @
$(MAKE
) -C menuselect dist-clean
390 @
$(MAKE
) -C sounds dist-clean
391 rm -f menuselect.makeopts makeopts menuselect-tree menuselect.makedeps
392 rm -f makeopts.embed_rules
393 rm -f config.log config.status
394 rm -rf autom4te.cache
395 rm -f
include/asterisk
/autoconfig.h
396 rm -f
include/asterisk
/buildopts.h
398 rm -f build_tools
/menuselect-deps
401 if
[ x
`$(ID) -un` = xroot
]; then CFLAGS
="$(ASTCFLAGS)" sh build_tools
/mkpkgconfig
$(DESTDIR
)/usr
/lib
/pkgconfig
; fi
402 # Should static HTTP be installed during make samples or even with its own target ala
403 # webvoicemail? There are portions here that *could* be customized but might also be
404 # improved a lot. I'll put it here for now.
405 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/static-http
406 for x in static-http
/*; do \
407 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTDATADIR
)/static-http
; \
409 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/images
410 for x in images
/*.jpg
; do \
411 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTDATADIR
)/images
; \
413 mkdir
-p
$(DESTDIR
)$(AGI_DIR
)
414 $(MAKE
) -C sounds
install
417 @if
[ -d .svn
]; then \
418 echo
"Updating from Subversion..." ; \
419 svn update | tee update.out
; \
421 if
[ `grep -c ^C update.out` -gt
0 ]; then \
422 echo
; echo
"The following files have conflicts:" ; \
423 grep ^C update.out | cut
-b4-
; \
427 echo
"Not under version control"; \
430 NEWHEADERS
=$(notdir $(wildcard include/asterisk
/*.h
))
431 OLDHEADERS
=$(filter-out $(NEWHEADERS
),$(notdir $(wildcard $(DESTDIR
)$(ASTHEADERDIR
)/*.h
)))
434 mkdir
-p
$(DESTDIR
)$(MODULES_DIR
)
435 mkdir
-p
$(DESTDIR
)$(ASTSBINDIR
)
436 mkdir
-p
$(DESTDIR
)$(ASTETCDIR
)
437 mkdir
-p
$(DESTDIR
)$(ASTBINDIR
)
438 mkdir
-p
$(DESTDIR
)$(ASTVARRUNDIR
)
439 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/voicemail
440 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/dictate
441 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/system
442 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/tmp
443 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/meetme
444 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/monitor
445 $(INSTALL
) -m
755 main
/asterisk
$(DESTDIR
)$(ASTSBINDIR
)/
446 $(LN
) -sf asterisk
$(DESTDIR
)$(ASTSBINDIR
)/rasterisk
447 $(INSTALL
) -m
755 contrib
/scripts
/astgenkey
$(DESTDIR
)$(ASTSBINDIR
)/
448 $(INSTALL
) -m
755 contrib
/scripts
/autosupport
$(DESTDIR
)$(ASTSBINDIR
)/
449 if
[ ! -f
$(DESTDIR
)$(ASTSBINDIR
)/safe_asterisk
]; then \
450 cat contrib
/scripts
/safe_asterisk | sed
's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;' > $(DESTDIR
)$(ASTSBINDIR
)/safe_asterisk
;\
451 chmod
755 $(DESTDIR
)$(ASTSBINDIR
)/safe_asterisk
;\
453 $(INSTALL
) -d
$(DESTDIR
)$(ASTHEADERDIR
)
454 $(INSTALL
) -m
644 include/asterisk.h
$(DESTDIR
)$(includedir)
455 $(INSTALL
) -m
644 include/asterisk
/*.h
$(DESTDIR
)$(ASTHEADERDIR
)
456 if
[ -n
"$(OLDHEADERS)" ]; then \
457 rm -f
$(addprefix $(DESTDIR
)$(ASTHEADERDIR
)/,$(OLDHEADERS
)) ;\
459 mkdir
-p
$(DESTDIR
)$(ASTLOGDIR
)/cdr-csv
460 mkdir
-p
$(DESTDIR
)$(ASTLOGDIR
)/cdr-custom
461 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/keys
462 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/firmware
463 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/firmware
/iax
464 mkdir
-p
$(DESTDIR
)$(ASTMANDIR
)/man8
465 $(INSTALL
) -m
644 keys
/iaxtel.pub
$(DESTDIR
)$(ASTDATADIR
)/keys
466 $(INSTALL
) -m
644 keys
/freeworlddialup.pub
$(DESTDIR
)$(ASTDATADIR
)/keys
467 $(INSTALL
) -m
644 doc
/asterisk
.8 $(DESTDIR
)$(ASTMANDIR
)/man8
468 $(INSTALL
) -m
644 contrib
/scripts
/astgenkey
.8 $(DESTDIR
)$(ASTMANDIR
)/man8
469 $(INSTALL
) -m
644 contrib
/scripts
/autosupport
.8 $(DESTDIR
)$(ASTMANDIR
)/man8
470 $(INSTALL
) -m
644 contrib
/scripts
/safe_asterisk
.8 $(DESTDIR
)$(ASTMANDIR
)/man8
471 if
[ -f contrib
/firmware
/iax
/iaxy.bin
] ; then \
472 $(INSTALL
) -m
644 contrib
/firmware
/iax
/iaxy.bin
$(DESTDIR
)$(ASTDATADIR
)/firmware
/iax
/iaxy.bin
; \
476 @DESTDIR
="$(DESTDIR)" ASTSBINDIR
="$(ASTSBINDIR)" $(MAKE
) -C
$(@
:-install=) install
478 NEWMODS
=$(notdir $(wildcard */*.so
))
479 OLDMODS
=$(filter-out $(NEWMODS
),$(notdir $(wildcard $(DESTDIR
)$(MODULES_DIR
)/*.so
)))
482 @if
[ -n
"$(OLDMODS)" ]; then \
483 echo
" WARNING WARNING WARNING" ;\
485 echo
" Your Asterisk modules directory, located at" ;\
486 echo
" $(DESTDIR)$(MODULES_DIR)" ;\
487 echo
" contains modules that were not installed by this " ;\
488 echo
" version of Asterisk. Please ensure that these" ;\
489 echo
" modules are compatible with this version before" ;\
490 echo
" attempting to run Asterisk." ;\
492 for f in
$(OLDMODS
); do \
496 echo
" WARNING WARNING WARNING" ;\
499 install: datafiles bininstall
$(SUBDIRS_INSTALL
)
500 @if
[ -x
/usr
/sbin
/asterisk-post-install
]; then \
501 /usr
/sbin
/asterisk-post-install
$(DESTDIR
) .
; \
503 @echo
" +---- Asterisk Installation Complete -------+"
505 @echo
" + YOU MUST READ THE SECURITY DOCUMENT +"
507 @echo
" + Asterisk has successfully been installed. +"
508 @echo
" + If you would like to install the sample +"
509 @echo
" + configuration files (overwriting any +"
510 @echo
" + existing config files), run: +"
512 ifeq ($(MAKE
), gmake
)
513 @echo
" + $(MAKE) samples +"
515 @echo
" + $(MAKE) samples +"
518 @echo
" +----------------- or ---------------------+"
520 @echo
" + You can go ahead and install the asterisk +"
521 @echo
" + program documentation now or later run: +"
523 ifeq ($(MAKE
), gmake
)
524 @echo
" + $(MAKE) progdocs +"
526 @echo
" + $(MAKE) progdocs +"
529 @echo
" + **Note** This requires that you have +"
530 @echo
" + doxygen installed on your local system +"
531 @echo
" +-------------------------------------------+"
532 @
$(MAKE
) -s oldmodcheck
537 mkdir
-p
$(DESTDIR
)$(ASTETCDIR
)
538 for x in configs
/*.adsi
; do \
539 if
[ ! -f
$(DESTDIR
)$(ASTETCDIR
)/$$x ]; then \
540 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTETCDIR
)/`$(BASENAME) $$x` ; \
545 mkdir
-p
$(DESTDIR
)$(ASTETCDIR
)
546 for x in configs
/*.sample
; do \
547 if
[ -f
$(DESTDIR
)$(ASTETCDIR
)/`$(BASENAME) $$x .sample` ]; then \
548 if
[ "$(OVERWRITE)" = "y" ]; then \
549 if cmp
-s
$(DESTDIR
)$(ASTETCDIR
)/`$(BASENAME) $$x .sample` $$x ; then \
550 echo
"Config file $$x is unchanged"; \
553 mv
-f
$(DESTDIR
)$(ASTETCDIR
)/`$(BASENAME) $$x .sample` $(DESTDIR
)$(ASTETCDIR
)/`$(BASENAME) $$x .sample`.old
; \
555 echo
"Skipping config file $$x"; \
559 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTETCDIR
)/`$(BASENAME) $$x .sample` ;\
561 if
[ "$(OVERWRITE)" = "y" ] ||
[ ! -f
$(DESTDIR
)$(ASTCONFPATH
) ]; then \
563 echo
"[directories]" ; \
564 echo
"astetcdir => $(ASTETCDIR)" ; \
565 echo
"astmoddir => $(MODULES_DIR)" ; \
566 echo
"astvarlibdir => $(ASTVARLIBDIR)" ; \
567 echo
"astdatadir => $(ASTDATADIR)" ; \
568 echo
"astagidir => $(AGI_DIR)" ; \
569 echo
"astspooldir => $(ASTSPOOLDIR)" ; \
570 echo
"astrundir => $(ASTVARRUNDIR)" ; \
571 echo
"astlogdir => $(ASTLOGDIR)" ; \
573 echo
";[options]" ; \
574 echo
";verbose = 3" ; \
575 echo
";debug = 3" ; \
576 echo
";alwaysfork = yes ; same as -F at startup" ; \
577 echo
";nofork = yes ; same as -f at startup" ; \
578 echo
";quiet = yes ; same as -q at startup" ; \
579 echo
";timestamp = yes ; same as -T at startup" ; \
580 echo
";execincludes = yes ; support #exec in config files" ; \
581 echo
";console = yes ; Run as console (same as -c at startup)" ; \
582 echo
";highpriority = yes ; Run realtime priority (same as -p at startup)" ; \
583 echo
";initcrypto = yes ; Initialize crypto keys (same as -i at startup)" ; \
584 echo
";nocolor = yes ; Disable console colors" ; \
585 echo
";dontwarn = yes ; Disable some warnings" ; \
586 echo
";dumpcore = yes ; Dump core on crash (same as -g at startup)" ; \
587 echo
";languageprefix = yes ; Use the new sound prefix path syntax" ; \
588 echo
";internal_timing = yes" ; \
589 echo
";systemname = my_system_name ; prefix uniqueid with a system name for global uniqueness issues" ; \
590 echo
";maxcalls = 10 ; Maximum amount of calls allowed" ; \
591 echo
";maxload = 0.9 ; Asterisk stops accepting new calls if the load average exceed this limit" ; \
592 echo
";cache_record_files = yes ; Cache recorded sound files to another directory during recording" ; \
593 echo
";record_cache_dir = /tmp ; Specify cache directory (used in cnjunction with cache_record_files)" ; \
594 echo
";transmit_silence_during_record = yes ; Transmit SLINEAR silence while a channel is being recorded" ; \
595 echo
";transcode_via_sln = yes ; Build transcode paths via SLINEAR, instead of directly" ; \
596 echo
";runuser = asterisk ; The user to run as" ; \
597 echo
";rungroup = asterisk ; The group to run as" ; \
599 echo
"; Changing the following lines may compromise your security." ; \
601 echo
";astctlpermissions = 0660" ; \
602 echo
";astctlowner = root" ; \
603 echo
";astctlgroup = apache" ; \
604 echo
";astctl = asterisk.ctl" ; \
605 ) > $(DESTDIR
)$(ASTCONFPATH
) ; \
607 echo
"Skipping asterisk.conf creation"; \
609 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/voicemail
/default
/1234/INBOX
610 build_tools
/make_sample_voicemail
$(DESTDIR
)/$(ASTDATADIR
) $(DESTDIR
)/$(ASTSPOOLDIR
)
613 @
[ -d
$(DESTDIR
)$(HTTP_DOCSDIR
)/ ] ||
( printf
"http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit
1 )
614 @
[ -d
$(DESTDIR
)$(HTTP_CGIDIR
) ] ||
( printf
"cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit
1 )
615 $(INSTALL
) -m
4755 -o root
-g root contrib
/scripts
/vmail.cgi
$(DESTDIR
)$(HTTP_CGIDIR
)/vmail.cgi
616 mkdir
-p
$(DESTDIR
)$(HTTP_DOCSDIR
)/_asterisk
617 for x in images
/*.gif
; do \
618 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(HTTP_DOCSDIR
)/_asterisk
/; \
620 @echo
" +--------- Asterisk Web Voicemail ----------+"
622 @echo
" + Asterisk Web Voicemail is installed in +"
623 @echo
" + your cgi-bin directory: +"
624 @echo
" + $(DESTDIR)$(HTTP_CGIDIR)"
625 @echo
" + IT USES A SETUID ROOT PERL SCRIPT, SO +"
626 @echo
" + IF YOU DON'T LIKE THAT, UNINSTALL IT! +"
628 @echo
" + Other static items have been stored in: +"
629 @echo
" + $(DESTDIR)$(HTTP_DOCSDIR)"
631 @echo
" + If these paths do not match your httpd +"
632 @echo
" + installation, correct the definitions +"
633 @echo
" + in your Makefile of HTTP_CGIDIR and +"
634 @echo
" + HTTP_DOCSDIR +"
636 @echo
" +-------------------------------------------+"
639 sed
"s/^Version:.*/Version: $(RPMVERSION)/g" redhat
/asterisk.spec
> asterisk.spec
; \
643 __rpm
: include/asterisk
/version.h
include/asterisk
/buildopts.h spec
644 rm -rf
/tmp
/asterisk
; \
645 mkdir
-p
/tmp
/asterisk
/redhat
/RPMS
/i386
; \
646 $(MAKE
) DESTDIR
=/tmp
/asterisk
install ; \
647 $(MAKE
) DESTDIR
=/tmp
/asterisk samples
; \
648 mkdir
-p
/tmp
/asterisk
/etc
/rc.d
/init.d
; \
649 cp
-f contrib
/init.d
/rc.redhat.asterisk
/tmp
/asterisk
/etc
/rc.d
/init.d
/asterisk
; \
650 rpmbuild
--rcfile
/usr
/lib
/rpm
/rpmrc
:redhat
/rpmrc
-bb asterisk.spec
653 (cat contrib
/asterisk-ng-doxygen
; echo
"HAVE_DOT=$(HAVEDOT)"; \
654 echo
"PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen
-
657 @if
[ "${OSARCH}" = "linux-gnu" ]; then \
658 if
[ -f
/etc
/redhat-release
-o
-f
/etc
/fedora-release
]; then \
659 $(INSTALL
) -m
755 contrib
/init.d
/rc.redhat.asterisk
$(DESTDIR
)/etc
/rc.d
/init.d
/asterisk
; \
660 if
[ -z
"$(DESTDIR)" ]; then
/sbin
/chkconfig
--add asterisk
; fi
; \
661 elif
[ -f
/etc
/debian_version
]; then \
662 $(INSTALL
) -m
755 contrib
/init.d
/rc.debian.asterisk
$(DESTDIR
)/etc
/init.d
/asterisk
; \
663 if
[ -z
"$(DESTDIR)" ]; then
/usr
/sbin
/update-rc.d asterisk start
50 2 3 4 5 . stop
91 2 3 4 5 .
; fi
; \
664 elif
[ -f
/etc
/gentoo-release
]; then \
665 $(INSTALL
) -m
755 contrib
/init.d
/rc.gentoo.asterisk
$(DESTDIR
)/etc
/init.d
/asterisk
; \
666 if
[ -z
"$(DESTDIR)" ]; then
/sbin
/rc-update add asterisk default
; fi
; \
667 elif
[ -f
/etc
/mandrake-release
-o
-f
/etc
/mandriva-release
]; then \
668 $(INSTALL
) -m
755 contrib
/init.d
/rc.mandrake.asterisk
$(DESTDIR
)/etc
/rc.d
/init.d
/asterisk
; \
669 if
[ -z
"$(DESTDIR)" ]; then
/sbin
/chkconfig
--add asterisk
; fi
; \
670 elif
[ -f
/etc
/SuSE-release
-o
-f
/etc
/novell-release
]; then \
671 $(INSTALL
) -m
755 contrib
/init.d
/rc.suse.asterisk
$(DESTDIR
)/etc
/init.d
/asterisk
; \
672 if
[ -z
"$(DESTDIR)" ]; then
/sbin
/chkconfig
--add asterisk
; fi
; \
673 elif
[ -f
/etc
/slackware-version
]; then \
674 echo
"Slackware is not currently supported, although an init script does exist for it." \
676 echo
"We could not install init scripts for your distribution."; \
679 echo
"We could not install init scripts for your operating system."; \
683 $(MAKE
) -C sounds
all
685 # If the cleancount has been changed, force a make clean.
686 # .cleancount is the global clean count, and .lastclean is the
687 # last clean count we had
690 @cmp
-s .cleancount .lastclean ||
$(MAKE
) clean
692 $(SUBDIRS_UNINSTALL
):
693 @
$(MAKE
) --no-print-directory
-C
$(@
:-uninstall=) uninstall
695 _uninstall
: $(SUBDIRS_UNINSTALL
)
696 rm -f
$(DESTDIR
)$(MODULES_DIR
)/*
697 rm -f
$(DESTDIR
)$(ASTSBINDIR
)/*asterisk
*
698 rm -f
$(DESTDIR
)$(ASTSBINDIR
)/astgenkey
699 rm -f
$(DESTDIR
)$(ASTSBINDIR
)/autosupport
700 rm -rf
$(DESTDIR
)$(ASTHEADERDIR
)
701 rm -rf
$(DESTDIR
)$(ASTDATADIR
)/firmware
702 rm -f
$(DESTDIR
)$(ASTMANDIR
)/man8
/asterisk
.8
703 rm -f
$(DESTDIR
)$(ASTMANDIR
)/man8
/astgenkey
.8
704 rm -f
$(DESTDIR
)$(ASTMANDIR
)/man8
/autosupport
.8
705 rm -f
$(DESTDIR
)$(ASTMANDIR
)/man8
/safe_asterisk
.8
706 $(MAKE
) -C sounds
uninstall
708 uninstall: _uninstall
709 @echo
" +--------- Asterisk Uninstall Complete -----+"
710 @echo
" + Asterisk binaries, sounds, man pages, +"
711 @echo
" + headers, modules, and firmware builds, +"
712 @echo
" + have all been uninstalled. +"
714 @echo
" + To remove ALL traces of Asterisk, +"
715 @echo
" + including configuration, spool +"
716 @echo
" + directories, and logs, run the following +"
717 @echo
" + command: +"
719 ifeq ($(MAKE
), gmake
)
720 @echo
" + $(MAKE) uninstall-all +"
722 @echo
" + $(MAKE) uninstall-all +"
724 @echo
" +-------------------------------------------+"
726 uninstall-all
: _uninstall
727 rm -rf
$(DESTDIR
)$(ASTLIBDIR
)
728 rm -rf
$(DESTDIR
)$(ASTVARLIBDIR
)
729 rm -rf
$(DESTDIR
)$(ASTDATADIR
)
730 rm -rf
$(DESTDIR
)$(ASTSPOOLDIR
)
731 rm -rf
$(DESTDIR
)$(ASTETCDIR
)
732 rm -rf
$(DESTDIR
)$(ASTLOGDIR
)
734 menuconfig
: menuselect
736 gmenuconfig
: gmenuselect
738 menuselect
: menuselect
/menuselect menuselect-tree
739 -@menuselect
/menuselect
$(GLOBAL_MAKEOPTS
) $(USER_MAKEOPTS
) menuselect.makeopts
&& (echo
"menuselect changes saved!"; rm -f channels
/h323
/Makefile.ast main
/asterisk
) || echo
"menuselect changes NOT saved!"
741 gmenuselect
: menuselect
/gmenuselect menuselect-tree
742 -@menuselect
/gmenuselect
$(GLOBAL_MAKEOPTS
) $(USER_MAKEOPTS
) menuselect.makeopts
&& (echo
"menuselect changes saved!"; rm -f channels
/h323
/Makefile.ast main
/asterisk
) || echo
"menuselect changes NOT saved!"
744 menuselect
/menuselect
: makeopts menuselect
/menuselect.c menuselect
/menuselect_curses.c menuselect
/menuselect_stub.c menuselect
/menuselect.h menuselect
/linkedlists.h makeopts
745 @CC
="$(HOST_CC)" LD
="" AR
="" RANLIB
="" CFLAGS
="" $(MAKE
) -C menuselect CONFIGURE_SILENT
="--silent"
747 menuselect
/gmenuselect
: makeopts menuselect
/menuselect.c menuselect
/menuselect_gtk.c menuselect
/menuselect_stub.c menuselect
/menuselect.h menuselect
/linkedlists.h makeopts
748 @CC
="$(HOST_CC)" CXX
="$(CXX)" LD
="" AR
="" RANLIB
="" CFLAGS
="" $(MAKE
) -C menuselect _gmenuselect CONFIGURE_SILENT
="--silent"
750 menuselect-tree
: $(foreach dir,$(filter-out main
,$(MOD_SUBDIRS
)),$(wildcard $(dir)/*.c
) $(wildcard $(dir)/*.
cc)) build_tools
/cflags.xml sounds
/sounds.xml build_tools
/embed_modules.xml configure
751 @echo
"Generating input for menuselect ..."
752 @echo
"<?xml version=\"1.0\"?>" > $@
754 @echo
"<menu name=\"Asterisk Module and Build Option Selection\">" >> $@
755 @for
dir in
$(sort $(filter-out main
,$(MOD_SUBDIRS
))); do
$(SUBMAKE
) -C
$${dir} SUBDIR
=$${dir} moduleinfo
>> $@
; done
756 @for
dir in
$(sort $(filter-out main
,$(MOD_SUBDIRS
))); do
$(SUBMAKE
) -C
$${dir} SUBDIR
=$${dir} makeopts
>> $@
; done
757 @cat build_tools
/cflags.xml
>> $@
758 @cat build_tools
/embed_modules.xml
>> $@
759 @cat sounds
/sounds.xml
>> $@
760 @echo
"</menu>" >> $@
762 .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
) menuselect.makeopts
include/asterisk
/version.h