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
63 # even though we could use '-include makeopts' here, use a wildcard
64 # lookup anyway, so that make won't try to build makeopts if it doesn't
65 # exist (other rules will force it to be built if needed)
66 ifneq ($(wildcard makeopts
),)
70 #Uncomment this to see all build commands instead of 'quiet' output
73 # Create OPTIONS variable
76 ASTTOPDIR
:=$(shell pwd
)
78 # Overwite config files on "make samples"
81 # Include debug and macro symbols in the executables (-g) and profiling info (-pg)
85 # Files are copied here temporarily during the install process
86 # For example, make DESTDIR=/tmp/asterisk woud put things in
87 # /tmp/asterisk/etc/asterisk
88 # !!! Watch out, put no spaces or comments after the value !!!
89 #DESTDIR?=/tmp/asterisk
91 # Define standard directories for various platforms
92 # These apply if they are not redefined in asterisk.conf
93 ifeq ($(OSARCH
),SunOS
)
94 ASTETCDIR
=/var
/etc
/asterisk
95 ASTLIBDIR
=/opt
/asterisk
/lib
96 ASTVARLIBDIR
=/var
/opt
/asterisk
97 ASTSPOOLDIR
=/var
/spool
/asterisk
98 ASTLOGDIR
=/var
/log
/asterisk
99 ASTHEADERDIR
=/opt
/asterisk
/include
100 ASTBINDIR
=/opt
/asterisk
/bin
101 ASTSBINDIR
=/opt
/asterisk
/sbin
102 ASTVARRUNDIR
=/var
/run
/asterisk
103 ASTMANDIR
=/opt
/asterisk
/man
105 ASTETCDIR
=$(sysconfdir
)/asterisk
106 ASTLIBDIR
=$(libdir)/asterisk
107 ASTHEADERDIR
=$(includedir)/asterisk
109 ASTSBINDIR
=$(sbindir
)
110 ASTSPOOLDIR
=$(localstatedir
)/spool
/asterisk
111 ASTLOGDIR
=$(localstatedir
)/log
/asterisk
112 ASTVARRUNDIR
=$(localstatedir
)/run
114 ifeq ($(OSARCH
),FreeBSD
)
115 ASTVARLIBDIR
=$(prefix)/share
/asterisk
117 ASTVARLIBDIR
=$(localstatedir
)/lib
/asterisk
120 ifeq ($(ASTDATADIR
),)
121 ASTDATADIR
:=$(ASTVARLIBDIR
)
124 # Asterisk.conf is located in ASTETCDIR or by using the -C flag
125 # when starting Asterisk
126 ASTCONFPATH
=$(ASTETCDIR
)/asterisk.conf
127 MODULES_DIR
=$(ASTLIBDIR
)/modules
128 AGI_DIR
=$(ASTDATADIR
)/agi-bin
130 # If you use Apache, you may determine by a grep 'DocumentRoot' of your httpd.conf file
131 HTTP_DOCSDIR
=/var
/www
/html
132 # Determine by a grep 'ScriptAlias' of your Apache httpd.conf file
133 HTTP_CGIDIR
=/var
/www
/cgi-bin
135 # Uncomment this to use the older DSP routines
136 #ASTCFLAGS+=-DOLD_DSP_ROUTINES
138 # If the file .asterisk.makeopts is present in your home directory, you can
139 # include all of your favorite menuselect options so that every time you download
140 # a new version of Asterisk, you don't have to run menuselect to set them.
141 # The file /etc/asterisk.makeopts will also be included but can be overridden
142 # by the file in your home directory.
144 GLOBAL_MAKEOPTS
=$(wildcard /etc
/asterisk.makeopts
)
145 USER_MAKEOPTS
=$(wildcard ~
/.asterisk.makeopts
)
147 MOD_SUBDIR_CFLAGS
=-I
$(ASTTOPDIR
)/include
148 OTHER_SUBDIR_CFLAGS
=-I
$(ASTTOPDIR
)/include
150 ifeq ($(OSARCH
),linux-gnu
)
151 ifeq ($(PROC
),x86_64
)
152 # You must have GCC 3.4 to use k8, otherwise use athlon
157 ifeq ($(PROC
),sparc64
)
158 #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
159 #This works for even old (2.96) versions of gcc and provides a small boost either way.
160 #A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
161 #So we go lowest common available by gcc and go a step down, still a step up from
162 #the default as we now have a better instruction set to work with. - Belgarath
164 OPTIONS
+=$(shell if
$(CC
) -mtune
=$(PROC
) -S
-o
/dev
/null
-xc
/dev
/null
>/dev
/null
2>&1; then echo
"-mtune=$(PROC)"; fi
)
165 OPTIONS
+=$(shell if
$(CC
) -mcpu
=v8
-S
-o
/dev
/null
-xc
/dev
/null
>/dev
/null
2>&1; then echo
"-mcpu=v8"; fi
)
166 OPTIONS
+=-fomit-frame-pointer
170 # The Cirrus logic is the only heavily shipping arm processor with a real floating point unit
171 ifeq ($(SUB_PROC
),maverick
)
172 OPTIONS
+=-fsigned-char
-mcpu
=ep9312
174 ifeq ($(SUB_PROC
),xscale
)
175 OPTIONS
+=-fsigned-char
-mcpu
=xscale
177 OPTIONS
+=-fsigned-char
183 ASTCFLAGS
+=-pipe
-Wall
-Wstrict-prototypes
-Wmissing-prototypes
-Wmissing-declarations
$(DEBUG
)
185 ASTCFLAGS
+=-include $(ASTTOPDIR
)/include/asterisk
/autoconfig.h
187 ifeq ($(AST_DEVMODE
),yes
)
188 ASTCFLAGS
+=-Werror
-Wunused
191 ifneq ($(findstring BSD
,$(OSARCH
)),)
192 ASTCFLAGS
+=-I
/usr
/local
/include
193 ASTLDFLAGS
+=-L
/usr
/local
/lib
196 ifneq ($(PROC
),ultrasparc
)
197 ASTCFLAGS
+=$(shell if
$(CC
) -march
=$(PROC
) -S
-o
/dev
/null
-xc
/dev
/null
>/dev
/null
2>&1; then echo
"-march=$(PROC)"; fi
)
201 ASTCFLAGS
+=-fsigned-char
204 ifeq ($(OSARCH
),FreeBSD
)
205 # -V is understood by BSD Make, not by GNU make.
206 BSDVERSION
=$(shell make
-V OSVERSION
-f
/usr
/share
/mk
/bsd.port.subdir.mk
)
207 ASTCFLAGS
+=$(shell if
test $(BSDVERSION
) -lt
500016 ; then echo
"-D_THREAD_SAFE"; fi
)
208 AST_LIBS
+=$(shell if
test $(BSDVERSION
) -lt
502102 ; then echo
"-lc_r"; else echo
"-pthread"; fi
)
211 ifeq ($(OSARCH
),NetBSD
)
212 ASTCFLAGS
+=-pthread
-I
/usr
/pkg
/include
215 ifeq ($(OSARCH
),OpenBSD
)
219 ifeq ($(OSARCH
),SunOS
)
220 ASTCFLAGS
+=-Wcast-align
-DSOLARIS
-I..
/include/solaris-compat
-I
/opt
/ssl
/include -I
/usr
/local
/ssl
/include
223 ASTERISKVERSION
:=$(shell build_tools
/make_version .
)
225 ifneq ($(wildcard .version
),)
226 ASTERISKVERSIONNUM
:=$(shell awk
-F.
'{printf "%02d%02d%02d", $$1, $$2, $$3}' .version
)
227 RPMVERSION
:=$(shell sed
's/[-\/:]/_/g' .version
)
232 ifneq ($(wildcard .svn
),)
233 ASTERISKVERSIONNUM
=999999
236 ASTCFLAGS
+=$(MALLOC_DEBUG
)$(BUSYDETECT
)$(OPTIONS
)
238 MOD_SUBDIRS
:=res channels pbx apps codecs formats cdr funcs main
239 OTHER_SUBDIRS
:=utils agi
240 SUBDIRS
:=$(OTHER_SUBDIRS
) $(MOD_SUBDIRS
)
241 SUBDIRS_INSTALL
:=$(SUBDIRS
:%=%-install)
242 SUBDIRS_CLEAN
:=$(SUBDIRS
:%=%-clean)
243 SUBDIRS_UNINSTALL
:=$(SUBDIRS
:%=%-uninstall)
244 MOD_SUBDIRS_EMBED_LDSCRIPT
:=$(MOD_SUBDIRS
:%=%-embed-ldscript
)
245 MOD_SUBDIRS_EMBED_LDFLAGS
:=$(MOD_SUBDIRS
:%=%-embed-ldflags
)
246 MOD_SUBDIRS_EMBED_LIBS
:=$(MOD_SUBDIRS
:%=%-embed-libs
)
248 ifneq ($(findstring darwin
,$(OSARCH
)),)
249 ASTCFLAGS
+=-D__Darwin__
250 AUDIO_LIBS
=-framework CoreAudio
251 SOLINK
=-dynamic
-bundle
-undefined suppress
-force_flat_namespace
253 # These are used for all but Darwin
254 SOLINK
=-shared
-Xlinker
-x
255 ifneq ($(findstring BSD
,$(OSARCH
)),)
256 LDFLAGS
+=-L
/usr
/local
/lib
260 ifeq ($(OSARCH
),SunOS
)
261 SOLINK
=-shared
-fpic
-L
/usr
/local
/ssl
/lib
264 # This is used when generating the doxygen documentation
272 @echo
" +--------- Asterisk Build Complete ---------+"
273 @echo
" + Asterisk has successfully been built, and +"
274 @echo
" + can be installed by running: +"
276 @echo
" + $(MAKE) install +"
277 @echo
" +-------------------------------------------+"
279 _all
: cleantest
$(SUBDIRS
)
283 @echo
"**** The configure script must be executed before running '$(MAKE)'."
287 menuselect.makeopts
: menuselect
/menuselect menuselect-tree
288 menuselect
/menuselect
--check-deps
$(GLOBAL_MAKEOPTS
) $(USER_MAKEOPTS
) menuselect.makeopts
290 $(MOD_SUBDIRS_EMBED_LDSCRIPT
):
291 @echo
"EMBED_LDSCRIPTS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-ldscript=) SUBDIR=$(@:-embed-ldscript=) __embed_ldscript` >> makeopts.embed_rules
293 $(MOD_SUBDIRS_EMBED_LDFLAGS
):
294 @echo
"EMBED_LDFLAGS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-ldflags=) SUBDIR=$(@:-embed-ldflags=) __embed_ldflags` >> makeopts.embed_rules
296 $(MOD_SUBDIRS_EMBED_LIBS
):
297 @echo
"EMBED_LIBS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-libs=) SUBDIR=$(@:-embed-libs=) __embed_libs` >> makeopts.embed_rules
299 makeopts.embed_rules
: menuselect.makeopts
300 @echo
"Generating embedded module rules ..."
302 @
$(MAKE
) --no-print-directory
$(MOD_SUBDIRS_EMBED_LDSCRIPT
)
303 @
$(MAKE
) --no-print-directory
$(MOD_SUBDIRS_EMBED_LDFLAGS
)
304 @
$(MAKE
) --no-print-directory
$(MOD_SUBDIRS_EMBED_LIBS
)
306 $(SUBDIRS
): include/asterisk
/version.h
include/asterisk
/buildopts.h defaults.h makeopts.embed_rules
308 # ensure that all module subdirectories are processed before 'main' during
309 # a parallel build, since if there are modules selected to be embedded the
310 # directories containing them must be completed before the main Asterisk
311 # binary can be built
312 main
: $(filter-out main
,$(MOD_SUBDIRS
))
315 @ASTCFLAGS
="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS
="$(ASTLDFLAGS)" AST_LIBS
="$(AST_LIBS)" $(MAKE
) --no-print-directory
--no-builtin-rules
-C
$@ SUBDIR
=$@
all
318 @ASTCFLAGS
="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS
="$(ASTLDFLAGS)" AUDIO_LIBS
="$(AUDIO_LIBS)" $(MAKE
) --no-print-directory
--no-builtin-rules
-C
$@ SUBDIR
=$@
all
321 @build_tools
/make_defaults_h
> $@.tmp
322 @if cmp
-s
$@.tmp
$@
; then
: ; else \
327 include/asterisk
/version.h
:
328 @build_tools
/make_version_h
> $@.tmp
329 @if cmp
-s
$@.tmp
$@
; then
: ; else \
334 include/asterisk
/buildopts.h
: menuselect.makeopts
335 @build_tools
/make_buildopts_h
> $@.tmp
336 @if cmp
-s
$@.tmp
$@
; then
: ; else \
342 @
$(MAKE
) --no-print-directory
-C
$(@
:-clean=) clean
344 clean: $(SUBDIRS_CLEAN
)
346 rm -f
include/asterisk
/build.h
347 rm -f
include/asterisk
/version.h
348 @
$(MAKE
) -C menuselect
clean
349 cp
-f .cleancount .lastclean
351 dist-clean
: distclean
354 @
$(MAKE
) -C menuselect dist-clean
355 @
$(MAKE
) -C sounds dist-clean
356 rm -f menuselect.makeopts makeopts menuselect-tree menuselect.makedeps
357 rm -f makeopts.embed_rules
358 rm -f config.log config.status
359 rm -rf autom4te.cache
360 rm -f
include/asterisk
/autoconfig.h
361 rm -f
include/asterisk
/buildopts.h
363 rm -f build_tools
/menuselect-deps
366 if
[ x
`$(ID) -un` = xroot
]; then CFLAGS
="$(ASTCFLAGS)" sh build_tools
/mkpkgconfig
$(DESTDIR
)/usr
/lib
/pkgconfig
; fi
367 # Should static HTTP be installed during make samples or even with its own target ala
368 # webvoicemail? There are portions here that *could* be customized but might also be
369 # improved a lot. I'll put it here for now.
370 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/static-http
371 for x in static-http
/*; do \
372 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTDATADIR
)/static-http
; \
374 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/images
375 for x in images
/*.jpg
; do \
376 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTDATADIR
)/images
; \
378 mkdir
-p
$(DESTDIR
)$(AGI_DIR
)
379 $(MAKE
) -C sounds
install
382 @if
[ -d .svn
]; then \
383 echo
"Updating from Subversion..." ; \
384 svn update | tee update.out
; \
386 if
[ `grep -c ^C update.out` -gt
0 ]; then \
387 echo
; echo
"The following files have conflicts:" ; \
388 grep ^C update.out | cut
-b4-
; \
392 echo
"Not under version control"; \
395 NEWHEADERS
=$(notdir $(wildcard include/asterisk
/*.h
))
396 OLDHEADERS
=$(filter-out $(NEWHEADERS
),$(notdir $(wildcard $(DESTDIR
)$(ASTHEADERDIR
)/*.h
)))
399 mkdir
-p
$(DESTDIR
)$(MODULES_DIR
)
400 mkdir
-p
$(DESTDIR
)$(ASTSBINDIR
)
401 mkdir
-p
$(DESTDIR
)$(ASTETCDIR
)
402 mkdir
-p
$(DESTDIR
)$(ASTBINDIR
)
403 mkdir
-p
$(DESTDIR
)$(ASTVARRUNDIR
)
404 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/voicemail
405 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/dictate
406 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/system
407 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/tmp
408 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/meetme
409 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/monitor
410 $(INSTALL
) -m
755 main
/asterisk
$(DESTDIR
)$(ASTSBINDIR
)/
411 $(LN
) -sf asterisk
$(DESTDIR
)$(ASTSBINDIR
)/rasterisk
412 $(INSTALL
) -m
755 contrib
/scripts
/astgenkey
$(DESTDIR
)$(ASTSBINDIR
)/
413 $(INSTALL
) -m
755 contrib
/scripts
/autosupport
$(DESTDIR
)$(ASTSBINDIR
)/
414 if
[ ! -f
$(DESTDIR
)$(ASTSBINDIR
)/safe_asterisk
]; then \
415 cat contrib
/scripts
/safe_asterisk | sed
's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;' > $(DESTDIR
)$(ASTSBINDIR
)/safe_asterisk
;\
416 chmod
755 $(DESTDIR
)$(ASTSBINDIR
)/safe_asterisk
;\
418 $(INSTALL
) -d
$(DESTDIR
)$(ASTHEADERDIR
)
419 $(INSTALL
) -m
644 include/asterisk.h
$(DESTDIR
)$(includedir)
420 $(INSTALL
) -m
644 include/asterisk
/*.h
$(DESTDIR
)$(ASTHEADERDIR
)
421 if
[ -n
"$(OLDHEADERS)" ]; then \
422 rm -f
$(addprefix $(DESTDIR
)$(ASTHEADERDIR
)/,$(OLDHEADERS
)) ;\
424 mkdir
-p
$(DESTDIR
)$(ASTLOGDIR
)/cdr-csv
425 mkdir
-p
$(DESTDIR
)$(ASTLOGDIR
)/cdr-custom
426 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/keys
427 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/firmware
428 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/firmware
/iax
429 mkdir
-p
$(DESTDIR
)$(ASTMANDIR
)/man8
430 $(INSTALL
) -m
644 keys
/iaxtel.pub
$(DESTDIR
)$(ASTDATADIR
)/keys
431 $(INSTALL
) -m
644 keys
/freeworlddialup.pub
$(DESTDIR
)$(ASTDATADIR
)/keys
432 $(INSTALL
) -m
644 doc
/asterisk
.8 $(DESTDIR
)$(ASTMANDIR
)/man8
433 $(INSTALL
) -m
644 contrib
/scripts
/astgenkey
.8 $(DESTDIR
)$(ASTMANDIR
)/man8
434 $(INSTALL
) -m
644 contrib
/scripts
/autosupport
.8 $(DESTDIR
)$(ASTMANDIR
)/man8
435 $(INSTALL
) -m
644 contrib
/scripts
/safe_asterisk
.8 $(DESTDIR
)$(ASTMANDIR
)/man8
436 if
[ -f contrib
/firmware
/iax
/iaxy.bin
] ; then \
437 $(INSTALL
) -m
644 contrib
/firmware
/iax
/iaxy.bin
$(DESTDIR
)$(ASTDATADIR
)/firmware
/iax
/iaxy.bin
; \
441 @DESTDIR
="$(DESTDIR)" ASTSBINDIR
="$(ASTSBINDIR)" $(MAKE
) -C
$(@
:-install=) install
443 NEWMODS
=$(notdir $(wildcard */*.so
))
444 OLDMODS
=$(filter-out $(NEWMODS
),$(notdir $(wildcard $(DESTDIR
)$(MODULES_DIR
)/*.so
)))
447 @if
[ -n
"$(OLDMODS)" ]; then \
448 echo
" WARNING WARNING WARNING" ;\
450 echo
" Your Asterisk modules directory, located at" ;\
451 echo
" $(DESTDIR)$(MODULES_DIR)" ;\
452 echo
" contains modules that were not installed by this " ;\
453 echo
" version of Asterisk. Please ensure that these" ;\
454 echo
" modules are compatible with this version before" ;\
455 echo
" attempting to run Asterisk." ;\
457 for f in
$(OLDMODS
); do \
461 echo
" WARNING WARNING WARNING" ;\
464 install: datafiles bininstall
$(SUBDIRS_INSTALL
)
465 @if
[ -x
/usr
/sbin
/asterisk-post-install
]; then \
466 /usr
/sbin
/asterisk-post-install
$(DESTDIR
) .
; \
468 @echo
" +---- Asterisk Installation Complete -------+"
470 @echo
" + YOU MUST READ THE SECURITY DOCUMENT +"
472 @echo
" + Asterisk has successfully been installed. +"
473 @echo
" + If you would like to install the sample +"
474 @echo
" + configuration files (overwriting any +"
475 @echo
" + existing config files), run: +"
477 @echo
" + $(MAKE) samples +"
479 @echo
" +----------------- or ---------------------+"
481 @echo
" + You can go ahead and install the asterisk +"
482 @echo
" + program documentation now or later run: +"
484 @echo
" + $(MAKE) progdocs +"
486 @echo
" + **Note** This requires that you have +"
487 @echo
" + doxygen installed on your local system +"
488 @echo
" +-------------------------------------------+"
489 @
$(MAKE
) -s oldmodcheck
494 mkdir
-p
$(DESTDIR
)$(ASTETCDIR
)
495 for x in configs
/*.adsi
; do \
496 if
[ ! -f
$(DESTDIR
)$(ASTETCDIR
)/$$x ]; then \
497 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTETCDIR
)/`$(BASENAME) $$x` ; \
502 mkdir
-p
$(DESTDIR
)$(ASTETCDIR
)
503 for x in configs
/*.sample
; do \
504 if
[ -f
$(DESTDIR
)$(ASTETCDIR
)/`$(BASENAME) $$x .sample` ]; then \
505 if
[ "$(OVERWRITE)" = "y" ]; then \
506 if cmp
-s
$(DESTDIR
)$(ASTETCDIR
)/`$(BASENAME) $$x .sample` $$x ; then \
507 echo
"Config file $$x is unchanged"; \
510 mv
-f
$(DESTDIR
)$(ASTETCDIR
)/`$(BASENAME) $$x .sample` $(DESTDIR
)$(ASTETCDIR
)/`$(BASENAME) $$x .sample`.old
; \
512 echo
"Skipping config file $$x"; \
516 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTETCDIR
)/`$(BASENAME) $$x .sample` ;\
518 if
[ "$(OVERWRITE)" = "y" ] ||
[ ! -f
$(DESTDIR
)$(ASTCONFPATH
) ]; then \
520 echo
"[directories]" ; \
521 echo
"astetcdir => $(ASTETCDIR)" ; \
522 echo
"astmoddir => $(MODULES_DIR)" ; \
523 echo
"astvarlibdir => $(ASTVARLIBDIR)" ; \
524 echo
"astdatadir => $(ASTDATADIR)" ; \
525 echo
"astagidir => $(AGI_DIR)" ; \
526 echo
"astspooldir => $(ASTSPOOLDIR)" ; \
527 echo
"astrundir => $(ASTVARRUNDIR)" ; \
528 echo
"astlogdir => $(ASTLOGDIR)" ; \
530 echo
"; Changing the following lines may compromise your security." ; \
532 echo
";astctlpermissions = 0660" ; \
533 echo
";astctlowner = root" ; \
534 echo
";astctlgroup = apache" ; \
535 echo
";astctl = asterisk.ctl" ; \
536 echo
";[options]" ; \
537 echo
";internal_timing = yes" ; \
538 ) > $(DESTDIR
)$(ASTCONFPATH
) ; \
540 echo
"Skipping asterisk.conf creation"; \
542 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/voicemail
/default
/1234/INBOX
543 :> $(DESTDIR
)$(ASTSPOOLDIR
)/voicemail
/default
/1234/unavail.gsm
544 for x in vm-theperson digits
/1 digits
/2 digits
/3 digits
/4 vm-isunavail
; do \
545 cat
$(DESTDIR
)$(ASTDATADIR
)/sounds
/$$x.gsm
>> $(DESTDIR
)$(ASTSPOOLDIR
)/voicemail
/default
/1234/unavail.gsm
; \
547 :> $(DESTDIR
)$(ASTSPOOLDIR
)/voicemail
/default
/1234/busy.gsm
548 for x in vm-theperson digits
/1 digits
/2 digits
/3 digits
/4 vm-isonphone
; do \
549 cat
$(DESTDIR
)$(ASTDATADIR
)/sounds
/$$x.gsm
>> $(DESTDIR
)$(ASTSPOOLDIR
)/voicemail
/default
/1234/busy.gsm
; \
553 @
[ -d
$(DESTDIR
)$(HTTP_DOCSDIR
)/ ] ||
( printf
"http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit
1 )
554 @
[ -d
$(DESTDIR
)$(HTTP_CGIDIR
) ] ||
( printf
"cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit
1 )
555 $(INSTALL
) -m
4755 -o root
-g root contrib
/scripts
/vmail.cgi
$(DESTDIR
)$(HTTP_CGIDIR
)/vmail.cgi
556 mkdir
-p
$(DESTDIR
)$(HTTP_DOCSDIR
)/_asterisk
557 for x in images
/*.gif
; do \
558 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(HTTP_DOCSDIR
)/_asterisk
/; \
560 @echo
" +--------- Asterisk Web Voicemail ----------+"
562 @echo
" + Asterisk Web Voicemail is installed in +"
563 @echo
" + your cgi-bin directory: +"
564 @echo
" + $(DESTDIR)$(HTTP_CGIDIR)"
565 @echo
" + IT USES A SETUID ROOT PERL SCRIPT, SO +"
566 @echo
" + IF YOU DON'T LIKE THAT, UNINSTALL IT! +"
568 @echo
" + Other static items have been stored in: +"
569 @echo
" + $(DESTDIR)$(HTTP_DOCSDIR)"
571 @echo
" + If these paths do not match your httpd +"
572 @echo
" + installation, correct the definitions +"
573 @echo
" + in your Makefile of HTTP_CGIDIR and +"
574 @echo
" + HTTP_DOCSDIR +"
576 @echo
" +-------------------------------------------+"
579 sed
"s/^Version:.*/Version: $(RPMVERSION)/g" redhat
/asterisk.spec
> asterisk.spec
; \
583 __rpm
: include/asterisk
/version.h
include/asterisk
/buildopts.h spec
584 rm -rf
/tmp
/asterisk
; \
585 mkdir
-p
/tmp
/asterisk
/redhat
/RPMS
/i386
; \
586 $(MAKE
) DESTDIR
=/tmp
/asterisk
install ; \
587 $(MAKE
) DESTDIR
=/tmp
/asterisk samples
; \
588 mkdir
-p
/tmp
/asterisk
/etc
/rc.d
/init.d
; \
589 cp
-f contrib
/init.d
/rc.redhat.asterisk
/tmp
/asterisk
/etc
/rc.d
/init.d
/asterisk
; \
590 rpmbuild
--rcfile
/usr
/lib
/rpm
/rpmrc
:redhat
/rpmrc
-bb asterisk.spec
593 (cat contrib
/asterisk-ng-doxygen
; echo
"HAVE_DOT=$(HAVEDOT)"; \
594 echo
"PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen
-
597 @if
[ "${OSARCH}" = "linux-gnu" ]; then \
598 if
[ -f
/etc
/redhat-release
-o
-f
/etc
/fedora-release
]; then \
599 $(INSTALL
) -m
755 contrib
/init.d
/rc.redhat.asterisk
/etc
/rc.d
/init.d
/asterisk
; \
600 /sbin
/chkconfig
--add asterisk
; \
601 elif
[ -f
/etc
/debian_version
]; then \
602 $(INSTALL
) -m
755 contrib
/init.d
/rc.debian.asterisk
/etc
/init.d
/asterisk
; \
603 /usr
/sbin
/update-rc.d asterisk start
10 2 3 4 5 . stop
91 2 3 4 5 .
; \
604 elif
[ -f
/etc
/gentoo-release
]; then \
605 $(INSTALL
) -m
755 contrib
/init.d
/rc.gentoo.asterisk
/etc
/init.d
/asterisk
; \
606 /sbin
/rc-update add asterisk default
; \
607 elif
[ -f
/etc
/mandrake-release
]; then \
608 $(INSTALL
) -m
755 contrib
/init.d
/rc.mandrake.asterisk
/etc
/rc.d
/init.d
/asterisk
; \
609 /sbin
/chkconfig
--add asterisk
; \
610 elif
[ -f
/etc
/SuSE-release
-o
-f
/etc
/novell-release
]; then \
611 $(INSTALL
) -m
755 contrib
/init.d
/rc.suse.asterisk
/etc
/init.d
/asterisk
; \
612 /sbin
/chkconfig
--add asterisk
; \
613 elif
[ -f
/etc
/slackware-version
]; then \
614 echo
"Slackware is not currently supported, although an init script does exist for it." \
616 echo
"We could not install init scripts for your distribution."; \
619 echo
"We could not install init scripts for your operating system."; \
623 $(MAKE
) -C sounds
all
625 # If the cleancount has been changed, force a make clean.
626 # .cleancount is the global clean count, and .lastclean is the
627 # last clean count we had
630 @if
! cmp
-s .cleancount .lastclean
; then \
634 $(SUBDIRS_UNINSTALL
):
635 @
$(MAKE
) --no-print-directory
-C
$(@
:-uninstall=) uninstall
637 _uninstall
: $(SUBDIRS_UNINSTALL
)
638 rm -f
$(DESTDIR
)$(MODULES_DIR
)/*
639 rm -f
$(DESTDIR
)$(ASTSBINDIR
)/*asterisk
*
640 rm -f
$(DESTDIR
)$(ASTSBINDIR
)/astgenkey
641 rm -f
$(DESTDIR
)$(ASTSBINDIR
)/autosupport
642 rm -rf
$(DESTDIR
)$(ASTHEADERDIR
)
643 rm -rf
$(DESTDIR
)$(ASTDATADIR
)/firmware
644 rm -rf
$(DESTDIR
)$(ASTMANDIR
)/man8
645 $(MAKE
) -C sounds
uninstall
647 uninstall: _uninstall
648 @echo
" +--------- Asterisk Uninstall Complete -----+"
649 @echo
" + Asterisk binaries, sounds, man pages, +"
650 @echo
" + headers, modules, and firmware builds, +"
651 @echo
" + have all been uninstalled. +"
653 @echo
" + To remove ALL traces of Asterisk, +"
654 @echo
" + including configuration, spool +"
655 @echo
" + directories, and logs, run the following +"
656 @echo
" + command: +"
658 @echo
" + $(MAKE) uninstall-all +"
659 @echo
" +-------------------------------------------+"
661 uninstall-all
: _uninstall
662 rm -rf
$(DESTDIR
)$(ASTLIBDIR
)
663 rm -rf
$(DESTDIR
)$(ASTVARLIBDIR
)
664 rm -rf
$(DESTDIR
)$(ASTDATADIR
)
665 rm -rf
$(DESTDIR
)$(ASTSPOOLDIR
)
666 rm -rf
$(DESTDIR
)$(ASTETCDIR
)
667 rm -rf
$(DESTDIR
)$(ASTLOGDIR
)
669 menuconfig
: menuselect
671 menuselect
: menuselect
/menuselect menuselect-tree
672 -@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!"
674 menuselect
/menuselect
: makeopts menuselect
/menuselect.c menuselect
/menuselect_curses.c menuselect
/menuselect_stub.c menuselect
/menuselect.h menuselect
/linkedlists.h makeopts
675 @CC
="$(HOST_CC)" LD
="" AR
="" RANLIB
="" $(MAKE
) -C menuselect CONFIGURE_SILENT
="--silent"
677 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
678 @echo
"Generating input for menuselect ..."
679 @build_tools
/prep_moduledeps
> $@
681 .PHONY
: menuselect main sounds
clean dist-clean
distclean all prereqs cleantest
uninstall _uninstall uninstall-all dont-optimize
$(SUBDIRS_INSTALL
) $(SUBDIRS_CLEAN
) $(SUBDIRS_UNINSTALL
) $(SUBDIRS
) $(MOD_SUBDIRS_EMBED_LDSCRIPT
) $(MOD_SUBDIRS_EMBED_LDFLAGS
) $(MOD_SUBDIRS_EMBED_LIBS
)