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
71 # even though we could use '-include makeopts' here, use a wildcard
72 # lookup anyway, so that make won't try to build makeopts if it doesn't
73 # exist (other rules will force it to be built if needed)
74 ifneq ($(wildcard makeopts
),)
78 # Some build systems, such as the one in openwrt, like to pass custom target
79 # CFLAGS and LDFLAGS in the COPTS and LDOPTS variables.
83 #Uncomment this to see all build commands instead of 'quiet' output
86 # Create OPTIONS variable
89 ASTTOPDIR
:=$(shell pwd
)
91 # Overwite config files on "make samples"
94 # Include debug and macro symbols in the executables (-g) and profiling info (-pg)
98 # Files are copied here temporarily during the install process
99 # For example, make DESTDIR=/tmp/asterisk woud put things in
100 # /tmp/asterisk/etc/asterisk
101 # !!! Watch out, put no spaces or comments after the value !!!
102 #DESTDIR?=/tmp/asterisk
104 # Define standard directories for various platforms
105 # These apply if they are not redefined in asterisk.conf
106 ifeq ($(OSARCH
),SunOS
)
107 ASTETCDIR
=/var
/etc
/asterisk
108 ASTLIBDIR
=/opt
/asterisk
/lib
109 ASTVARLIBDIR
=/var
/opt
/asterisk
110 ASTSPOOLDIR
=/var
/spool
/asterisk
111 ASTLOGDIR
=/var
/log
/asterisk
112 ASTHEADERDIR
=/opt
/asterisk
/include
113 ASTBINDIR
=/opt
/asterisk
/bin
114 ASTSBINDIR
=/opt
/asterisk
/sbin
115 ASTVARRUNDIR
=/var
/run
/asterisk
116 ASTMANDIR
=/opt
/asterisk
/man
118 ASTETCDIR
=$(sysconfdir
)/asterisk
119 ASTLIBDIR
=$(libdir)/asterisk
120 ASTHEADERDIR
=$(includedir)/asterisk
122 ASTSBINDIR
=$(sbindir
)
123 ASTSPOOLDIR
=$(localstatedir
)/spool
/asterisk
124 ASTLOGDIR
=$(localstatedir
)/log
/asterisk
125 ASTVARRUNDIR
=$(localstatedir
)/run
127 ifneq ($(findstring BSD
,$(OSARCH
)),)
128 ASTVARLIBDIR
=$(prefix)/share
/asterisk
129 ASTVARRUNDIR
=$(localstatedir
)/run
/asterisk
131 ASTVARLIBDIR
=$(localstatedir
)/lib
/asterisk
134 ifeq ($(ASTDATADIR
),)
135 ASTDATADIR
:=$(ASTVARLIBDIR
)
138 # Asterisk.conf is located in ASTETCDIR or by using the -C flag
139 # when starting Asterisk
140 ASTCONFPATH
=$(ASTETCDIR
)/asterisk.conf
141 MODULES_DIR
=$(ASTLIBDIR
)/modules
142 AGI_DIR
=$(ASTDATADIR
)/agi-bin
144 # If you use Apache, you may determine by a grep 'DocumentRoot' of your httpd.conf file
145 HTTP_DOCSDIR
=/var
/www
/html
146 # Determine by a grep 'ScriptAlias' of your Apache httpd.conf file
147 HTTP_CGIDIR
=/var
/www
/cgi-bin
149 # Uncomment this to use the older DSP routines
150 #ASTCFLAGS+=-DOLD_DSP_ROUTINES
152 # If the file .asterisk.makeopts is present in your home directory, you can
153 # include all of your favorite menuselect options so that every time you download
154 # a new version of Asterisk, you don't have to run menuselect to set them.
155 # The file /etc/asterisk.makeopts will also be included but can be overridden
156 # by the file in your home directory.
158 GLOBAL_MAKEOPTS
=$(wildcard /etc
/asterisk.makeopts
)
159 USER_MAKEOPTS
=$(wildcard ~
/.asterisk.makeopts
)
161 MOD_SUBDIR_CFLAGS
=-I
$(ASTTOPDIR
)/include
162 OTHER_SUBDIR_CFLAGS
=-I
$(ASTTOPDIR
)/include
164 ifeq ($(OSARCH
),linux-gnu
)
165 ifeq ($(PROC
),x86_64
)
166 # You must have GCC 3.4 to use k8, otherwise use athlon
171 ifeq ($(PROC
),sparc64
)
172 #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
173 #This works for even old (2.96) versions of gcc and provides a small boost either way.
174 #A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
175 #So we go lowest common available by gcc and go a step down, still a step up from
176 #the default as we now have a better instruction set to work with. - Belgarath
178 OPTIONS
+=$(shell if
$(CC
) -mtune
=$(PROC
) -S
-o
/dev
/null
-xc
/dev
/null
>/dev
/null
2>&1; then echo
"-mtune=$(PROC)"; fi
)
179 OPTIONS
+=$(shell if
$(CC
) -mcpu
=v8
-S
-o
/dev
/null
-xc
/dev
/null
>/dev
/null
2>&1; then echo
"-mcpu=v8"; fi
)
180 OPTIONS
+=-fomit-frame-pointer
184 # The Cirrus logic is the only heavily shipping arm processor with a real floating point unit
185 ifeq ($(SUB_PROC
),maverick
)
186 OPTIONS
+=-fsigned-char
-mcpu
=ep9312
188 ifeq ($(SUB_PROC
),xscale
)
189 OPTIONS
+=-fsigned-char
-mcpu
=xscale
191 OPTIONS
+=-fsigned-char
197 ASTCFLAGS
+=-pipe
-Wall
-Wstrict-prototypes
-Wmissing-prototypes
-Wmissing-declarations
$(DEBUG
)
199 ASTCFLAGS
+=-include $(ASTTOPDIR
)/include/asterisk
/autoconfig.h
201 ifeq ($(AST_DEVMODE
),yes
)
202 ASTCFLAGS
+=-Werror
-Wunused
$(AST_DECLARATION_AFTER_STATEMENT
)
205 ifneq ($(findstring BSD
,$(OSARCH
)),)
206 ASTCFLAGS
+=-I
/usr
/local
/include
207 ASTLDFLAGS
+=-L
/usr
/local
/lib
210 ifneq ($(PROC
),ultrasparc
)
211 ASTCFLAGS
+=$(shell if
$(CC
) -march
=$(PROC
) -S
-o
/dev
/null
-xc
/dev
/null
>/dev
/null
2>&1; then echo
"-march=$(PROC)"; fi
)
215 ASTCFLAGS
+=-fsigned-char
218 ifeq ($(OSARCH
),FreeBSD
)
219 # -V is understood by BSD Make, not by GNU make.
220 BSDVERSION
=$(shell make
-V OSVERSION
-f
/usr
/share
/mk
/bsd.port.subdir.mk
)
221 ASTCFLAGS
+=$(shell if
test $(BSDVERSION
) -lt
500016 ; then echo
"-D_THREAD_SAFE"; fi
)
222 AST_LIBS
+=$(shell if
test $(BSDVERSION
) -lt
502102 ; then echo
"-lc_r"; else echo
"-pthread"; fi
)
225 ifeq ($(OSARCH
),NetBSD
)
226 ASTCFLAGS
+=-pthread
-I
/usr
/pkg
/include
229 ifeq ($(OSARCH
),OpenBSD
)
233 ifeq ($(OSARCH
),SunOS
)
234 ASTCFLAGS
+=-Wcast-align
-DSOLARIS
-I..
/include/solaris-compat
-I
/opt
/ssl
/include -I
/usr
/local
/ssl
/include
237 ASTERISKVERSION
:=$(shell build_tools
/make_version .
)
239 ifneq ($(wildcard .version
),)
240 ASTERISKVERSIONNUM
:=$(shell awk
-F.
'{printf "%01d%02d%02d", $$1, $$2, $$3}' .version
)
241 RPMVERSION
:=$(shell sed
's/[-\/:]/_/g' .version
)
246 ifneq ($(wildcard .svn
),)
247 ASTERISKVERSIONNUM
=999999
250 ASTCFLAGS
+=$(MALLOC_DEBUG
)$(BUSYDETECT
)$(OPTIONS
)
252 MOD_SUBDIRS
:=res channels pbx apps codecs formats cdr funcs main
253 OTHER_SUBDIRS
:=utils agi
254 SUBDIRS
:=$(OTHER_SUBDIRS
) $(MOD_SUBDIRS
)
255 SUBDIRS_INSTALL
:=$(SUBDIRS
:%=%-install)
256 SUBDIRS_CLEAN
:=$(SUBDIRS
:%=%-clean)
257 SUBDIRS_DIST_CLEAN
:=$(SUBDIRS
:%=%-dist-clean
)
258 SUBDIRS_UNINSTALL
:=$(SUBDIRS
:%=%-uninstall)
259 MOD_SUBDIRS_EMBED_LDSCRIPT
:=$(MOD_SUBDIRS
:%=%-embed-ldscript
)
260 MOD_SUBDIRS_EMBED_LDFLAGS
:=$(MOD_SUBDIRS
:%=%-embed-ldflags
)
261 MOD_SUBDIRS_EMBED_LIBS
:=$(MOD_SUBDIRS
:%=%-embed-libs
)
263 ifneq ($(findstring darwin
,$(OSARCH
)),)
264 ASTCFLAGS
+=-D__Darwin__
265 AUDIO_LIBS
=-framework CoreAudio
266 SOLINK
=-dynamic
-bundle
-undefined suppress
-force_flat_namespace
268 # These are used for all but Darwin
269 SOLINK
=-shared
-Xlinker
-x
270 ifneq ($(findstring BSD
,$(OSARCH
)),)
271 LDFLAGS
+=-L
/usr
/local
/lib
275 ifeq ($(OSARCH
),SunOS
)
276 SOLINK
=-shared
-fpic
-L
/usr
/local
/ssl
/lib
279 # This is used when generating the doxygen documentation
287 @echo
" +--------- Asterisk Build Complete ---------+"
288 @echo
" + Asterisk has successfully been built, and +"
289 @echo
" + can be installed by running: +"
291 ifeq ($(MAKE
), gmake
)
292 @echo
" + $(MAKE) install +"
294 @echo
" + $(MAKE) install +"
296 @echo
" +-------------------------------------------+"
298 _all
: cleantest
$(SUBDIRS
)
302 @echo
"**** The configure script must be executed before running '$(MAKE)'."
303 @echo
"**** Please run \"./configure\"."
307 menuselect.makeopts
: menuselect
/menuselect menuselect-tree
308 menuselect
/menuselect
--check-deps
$(GLOBAL_MAKEOPTS
) $(USER_MAKEOPTS
) menuselect.makeopts
310 $(MOD_SUBDIRS_EMBED_LDSCRIPT
):
311 @echo
"EMBED_LDSCRIPTS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-ldscript=) SUBDIR=$(@:-embed-ldscript=) __embed_ldscript` >> makeopts.embed_rules
313 $(MOD_SUBDIRS_EMBED_LDFLAGS
):
314 @echo
"EMBED_LDFLAGS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-ldflags=) SUBDIR=$(@:-embed-ldflags=) __embed_ldflags` >> makeopts.embed_rules
316 $(MOD_SUBDIRS_EMBED_LIBS
):
317 @echo
"EMBED_LIBS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-libs=) SUBDIR=$(@:-embed-libs=) __embed_libs` >> makeopts.embed_rules
319 makeopts.embed_rules
: menuselect.makeopts
320 @echo
"Generating embedded module rules ..."
322 @
$(MAKE
) --no-print-directory
$(MOD_SUBDIRS_EMBED_LDSCRIPT
)
323 @
$(MAKE
) --no-print-directory
$(MOD_SUBDIRS_EMBED_LDFLAGS
)
324 @
$(MAKE
) --no-print-directory
$(MOD_SUBDIRS_EMBED_LIBS
)
326 $(SUBDIRS
): include/asterisk
/version.h
include/asterisk
/buildopts.h defaults.h makeopts.embed_rules
328 # ensure that all module subdirectories are processed before 'main' during
329 # a parallel build, since if there are modules selected to be embedded the
330 # directories containing them must be completed before the main Asterisk
331 # binary can be built
332 main
: $(filter-out main
,$(MOD_SUBDIRS
))
335 @ASTCFLAGS
="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS
="$(ASTLDFLAGS)" AST_LIBS
="$(AST_LIBS)" $(MAKE
) --no-print-directory
--no-builtin-rules
-C
$@ SUBDIR
=$@
all
338 @ASTCFLAGS
="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS
="$(ASTLDFLAGS)" AUDIO_LIBS
="$(AUDIO_LIBS)" $(MAKE
) --no-print-directory
--no-builtin-rules
-C
$@ SUBDIR
=$@
all
341 @build_tools
/make_defaults_h
> $@.tmp
342 @if cmp
-s
$@.tmp
$@
; then
: ; else \
347 include/asterisk
/version.h
:
348 @build_tools
/make_version_h
> $@.tmp
349 @if cmp
-s
$@.tmp
$@
; then
: ; else \
354 include/asterisk
/buildopts.h
: menuselect.makeopts
355 @build_tools
/make_buildopts_h
> $@.tmp
356 @if cmp
-s
$@.tmp
$@
; then
: ; else \
362 @
$(MAKE
) --no-print-directory
-C
$(@
:-clean=) clean
364 $(SUBDIRS_DIST_CLEAN
):
365 @
$(MAKE
) --no-print-directory
-C
$(@
:-dist-clean
=) dist-clean
367 clean: $(SUBDIRS_CLEAN
)
369 rm -f
include/asterisk
/build.h
370 rm -f
include/asterisk
/version.h
371 @
$(MAKE
) -C menuselect
clean
372 cp
-f .cleancount .lastclean
374 dist-clean
: distclean
376 distclean: $(SUBDIRS_DIST_CLEAN
) clean
377 @
$(MAKE
) -C menuselect dist-clean
378 @
$(MAKE
) -C sounds dist-clean
379 rm -f menuselect.makeopts makeopts menuselect-tree menuselect.makedeps
380 rm -f makeopts.embed_rules
381 rm -f config.log config.status
382 rm -rf autom4te.cache
383 rm -f
include/asterisk
/autoconfig.h
384 rm -f
include/asterisk
/buildopts.h
386 rm -f build_tools
/menuselect-deps
389 if
[ x
`$(ID) -un` = xroot
]; then CFLAGS
="$(ASTCFLAGS)" sh build_tools
/mkpkgconfig
$(DESTDIR
)/usr
/lib
/pkgconfig
; fi
390 # Should static HTTP be installed during make samples or even with its own target ala
391 # webvoicemail? There are portions here that *could* be customized but might also be
392 # improved a lot. I'll put it here for now.
393 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/static-http
394 for x in static-http
/*; do \
395 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTDATADIR
)/static-http
; \
397 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/images
398 for x in images
/*.jpg
; do \
399 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTDATADIR
)/images
; \
401 mkdir
-p
$(DESTDIR
)$(AGI_DIR
)
402 $(MAKE
) -C sounds
install
405 @if
[ -d .svn
]; then \
406 echo
"Updating from Subversion..." ; \
407 svn update | tee update.out
; \
409 if
[ `grep -c ^C update.out` -gt
0 ]; then \
410 echo
; echo
"The following files have conflicts:" ; \
411 grep ^C update.out | cut
-b4-
; \
415 echo
"Not under version control"; \
418 NEWHEADERS
=$(notdir $(wildcard include/asterisk
/*.h
))
419 OLDHEADERS
=$(filter-out $(NEWHEADERS
),$(notdir $(wildcard $(DESTDIR
)$(ASTHEADERDIR
)/*.h
)))
422 mkdir
-p
$(DESTDIR
)$(MODULES_DIR
)
423 mkdir
-p
$(DESTDIR
)$(ASTSBINDIR
)
424 mkdir
-p
$(DESTDIR
)$(ASTETCDIR
)
425 mkdir
-p
$(DESTDIR
)$(ASTBINDIR
)
426 mkdir
-p
$(DESTDIR
)$(ASTVARRUNDIR
)
427 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/voicemail
428 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/dictate
429 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/system
430 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/tmp
431 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/meetme
432 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/monitor
433 $(INSTALL
) -m
755 main
/asterisk
$(DESTDIR
)$(ASTSBINDIR
)/
434 $(LN
) -sf asterisk
$(DESTDIR
)$(ASTSBINDIR
)/rasterisk
435 $(INSTALL
) -m
755 contrib
/scripts
/astgenkey
$(DESTDIR
)$(ASTSBINDIR
)/
436 $(INSTALL
) -m
755 contrib
/scripts
/autosupport
$(DESTDIR
)$(ASTSBINDIR
)/
437 if
[ ! -f
$(DESTDIR
)$(ASTSBINDIR
)/safe_asterisk
]; then \
438 cat contrib
/scripts
/safe_asterisk | sed
's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;' > $(DESTDIR
)$(ASTSBINDIR
)/safe_asterisk
;\
439 chmod
755 $(DESTDIR
)$(ASTSBINDIR
)/safe_asterisk
;\
441 $(INSTALL
) -d
$(DESTDIR
)$(ASTHEADERDIR
)
442 $(INSTALL
) -m
644 include/asterisk.h
$(DESTDIR
)$(includedir)
443 $(INSTALL
) -m
644 include/asterisk
/*.h
$(DESTDIR
)$(ASTHEADERDIR
)
444 if
[ -n
"$(OLDHEADERS)" ]; then \
445 rm -f
$(addprefix $(DESTDIR
)$(ASTHEADERDIR
)/,$(OLDHEADERS
)) ;\
447 mkdir
-p
$(DESTDIR
)$(ASTLOGDIR
)/cdr-csv
448 mkdir
-p
$(DESTDIR
)$(ASTLOGDIR
)/cdr-custom
449 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/keys
450 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/firmware
451 mkdir
-p
$(DESTDIR
)$(ASTDATADIR
)/firmware
/iax
452 mkdir
-p
$(DESTDIR
)$(ASTMANDIR
)/man8
453 $(INSTALL
) -m
644 keys
/iaxtel.pub
$(DESTDIR
)$(ASTDATADIR
)/keys
454 $(INSTALL
) -m
644 keys
/freeworlddialup.pub
$(DESTDIR
)$(ASTDATADIR
)/keys
455 $(INSTALL
) -m
644 doc
/asterisk
.8 $(DESTDIR
)$(ASTMANDIR
)/man8
456 $(INSTALL
) -m
644 contrib
/scripts
/astgenkey
.8 $(DESTDIR
)$(ASTMANDIR
)/man8
457 $(INSTALL
) -m
644 contrib
/scripts
/autosupport
.8 $(DESTDIR
)$(ASTMANDIR
)/man8
458 $(INSTALL
) -m
644 contrib
/scripts
/safe_asterisk
.8 $(DESTDIR
)$(ASTMANDIR
)/man8
459 if
[ -f contrib
/firmware
/iax
/iaxy.bin
] ; then \
460 $(INSTALL
) -m
644 contrib
/firmware
/iax
/iaxy.bin
$(DESTDIR
)$(ASTDATADIR
)/firmware
/iax
/iaxy.bin
; \
464 @DESTDIR
="$(DESTDIR)" ASTSBINDIR
="$(ASTSBINDIR)" $(MAKE
) -C
$(@
:-install=) install
466 NEWMODS
=$(notdir $(wildcard */*.so
))
467 OLDMODS
=$(filter-out $(NEWMODS
),$(notdir $(wildcard $(DESTDIR
)$(MODULES_DIR
)/*.so
)))
470 @if
[ -n
"$(OLDMODS)" ]; then \
471 echo
" WARNING WARNING WARNING" ;\
473 echo
" Your Asterisk modules directory, located at" ;\
474 echo
" $(DESTDIR)$(MODULES_DIR)" ;\
475 echo
" contains modules that were not installed by this " ;\
476 echo
" version of Asterisk. Please ensure that these" ;\
477 echo
" modules are compatible with this version before" ;\
478 echo
" attempting to run Asterisk." ;\
480 for f in
$(OLDMODS
); do \
484 echo
" WARNING WARNING WARNING" ;\
487 install: datafiles bininstall
$(SUBDIRS_INSTALL
)
488 @if
[ -x
/usr
/sbin
/asterisk-post-install
]; then \
489 /usr
/sbin
/asterisk-post-install
$(DESTDIR
) .
; \
491 @echo
" +---- Asterisk Installation Complete -------+"
493 @echo
" + YOU MUST READ THE SECURITY DOCUMENT +"
495 @echo
" + Asterisk has successfully been installed. +"
496 @echo
" + If you would like to install the sample +"
497 @echo
" + configuration files (overwriting any +"
498 @echo
" + existing config files), run: +"
500 ifeq ($(MAKE
), gmake
)
501 @echo
" + $(MAKE) samples +"
503 @echo
" + $(MAKE) samples +"
506 @echo
" +----------------- or ---------------------+"
508 @echo
" + You can go ahead and install the asterisk +"
509 @echo
" + program documentation now or later run: +"
511 ifeq ($(MAKE
), gmake
)
512 @echo
" + $(MAKE) progdocs +"
514 @echo
" + $(MAKE) progdocs +"
517 @echo
" + **Note** This requires that you have +"
518 @echo
" + doxygen installed on your local system +"
519 @echo
" +-------------------------------------------+"
520 @
$(MAKE
) -s oldmodcheck
525 mkdir
-p
$(DESTDIR
)$(ASTETCDIR
)
526 for x in configs
/*.adsi
; do \
527 if
[ ! -f
$(DESTDIR
)$(ASTETCDIR
)/$$x ]; then \
528 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTETCDIR
)/`$(BASENAME) $$x` ; \
533 mkdir
-p
$(DESTDIR
)$(ASTETCDIR
)
534 for x in configs
/*.sample
; do \
535 if
[ -f
$(DESTDIR
)$(ASTETCDIR
)/`$(BASENAME) $$x .sample` ]; then \
536 if
[ "$(OVERWRITE)" = "y" ]; then \
537 if cmp
-s
$(DESTDIR
)$(ASTETCDIR
)/`$(BASENAME) $$x .sample` $$x ; then \
538 echo
"Config file $$x is unchanged"; \
541 mv
-f
$(DESTDIR
)$(ASTETCDIR
)/`$(BASENAME) $$x .sample` $(DESTDIR
)$(ASTETCDIR
)/`$(BASENAME) $$x .sample`.old
; \
543 echo
"Skipping config file $$x"; \
547 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(ASTETCDIR
)/`$(BASENAME) $$x .sample` ;\
549 if
[ "$(OVERWRITE)" = "y" ] ||
[ ! -f
$(DESTDIR
)$(ASTCONFPATH
) ]; then \
551 echo
"[directories]" ; \
552 echo
"astetcdir => $(ASTETCDIR)" ; \
553 echo
"astmoddir => $(MODULES_DIR)" ; \
554 echo
"astvarlibdir => $(ASTVARLIBDIR)" ; \
555 echo
"astdatadir => $(ASTDATADIR)" ; \
556 echo
"astagidir => $(AGI_DIR)" ; \
557 echo
"astspooldir => $(ASTSPOOLDIR)" ; \
558 echo
"astrundir => $(ASTVARRUNDIR)" ; \
559 echo
"astlogdir => $(ASTLOGDIR)" ; \
561 echo
";[options]" ; \
562 echo
";internal_timing = yes" ; \
563 echo
";systemname = my_system_name ; prefix uniqueid with a system name for global uniqueness issues" ; \
564 echo
"; Changing the following lines may compromise your security." ; \
566 echo
";astctlpermissions = 0660" ; \
567 echo
";astctlowner = root" ; \
568 echo
";astctlgroup = apache" ; \
569 echo
";astctl = asterisk.ctl" ; \
570 ) > $(DESTDIR
)$(ASTCONFPATH
) ; \
572 echo
"Skipping asterisk.conf creation"; \
574 mkdir
-p
$(DESTDIR
)$(ASTSPOOLDIR
)/voicemail
/default
/1234/INBOX
575 build_tools
/make_sample_voicemail
$(DESTDIR
)/$(ASTDATADIR
) $(DESTDIR
)/$(ASTSPOOLDIR
)
578 @
[ -d
$(DESTDIR
)$(HTTP_DOCSDIR
)/ ] ||
( printf
"http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit
1 )
579 @
[ -d
$(DESTDIR
)$(HTTP_CGIDIR
) ] ||
( printf
"cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit
1 )
580 $(INSTALL
) -m
4755 -o root
-g root contrib
/scripts
/vmail.cgi
$(DESTDIR
)$(HTTP_CGIDIR
)/vmail.cgi
581 mkdir
-p
$(DESTDIR
)$(HTTP_DOCSDIR
)/_asterisk
582 for x in images
/*.gif
; do \
583 $(INSTALL
) -m
644 $$x $(DESTDIR
)$(HTTP_DOCSDIR
)/_asterisk
/; \
585 @echo
" +--------- Asterisk Web Voicemail ----------+"
587 @echo
" + Asterisk Web Voicemail is installed in +"
588 @echo
" + your cgi-bin directory: +"
589 @echo
" + $(DESTDIR)$(HTTP_CGIDIR)"
590 @echo
" + IT USES A SETUID ROOT PERL SCRIPT, SO +"
591 @echo
" + IF YOU DON'T LIKE THAT, UNINSTALL IT! +"
593 @echo
" + Other static items have been stored in: +"
594 @echo
" + $(DESTDIR)$(HTTP_DOCSDIR)"
596 @echo
" + If these paths do not match your httpd +"
597 @echo
" + installation, correct the definitions +"
598 @echo
" + in your Makefile of HTTP_CGIDIR and +"
599 @echo
" + HTTP_DOCSDIR +"
601 @echo
" +-------------------------------------------+"
604 sed
"s/^Version:.*/Version: $(RPMVERSION)/g" redhat
/asterisk.spec
> asterisk.spec
; \
608 __rpm
: include/asterisk
/version.h
include/asterisk
/buildopts.h spec
609 rm -rf
/tmp
/asterisk
; \
610 mkdir
-p
/tmp
/asterisk
/redhat
/RPMS
/i386
; \
611 $(MAKE
) DESTDIR
=/tmp
/asterisk
install ; \
612 $(MAKE
) DESTDIR
=/tmp
/asterisk samples
; \
613 mkdir
-p
/tmp
/asterisk
/etc
/rc.d
/init.d
; \
614 cp
-f contrib
/init.d
/rc.redhat.asterisk
/tmp
/asterisk
/etc
/rc.d
/init.d
/asterisk
; \
615 rpmbuild
--rcfile
/usr
/lib
/rpm
/rpmrc
:redhat
/rpmrc
-bb asterisk.spec
618 (cat contrib
/asterisk-ng-doxygen
; echo
"HAVE_DOT=$(HAVEDOT)"; \
619 echo
"PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen
-
622 @if
[ "${OSARCH}" = "linux-gnu" ]; then \
623 if
[ -f
/etc
/redhat-release
-o
-f
/etc
/fedora-release
]; then \
624 $(INSTALL
) -m
755 contrib
/init.d
/rc.redhat.asterisk
/etc
/rc.d
/init.d
/asterisk
; \
625 /sbin
/chkconfig
--add asterisk
; \
626 elif
[ -f
/etc
/debian_version
]; then \
627 $(INSTALL
) -m
755 contrib
/init.d
/rc.debian.asterisk
/etc
/init.d
/asterisk
; \
628 /usr
/sbin
/update-rc.d asterisk start
10 2 3 4 5 . stop
91 2 3 4 5 .
; \
629 elif
[ -f
/etc
/gentoo-release
]; then \
630 $(INSTALL
) -m
755 contrib
/init.d
/rc.gentoo.asterisk
/etc
/init.d
/asterisk
; \
631 /sbin
/rc-update add asterisk default
; \
632 elif
[ -f
/etc
/mandrake-release
]; then \
633 $(INSTALL
) -m
755 contrib
/init.d
/rc.mandrake.asterisk
/etc
/rc.d
/init.d
/asterisk
; \
634 /sbin
/chkconfig
--add asterisk
; \
635 elif
[ -f
/etc
/SuSE-release
-o
-f
/etc
/novell-release
]; then \
636 $(INSTALL
) -m
755 contrib
/init.d
/rc.suse.asterisk
/etc
/init.d
/asterisk
; \
637 /sbin
/chkconfig
--add asterisk
; \
638 elif
[ -f
/etc
/slackware-version
]; then \
639 echo
"Slackware is not currently supported, although an init script does exist for it." \
641 echo
"We could not install init scripts for your distribution."; \
644 echo
"We could not install init scripts for your operating system."; \
648 $(MAKE
) -C sounds
all
650 # If the cleancount has been changed, force a make clean.
651 # .cleancount is the global clean count, and .lastclean is the
652 # last clean count we had
655 @cmp
-s .cleancount .lastclean ||
$(MAKE
) clean
657 $(SUBDIRS_UNINSTALL
):
658 @
$(MAKE
) --no-print-directory
-C
$(@
:-uninstall=) uninstall
660 _uninstall
: $(SUBDIRS_UNINSTALL
)
661 rm -f
$(DESTDIR
)$(MODULES_DIR
)/*
662 rm -f
$(DESTDIR
)$(ASTSBINDIR
)/*asterisk
*
663 rm -f
$(DESTDIR
)$(ASTSBINDIR
)/astgenkey
664 rm -f
$(DESTDIR
)$(ASTSBINDIR
)/autosupport
665 rm -rf
$(DESTDIR
)$(ASTHEADERDIR
)
666 rm -rf
$(DESTDIR
)$(ASTDATADIR
)/firmware
667 rm -f
$(DESTDIR
)$(ASTMANDIR
)/man8
/asterisk
.8
668 rm -f
$(DESTDIR
)$(ASTMANDIR
)/man8
/astgenkey
.8
669 rm -f
$(DESTDIR
)$(ASTMANDIR
)/man8
/autosupport
.8
670 rm -f
$(DESTDIR
)$(ASTMANDIR
)/man8
/safe_asterisk
.8
671 $(MAKE
) -C sounds
uninstall
673 uninstall: _uninstall
674 @echo
" +--------- Asterisk Uninstall Complete -----+"
675 @echo
" + Asterisk binaries, sounds, man pages, +"
676 @echo
" + headers, modules, and firmware builds, +"
677 @echo
" + have all been uninstalled. +"
679 @echo
" + To remove ALL traces of Asterisk, +"
680 @echo
" + including configuration, spool +"
681 @echo
" + directories, and logs, run the following +"
682 @echo
" + command: +"
684 ifeq ($(MAKE
), gmake
)
685 @echo
" + $(MAKE) uninstall-all +"
687 @echo
" + $(MAKE) uninstall-all +"
689 @echo
" +-------------------------------------------+"
691 uninstall-all
: _uninstall
692 rm -rf
$(DESTDIR
)$(ASTLIBDIR
)
693 rm -rf
$(DESTDIR
)$(ASTVARLIBDIR
)
694 rm -rf
$(DESTDIR
)$(ASTDATADIR
)
695 rm -rf
$(DESTDIR
)$(ASTSPOOLDIR
)
696 rm -rf
$(DESTDIR
)$(ASTETCDIR
)
697 rm -rf
$(DESTDIR
)$(ASTLOGDIR
)
699 menuconfig
: menuselect
701 gmenuconfig
: gmenuselect
703 menuselect
: menuselect
/menuselect menuselect-tree
704 -@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!"
706 gmenuselect
: menuselect
/gmenuselect menuselect-tree
707 -@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!"
709 menuselect
/menuselect
: makeopts menuselect
/menuselect.c menuselect
/menuselect_curses.c menuselect
/menuselect_stub.c menuselect
/menuselect.h menuselect
/linkedlists.h makeopts
710 @CC
="$(HOST_CC)" LD
="" AR
="" RANLIB
="" CFLAGS
="" $(MAKE
) -C menuselect CONFIGURE_SILENT
="--silent"
712 menuselect
/gmenuselect
: makeopts menuselect
/menuselect.c menuselect
/menuselect_gtk.c menuselect
/menuselect_stub.c menuselect
/menuselect.h menuselect
/linkedlists.h makeopts
713 @CC
="$(HOST_CC)" CXX
="$(CXX)" LD
="" AR
="" RANLIB
="" CFLAGS
="" $(MAKE
) -C menuselect _gmenuselect CONFIGURE_SILENT
="--silent"
715 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
716 @echo
"Generating input for menuselect ..."
717 @build_tools
/prep_moduledeps
> $@
719 .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