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