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
68 # even though we could use '-include makeopts' here, use a wildcard
69 # lookup anyway, so that make won't try to build makeopts if it doesn't
70 # exist (other rules will force it to be built if needed)
71 ifneq ($(wildcard makeopts),)
75 #Uncomment this to see all build commands instead of 'quiet' output
78 # Create OPTIONS variable
83 # Overwite config files on "make samples"
86 # Include debug and macro symbols in the executables (-g) and profiling info (-pg)
90 # Files are copied here temporarily during the install process
91 # For example, make DESTDIR=/tmp/asterisk woud put things in
92 # /tmp/asterisk/etc/asterisk
93 # !!! Watch out, put no spaces or comments after the value !!!
94 #DESTDIR?=/tmp/asterisk
96 # Define standard directories for various platforms
97 # These apply if they are not redefined in asterisk.conf
98 ifeq ($(OSARCH),SunOS)
99 ASTETCDIR=/var/etc/asterisk
100 ASTLIBDIR=/opt/asterisk/lib
101 ASTVARLIBDIR=/var/opt/asterisk
102 ASTSPOOLDIR=/var/spool/asterisk
103 ASTLOGDIR=/var/log/asterisk
104 ASTHEADERDIR=/opt/asterisk/include
105 ASTBINDIR=/opt/asterisk/bin
106 ASTSBINDIR=/opt/asterisk/sbin
107 ASTVARRUNDIR=/var/run/asterisk
108 ASTMANDIR=/opt/asterisk/man
110 ASTETCDIR=$(sysconfdir)/asterisk
111 ASTLIBDIR=$(libdir)/asterisk
112 ASTHEADERDIR=$(includedir)/asterisk
114 ASTSBINDIR=$(sbindir)
115 ASTSPOOLDIR=$(localstatedir)/spool/asterisk
116 ASTLOGDIR=$(localstatedir)/log/asterisk
117 ASTVARRUNDIR=$(localstatedir)/run
119 ifeq ($(OSARCH),FreeBSD)
120 ASTVARLIBDIR=$(prefix)/share/asterisk
122 ASTVARLIBDIR=$(localstatedir)/lib/asterisk
125 ifeq ($(ASTDATADIR),)
126 ASTDATADIR:=$(ASTVARLIBDIR)
129 # Asterisk.conf is located in ASTETCDIR or by using the -C flag
130 # when starting Asterisk
131 ASTCONFPATH=$(ASTETCDIR)/asterisk.conf
132 MODULES_DIR=$(ASTLIBDIR)/modules
133 AGI_DIR=$(ASTDATADIR)/agi-bin
135 # If you use Apache, you may determine by a grep 'DocumentRoot' of your httpd.conf file
136 HTTP_DOCSDIR=/var/www/html
137 # Determine by a grep 'ScriptAlias' of your Apache httpd.conf file
138 HTTP_CGIDIR=/var/www/cgi-bin
140 # Uncomment this to use the older DSP routines
141 #ASTCFLAGS+=-DOLD_DSP_ROUTINES
143 # If the file .asterisk.makeopts is present in your home directory, you can
144 # include all of your favorite menuselect options so that every time you download
145 # a new version of Asterisk, you don't have to run menuselect to set them.
146 # The file /etc/asterisk.makeopts will also be included but can be overridden
147 # by the file in your home directory.
149 GLOBAL_MAKEOPTS=$(wildcard /etc/asterisk.makeopts)
150 USER_MAKEOPTS=$(wildcard ~/.asterisk.makeopts)
152 MOD_SUBDIR_CFLAGS=-I$(ASTTOPDIR)/include
153 OTHER_SUBDIR_CFLAGS=-I$(ASTTOPDIR)/include
155 ifeq ($(OSARCH),linux-gnu)
156 ifeq ($(PROC),x86_64)
157 # You must have GCC 3.4 to use k8, otherwise use athlon
162 ifeq ($(PROC),sparc64)
163 #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
164 #This works for even old (2.96) versions of gcc and provides a small boost either way.
165 #A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
166 #So we go lowest common available by gcc and go a step down, still a step up from
167 #the default as we now have a better instruction set to work with. - Belgarath
169 OPTIONS+=$(shell if $(CC) -mtune=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mtune=$(PROC)"; fi)
170 OPTIONS+=$(shell if $(CC) -mcpu=v8 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mcpu=v8"; fi)
171 OPTIONS+=-fomit-frame-pointer
175 # The Cirrus logic is the only heavily shipping arm processor with a real floating point unit
176 ifeq ($(SUB_PROC),maverick)
177 OPTIONS+=-fsigned-char -mcpu=ep9312
179 ifeq ($(SUB_PROC),xscale)
180 OPTIONS+=-fsigned-char -mcpu=xscale
182 OPTIONS+=-fsigned-char
188 ASTCFLAGS+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG)
190 ASTCFLAGS+=-include $(ASTTOPDIR)/include/asterisk/autoconfig.h
192 ifeq ($(AST_DEVMODE),yes)
193 ASTCFLAGS+=-Werror -Wunused -Wundef
196 ifneq ($(findstring BSD,$(OSARCH)),)
197 ASTCFLAGS+=-I/usr/local/include
198 ASTLDFLAGS+=-L/usr/local/lib
201 ifneq ($(PROC),ultrasparc)
202 ASTCFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
206 ASTCFLAGS+=-fsigned-char
209 ifeq ($(OSARCH),FreeBSD)
210 # -V is understood by BSD Make, not by GNU make.
211 BSDVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk)
212 ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
213 AST_LIBS+=$(shell if test $(BSDVERSION) -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi)
216 ifeq ($(OSARCH),NetBSD)
217 ASTCFLAGS+=-pthread -I/usr/pkg/include
220 ifeq ($(OSARCH),OpenBSD)
224 ifeq ($(OSARCH),SunOS)
225 ASTCFLAGS+=-Wcast-align -DSOLARIS -I../include/solaris-compat -I/opt/ssl/include -I/usr/local/ssl/include
228 ASTERISKVERSION:=$(shell build_tools/make_version .)
230 ifneq ($(wildcard .version),)
231 ASTERISKVERSIONNUM:=$(shell awk -F. '{printf "%01d%02d%02d", $$1, $$2, $$3}' .version)
232 RPMVERSION:=$(shell sed 's/[-\/:]/_/g' .version)
237 ifneq ($(wildcard .svn),)
238 ASTERISKVERSIONNUM=999999
241 ASTCFLAGS+=$(MALLOC_DEBUG)$(BUSYDETECT)$(OPTIONS)
243 MOD_SUBDIRS:=res channels pbx apps codecs formats cdr funcs main
244 OTHER_SUBDIRS:=utils agi
245 SUBDIRS:=$(OTHER_SUBDIRS) $(MOD_SUBDIRS)
246 SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)
247 SUBDIRS_CLEAN:=$(SUBDIRS:%=%-clean)
248 SUBDIRS_UNINSTALL:=$(SUBDIRS:%=%-uninstall)
249 MOD_SUBDIRS_EMBED_LDSCRIPT:=$(MOD_SUBDIRS:%=%-embed-ldscript)
250 MOD_SUBDIRS_EMBED_LDFLAGS:=$(MOD_SUBDIRS:%=%-embed-ldflags)
251 MOD_SUBDIRS_EMBED_LIBS:=$(MOD_SUBDIRS:%=%-embed-libs)
253 ifneq ($(findstring darwin,$(OSARCH)),)
254 ASTCFLAGS+=-D__Darwin__
255 AUDIO_LIBS=-framework CoreAudio
256 SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
258 # These are used for all but Darwin
259 SOLINK=-shared -Xlinker -x
260 ifneq ($(findstring BSD,$(OSARCH)),)
261 LDFLAGS+=-L/usr/local/lib
265 ifeq ($(OSARCH),SunOS)
266 SOLINK=-shared -fpic -L/usr/local/ssl/lib
269 # This is used when generating the doxygen documentation
277 @echo " +--------- Asterisk Build Complete ---------+"
278 @echo " + Asterisk has successfully been built, and +"
279 @echo " + can be installed by running: +"
281 @echo " + $(MAKE) install +"
282 @echo " +-------------------------------------------+"
284 _all: cleantest $(SUBDIRS)
288 @echo "**** The configure script must be executed before running '$(MAKE)'."
292 menuselect.makeopts: menuselect/menuselect menuselect-tree
293 menuselect/menuselect --check-deps $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts
295 $(MOD_SUBDIRS_EMBED_LDSCRIPT):
296 @echo "EMBED_LDSCRIPTS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-ldscript=) SUBDIR=$(@:-embed-ldscript=) __embed_ldscript` >> makeopts.embed_rules
298 $(MOD_SUBDIRS_EMBED_LDFLAGS):
299 @echo "EMBED_LDFLAGS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-ldflags=) SUBDIR=$(@:-embed-ldflags=) __embed_ldflags` >> makeopts.embed_rules
301 $(MOD_SUBDIRS_EMBED_LIBS):
302 @echo "EMBED_LIBS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-libs=) SUBDIR=$(@:-embed-libs=) __embed_libs` >> makeopts.embed_rules
304 makeopts.embed_rules: menuselect.makeopts
305 @echo "Generating embedded module rules ..."
307 @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LDSCRIPT)
308 @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LDFLAGS)
309 @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LIBS)
311 $(SUBDIRS): include/asterisk/version.h include/asterisk/build.h include/asterisk/buildopts.h defaults.h makeopts.embed_rules
313 # ensure that all module subdirectories are processed before 'main' during
314 # a parallel build, since if there are modules selected to be embedded the
315 # directories containing them must be completed before the main Asterisk
316 # binary can be built
317 main: $(filter-out main,$(MOD_SUBDIRS))
320 @ASTCFLAGS="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" AST_LIBS="$(AST_LIBS)" $(MAKE) --no-print-directory --no-builtin-rules -C $@ SUBDIR=$@ all
323 @ASTCFLAGS="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" AUDIO_LIBS="$(AUDIO_LIBS)" $(MAKE) --no-print-directory --no-builtin-rules -C $@ SUBDIR=$@ all
326 @build_tools/make_defaults_h > $@.tmp
327 @if cmp -s $@.tmp $@ ; then : ; else \
332 include/asterisk/version.h:
333 @build_tools/make_version_h > $@.tmp
334 @if cmp -s $@.tmp $@ ; then : ; else \
339 include/asterisk/buildopts.h: menuselect.makeopts
340 @build_tools/make_buildopts_h > $@.tmp
341 @if cmp -s $@.tmp $@ ; then : ; else \
346 include/asterisk/build.h:
347 @build_tools/make_build_h > $@.tmp
348 @if cmp -s $@.tmp $@ ; then : ; else \
354 @$(MAKE) --no-print-directory -C $(@:-clean=) clean
356 clean: $(SUBDIRS_CLEAN)
358 rm -f include/asterisk/build.h
359 rm -f include/asterisk/version.h
360 @$(MAKE) -C menuselect clean
361 cp -f .cleancount .lastclean
363 dist-clean: distclean
366 @$(MAKE) -C menuselect dist-clean
367 @$(MAKE) -C sounds dist-clean
368 rm -f menuselect.makeopts makeopts menuselect-tree menuselect.makedeps
369 rm -f makeopts.embed_rules
370 rm -f config.log config.status
371 rm -rf autom4te.cache
372 rm -f include/asterisk/autoconfig.h
373 rm -f include/asterisk/buildopts.h
375 rm -f build_tools/menuselect-deps
378 if [ x`$(ID) -un` = xroot ]; then CFLAGS="$(ASTCFLAGS)" sh build_tools/mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig; fi
379 # Should static HTTP be installed during make samples or even with its own target ala
380 # webvoicemail? There are portions here that *could* be customized but might also be
381 # improved a lot. I'll put it here for now.
382 mkdir -p $(DESTDIR)$(ASTDATADIR)/static-http
383 for x in static-http/*; do \
384 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/static-http ; \
386 mkdir -p $(DESTDIR)$(ASTDATADIR)/images
387 for x in images/*.jpg; do \
388 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/images ; \
390 mkdir -p $(DESTDIR)$(AGI_DIR)
391 $(MAKE) -C sounds install
394 @if [ -d .svn ]; then \
395 echo "Updating from Subversion..." ; \
396 svn update | tee update.out; \
398 if [ `grep -c ^C update.out` -gt 0 ]; then \
399 echo ; echo "The following files have conflicts:" ; \
400 grep ^C update.out | cut -b4- ; \
404 echo "Not under version control"; \
407 NEWHEADERS=$(notdir $(wildcard include/asterisk/*.h))
408 OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h)))
411 mkdir -p $(DESTDIR)$(MODULES_DIR)
412 mkdir -p $(DESTDIR)$(ASTSBINDIR)
413 mkdir -p $(DESTDIR)$(ASTETCDIR)
414 mkdir -p $(DESTDIR)$(ASTBINDIR)
415 mkdir -p $(DESTDIR)$(ASTVARRUNDIR)
416 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail
417 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/dictate
418 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/system
419 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/tmp
420 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/meetme
421 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/monitor
422 $(INSTALL) -m 755 main/asterisk $(DESTDIR)$(ASTSBINDIR)/
423 $(LN) -sf asterisk $(DESTDIR)$(ASTSBINDIR)/rasterisk
424 $(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
425 $(INSTALL) -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/
426 if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \
427 cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;' > $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ;\
428 chmod 755 $(DESTDIR)$(ASTSBINDIR)/safe_asterisk;\
430 $(INSTALL) -d $(DESTDIR)$(ASTHEADERDIR)
431 $(INSTALL) -m 644 include/asterisk.h $(DESTDIR)$(includedir)
432 $(INSTALL) -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
433 if [ -n "$(OLDHEADERS)" ]; then \
434 rm -f $(addprefix $(DESTDIR)$(ASTHEADERDIR)/,$(OLDHEADERS)) ;\
436 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
437 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-custom
438 mkdir -p $(DESTDIR)$(ASTDATADIR)/keys
439 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware
440 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware/iax
441 mkdir -p $(DESTDIR)$(ASTMANDIR)/man8
442 $(INSTALL) -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTDATADIR)/keys
443 $(INSTALL) -m 644 keys/freeworlddialup.pub $(DESTDIR)$(ASTDATADIR)/keys
444 $(INSTALL) -m 644 doc/asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
445 $(INSTALL) -m 644 contrib/scripts/astgenkey.8 $(DESTDIR)$(ASTMANDIR)/man8
446 $(INSTALL) -m 644 contrib/scripts/autosupport.8 $(DESTDIR)$(ASTMANDIR)/man8
447 $(INSTALL) -m 644 contrib/scripts/safe_asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
448 if [ -f contrib/firmware/iax/iaxy.bin ] ; then \
449 $(INSTALL) -m 644 contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTDATADIR)/firmware/iax/iaxy.bin; \
453 @DESTDIR="$(DESTDIR)" ASTSBINDIR="$(ASTSBINDIR)" $(MAKE) -C $(@:-install=) install
455 NEWMODS=$(notdir $(wildcard */*.so))
456 OLDMODS=$(filter-out $(NEWMODS),$(notdir $(wildcard $(DESTDIR)$(MODULES_DIR)/*.so)))
459 @if [ -n "$(OLDMODS)" ]; then \
460 echo " WARNING WARNING WARNING" ;\
462 echo " Your Asterisk modules directory, located at" ;\
463 echo " $(DESTDIR)$(MODULES_DIR)" ;\
464 echo " contains modules that were not installed by this " ;\
465 echo " version of Asterisk. Please ensure that these" ;\
466 echo " modules are compatible with this version before" ;\
467 echo " attempting to run Asterisk." ;\
469 for f in $(OLDMODS); do \
473 echo " WARNING WARNING WARNING" ;\
476 install: datafiles bininstall $(SUBDIRS_INSTALL)
477 @if [ -x /usr/sbin/asterisk-post-install ]; then \
478 /usr/sbin/asterisk-post-install $(DESTDIR) . ; \
480 @echo " +---- Asterisk Installation Complete -------+"
482 @echo " + YOU MUST READ THE SECURITY DOCUMENT +"
484 @echo " + Asterisk has successfully been installed. +"
485 @echo " + If you would like to install the sample +"
486 @echo " + configuration files (overwriting any +"
487 @echo " + existing config files), run: +"
489 @echo " + $(MAKE) samples +"
491 @echo " +----------------- or ---------------------+"
493 @echo " + You can go ahead and install the asterisk +"
494 @echo " + program documentation now or later run: +"
496 @echo " + $(MAKE) progdocs +"
498 @echo " + **Note** This requires that you have +"
499 @echo " + doxygen installed on your local system +"
500 @echo " +-------------------------------------------+"
501 @$(MAKE) -s oldmodcheck
506 mkdir -p $(DESTDIR)$(ASTETCDIR)
507 for x in configs/*.adsi; do \
508 if [ ! -f $(DESTDIR)$(ASTETCDIR)/$$x ]; then \
509 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x` ; \
514 mkdir -p $(DESTDIR)$(ASTETCDIR)
515 for x in configs/*.sample; do \
516 if [ -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ]; then \
517 if [ "$(OVERWRITE)" = "y" ]; then \
518 if cmp -s $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $$x ; then \
519 echo "Config file $$x is unchanged"; \
522 mv -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample`.old ; \
524 echo "Skipping config file $$x"; \
528 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ;\
530 if [ "$(OVERWRITE)" = "y" ] || [ ! -f $(DESTDIR)$(ASTCONFPATH) ]; then \
532 echo "[directories]" ; \
533 echo "astetcdir => $(ASTETCDIR)" ; \
534 echo "astmoddir => $(MODULES_DIR)" ; \
535 echo "astvarlibdir => $(ASTVARLIBDIR)" ; \
536 echo "astdatadir => $(ASTDATADIR)" ; \
537 echo "astagidir => $(AGI_DIR)" ; \
538 echo "astspooldir => $(ASTSPOOLDIR)" ; \
539 echo "astrundir => $(ASTVARRUNDIR)" ; \
540 echo "astlogdir => $(ASTLOGDIR)" ; \
542 echo ";[options]" ; \
543 echo ";internal_timing = yes" ; \
544 echo ";systemname = my_system_name ; prefix uniqueid with a system name for global uniqueness issues" ; \
545 echo "; Changing the following lines may compromise your security." ; \
547 echo ";astctlpermissions = 0660" ; \
548 echo ";astctlowner = root" ; \
549 echo ";astctlgroup = apache" ; \
550 echo ";astctl = asterisk.ctl" ; \
551 ) > $(DESTDIR)$(ASTCONFPATH) ; \
553 echo "Skipping asterisk.conf creation"; \
555 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
556 build_tools/make_sample_voicemail $(DESTDIR)/$(ASTDATADIR) $(DESTDIR)/$(ASTSPOOLDIR)
559 @[ -d $(DESTDIR)$(HTTP_DOCSDIR)/ ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 )
560 @[ -d $(DESTDIR)$(HTTP_CGIDIR) ] || ( printf "cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit 1 )
561 $(INSTALL) -m 4755 -o root -g root contrib/scripts/vmail.cgi $(DESTDIR)$(HTTP_CGIDIR)/vmail.cgi
562 mkdir -p $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk
563 for x in images/*.gif; do \
564 $(INSTALL) -m 644 $$x $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk/; \
566 @echo " +--------- Asterisk Web Voicemail ----------+"
568 @echo " + Asterisk Web Voicemail is installed in +"
569 @echo " + your cgi-bin directory: +"
570 @echo " + $(DESTDIR)$(HTTP_CGIDIR)"
571 @echo " + IT USES A SETUID ROOT PERL SCRIPT, SO +"
572 @echo " + IF YOU DON'T LIKE THAT, UNINSTALL IT! +"
574 @echo " + Other static items have been stored in: +"
575 @echo " + $(DESTDIR)$(HTTP_DOCSDIR)"
577 @echo " + If these paths do not match your httpd +"
578 @echo " + installation, correct the definitions +"
579 @echo " + in your Makefile of HTTP_CGIDIR and +"
580 @echo " + HTTP_DOCSDIR +"
582 @echo " +-------------------------------------------+"
585 sed "s/^Version:.*/Version: $(RPMVERSION)/g" redhat/asterisk.spec > asterisk.spec ; \
589 __rpm: include/asterisk/version.h include/asterisk/buildopts.h spec
590 rm -rf /tmp/asterisk ; \
591 mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
592 $(MAKE) DESTDIR=/tmp/asterisk install ; \
593 $(MAKE) DESTDIR=/tmp/asterisk samples ; \
594 mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
595 cp -f contrib/init.d/rc.redhat.asterisk /tmp/asterisk/etc/rc.d/init.d/asterisk ; \
596 rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec
599 (cat contrib/asterisk-ng-doxygen; echo "HAVE_DOT=$(HAVEDOT)"; \
600 echo "PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen -
603 @if [ "${OSARCH}" = "linux-gnu" ]; then \
604 if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \
605 $(INSTALL) -m 755 contrib/init.d/rc.redhat.asterisk /etc/rc.d/init.d/asterisk; \
606 /sbin/chkconfig --add asterisk; \
607 elif [ -f /etc/debian_version ]; then \
608 $(INSTALL) -m 755 contrib/init.d/rc.debian.asterisk /etc/init.d/asterisk; \
609 /usr/sbin/update-rc.d asterisk start 10 2 3 4 5 . stop 91 2 3 4 5 .; \
610 elif [ -f /etc/gentoo-release ]; then \
611 $(INSTALL) -m 755 contrib/init.d/rc.gentoo.asterisk /etc/init.d/asterisk; \
612 /sbin/rc-update add asterisk default; \
613 elif [ -f /etc/mandrake-release ]; then \
614 $(INSTALL) -m 755 contrib/init.d/rc.mandrake.asterisk /etc/rc.d/init.d/asterisk; \
615 /sbin/chkconfig --add asterisk; \
616 elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then \
617 $(INSTALL) -m 755 contrib/init.d/rc.suse.asterisk /etc/init.d/asterisk; \
618 /sbin/chkconfig --add asterisk; \
619 elif [ -f /etc/slackware-version ]; then \
620 echo "Slackware is not currently supported, although an init script does exist for it." \
622 echo "We could not install init scripts for your distribution."; \
625 echo "We could not install init scripts for your operating system."; \
629 $(MAKE) -C sounds all
631 # If the cleancount has been changed, force a make clean.
632 # .cleancount is the global clean count, and .lastclean is the
633 # last clean count we had
636 @if ! cmp -s .cleancount .lastclean ; then \
640 $(SUBDIRS_UNINSTALL):
641 @$(MAKE) --no-print-directory -C $(@:-uninstall=) uninstall
643 _uninstall: $(SUBDIRS_UNINSTALL)
644 rm -f $(DESTDIR)$(MODULES_DIR)/*
645 rm -f $(DESTDIR)$(ASTSBINDIR)/*asterisk*
646 rm -f $(DESTDIR)$(ASTSBINDIR)/astgenkey
647 rm -f $(DESTDIR)$(ASTSBINDIR)/autosupport
648 rm -rf $(DESTDIR)$(ASTHEADERDIR)
649 rm -rf $(DESTDIR)$(ASTDATADIR)/firmware
650 rm -rf $(DESTDIR)$(ASTMANDIR)/man8
651 $(MAKE) -C sounds uninstall
653 uninstall: _uninstall
654 @echo " +--------- Asterisk Uninstall Complete -----+"
655 @echo " + Asterisk binaries, sounds, man pages, +"
656 @echo " + headers, modules, and firmware builds, +"
657 @echo " + have all been uninstalled. +"
659 @echo " + To remove ALL traces of Asterisk, +"
660 @echo " + including configuration, spool +"
661 @echo " + directories, and logs, run the following +"
662 @echo " + command: +"
664 @echo " + $(MAKE) uninstall-all +"
665 @echo " +-------------------------------------------+"
667 uninstall-all: _uninstall
668 rm -rf $(DESTDIR)$(ASTLIBDIR)
669 rm -rf $(DESTDIR)$(ASTVARLIBDIR)
670 rm -rf $(DESTDIR)$(ASTDATADIR)
671 rm -rf $(DESTDIR)$(ASTSPOOLDIR)
672 rm -rf $(DESTDIR)$(ASTETCDIR)
673 rm -rf $(DESTDIR)$(ASTLOGDIR)
675 menuconfig: menuselect
677 menuselect: menuselect/menuselect menuselect-tree
678 -@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!"
680 menuselect/menuselect: makeopts menuselect/menuselect.c menuselect/menuselect_curses.c menuselect/menuselect_stub.c menuselect/menuselect.h menuselect/linkedlists.h makeopts
681 @CC="$(HOST_CC)" LD="" AR="" RANLIB="" $(MAKE) -C menuselect CONFIGURE_SILENT="--silent"
683 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
684 @echo "Generating input for menuselect ..."
685 @build_tools/prep_moduledeps > $@
687 asterisk.pdf: doc/asterisk.pdf
690 ifeq ($(findstring rubber,$(RUBBER)),)
691 @echo "**********************************************"
692 @echo "** You must install the \"rubber\" tool ***"
693 @echo "** to generate the Asterisk reference PDF. ***"
694 @echo "**********************************************"
696 @echo "**********************************************"
697 @echo "** The Asterisk reference PDF will now be ***"
698 @echo "** generated. When complete, it will be ***"
699 @echo "** located at doc/asterisk.pdf. ***"
700 @echo "**********************************************"
701 @cd doc && rubber asterisk.tex
704 .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)