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
61 # even though we could use '-include makeopts' here, use a wildcard
62 # lookup anyway, so that make won't try to build makeopts if it doesn't
63 # exist (other rules will force it to be built if needed)
64 ifneq ($(wildcard makeopts),)
68 #Uncomment this to see all build commands instead of 'quiet' output
71 # Create OPTIONS variable
74 ASTTOPDIR:=$(shell pwd)
76 # Overwite config files on "make samples"
79 # Include debug and macro symbols in the executables (-g) and profiling info (-pg)
83 # Files are copied here temporarily during the install process
84 # For example, make DESTDIR=/tmp/asterisk woud put things in
85 # /tmp/asterisk/etc/asterisk
86 # !!! Watch out, put no spaces or comments after the value !!!
87 #DESTDIR?=/tmp/asterisk
89 # Define standard directories for various platforms
90 # These apply if they are not redefined in asterisk.conf
91 ifeq ($(OSARCH),SunOS)
92 ASTETCDIR=/var/etc/asterisk
93 ASTLIBDIR=/opt/asterisk/lib
94 ASTVARLIBDIR=/var/opt/asterisk
95 ASTSPOOLDIR=/var/spool/asterisk
96 ASTLOGDIR=/var/log/asterisk
97 ASTHEADERDIR=/opt/asterisk/include
98 ASTBINDIR=/opt/asterisk/bin
99 ASTSBINDIR=/opt/asterisk/sbin
100 ASTVARRUNDIR=/var/run/asterisk
101 ASTMANDIR=/opt/asterisk/man
103 ASTETCDIR=$(sysconfdir)/asterisk
104 ASTLIBDIR=$(libdir)/asterisk
105 ASTHEADERDIR=$(includedir)/asterisk
107 ASTSBINDIR=$(sbindir)
108 ASTSPOOLDIR=$(localstatedir)/spool/asterisk
109 ASTLOGDIR=$(localstatedir)/log/asterisk
110 ASTVARRUNDIR=$(localstatedir)/run
112 ifeq ($(OSARCH),FreeBSD)
113 ASTVARLIBDIR=$(prefix)/share/asterisk
115 ASTVARLIBDIR=$(localstatedir)/lib/asterisk
118 ifeq ($(ASTDATADIR),)
119 ASTDATADIR:=$(ASTVARLIBDIR)
122 # Asterisk.conf is located in ASTETCDIR or by using the -C flag
123 # when starting Asterisk
124 ASTCONFPATH=$(ASTETCDIR)/asterisk.conf
125 MODULES_DIR=$(ASTLIBDIR)/modules
126 AGI_DIR=$(ASTDATADIR)/agi-bin
128 # If you use Apache, you may determine by a grep 'DocumentRoot' of your httpd.conf file
129 HTTP_DOCSDIR=/var/www/html
130 # Determine by a grep 'ScriptAlias' of your Apache httpd.conf file
131 HTTP_CGIDIR=/var/www/cgi-bin
133 # Uncomment this to use the older DSP routines
134 #ASTCFLAGS+=-DOLD_DSP_ROUTINES
136 # If the file .asterisk.makeopts is present in your home directory, you can
137 # include all of your favorite menuselect options so that every time you download
138 # a new version of Asterisk, you don't have to run menuselect to set them.
139 # The file /etc/asterisk.makeopts will also be included but can be overridden
140 # by the file in your home directory.
142 GLOBAL_MAKEOPTS=$(wildcard /etc/asterisk.makeopts)
143 USER_MAKEOPTS=$(wildcard ~/.asterisk.makeopts)
145 MOD_SUBDIR_CFLAGS=-I$(ASTTOPDIR)/include
146 OTHER_SUBDIR_CFLAGS=-I$(ASTTOPDIR)/include
148 ifeq ($(OSARCH),linux-gnu)
149 ifeq ($(PROC),x86_64)
150 # You must have GCC 3.4 to use k8, otherwise use athlon
155 ifeq ($(PROC),sparc64)
156 #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
157 #This works for even old (2.96) versions of gcc and provides a small boost either way.
158 #A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
159 #So we go lowest common available by gcc and go a step down, still a step up from
160 #the default as we now have a better instruction set to work with. - Belgarath
162 OPTIONS+=$(shell if $(CC) -mtune=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mtune=$(PROC)"; fi)
163 OPTIONS+=$(shell if $(CC) -mcpu=v8 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mcpu=v8"; fi)
164 OPTIONS+=-fomit-frame-pointer
168 # The Cirrus logic is the only heavily shipping arm processor with a real floating point unit
169 ifeq ($(SUB_PROC),maverick)
170 OPTIONS+=-fsigned-char -mcpu=ep9312
172 ifeq ($(SUB_PROC),xscale)
173 OPTIONS+=-fsigned-char -mcpu=xscale
175 OPTIONS+=-fsigned-char
181 ASTCFLAGS+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG)
183 ifeq ($(AST_DEVMODE),yes)
184 ASTCFLAGS+=-Werror -Wunused
187 ifneq ($(findstring BSD,$(OSARCH)),)
188 ASTCFLAGS+=-I/usr/local/include
189 ASTLDFLAGS+=-L/usr/local/lib
192 ifneq ($(PROC),ultrasparc)
193 ASTCFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
197 ASTCFLAGS+=-fsigned-char
200 ifeq ($(OSARCH),FreeBSD)
201 # -V is understood by BSD Make, not by GNU make.
202 BSDVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk)
203 ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
204 AST_LIBS+=$(shell if test $(BSDVERSION) -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi)
207 ifeq ($(OSARCH),NetBSD)
208 ASTCFLAGS+=-pthread -I/usr/pkg/include
211 ifeq ($(OSARCH),OpenBSD)
215 ifeq ($(OSARCH),SunOS)
216 ASTCFLAGS+=-Wcast-align -DSOLARIS -I../include/solaris-compat -I/opt/ssl/include -I/usr/local/ssl/include
219 ASTERISKVERSION:=$(shell build_tools/make_version .)
221 ifneq ($(wildcard .version),)
222 ASTERISKVERSIONNUM:=$(shell awk -F. '{printf "%02d%02d%02d", $$1, $$2, $$3}' .version)
223 RPMVERSION:=$(shell sed 's/[-\/:]/_/g' .version)
228 ifneq ($(wildcard .svn),)
229 ASTERISKVERSIONNUM=999999
232 ASTCFLAGS+=$(MALLOC_DEBUG)$(BUSYDETECT)$(OPTIONS)
234 MOD_SUBDIRS:=res channels pbx apps codecs formats cdr funcs main
235 OTHER_SUBDIRS:=utils agi
236 SUBDIRS:=$(OTHER_SUBDIRS) $(MOD_SUBDIRS)
237 SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)
238 SUBDIRS_CLEAN:=$(SUBDIRS:%=%-clean)
239 SUBDIRS_CLEAN_DEPEND:=$(SUBDIRS:%=%-clean-depend)
240 MOD_SUBDIRS_DEPEND:=$(MOD_SUBDIRS:%=%-depend)
241 OTHER_SUBDIRS_DEPEND:=$(OTHER_SUBDIRS:%=%-depend)
242 SUBDIRS_DEPEND:=$(OTHER_SUBDIRS_DEPEND) $(MOD_SUBDIRS_DEPEND)
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): depend 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 \
348 $(SUBDIRS_CLEAN_DEPEND):
349 @$(MAKE) --no-print-directory -C $(@:-clean-depend=) clean-depend
352 @$(MAKE) --no-print-directory -C $(@:-clean=) clean
354 clean-depend: $(SUBDIRS_CLEAN_DEPEND)
356 clean: $(SUBDIRS_CLEAN) clean-depend
358 rm -f include/asterisk/build.h
359 rm -f include/asterisk/version.h
361 @$(MAKE) -C menuselect clean
362 cp -f .cleancount .lastclean
364 dist-clean: distclean
367 @$(MAKE) -C menuselect dist-clean
368 @$(MAKE) -C sounds dist-clean
369 rm -f menuselect.makeopts makeopts menuselect-tree menuselect.makedeps
370 rm -f makeopts.embed_rules
371 rm -f config.log config.status
372 rm -rf autom4te.cache
373 rm -f include/asterisk/autoconfig.h
374 rm -f include/asterisk/buildopts.h
376 rm -f build_tools/menuselect-deps
379 if [ x`$(ID) -un` = xroot ]; then CFLAGS="$(ASTCFLAGS)" sh build_tools/mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig; fi
380 # Should static HTTP be installed during make samples or even with its own target ala
381 # webvoicemail? There are portions here that *could* be customized but might also be
382 # improved a lot. I'll put it here for now.
383 mkdir -p $(DESTDIR)$(ASTDATADIR)/static-http
384 for x in static-http/*; do \
385 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/static-http ; \
387 mkdir -p $(DESTDIR)$(ASTDATADIR)/images
388 for x in images/*.jpg; do \
389 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/images ; \
391 mkdir -p $(DESTDIR)$(AGI_DIR)
392 $(MAKE) -C sounds install
395 @if [ -d .svn ]; then \
396 echo "Updating from Subversion..." ; \
397 svn update | tee update.out; \
399 if [ `grep -c ^C update.out` -gt 0 ]; then \
400 echo ; echo "The following files have conflicts:" ; \
401 grep ^C update.out | cut -b4- ; \
404 $(MAKE) clean-depend; \
406 echo "Not under version control"; \
409 NEWHEADERS=$(notdir $(wildcard include/asterisk/*.h))
410 OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h)))
413 mkdir -p $(DESTDIR)$(MODULES_DIR)
414 mkdir -p $(DESTDIR)$(ASTSBINDIR)
415 mkdir -p $(DESTDIR)$(ASTETCDIR)
416 mkdir -p $(DESTDIR)$(ASTBINDIR)
417 mkdir -p $(DESTDIR)$(ASTVARRUNDIR)
418 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail
419 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/dictate
420 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/system
421 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/tmp
422 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/meetme
423 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/monitor
424 $(INSTALL) -m 755 main/asterisk $(DESTDIR)$(ASTSBINDIR)/
425 $(LN) -sf asterisk $(DESTDIR)$(ASTSBINDIR)/rasterisk
426 $(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
427 $(INSTALL) -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/
428 if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \
429 cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;' > $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ;\
430 chmod 755 $(DESTDIR)$(ASTSBINDIR)/safe_asterisk;\
432 $(INSTALL) -d $(DESTDIR)$(ASTHEADERDIR)
433 $(INSTALL) -m 644 include/asterisk.h $(DESTDIR)$(includedir)
434 $(INSTALL) -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
435 if [ -n "$(OLDHEADERS)" ]; then \
436 rm -f $(addprefix $(DESTDIR)$(ASTHEADERDIR)/,$(OLDHEADERS)) ;\
438 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
439 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-custom
440 mkdir -p $(DESTDIR)$(ASTDATADIR)/keys
441 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware
442 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware/iax
443 mkdir -p $(DESTDIR)$(ASTMANDIR)/man8
444 $(INSTALL) -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTDATADIR)/keys
445 $(INSTALL) -m 644 keys/freeworlddialup.pub $(DESTDIR)$(ASTDATADIR)/keys
446 $(INSTALL) -m 644 doc/asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
447 $(INSTALL) -m 644 contrib/scripts/astgenkey.8 $(DESTDIR)$(ASTMANDIR)/man8
448 $(INSTALL) -m 644 contrib/scripts/autosupport.8 $(DESTDIR)$(ASTMANDIR)/man8
449 $(INSTALL) -m 644 contrib/scripts/safe_asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
450 if [ -f contrib/firmware/iax/iaxy.bin ] ; then \
451 $(INSTALL) -m 644 contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTDATADIR)/firmware/iax/iaxy.bin; \
455 @DESTDIR="$(DESTDIR)" ASTSBINDIR="$(ASTSBINDIR)" $(MAKE) -C $(@:-install=) install
457 NEWMODS=$(notdir $(wildcard */*.so))
458 OLDMODS=$(filter-out $(NEWMODS),$(notdir $(wildcard $(DESTDIR)$(MODULES_DIR)/*.so)))
461 @if [ -n "$(OLDMODS)" ]; then \
462 echo " WARNING WARNING WARNING" ;\
464 echo " Your Asterisk modules directory, located at" ;\
465 echo " $(DESTDIR)$(MODULES_DIR)" ;\
466 echo " contains modules that were not installed by this " ;\
467 echo " version of Asterisk. Please ensure that these" ;\
468 echo " modules are compatible with this version before" ;\
469 echo " attempting to run Asterisk." ;\
471 for f in $(OLDMODS); do \
475 echo " WARNING WARNING WARNING" ;\
478 install: datafiles bininstall $(SUBDIRS_INSTALL)
479 @if [ -x /usr/sbin/asterisk-post-install ]; then \
480 /usr/sbin/asterisk-post-install $(DESTDIR) . ; \
482 @echo " +---- Asterisk Installation Complete -------+"
484 @echo " + YOU MUST READ THE SECURITY DOCUMENT +"
486 @echo " + Asterisk has successfully been installed. +"
487 @echo " + If you would like to install the sample +"
488 @echo " + configuration files (overwriting any +"
489 @echo " + existing config files), run: +"
491 @echo " + $(MAKE) samples +"
493 @echo " +----------------- or ---------------------+"
495 @echo " + You can go ahead and install the asterisk +"
496 @echo " + program documentation now or later run: +"
498 @echo " + $(MAKE) progdocs +"
500 @echo " + **Note** This requires that you have +"
501 @echo " + doxygen installed on your local system +"
502 @echo " +-------------------------------------------+"
503 @$(MAKE) -s oldmodcheck
508 mkdir -p $(DESTDIR)$(ASTETCDIR)
509 for x in configs/*.adsi; do \
510 if [ ! -f $(DESTDIR)$(ASTETCDIR)/$$x ]; then \
511 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x` ; \
516 mkdir -p $(DESTDIR)$(ASTETCDIR)
517 for x in configs/*.sample; do \
518 if [ -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ]; then \
519 if [ "$(OVERWRITE)" = "y" ]; then \
520 if cmp -s $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $$x ; then \
521 echo "Config file $$x is unchanged"; \
524 mv -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample`.old ; \
526 echo "Skipping config file $$x"; \
530 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ;\
532 if [ "$(OVERWRITE)" = "y" ] || [ ! -f $(DESTDIR)$(ASTCONFPATH) ]; then \
534 echo "[directories]" ; \
535 echo "astetcdir => $(ASTETCDIR)" ; \
536 echo "astmoddir => $(MODULES_DIR)" ; \
537 echo "astvarlibdir => $(ASTVARLIBDIR)" ; \
538 echo "astdatadir => $(ASTDATADIR)" ; \
539 echo "astagidir => $(AGI_DIR)" ; \
540 echo "astspooldir => $(ASTSPOOLDIR)" ; \
541 echo "astrundir => $(ASTVARRUNDIR)" ; \
542 echo "astlogdir => $(ASTLOGDIR)" ; \
544 echo "; Changing the following lines may compromise your security." ; \
546 echo ";astctlpermissions = 0660" ; \
547 echo ";astctlowner = root" ; \
548 echo ";astctlgroup = apache" ; \
549 echo ";astctl = asterisk.ctl" ; \
550 echo ";[options]" ; \
551 echo ";internal_timing = yes" ; \
552 ) > $(DESTDIR)$(ASTCONFPATH) ; \
554 echo "Skipping asterisk.conf creation"; \
556 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
557 :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm
558 for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isunavail; do \
559 cat $(DESTDIR)$(ASTDATADIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm ; \
561 :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm
562 for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isonphone; do \
563 cat $(DESTDIR)$(ASTDATADIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm ; \
567 @[ -d $(DESTDIR)$(HTTP_DOCSDIR)/ ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 )
568 @[ -d $(DESTDIR)$(HTTP_CGIDIR) ] || ( printf "cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit 1 )
569 $(INSTALL) -m 4755 -o root -g root contrib/scripts/vmail.cgi $(DESTDIR)$(HTTP_CGIDIR)/vmail.cgi
570 mkdir -p $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk
571 for x in images/*.gif; do \
572 $(INSTALL) -m 644 $$x $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk/; \
574 @echo " +--------- Asterisk Web Voicemail ----------+"
576 @echo " + Asterisk Web Voicemail is installed in +"
577 @echo " + your cgi-bin directory: +"
578 @echo " + $(DESTDIR)$(HTTP_CGIDIR)"
579 @echo " + IT USES A SETUID ROOT PERL SCRIPT, SO +"
580 @echo " + IF YOU DON'T LIKE THAT, UNINSTALL IT! +"
582 @echo " + Other static items have been stored in: +"
583 @echo " + $(DESTDIR)$(HTTP_DOCSDIR)"
585 @echo " + If these paths do not match your httpd +"
586 @echo " + installation, correct the definitions +"
587 @echo " + in your Makefile of HTTP_CGIDIR and +"
588 @echo " + HTTP_DOCSDIR +"
590 @echo " +-------------------------------------------+"
593 sed "s/^Version:.*/Version: $(RPMVERSION)/g" redhat/asterisk.spec > asterisk.spec ; \
597 __rpm: include/asterisk/version.h include/asterisk/buildopts.h spec
598 rm -rf /tmp/asterisk ; \
599 mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
600 $(MAKE) DESTDIR=/tmp/asterisk install ; \
601 $(MAKE) DESTDIR=/tmp/asterisk samples ; \
602 mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
603 cp -f contrib/init.d/rc.redhat.asterisk /tmp/asterisk/etc/rc.d/init.d/asterisk ; \
604 rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec
607 (cat contrib/asterisk-ng-doxygen; echo "HAVE_DOT=$(HAVEDOT)"; \
608 echo "PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen -
611 @if [ "${OSARCH}" = "linux-gnu" ]; then \
612 if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \
613 $(INSTALL) -m 755 contrib/init.d/rc.redhat.asterisk /etc/rc.d/init.d/asterisk; \
614 /sbin/chkconfig --add asterisk; \
615 elif [ -f /etc/debian_version ]; then \
616 $(INSTALL) -m 755 contrib/init.d/rc.debian.asterisk /etc/init.d/asterisk; \
617 /usr/sbin/update-rc.d asterisk start 10 2 3 4 5 . stop 91 2 3 4 5 .; \
618 elif [ -f /etc/gentoo-release ]; then \
619 $(INSTALL) -m 755 contrib/init.d/rc.gentoo.asterisk /etc/init.d/asterisk; \
620 /sbin/rc-update add asterisk default; \
621 elif [ -f /etc/mandrake-release ]; then \
622 $(INSTALL) -m 755 contrib/init.d/rc.mandrake.asterisk /etc/rc.d/init.d/asterisk; \
623 /sbin/chkconfig --add asterisk; \
624 elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then \
625 $(INSTALL) -m 755 contrib/init.d/rc.suse.asterisk /etc/init.d/asterisk; \
626 /sbin/chkconfig --add asterisk; \
627 elif [ -f /etc/slackware-version ]; then \
628 echo "Slackware is not currently supported, although an init script does exist for it." \
630 echo "We could not install init scripts for your distribution."; \
633 echo "We could not install init scripts for your operating system."; \
636 $(MOD_SUBDIRS_DEPEND):
637 @ASTCFLAGS="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" $(MAKE) --no-print-directory -C $(@:-depend=) depend
639 $(OTHER_SUBDIRS_DEPEND):
640 @ASTCFLAGS="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" $(MAKE) --no-print-directory -C $(@:-depend=) depend
642 depend: include/asterisk/version.h include/asterisk/buildopts.h include/asterisk/build.h defaults.h $(SUBDIRS_DEPEND)
645 $(MAKE) -C sounds all
647 # If the cleancount has been changed, force a make clean.
648 # .cleancount is the global clean count, and .lastclean is the
649 # last clean count we had
652 @if ! cmp -s .cleancount .lastclean ; then \
656 $(SUBDIRS_UNINSTALL):
657 @$(MAKE) --no-print-directory -C $(@:-uninstall=) uninstall
659 _uninstall: $(SUBDIRS_UNINSTALL)
660 rm -f $(DESTDIR)$(MODULES_DIR)/*
661 rm -f $(DESTDIR)$(ASTSBINDIR)/*asterisk*
662 rm -f $(DESTDIR)$(ASTSBINDIR)/astgenkey
663 rm -f $(DESTDIR)$(ASTSBINDIR)/autosupport
664 rm -rf $(DESTDIR)$(ASTHEADERDIR)
665 rm -rf $(DESTDIR)$(ASTDATADIR)/firmware
666 rm -rf $(DESTDIR)$(ASTMANDIR)/man8
667 $(MAKE) -C sounds uninstall
669 uninstall: _uninstall
670 @echo " +--------- Asterisk Uninstall Complete -----+"
671 @echo " + Asterisk binaries, sounds, man pages, +"
672 @echo " + headers, modules, and firmware builds, +"
673 @echo " + have all been uninstalled. +"
675 @echo " + To remove ALL traces of Asterisk, +"
676 @echo " + including configuration, spool +"
677 @echo " + directories, and logs, run the following +"
678 @echo " + command: +"
680 @echo " + $(MAKE) uninstall-all +"
681 @echo " +-------------------------------------------+"
683 uninstall-all: _uninstall
684 rm -rf $(DESTDIR)$(ASTLIBDIR)
685 rm -rf $(DESTDIR)$(ASTVARLIBDIR)
686 rm -rf $(DESTDIR)$(ASTDATADIR)
687 rm -rf $(DESTDIR)$(ASTSPOOLDIR)
688 rm -rf $(DESTDIR)$(ASTETCDIR)
689 rm -rf $(DESTDIR)$(ASTLOGDIR)
691 menuconfig: menuselect
693 menuselect: menuselect/menuselect menuselect-tree
694 -@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!"
696 menuselect/menuselect: makeopts menuselect/menuselect.c menuselect/menuselect_curses.c menuselect/menuselect_stub.c menuselect/menuselect.h menuselect/linkedlists.h makeopts
697 @unset CC LD AR RANLIB && $(MAKE) -C menuselect CONFIGURE_SILENT="--silent"
699 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
700 @echo "Generating input for menuselect ..."
701 @build_tools/prep_moduledeps > $@
703 .PHONY: menuselect main sounds clean clean-depend dist-clean distclean all prereqs depend cleantest uninstall _uninstall uninstall-all dont-optimize $(SUBDIRS_INSTALL) $(SUBDIRS_CLEAN) $(SUBDIRS_CLEAN_DEPEND) $(SUBDIRS_DEPEND) $(SUBDIRS_UNINSTALL) $(SUBDIRS) $(MOD_SUBDIRS_EMBED_LDSCRIPT) $(MOD_SUBDIRS_EMBED_LDFLAGS) $(MOD_SUBDIRS_EMBED_LIBS)