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 # Some build systems, such as the one in openwrt, like to pass custom target
78 # CFLAGS in the COPTS variable.
81 #Uncomment this to see all build commands instead of 'quiet' output
84 # Create OPTIONS variable
89 # Overwite config files on "make samples"
92 # Include debug and macro symbols in the executables (-g) and profiling info (-pg)
96 # Files are copied here temporarily during the install process
97 # For example, make DESTDIR=/tmp/asterisk woud put things in
98 # /tmp/asterisk/etc/asterisk
99 # !!! Watch out, put no spaces or comments after the value !!!
100 #DESTDIR?=/tmp/asterisk
102 # Define standard directories for various platforms
103 # These apply if they are not redefined in asterisk.conf
104 ifeq ($(OSARCH),SunOS)
105 ASTETCDIR=/var/etc/asterisk
106 ASTLIBDIR=/opt/asterisk/lib
107 ASTVARLIBDIR=/var/opt/asterisk
108 ASTSPOOLDIR=/var/spool/asterisk
109 ASTLOGDIR=/var/log/asterisk
110 ASTHEADERDIR=/opt/asterisk/include
111 ASTBINDIR=/opt/asterisk/bin
112 ASTSBINDIR=/opt/asterisk/sbin
113 ASTVARRUNDIR=/var/run/asterisk
114 ASTMANDIR=/opt/asterisk/man
116 ASTETCDIR=$(sysconfdir)/asterisk
117 ASTLIBDIR=$(libdir)/asterisk
118 ASTHEADERDIR=$(includedir)/asterisk
120 ASTSBINDIR=$(sbindir)
121 ASTSPOOLDIR=$(localstatedir)/spool/asterisk
122 ASTLOGDIR=$(localstatedir)/log/asterisk
123 ASTVARRUNDIR=$(localstatedir)/run
125 ifneq ($(findstring BSD,$(OSARCH)),)
126 ASTVARLIBDIR=$(prefix)/share/asterisk
127 ASTVARRUNDIR=$(localstatedir)/run/asterisk
129 ASTVARLIBDIR=$(localstatedir)/lib/asterisk
132 ifeq ($(ASTDATADIR),)
133 ASTDATADIR:=$(ASTVARLIBDIR)
136 # Asterisk.conf is located in ASTETCDIR or by using the -C flag
137 # when starting Asterisk
138 ASTCONFPATH=$(ASTETCDIR)/asterisk.conf
139 MODULES_DIR=$(ASTLIBDIR)/modules
140 AGI_DIR=$(ASTDATADIR)/agi-bin
142 # If you use Apache, you may determine by a grep 'DocumentRoot' of your httpd.conf file
143 HTTP_DOCSDIR=/var/www/html
144 # Determine by a grep 'ScriptAlias' of your Apache httpd.conf file
145 HTTP_CGIDIR=/var/www/cgi-bin
147 # Uncomment this to use the older DSP routines
148 #ASTCFLAGS+=-DOLD_DSP_ROUTINES
150 # If the file .asterisk.makeopts is present in your home directory, you can
151 # include all of your favorite menuselect options so that every time you download
152 # a new version of Asterisk, you don't have to run menuselect to set them.
153 # The file /etc/asterisk.makeopts will also be included but can be overridden
154 # by the file in your home directory.
156 GLOBAL_MAKEOPTS=$(wildcard /etc/asterisk.makeopts)
157 USER_MAKEOPTS=$(wildcard ~/.asterisk.makeopts)
159 MOD_SUBDIR_CFLAGS=-I$(ASTTOPDIR)/include
160 OTHER_SUBDIR_CFLAGS=-I$(ASTTOPDIR)/include
162 ifeq ($(OSARCH),linux-gnu)
163 ifeq ($(PROC),x86_64)
164 # You must have GCC 3.4 to use k8, otherwise use athlon
169 ifeq ($(PROC),sparc64)
170 #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
171 #This works for even old (2.96) versions of gcc and provides a small boost either way.
172 #A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
173 #So we go lowest common available by gcc and go a step down, still a step up from
174 #the default as we now have a better instruction set to work with. - Belgarath
176 OPTIONS+=$(shell if $(CC) -mtune=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mtune=$(PROC)"; fi)
177 OPTIONS+=$(shell if $(CC) -mcpu=v8 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mcpu=v8"; fi)
178 OPTIONS+=-fomit-frame-pointer
182 # The Cirrus logic is the only heavily shipping arm processor with a real floating point unit
183 ifeq ($(SUB_PROC),maverick)
184 OPTIONS+=-fsigned-char -mcpu=ep9312
186 ifeq ($(SUB_PROC),xscale)
187 OPTIONS+=-fsigned-char -mcpu=xscale
189 OPTIONS+=-fsigned-char
195 ASTCFLAGS+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG)
197 ASTCFLAGS+=-include $(ASTTOPDIR)/include/asterisk/autoconfig.h
199 ifeq ($(AST_DEVMODE),yes)
200 ASTCFLAGS+=-Werror -Wunused -Wundef $(AST_DECLARATION_AFTER_STATEMENT)
203 ifneq ($(findstring BSD,$(OSARCH)),)
204 ASTCFLAGS+=-I/usr/local/include
205 ASTLDFLAGS+=-L/usr/local/lib
208 ifneq ($(PROC),ultrasparc)
209 ASTCFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
213 ASTCFLAGS+=-fsigned-char
216 ifeq ($(OSARCH),FreeBSD)
217 # -V is understood by BSD Make, not by GNU make.
218 BSDVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk)
219 ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
220 AST_LIBS+=$(shell if test $(BSDVERSION) -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi)
223 ifeq ($(OSARCH),NetBSD)
224 ASTCFLAGS+=-pthread -I/usr/pkg/include
227 ifeq ($(OSARCH),OpenBSD)
231 ifeq ($(OSARCH),SunOS)
232 ASTCFLAGS+=-Wcast-align -DSOLARIS -I../include/solaris-compat -I/opt/ssl/include -I/usr/local/ssl/include
235 ASTERISKVERSION:=$(shell build_tools/make_version .)
237 ifneq ($(wildcard .version),)
238 ASTERISKVERSIONNUM:=$(shell awk -F. '{printf "%01d%02d%02d", $$1, $$2, $$3}' .version)
239 RPMVERSION:=$(shell sed 's/[-\/:]/_/g' .version)
244 ifneq ($(wildcard .svn),)
245 ASTERISKVERSIONNUM=999999
248 ASTCFLAGS+=$(MALLOC_DEBUG)$(BUSYDETECT)$(OPTIONS)
250 MOD_SUBDIRS:=res channels pbx apps codecs formats cdr funcs main
251 OTHER_SUBDIRS:=utils agi
252 SUBDIRS:=$(OTHER_SUBDIRS) $(MOD_SUBDIRS)
253 SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)
254 SUBDIRS_CLEAN:=$(SUBDIRS:%=%-clean)
255 SUBDIRS_UNINSTALL:=$(SUBDIRS:%=%-uninstall)
256 MOD_SUBDIRS_EMBED_LDSCRIPT:=$(MOD_SUBDIRS:%=%-embed-ldscript)
257 MOD_SUBDIRS_EMBED_LDFLAGS:=$(MOD_SUBDIRS:%=%-embed-ldflags)
258 MOD_SUBDIRS_EMBED_LIBS:=$(MOD_SUBDIRS:%=%-embed-libs)
260 ifneq ($(findstring darwin,$(OSARCH)),)
261 ASTCFLAGS+=-D__Darwin__
262 AUDIO_LIBS=-framework CoreAudio
263 SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
265 # These are used for all but Darwin
266 SOLINK=-shared -Xlinker -x
267 ifneq ($(findstring BSD,$(OSARCH)),)
268 LDFLAGS+=-L/usr/local/lib
272 ifeq ($(OSARCH),SunOS)
273 SOLINK=-shared -fpic -L/usr/local/ssl/lib
276 # This is used when generating the doxygen documentation
284 @echo " +--------- Asterisk Build Complete ---------+"
285 @echo " + Asterisk has successfully been built, and +"
286 @echo " + can be installed by running: +"
288 ifeq ($(MAKE), gmake)
289 @echo " + $(MAKE) install +"
291 @echo " + $(MAKE) install +"
293 @echo " +-------------------------------------------+"
295 _all: cleantest $(SUBDIRS)
299 @echo "**** The configure script must be executed before running '$(MAKE)'."
300 @echo "**** Please run \"./configure\"."
304 menuselect.makeopts: menuselect/menuselect menuselect-tree
305 menuselect/menuselect --check-deps $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts
307 $(MOD_SUBDIRS_EMBED_LDSCRIPT):
308 @echo "EMBED_LDSCRIPTS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-ldscript=) SUBDIR=$(@:-embed-ldscript=) __embed_ldscript` >> makeopts.embed_rules
310 $(MOD_SUBDIRS_EMBED_LDFLAGS):
311 @echo "EMBED_LDFLAGS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-ldflags=) SUBDIR=$(@:-embed-ldflags=) __embed_ldflags` >> makeopts.embed_rules
313 $(MOD_SUBDIRS_EMBED_LIBS):
314 @echo "EMBED_LIBS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-libs=) SUBDIR=$(@:-embed-libs=) __embed_libs` >> makeopts.embed_rules
316 makeopts.embed_rules: menuselect.makeopts
317 @echo "Generating embedded module rules ..."
319 @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LDSCRIPT)
320 @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LDFLAGS)
321 @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LIBS)
323 $(SUBDIRS): include/asterisk/version.h include/asterisk/build.h include/asterisk/buildopts.h defaults.h makeopts.embed_rules
325 # ensure that all module subdirectories are processed before 'main' during
326 # a parallel build, since if there are modules selected to be embedded the
327 # directories containing them must be completed before the main Asterisk
328 # binary can be built
329 main: $(filter-out main,$(MOD_SUBDIRS))
332 @ASTCFLAGS="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" AST_LIBS="$(AST_LIBS)" $(MAKE) --no-print-directory --no-builtin-rules -C $@ SUBDIR=$@ all
335 @ASTCFLAGS="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" AUDIO_LIBS="$(AUDIO_LIBS)" $(MAKE) --no-print-directory --no-builtin-rules -C $@ SUBDIR=$@ all
338 @build_tools/make_defaults_h > $@.tmp
339 @if cmp -s $@.tmp $@ ; then : ; else \
344 include/asterisk/version.h:
345 @build_tools/make_version_h > $@.tmp
346 @if cmp -s $@.tmp $@ ; then : ; else \
351 include/asterisk/buildopts.h: menuselect.makeopts
352 @build_tools/make_buildopts_h > $@.tmp
353 @if cmp -s $@.tmp $@ ; then : ; else \
358 include/asterisk/build.h:
359 @build_tools/make_build_h > $@.tmp
360 @if cmp -s $@.tmp $@ ; then : ; else \
366 @$(MAKE) --no-print-directory -C $(@:-clean=) clean
368 clean: $(SUBDIRS_CLEAN)
370 rm -f include/asterisk/build.h
371 rm -f include/asterisk/version.h
372 @$(MAKE) -C menuselect clean
373 cp -f .cleancount .lastclean
375 dist-clean: distclean
378 @$(MAKE) -C menuselect dist-clean
379 @$(MAKE) -C sounds dist-clean
380 rm -f menuselect.makeopts makeopts menuselect-tree menuselect.makedeps
381 rm -f makeopts.embed_rules
382 rm -f config.log config.status
383 rm -rf autom4te.cache
384 rm -f include/asterisk/autoconfig.h
385 rm -f include/asterisk/buildopts.h
387 rm -f build_tools/menuselect-deps
390 if [ x`$(ID) -un` = xroot ]; then CFLAGS="$(ASTCFLAGS)" sh build_tools/mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig; fi
391 # Should static HTTP be installed during make samples or even with its own target ala
392 # webvoicemail? There are portions here that *could* be customized but might also be
393 # improved a lot. I'll put it here for now.
394 mkdir -p $(DESTDIR)$(ASTDATADIR)/static-http
395 for x in static-http/*; do \
396 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/static-http ; \
398 mkdir -p $(DESTDIR)$(ASTDATADIR)/images
399 for x in images/*.jpg; do \
400 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/images ; \
402 mkdir -p $(DESTDIR)$(AGI_DIR)
403 $(MAKE) -C sounds install
406 @if [ -d .svn ]; then \
407 echo "Updating from Subversion..." ; \
408 svn update | tee update.out; \
410 if [ `grep -c ^C update.out` -gt 0 ]; then \
411 echo ; echo "The following files have conflicts:" ; \
412 grep ^C update.out | cut -b4- ; \
416 echo "Not under version control"; \
419 NEWHEADERS=$(notdir $(wildcard include/asterisk/*.h))
420 OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h)))
423 mkdir -p $(DESTDIR)$(MODULES_DIR)
424 mkdir -p $(DESTDIR)$(ASTSBINDIR)
425 mkdir -p $(DESTDIR)$(ASTETCDIR)
426 mkdir -p $(DESTDIR)$(ASTBINDIR)
427 mkdir -p $(DESTDIR)$(ASTVARRUNDIR)
428 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail
429 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/dictate
430 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/system
431 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/tmp
432 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/meetme
433 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/monitor
434 $(INSTALL) -m 755 main/asterisk $(DESTDIR)$(ASTSBINDIR)/
435 $(LN) -sf asterisk $(DESTDIR)$(ASTSBINDIR)/rasterisk
436 $(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
437 $(INSTALL) -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/
438 if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \
439 cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;' > $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ;\
440 chmod 755 $(DESTDIR)$(ASTSBINDIR)/safe_asterisk;\
442 $(INSTALL) -d $(DESTDIR)$(ASTHEADERDIR)
443 $(INSTALL) -m 644 include/asterisk.h $(DESTDIR)$(includedir)
444 $(INSTALL) -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
445 if [ -n "$(OLDHEADERS)" ]; then \
446 rm -f $(addprefix $(DESTDIR)$(ASTHEADERDIR)/,$(OLDHEADERS)) ;\
448 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
449 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-custom
450 mkdir -p $(DESTDIR)$(ASTDATADIR)/keys
451 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware
452 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware/iax
453 mkdir -p $(DESTDIR)$(ASTMANDIR)/man8
454 $(INSTALL) -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTDATADIR)/keys
455 $(INSTALL) -m 644 keys/freeworlddialup.pub $(DESTDIR)$(ASTDATADIR)/keys
456 $(INSTALL) -m 644 doc/asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
457 $(INSTALL) -m 644 contrib/scripts/astgenkey.8 $(DESTDIR)$(ASTMANDIR)/man8
458 $(INSTALL) -m 644 contrib/scripts/autosupport.8 $(DESTDIR)$(ASTMANDIR)/man8
459 $(INSTALL) -m 644 contrib/scripts/safe_asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
460 if [ -f contrib/firmware/iax/iaxy.bin ] ; then \
461 $(INSTALL) -m 644 contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTDATADIR)/firmware/iax/iaxy.bin; \
465 @DESTDIR="$(DESTDIR)" ASTSBINDIR="$(ASTSBINDIR)" $(MAKE) -C $(@:-install=) install
467 NEWMODS=$(notdir $(wildcard */*.so))
468 OLDMODS=$(filter-out $(NEWMODS),$(notdir $(wildcard $(DESTDIR)$(MODULES_DIR)/*.so)))
471 @if [ -n "$(OLDMODS)" ]; then \
472 echo " WARNING WARNING WARNING" ;\
474 echo " Your Asterisk modules directory, located at" ;\
475 echo " $(DESTDIR)$(MODULES_DIR)" ;\
476 echo " contains modules that were not installed by this " ;\
477 echo " version of Asterisk. Please ensure that these" ;\
478 echo " modules are compatible with this version before" ;\
479 echo " attempting to run Asterisk." ;\
481 for f in $(OLDMODS); do \
485 echo " WARNING WARNING WARNING" ;\
488 install: datafiles bininstall $(SUBDIRS_INSTALL)
489 @if [ -x /usr/sbin/asterisk-post-install ]; then \
490 /usr/sbin/asterisk-post-install $(DESTDIR) . ; \
492 @echo " +---- Asterisk Installation Complete -------+"
494 @echo " + YOU MUST READ THE SECURITY DOCUMENT +"
496 @echo " + Asterisk has successfully been installed. +"
497 @echo " + If you would like to install the sample +"
498 @echo " + configuration files (overwriting any +"
499 @echo " + existing config files), run: +"
501 ifeq ($(MAKE), gmake)
502 @echo " + $(MAKE) samples +"
504 @echo " + $(MAKE) samples +"
507 @echo " +----------------- or ---------------------+"
509 @echo " + You can go ahead and install the asterisk +"
510 @echo " + program documentation now or later run: +"
512 ifeq ($(MAKE), gmake)
513 @echo " + $(MAKE) progdocs +"
515 @echo " + $(MAKE) progdocs +"
518 @echo " + **Note** This requires that you have +"
519 @echo " + doxygen installed on your local system +"
520 @echo " +-------------------------------------------+"
521 @$(MAKE) -s oldmodcheck
526 mkdir -p $(DESTDIR)$(ASTETCDIR)
527 for x in configs/*.adsi; do \
528 if [ ! -f $(DESTDIR)$(ASTETCDIR)/$$x ]; then \
529 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x` ; \
534 mkdir -p $(DESTDIR)$(ASTETCDIR)
535 for x in configs/*.sample; do \
536 if [ -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ]; then \
537 if [ "$(OVERWRITE)" = "y" ]; then \
538 if cmp -s $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $$x ; then \
539 echo "Config file $$x is unchanged"; \
542 mv -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample`.old ; \
544 echo "Skipping config file $$x"; \
548 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ;\
550 if [ "$(OVERWRITE)" = "y" ] || [ ! -f $(DESTDIR)$(ASTCONFPATH) ]; then \
552 echo "[directories]" ; \
553 echo "astetcdir => $(ASTETCDIR)" ; \
554 echo "astmoddir => $(MODULES_DIR)" ; \
555 echo "astvarlibdir => $(ASTVARLIBDIR)" ; \
556 echo "astdatadir => $(ASTDATADIR)" ; \
557 echo "astagidir => $(AGI_DIR)" ; \
558 echo "astspooldir => $(ASTSPOOLDIR)" ; \
559 echo "astrundir => $(ASTVARRUNDIR)" ; \
560 echo "astlogdir => $(ASTLOGDIR)" ; \
562 echo ";[options]" ; \
563 echo ";internal_timing = yes" ; \
564 echo ";systemname = my_system_name ; prefix uniqueid with a system name for global uniqueness issues" ; \
565 echo ";autosystemname = yes ; automatically set systemname to hostname - uses 'localhost' on failure, or systemname if set" ; \
566 echo "; Changing the following lines may compromise your security." ; \
568 echo ";astctlpermissions = 0660" ; \
569 echo ";astctlowner = root" ; \
570 echo ";astctlgroup = apache" ; \
571 echo ";astctl = asterisk.ctl" ; \
572 ) > $(DESTDIR)$(ASTCONFPATH) ; \
574 echo "Skipping asterisk.conf creation"; \
576 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
577 build_tools/make_sample_voicemail $(DESTDIR)/$(ASTDATADIR) $(DESTDIR)/$(ASTSPOOLDIR)
580 @[ -d $(DESTDIR)$(HTTP_DOCSDIR)/ ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 )
581 @[ -d $(DESTDIR)$(HTTP_CGIDIR) ] || ( printf "cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit 1 )
582 $(INSTALL) -m 4755 -o root -g root contrib/scripts/vmail.cgi $(DESTDIR)$(HTTP_CGIDIR)/vmail.cgi
583 mkdir -p $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk
584 for x in images/*.gif; do \
585 $(INSTALL) -m 644 $$x $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk/; \
587 @echo " +--------- Asterisk Web Voicemail ----------+"
589 @echo " + Asterisk Web Voicemail is installed in +"
590 @echo " + your cgi-bin directory: +"
591 @echo " + $(DESTDIR)$(HTTP_CGIDIR)"
592 @echo " + IT USES A SETUID ROOT PERL SCRIPT, SO +"
593 @echo " + IF YOU DON'T LIKE THAT, UNINSTALL IT! +"
595 @echo " + Other static items have been stored in: +"
596 @echo " + $(DESTDIR)$(HTTP_DOCSDIR)"
598 @echo " + If these paths do not match your httpd +"
599 @echo " + installation, correct the definitions +"
600 @echo " + in your Makefile of HTTP_CGIDIR and +"
601 @echo " + HTTP_DOCSDIR +"
603 @echo " +-------------------------------------------+"
606 sed "s/^Version:.*/Version: $(RPMVERSION)/g" redhat/asterisk.spec > asterisk.spec ; \
610 __rpm: include/asterisk/version.h include/asterisk/buildopts.h spec
611 rm -rf /tmp/asterisk ; \
612 mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
613 $(MAKE) DESTDIR=/tmp/asterisk install ; \
614 $(MAKE) DESTDIR=/tmp/asterisk samples ; \
615 mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
616 cp -f contrib/init.d/rc.redhat.asterisk /tmp/asterisk/etc/rc.d/init.d/asterisk ; \
617 rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec
620 (cat contrib/asterisk-ng-doxygen; echo "HAVE_DOT=$(HAVEDOT)"; \
621 echo "PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen -
624 @if [ "${OSARCH}" = "linux-gnu" ]; then \
625 if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \
626 $(INSTALL) -m 755 contrib/init.d/rc.redhat.asterisk /etc/rc.d/init.d/asterisk; \
627 /sbin/chkconfig --add asterisk; \
628 elif [ -f /etc/debian_version ]; then \
629 $(INSTALL) -m 755 contrib/init.d/rc.debian.asterisk /etc/init.d/asterisk; \
630 /usr/sbin/update-rc.d asterisk start 10 2 3 4 5 . stop 91 2 3 4 5 .; \
631 elif [ -f /etc/gentoo-release ]; then \
632 $(INSTALL) -m 755 contrib/init.d/rc.gentoo.asterisk /etc/init.d/asterisk; \
633 /sbin/rc-update add asterisk default; \
634 elif [ -f /etc/mandrake-release ]; then \
635 $(INSTALL) -m 755 contrib/init.d/rc.mandrake.asterisk /etc/rc.d/init.d/asterisk; \
636 /sbin/chkconfig --add asterisk; \
637 elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then \
638 $(INSTALL) -m 755 contrib/init.d/rc.suse.asterisk /etc/init.d/asterisk; \
639 /sbin/chkconfig --add asterisk; \
640 elif [ -f /etc/slackware-version ]; then \
641 echo "Slackware is not currently supported, although an init script does exist for it." \
643 echo "We could not install init scripts for your distribution."; \
646 echo "We could not install init scripts for your operating system."; \
650 $(MAKE) -C sounds all
652 # If the cleancount has been changed, force a make clean.
653 # .cleancount is the global clean count, and .lastclean is the
654 # last clean count we had
657 @if ! cmp -s .cleancount .lastclean ; then \
661 $(SUBDIRS_UNINSTALL):
662 @$(MAKE) --no-print-directory -C $(@:-uninstall=) uninstall
664 _uninstall: $(SUBDIRS_UNINSTALL)
665 rm -f $(DESTDIR)$(MODULES_DIR)/*
666 rm -f $(DESTDIR)$(ASTSBINDIR)/*asterisk*
667 rm -f $(DESTDIR)$(ASTSBINDIR)/astgenkey
668 rm -f $(DESTDIR)$(ASTSBINDIR)/autosupport
669 rm -rf $(DESTDIR)$(ASTHEADERDIR)
670 rm -rf $(DESTDIR)$(ASTDATADIR)/firmware
671 rm -f $(DESTDIR)$(ASTMANDIR)/man8/asterisk.8
672 rm -f $(DESTDIR)$(ASTMANDIR)/man8/astgenkey.8
673 rm -f $(DESTDIR)$(ASTMANDIR)/man8/autosupport.8
674 rm -f $(DESTDIR)$(ASTMANDIR)/man8/safe_asterisk.8
675 $(MAKE) -C sounds uninstall
677 uninstall: _uninstall
678 @echo " +--------- Asterisk Uninstall Complete -----+"
679 @echo " + Asterisk binaries, sounds, man pages, +"
680 @echo " + headers, modules, and firmware builds, +"
681 @echo " + have all been uninstalled. +"
683 @echo " + To remove ALL traces of Asterisk, +"
684 @echo " + including configuration, spool +"
685 @echo " + directories, and logs, run the following +"
686 @echo " + command: +"
688 ifeq ($(MAKE), gmake)
689 @echo " + $(MAKE) uninstall-all +"
691 @echo " + $(MAKE) uninstall-all +"
693 @echo " +-------------------------------------------+"
695 uninstall-all: _uninstall
696 rm -rf $(DESTDIR)$(ASTLIBDIR)
697 rm -rf $(DESTDIR)$(ASTVARLIBDIR)
698 rm -rf $(DESTDIR)$(ASTDATADIR)
699 rm -rf $(DESTDIR)$(ASTSPOOLDIR)
700 rm -rf $(DESTDIR)$(ASTETCDIR)
701 rm -rf $(DESTDIR)$(ASTLOGDIR)
703 menuconfig: menuselect
705 gmenuconfig: gmenuselect
707 menuselect: menuselect/menuselect menuselect-tree
708 -@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!"
710 gmenuselect: menuselect/gmenuselect menuselect-tree
711 -@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!"
713 menuselect/menuselect: makeopts menuselect/menuselect.c menuselect/menuselect_curses.c menuselect/menuselect_stub.c menuselect/menuselect.h menuselect/linkedlists.h makeopts
714 @CC="$(HOST_CC)" LD="" AR="" RANLIB="" CFLAGS="" $(MAKE) -C menuselect CONFIGURE_SILENT="--silent"
716 menuselect/gmenuselect: makeopts menuselect/menuselect.c menuselect/menuselect_gtk.c menuselect/menuselect_stub.c menuselect/menuselect.h menuselect/linkedlists.h makeopts
717 @CC="$(HOST_CC)" CXX="$(CXX)" LD="" AR="" RANLIB="" CFLAGS="" $(MAKE) -C menuselect _gmenuselect CONFIGURE_SILENT="--silent"
719 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
720 @echo "Generating input for menuselect ..."
721 @build_tools/prep_moduledeps > $@
724 $(MAKE) -C doc/tex asterisk.pdf
726 .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