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
70 # even though we could use '-include makeopts' here, use a wildcard
71 # lookup anyway, so that make won't try to build makeopts if it doesn't
72 # exist (other rules will force it to be built if needed)
73 ifneq ($(wildcard makeopts),)
77 #Uncomment this to see all build commands instead of 'quiet' output
80 # Create OPTIONS variable
85 # Overwite config files on "make samples"
88 # Include debug and macro symbols in the executables (-g) and profiling info (-pg)
92 # Files are copied here temporarily during the install process
93 # For example, make DESTDIR=/tmp/asterisk woud put things in
94 # /tmp/asterisk/etc/asterisk
95 # !!! Watch out, put no spaces or comments after the value !!!
96 #DESTDIR?=/tmp/asterisk
98 # Define standard directories for various platforms
99 # These apply if they are not redefined in asterisk.conf
100 ifeq ($(OSARCH),SunOS)
101 ASTETCDIR=/var/etc/asterisk
102 ASTLIBDIR=/opt/asterisk/lib
103 ASTVARLIBDIR=/var/opt/asterisk
104 ASTSPOOLDIR=/var/spool/asterisk
105 ASTLOGDIR=/var/log/asterisk
106 ASTHEADERDIR=/opt/asterisk/include
107 ASTBINDIR=/opt/asterisk/bin
108 ASTSBINDIR=/opt/asterisk/sbin
109 ASTVARRUNDIR=/var/run/asterisk
110 ASTMANDIR=/opt/asterisk/man
112 ASTETCDIR=$(sysconfdir)/asterisk
113 ASTLIBDIR=$(libdir)/asterisk
114 ASTHEADERDIR=$(includedir)/asterisk
116 ASTSBINDIR=$(sbindir)
117 ASTSPOOLDIR=$(localstatedir)/spool/asterisk
118 ASTLOGDIR=$(localstatedir)/log/asterisk
119 ASTVARRUNDIR=$(localstatedir)/run
121 ifeq ($(OSARCH),FreeBSD)
122 ASTVARLIBDIR=$(prefix)/share/asterisk
124 ASTVARLIBDIR=$(localstatedir)/lib/asterisk
127 ifeq ($(ASTDATADIR),)
128 ASTDATADIR:=$(ASTVARLIBDIR)
131 # Asterisk.conf is located in ASTETCDIR or by using the -C flag
132 # when starting Asterisk
133 ASTCONFPATH=$(ASTETCDIR)/asterisk.conf
134 MODULES_DIR=$(ASTLIBDIR)/modules
135 AGI_DIR=$(ASTDATADIR)/agi-bin
137 # If you use Apache, you may determine by a grep 'DocumentRoot' of your httpd.conf file
138 HTTP_DOCSDIR=/var/www/html
139 # Determine by a grep 'ScriptAlias' of your Apache httpd.conf file
140 HTTP_CGIDIR=/var/www/cgi-bin
142 # Uncomment this to use the older DSP routines
143 #ASTCFLAGS+=-DOLD_DSP_ROUTINES
145 # If the file .asterisk.makeopts is present in your home directory, you can
146 # include all of your favorite menuselect options so that every time you download
147 # a new version of Asterisk, you don't have to run menuselect to set them.
148 # The file /etc/asterisk.makeopts will also be included but can be overridden
149 # by the file in your home directory.
151 GLOBAL_MAKEOPTS=$(wildcard /etc/asterisk.makeopts)
152 USER_MAKEOPTS=$(wildcard ~/.asterisk.makeopts)
154 MOD_SUBDIR_CFLAGS=-I$(ASTTOPDIR)/include
155 OTHER_SUBDIR_CFLAGS=-I$(ASTTOPDIR)/include
157 ifeq ($(OSARCH),linux-gnu)
158 ifeq ($(PROC),x86_64)
159 # You must have GCC 3.4 to use k8, otherwise use athlon
164 ifeq ($(PROC),sparc64)
165 #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
166 #This works for even old (2.96) versions of gcc and provides a small boost either way.
167 #A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
168 #So we go lowest common available by gcc and go a step down, still a step up from
169 #the default as we now have a better instruction set to work with. - Belgarath
171 OPTIONS+=$(shell if $(CC) -mtune=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mtune=$(PROC)"; fi)
172 OPTIONS+=$(shell if $(CC) -mcpu=v8 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mcpu=v8"; fi)
173 OPTIONS+=-fomit-frame-pointer
177 # The Cirrus logic is the only heavily shipping arm processor with a real floating point unit
178 ifeq ($(SUB_PROC),maverick)
179 OPTIONS+=-fsigned-char -mcpu=ep9312
181 ifeq ($(SUB_PROC),xscale)
182 OPTIONS+=-fsigned-char -mcpu=xscale
184 OPTIONS+=-fsigned-char
190 ASTCFLAGS+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG)
192 ASTCFLAGS+=-include $(ASTTOPDIR)/include/asterisk/autoconfig.h
194 ifeq ($(AST_DEVMODE),yes)
195 ASTCFLAGS+=-Werror -Wunused -Wundef
198 ifneq ($(findstring BSD,$(OSARCH)),)
199 ASTCFLAGS+=-I/usr/local/include
200 ASTLDFLAGS+=-L/usr/local/lib
203 ifneq ($(PROC),ultrasparc)
204 ASTCFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
208 ASTCFLAGS+=-fsigned-char
211 ifeq ($(OSARCH),FreeBSD)
212 # -V is understood by BSD Make, not by GNU make.
213 BSDVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk)
214 ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
215 AST_LIBS+=$(shell if test $(BSDVERSION) -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi)
218 ifeq ($(OSARCH),NetBSD)
219 ASTCFLAGS+=-pthread -I/usr/pkg/include
222 ifeq ($(OSARCH),OpenBSD)
226 ifeq ($(OSARCH),SunOS)
227 ASTCFLAGS+=-Wcast-align -DSOLARIS -I../include/solaris-compat -I/opt/ssl/include -I/usr/local/ssl/include
230 ASTERISKVERSION:=$(shell build_tools/make_version .)
232 ifneq ($(wildcard .version),)
233 ASTERISKVERSIONNUM:=$(shell awk -F. '{printf "%01d%02d%02d", $$1, $$2, $$3}' .version)
234 RPMVERSION:=$(shell sed 's/[-\/:]/_/g' .version)
239 ifneq ($(wildcard .svn),)
240 ASTERISKVERSIONNUM=999999
243 ASTCFLAGS+=$(MALLOC_DEBUG)$(BUSYDETECT)$(OPTIONS)
245 MOD_SUBDIRS:=res channels pbx apps codecs formats cdr funcs main
246 OTHER_SUBDIRS:=utils agi
247 SUBDIRS:=$(OTHER_SUBDIRS) $(MOD_SUBDIRS)
248 SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)
249 SUBDIRS_CLEAN:=$(SUBDIRS:%=%-clean)
250 SUBDIRS_UNINSTALL:=$(SUBDIRS:%=%-uninstall)
251 MOD_SUBDIRS_EMBED_LDSCRIPT:=$(MOD_SUBDIRS:%=%-embed-ldscript)
252 MOD_SUBDIRS_EMBED_LDFLAGS:=$(MOD_SUBDIRS:%=%-embed-ldflags)
253 MOD_SUBDIRS_EMBED_LIBS:=$(MOD_SUBDIRS:%=%-embed-libs)
255 ifneq ($(findstring darwin,$(OSARCH)),)
256 ASTCFLAGS+=-D__Darwin__
257 AUDIO_LIBS=-framework CoreAudio
258 SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
260 # These are used for all but Darwin
261 SOLINK=-shared -Xlinker -x
262 ifneq ($(findstring BSD,$(OSARCH)),)
263 LDFLAGS+=-L/usr/local/lib
267 ifeq ($(OSARCH),SunOS)
268 SOLINK=-shared -fpic -L/usr/local/ssl/lib
271 # This is used when generating the doxygen documentation
279 @echo " +--------- Asterisk Build Complete ---------+"
280 @echo " + Asterisk has successfully been built, and +"
281 @echo " + can be installed by running: +"
283 @echo " + $(MAKE) install +"
284 @echo " +-------------------------------------------+"
286 _all: cleantest $(SUBDIRS)
290 @echo "**** The configure script must be executed before running '$(MAKE)'."
291 @echo "**** Please run \"./configure\"."
295 menuselect.makeopts: menuselect/menuselect menuselect-tree
296 menuselect/menuselect --check-deps $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts
298 $(MOD_SUBDIRS_EMBED_LDSCRIPT):
299 @echo "EMBED_LDSCRIPTS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-ldscript=) SUBDIR=$(@:-embed-ldscript=) __embed_ldscript` >> makeopts.embed_rules
301 $(MOD_SUBDIRS_EMBED_LDFLAGS):
302 @echo "EMBED_LDFLAGS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-ldflags=) SUBDIR=$(@:-embed-ldflags=) __embed_ldflags` >> makeopts.embed_rules
304 $(MOD_SUBDIRS_EMBED_LIBS):
305 @echo "EMBED_LIBS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-libs=) SUBDIR=$(@:-embed-libs=) __embed_libs` >> makeopts.embed_rules
307 makeopts.embed_rules: menuselect.makeopts
308 @echo "Generating embedded module rules ..."
310 @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LDSCRIPT)
311 @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LDFLAGS)
312 @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LIBS)
314 $(SUBDIRS): include/asterisk/version.h include/asterisk/build.h include/asterisk/buildopts.h defaults.h makeopts.embed_rules
316 # ensure that all module subdirectories are processed before 'main' during
317 # a parallel build, since if there are modules selected to be embedded the
318 # directories containing them must be completed before the main Asterisk
319 # binary can be built
320 main: $(filter-out main,$(MOD_SUBDIRS))
323 @ASTCFLAGS="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" AST_LIBS="$(AST_LIBS)" $(MAKE) --no-print-directory --no-builtin-rules -C $@ SUBDIR=$@ all
326 @ASTCFLAGS="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" AUDIO_LIBS="$(AUDIO_LIBS)" $(MAKE) --no-print-directory --no-builtin-rules -C $@ SUBDIR=$@ all
329 @build_tools/make_defaults_h > $@.tmp
330 @if cmp -s $@.tmp $@ ; then : ; else \
335 include/asterisk/version.h:
336 @build_tools/make_version_h > $@.tmp
337 @if cmp -s $@.tmp $@ ; then : ; else \
342 include/asterisk/buildopts.h: menuselect.makeopts
343 @build_tools/make_buildopts_h > $@.tmp
344 @if cmp -s $@.tmp $@ ; then : ; else \
349 include/asterisk/build.h:
350 @build_tools/make_build_h > $@.tmp
351 @if cmp -s $@.tmp $@ ; then : ; else \
357 @$(MAKE) --no-print-directory -C $(@:-clean=) clean
359 clean: $(SUBDIRS_CLEAN)
361 rm -f include/asterisk/build.h
362 rm -f include/asterisk/version.h
363 @$(MAKE) -C menuselect clean
364 cp -f .cleancount .lastclean
366 dist-clean: distclean
369 @$(MAKE) -C menuselect dist-clean
370 @$(MAKE) -C sounds dist-clean
371 rm -f menuselect.makeopts makeopts menuselect-tree menuselect.makedeps
372 rm -f makeopts.embed_rules
373 rm -f config.log config.status
374 rm -rf autom4te.cache
375 rm -f include/asterisk/autoconfig.h
376 rm -f include/asterisk/buildopts.h
378 rm -f build_tools/menuselect-deps
381 if [ x`$(ID) -un` = xroot ]; then CFLAGS="$(ASTCFLAGS)" sh build_tools/mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig; fi
382 # Should static HTTP be installed during make samples or even with its own target ala
383 # webvoicemail? There are portions here that *could* be customized but might also be
384 # improved a lot. I'll put it here for now.
385 mkdir -p $(DESTDIR)$(ASTDATADIR)/static-http
386 for x in static-http/*; do \
387 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/static-http ; \
389 mkdir -p $(DESTDIR)$(ASTDATADIR)/images
390 for x in images/*.jpg; do \
391 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/images ; \
393 mkdir -p $(DESTDIR)$(AGI_DIR)
394 $(MAKE) -C sounds install
397 @if [ -d .svn ]; then \
398 echo "Updating from Subversion..." ; \
399 svn update | tee update.out; \
401 if [ `grep -c ^C update.out` -gt 0 ]; then \
402 echo ; echo "The following files have conflicts:" ; \
403 grep ^C update.out | cut -b4- ; \
407 echo "Not under version control"; \
410 NEWHEADERS=$(notdir $(wildcard include/asterisk/*.h))
411 OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h)))
414 mkdir -p $(DESTDIR)$(MODULES_DIR)
415 mkdir -p $(DESTDIR)$(ASTSBINDIR)
416 mkdir -p $(DESTDIR)$(ASTETCDIR)
417 mkdir -p $(DESTDIR)$(ASTBINDIR)
418 mkdir -p $(DESTDIR)$(ASTVARRUNDIR)
419 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail
420 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/dictate
421 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/system
422 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/tmp
423 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/meetme
424 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/monitor
425 $(INSTALL) -m 755 main/asterisk $(DESTDIR)$(ASTSBINDIR)/
426 $(LN) -sf asterisk $(DESTDIR)$(ASTSBINDIR)/rasterisk
427 $(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
428 $(INSTALL) -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/
429 if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \
430 cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;' > $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ;\
431 chmod 755 $(DESTDIR)$(ASTSBINDIR)/safe_asterisk;\
433 $(INSTALL) -d $(DESTDIR)$(ASTHEADERDIR)
434 $(INSTALL) -m 644 include/asterisk.h $(DESTDIR)$(includedir)
435 $(INSTALL) -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
436 if [ -n "$(OLDHEADERS)" ]; then \
437 rm -f $(addprefix $(DESTDIR)$(ASTHEADERDIR)/,$(OLDHEADERS)) ;\
439 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
440 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-custom
441 mkdir -p $(DESTDIR)$(ASTDATADIR)/keys
442 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware
443 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware/iax
444 mkdir -p $(DESTDIR)$(ASTMANDIR)/man8
445 $(INSTALL) -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTDATADIR)/keys
446 $(INSTALL) -m 644 keys/freeworlddialup.pub $(DESTDIR)$(ASTDATADIR)/keys
447 $(INSTALL) -m 644 doc/asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
448 $(INSTALL) -m 644 contrib/scripts/astgenkey.8 $(DESTDIR)$(ASTMANDIR)/man8
449 $(INSTALL) -m 644 contrib/scripts/autosupport.8 $(DESTDIR)$(ASTMANDIR)/man8
450 $(INSTALL) -m 644 contrib/scripts/safe_asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
451 if [ -f contrib/firmware/iax/iaxy.bin ] ; then \
452 $(INSTALL) -m 644 contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTDATADIR)/firmware/iax/iaxy.bin; \
456 @DESTDIR="$(DESTDIR)" ASTSBINDIR="$(ASTSBINDIR)" $(MAKE) -C $(@:-install=) install
458 NEWMODS=$(notdir $(wildcard */*.so))
459 OLDMODS=$(filter-out $(NEWMODS),$(notdir $(wildcard $(DESTDIR)$(MODULES_DIR)/*.so)))
462 @if [ -n "$(OLDMODS)" ]; then \
463 echo " WARNING WARNING WARNING" ;\
465 echo " Your Asterisk modules directory, located at" ;\
466 echo " $(DESTDIR)$(MODULES_DIR)" ;\
467 echo " contains modules that were not installed by this " ;\
468 echo " version of Asterisk. Please ensure that these" ;\
469 echo " modules are compatible with this version before" ;\
470 echo " attempting to run Asterisk." ;\
472 for f in $(OLDMODS); do \
476 echo " WARNING WARNING WARNING" ;\
479 install: datafiles bininstall $(SUBDIRS_INSTALL)
480 @if [ -x /usr/sbin/asterisk-post-install ]; then \
481 /usr/sbin/asterisk-post-install $(DESTDIR) . ; \
483 @echo " +---- Asterisk Installation Complete -------+"
485 @echo " + YOU MUST READ THE SECURITY DOCUMENT +"
487 @echo " + Asterisk has successfully been installed. +"
488 @echo " + If you would like to install the sample +"
489 @echo " + configuration files (overwriting any +"
490 @echo " + existing config files), run: +"
492 @echo " + $(MAKE) samples +"
494 @echo " +----------------- or ---------------------+"
496 @echo " + You can go ahead and install the asterisk +"
497 @echo " + program documentation now or later run: +"
499 @echo " + $(MAKE) progdocs +"
501 @echo " + **Note** This requires that you have +"
502 @echo " + doxygen installed on your local system +"
503 @echo " +-------------------------------------------+"
504 @$(MAKE) -s oldmodcheck
509 mkdir -p $(DESTDIR)$(ASTETCDIR)
510 for x in configs/*.adsi; do \
511 if [ ! -f $(DESTDIR)$(ASTETCDIR)/$$x ]; then \
512 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x` ; \
517 mkdir -p $(DESTDIR)$(ASTETCDIR)
518 for x in configs/*.sample; do \
519 if [ -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ]; then \
520 if [ "$(OVERWRITE)" = "y" ]; then \
521 if cmp -s $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $$x ; then \
522 echo "Config file $$x is unchanged"; \
525 mv -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample`.old ; \
527 echo "Skipping config file $$x"; \
531 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ;\
533 if [ "$(OVERWRITE)" = "y" ] || [ ! -f $(DESTDIR)$(ASTCONFPATH) ]; then \
535 echo "[directories]" ; \
536 echo "astetcdir => $(ASTETCDIR)" ; \
537 echo "astmoddir => $(MODULES_DIR)" ; \
538 echo "astvarlibdir => $(ASTVARLIBDIR)" ; \
539 echo "astdatadir => $(ASTDATADIR)" ; \
540 echo "astagidir => $(AGI_DIR)" ; \
541 echo "astspooldir => $(ASTSPOOLDIR)" ; \
542 echo "astrundir => $(ASTVARRUNDIR)" ; \
543 echo "astlogdir => $(ASTLOGDIR)" ; \
545 echo ";[options]" ; \
546 echo ";internal_timing = yes" ; \
547 echo ";systemname = my_system_name ; prefix uniqueid with a system name for global uniqueness issues" ; \
548 echo "; Changing the following lines may compromise your security." ; \
550 echo ";astctlpermissions = 0660" ; \
551 echo ";astctlowner = root" ; \
552 echo ";astctlgroup = apache" ; \
553 echo ";astctl = asterisk.ctl" ; \
554 ) > $(DESTDIR)$(ASTCONFPATH) ; \
556 echo "Skipping asterisk.conf creation"; \
558 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
559 build_tools/make_sample_voicemail $(DESTDIR)/$(ASTDATADIR) $(DESTDIR)/$(ASTSPOOLDIR)
562 @[ -d $(DESTDIR)$(HTTP_DOCSDIR)/ ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 )
563 @[ -d $(DESTDIR)$(HTTP_CGIDIR) ] || ( printf "cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit 1 )
564 $(INSTALL) -m 4755 -o root -g root contrib/scripts/vmail.cgi $(DESTDIR)$(HTTP_CGIDIR)/vmail.cgi
565 mkdir -p $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk
566 for x in images/*.gif; do \
567 $(INSTALL) -m 644 $$x $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk/; \
569 @echo " +--------- Asterisk Web Voicemail ----------+"
571 @echo " + Asterisk Web Voicemail is installed in +"
572 @echo " + your cgi-bin directory: +"
573 @echo " + $(DESTDIR)$(HTTP_CGIDIR)"
574 @echo " + IT USES A SETUID ROOT PERL SCRIPT, SO +"
575 @echo " + IF YOU DON'T LIKE THAT, UNINSTALL IT! +"
577 @echo " + Other static items have been stored in: +"
578 @echo " + $(DESTDIR)$(HTTP_DOCSDIR)"
580 @echo " + If these paths do not match your httpd +"
581 @echo " + installation, correct the definitions +"
582 @echo " + in your Makefile of HTTP_CGIDIR and +"
583 @echo " + HTTP_DOCSDIR +"
585 @echo " +-------------------------------------------+"
588 sed "s/^Version:.*/Version: $(RPMVERSION)/g" redhat/asterisk.spec > asterisk.spec ; \
592 __rpm: include/asterisk/version.h include/asterisk/buildopts.h spec
593 rm -rf /tmp/asterisk ; \
594 mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
595 $(MAKE) DESTDIR=/tmp/asterisk install ; \
596 $(MAKE) DESTDIR=/tmp/asterisk samples ; \
597 mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
598 cp -f contrib/init.d/rc.redhat.asterisk /tmp/asterisk/etc/rc.d/init.d/asterisk ; \
599 rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec
602 (cat contrib/asterisk-ng-doxygen; echo "HAVE_DOT=$(HAVEDOT)"; \
603 echo "PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen -
606 @if [ "${OSARCH}" = "linux-gnu" ]; then \
607 if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \
608 $(INSTALL) -m 755 contrib/init.d/rc.redhat.asterisk /etc/rc.d/init.d/asterisk; \
609 /sbin/chkconfig --add asterisk; \
610 elif [ -f /etc/debian_version ]; then \
611 $(INSTALL) -m 755 contrib/init.d/rc.debian.asterisk /etc/init.d/asterisk; \
612 /usr/sbin/update-rc.d asterisk start 10 2 3 4 5 . stop 91 2 3 4 5 .; \
613 elif [ -f /etc/gentoo-release ]; then \
614 $(INSTALL) -m 755 contrib/init.d/rc.gentoo.asterisk /etc/init.d/asterisk; \
615 /sbin/rc-update add asterisk default; \
616 elif [ -f /etc/mandrake-release ]; then \
617 $(INSTALL) -m 755 contrib/init.d/rc.mandrake.asterisk /etc/rc.d/init.d/asterisk; \
618 /sbin/chkconfig --add asterisk; \
619 elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then \
620 $(INSTALL) -m 755 contrib/init.d/rc.suse.asterisk /etc/init.d/asterisk; \
621 /sbin/chkconfig --add asterisk; \
622 elif [ -f /etc/slackware-version ]; then \
623 echo "Slackware is not currently supported, although an init script does exist for it." \
625 echo "We could not install init scripts for your distribution."; \
628 echo "We could not install init scripts for your operating system."; \
632 $(MAKE) -C sounds all
634 # If the cleancount has been changed, force a make clean.
635 # .cleancount is the global clean count, and .lastclean is the
636 # last clean count we had
639 @if ! cmp -s .cleancount .lastclean ; then \
643 $(SUBDIRS_UNINSTALL):
644 @$(MAKE) --no-print-directory -C $(@:-uninstall=) uninstall
646 _uninstall: $(SUBDIRS_UNINSTALL)
647 rm -f $(DESTDIR)$(MODULES_DIR)/*
648 rm -f $(DESTDIR)$(ASTSBINDIR)/*asterisk*
649 rm -f $(DESTDIR)$(ASTSBINDIR)/astgenkey
650 rm -f $(DESTDIR)$(ASTSBINDIR)/autosupport
651 rm -rf $(DESTDIR)$(ASTHEADERDIR)
652 rm -rf $(DESTDIR)$(ASTDATADIR)/firmware
653 rm -rf $(DESTDIR)$(ASTMANDIR)/man8
654 $(MAKE) -C sounds uninstall
656 uninstall: _uninstall
657 @echo " +--------- Asterisk Uninstall Complete -----+"
658 @echo " + Asterisk binaries, sounds, man pages, +"
659 @echo " + headers, modules, and firmware builds, +"
660 @echo " + have all been uninstalled. +"
662 @echo " + To remove ALL traces of Asterisk, +"
663 @echo " + including configuration, spool +"
664 @echo " + directories, and logs, run the following +"
665 @echo " + command: +"
667 @echo " + $(MAKE) uninstall-all +"
668 @echo " +-------------------------------------------+"
670 uninstall-all: _uninstall
671 rm -rf $(DESTDIR)$(ASTLIBDIR)
672 rm -rf $(DESTDIR)$(ASTVARLIBDIR)
673 rm -rf $(DESTDIR)$(ASTDATADIR)
674 rm -rf $(DESTDIR)$(ASTSPOOLDIR)
675 rm -rf $(DESTDIR)$(ASTETCDIR)
676 rm -rf $(DESTDIR)$(ASTLOGDIR)
678 menuconfig: menuselect
680 gmenuconfig: gmenuselect
682 menuselect: menuselect/menuselect menuselect-tree
683 -@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!"
685 gmenuselect: menuselect/gmenuselect menuselect-tree
686 -@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!"
688 menuselect/menuselect: makeopts menuselect/menuselect.c menuselect/menuselect_curses.c menuselect/menuselect_stub.c menuselect/menuselect.h menuselect/linkedlists.h makeopts
689 @CC="$(HOST_CC)" LD="" AR="" RANLIB="" $(MAKE) -C menuselect CONFIGURE_SILENT="--silent"
691 menuselect/gmenuselect: makeopts menuselect/menuselect.c menuselect/menuselect_gtk.c menuselect/menuselect_stub.c menuselect/menuselect.h menuselect/linkedlists.h makeopts
692 @CC="$(HOST_CC)" CXX="$(CXX)" LD="" AR="" RANLIB="" $(MAKE) -C menuselect _gmenuselect CONFIGURE_SILENT="--silent"
694 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
695 @echo "Generating input for menuselect ..."
696 @build_tools/prep_moduledeps > $@
698 asterisk.pdf: doc/asterisk.pdf
700 doc/asterisk.pdf: $(wildcard doc/*.tex)
701 ifeq ($(findstring rubber,$(RUBBER)),)
702 @echo "**********************************************"
703 @echo "** You must install the \"rubber\" tool ***"
704 @echo "** to generate the Asterisk reference PDF. ***"
705 @echo "**********************************************"
707 @echo "**********************************************"
708 @echo "** The Asterisk reference PDF will now be ***"
709 @echo "** generated. When complete, it will be ***"
710 @echo "** located at doc/asterisk.pdf. ***"
711 @echo "**********************************************"
712 @cp doc/asterisk.tex doc/asterisk.tex.orig
713 @sed -i -e 's/ASTERISKVERSION/$(ASTERISKVERSION)/' doc/asterisk.tex
714 @cd doc && $(RUBBER) --pdf asterisk.tex
715 @mv doc/asterisk.tex.orig doc/asterisk.tex
718 .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) menuselect.makeopts