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
43 export MENUSELECT_CFLAGS
55 # even though we could use '-include makeopts' here, use a wildcard
56 # lookup anyway, so that make won't try to build makeopts if it doesn't
57 # exist (other rules will force it to be built if needed)
58 ifneq ($(wildcard makeopts),)
62 #Uncomment this to see all build commands instead of 'quiet' output
65 # Create OPTIONS variable
68 ASTTOPDIR:=$(shell pwd)
70 # Overwite config files on "make samples"
73 # Include debug and macro symbols in the executables (-g) and profiling info (-pg)
77 # Files are copied here temporarily during the install process
78 # For example, make DESTDIR=/tmp/asterisk woud put things in
79 # /tmp/asterisk/etc/asterisk
80 # !!! Watch out, put no spaces or comments after the value !!!
81 #DESTDIR?=/tmp/asterisk
83 # Define standard directories for various platforms
84 # These apply if they are not redefined in asterisk.conf
85 ifeq ($(OSARCH),SunOS)
86 ASTETCDIR=/var/etc/asterisk
87 ASTLIBDIR=/opt/asterisk/lib
88 ASTVARLIBDIR=/var/opt/asterisk
89 ASTSPOOLDIR=/var/spool/asterisk
90 ASTLOGDIR=/var/log/asterisk
91 ASTHEADERDIR=/opt/asterisk/include
92 ASTBINDIR=/opt/asterisk/bin
93 ASTSBINDIR=/opt/asterisk/sbin
94 ASTVARRUNDIR=/var/run/asterisk
95 ASTMANDIR=/opt/asterisk/man
97 ASTETCDIR=$(sysconfdir)/asterisk
98 ASTLIBDIR=$(libdir)/asterisk
99 ASTHEADERDIR=$(includedir)/asterisk
101 ASTSBINDIR=$(sbindir)
102 ASTSPOOLDIR=$(localstatedir)/spool/asterisk
103 ASTLOGDIR=$(localstatedir)/log/asterisk
104 ASTVARRUNDIR=$(localstatedir)/run
106 ifeq ($(OSARCH),FreeBSD)
107 ASTVARLIBDIR=$(prefix)/share/asterisk
109 ASTVARLIBDIR=$(localstatedir)/lib/asterisk
112 ifeq ($(ASTDATADIR),)
113 ASTDATADIR:=$(ASTVARLIBDIR)
116 # Asterisk.conf is located in ASTETCDIR or by using the -C flag
117 # when starting Asterisk
118 ASTCONFPATH=$(ASTETCDIR)/asterisk.conf
119 MODULES_DIR=$(ASTLIBDIR)/modules
120 AGI_DIR=$(ASTDATADIR)/agi-bin
122 # If you use Apache, you may determine by a grep 'DocumentRoot' of your httpd.conf file
123 HTTP_DOCSDIR=/var/www/html
124 # Determine by a grep 'ScriptAlias' of your Apache httpd.conf file
125 HTTP_CGIDIR=/var/www/cgi-bin
127 # Uncomment this to use the older DSP routines
128 #ASTCFLAGS+=-DOLD_DSP_ROUTINES
130 # If the file .asterisk.makeopts is present in your home directory, you can
131 # include all of your favorite menuselect options so that every time you download
132 # a new version of Asterisk, you don't have to run menuselect to set them.
133 # The file /etc/asterisk.makeopts will also be included but can be overridden
134 # by the file in your home directory.
136 GLOBAL_MAKEOPTS=$(wildcard /etc/asterisk.makeopts)
137 USER_MAKEOPTS=$(wildcard ~/.asterisk.makeopts)
139 MOD_SUBDIR_CFLAGS=-I$(ASTTOPDIR)/include
140 OTHER_SUBDIR_CFLAGS=-I$(ASTTOPDIR)/include
142 ifeq ($(OSARCH),linux-gnu)
143 ifeq ($(PROC),x86_64)
144 # You must have GCC 3.4 to use k8, otherwise use athlon
149 ifeq ($(PROC),sparc64)
150 #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
151 #This works for even old (2.96) versions of gcc and provides a small boost either way.
152 #A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
153 #So we go lowest common available by gcc and go a step down, still a step up from
154 #the default as we now have a better instruction set to work with. - Belgarath
156 OPTIONS+=$(shell if $(CC) -mtune=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mtune=$(PROC)"; fi)
157 OPTIONS+=$(shell if $(CC) -mcpu=v8 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mcpu=v8"; fi)
158 OPTIONS+=-fomit-frame-pointer
162 # The Cirrus logic is the only heavily shipping arm processor with a real floating point unit
163 ifeq ($(SUB_PROC),maverick)
164 OPTIONS+=-fsigned-char -mcpu=ep9312
166 ifeq ($(SUB_PROC),xscale)
167 OPTIONS+=-fsigned-char -mcpu=xscale
169 OPTIONS+=-fsigned-char
175 ASTCFLAGS+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG)
177 ifeq ($(AST_DEVMODE),yes)
178 ASTCFLAGS+=-Werror -Wunused
181 ifneq ($(findstring BSD,$(OSARCH)),)
182 ASTCFLAGS+=-I/usr/local/include
183 ASTLDFLAGS+=-L/usr/local/lib
186 ifneq ($(PROC),ultrasparc)
187 ASTCFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
191 ASTCFLAGS+=-fsigned-char
194 ifeq ($(OSARCH),FreeBSD)
195 # -V is understood by BSD Make, not by GNU make.
196 BSDVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk)
197 ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
198 AST_LIBS+=$(shell if test $(BSDVERSION) -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi)
201 ifeq ($(OSARCH),NetBSD)
202 ASTCFLAGS+=-pthread -I/usr/pkg/include
205 ifeq ($(OSARCH),OpenBSD)
209 ifeq ($(OSARCH),SunOS)
210 ASTCFLAGS+=-Wcast-align -DSOLARIS -I../include/solaris-compat -I/opt/ssl/include -I/usr/local/ssl/include
213 ASTERISKVERSION:=$(shell build_tools/make_version .)
215 ifneq ($(wildcard .version),)
216 ASTERISKVERSIONNUM:=$(shell awk -F. '{printf "%02d%02d%02d", $$1, $$2, $$3}' .version)
217 RPMVERSION:=$(shell sed 's/[-\/:]/_/g' .version)
222 ifneq ($(wildcard .svn),)
223 ASTERISKVERSIONNUM=999999
226 ASTCFLAGS+=$(MALLOC_DEBUG)$(BUSYDETECT)$(OPTIONS)
228 MOD_SUBDIRS:=res channels pbx apps codecs formats cdr funcs main
229 OTHER_SUBDIRS:=utils agi
230 SUBDIRS:=$(OTHER_SUBDIRS) $(MOD_SUBDIRS)
231 SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)
232 SUBDIRS_CLEAN:=$(SUBDIRS:%=%-clean)
233 SUBDIRS_CLEAN_DEPEND:=$(SUBDIRS:%=%-clean-depend)
234 MOD_SUBDIRS_DEPEND:=$(MOD_SUBDIRS:%=%-depend)
235 OTHER_SUBDIRS_DEPEND:=$(OTHER_SUBDIRS:%=%-depend)
236 SUBDIRS_DEPEND:=$(OTHER_SUBDIRS_DEPEND) $(MOD_SUBDIRS_DEPEND)
237 SUBDIRS_UNINSTALL:=$(SUBDIRS:%=%-uninstall)
238 MOD_SUBDIRS_EMBED_LDSCRIPT:=$(MOD_SUBDIRS:%=%-embed-ldscript)
239 MOD_SUBDIRS_EMBED_LDFLAGS:=$(MOD_SUBDIRS:%=%-embed-ldflags)
240 MOD_SUBDIRS_EMBED_LIBS:=$(MOD_SUBDIRS:%=%-embed-libs)
242 ifneq ($(findstring darwin,$(OSARCH)),)
243 ASTCFLAGS+=-D__Darwin__
244 AUDIO_LIBS=-framework CoreAudio
245 SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
247 # These are used for all but Darwin
248 SOLINK=-shared -Xlinker -x
249 ifneq ($(findstring BSD,$(OSARCH)),)
250 LDFLAGS+=-L/usr/local/lib
254 ifeq ($(OSARCH),SunOS)
255 SOLINK=-shared -fpic -L/usr/local/ssl/lib
258 # This is used when generating the doxygen documentation
266 @echo " +--------- Asterisk Build Complete ---------+"
267 @echo " + Asterisk has successfully been built, and +"
268 @echo " + can be installed by running: +"
270 @echo " + make install +"
271 @echo " +-------------------------------------------+"
273 _all: cleantest $(SUBDIRS)
277 @echo "**** The configure script must be executed before running 'make'."
281 menuselect.makeopts: menuselect/menuselect menuselect-tree
282 menuselect/menuselect --check-deps $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts
284 $(MOD_SUBDIRS_EMBED_LDSCRIPT):
285 @echo "EMBED_LDSCRIPTS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-ldscript=) SUBDIR=$(@:-embed-ldscript=) __embed_ldscript` >> makeopts.embed_rules
287 $(MOD_SUBDIRS_EMBED_LDFLAGS):
288 @echo "EMBED_LDFLAGS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-ldflags=) SUBDIR=$(@:-embed-ldflags=) __embed_ldflags` >> makeopts.embed_rules
290 $(MOD_SUBDIRS_EMBED_LIBS):
291 @echo "EMBED_LIBS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-libs=) SUBDIR=$(@:-embed-libs=) __embed_libs` >> makeopts.embed_rules
293 makeopts.embed_rules: menuselect.makeopts
294 @echo "Generating embedded module rules ..."
296 @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LDSCRIPT)
297 @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LDFLAGS)
298 @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LIBS)
300 $(SUBDIRS): depend makeopts.embed_rules
302 # ensure that all module subdirectories are processed before 'main' during
303 # a parallel build, since if there are modules selected to be embedded the
304 # directories containing them must be completed before the main Asterisk
305 # binary can be built
306 main: $(filter-out main,$(MOD_SUBDIRS))
309 @ASTCFLAGS="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" AST_LIBS="$(AST_LIBS)" $(MAKE) --no-print-directory -C $@ SUBDIR=$@ all
312 @ASTCFLAGS="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" AUDIO_LIBS="$(AUDIO_LIBS)" $(MAKE) --no-print-directory -C $@ SUBDIR=$@ all
315 @build_tools/make_defaults_h > $@.tmp
316 @if cmp -s $@.tmp $@ ; then : ; else \
321 include/asterisk/version.h:
322 @build_tools/make_version_h > $@.tmp
323 @if cmp -s $@.tmp $@ ; then : ; else \
328 include/asterisk/buildopts.h: menuselect.makeopts
329 @build_tools/make_buildopts_h > $@.tmp
330 @if cmp -s $@.tmp $@ ; then : ; else \
335 $(SUBDIRS_CLEAN_DEPEND):
336 @$(MAKE) --no-print-directory -C $(@:-clean-depend=) clean-depend
339 @$(MAKE) --no-print-directory -C $(@:-clean=) clean
341 clean-depend: $(SUBDIRS_CLEAN_DEPEND)
343 clean: $(SUBDIRS_CLEAN) clean-depend
345 rm -f include/asterisk/build.h
346 rm -f include/asterisk/version.h
348 @$(MAKE) -C menuselect clean
349 cp -f .cleancount .lastclean
351 dist-clean: distclean
354 @$(MAKE) -C menuselect dist-clean
355 @$(MAKE) -C sounds dist-clean
356 rm -f menuselect.makeopts makeopts menuselect-tree menuselect.makedeps
357 rm -f makeopts.embed_rules
358 rm -f config.log config.status
359 rm -rf autom4te.cache
360 rm -f include/asterisk/autoconfig.h
361 rm -f include/asterisk/buildopts.h
363 rm -f build_tools/menuselect-deps
366 if [ x`$(ID) -un` = xroot ]; then CFLAGS="$(ASTCFLAGS)" sh build_tools/mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig; fi
367 # Should static HTTP be installed during make samples or even with its own target ala
368 # webvoicemail? There are portions here that *could* be customized but might also be
369 # improved a lot. I'll put it here for now.
370 mkdir -p $(DESTDIR)$(ASTDATADIR)/static-http
371 for x in static-http/*; do \
372 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/static-http ; \
374 mkdir -p $(DESTDIR)$(ASTDATADIR)/images
375 for x in images/*.jpg; do \
376 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/images ; \
378 mkdir -p $(DESTDIR)$(AGI_DIR)
379 $(MAKE) -C sounds install
382 @if [ -d .svn ]; then \
383 echo "Updating from Subversion..." ; \
384 svn update | tee update.out; \
386 if [ `grep -c ^C update.out` -gt 0 ]; then \
387 echo ; echo "The following files have conflicts:" ; \
388 grep ^C update.out | cut -b4- ; \
391 $(MAKE) clean-depend; \
393 echo "Not under version control"; \
396 NEWHEADERS=$(notdir $(wildcard include/asterisk/*.h))
397 OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h)))
400 mkdir -p $(DESTDIR)$(MODULES_DIR)
401 mkdir -p $(DESTDIR)$(ASTSBINDIR)
402 mkdir -p $(DESTDIR)$(ASTETCDIR)
403 mkdir -p $(DESTDIR)$(ASTBINDIR)
404 mkdir -p $(DESTDIR)$(ASTVARRUNDIR)
405 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail
406 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/dictate
407 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/system
408 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/tmp
409 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/meetme
410 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/monitor
411 $(INSTALL) -m 755 main/asterisk $(DESTDIR)$(ASTSBINDIR)/
412 $(LN) -sf asterisk $(DESTDIR)$(ASTSBINDIR)/rasterisk
413 $(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
414 $(INSTALL) -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/
415 if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \
416 cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;' > $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ;\
417 chmod 755 $(DESTDIR)$(ASTSBINDIR)/safe_asterisk;\
419 $(INSTALL) -d $(DESTDIR)$(ASTHEADERDIR)
420 $(INSTALL) -m 644 include/asterisk.h $(DESTDIR)$(includedir)
421 $(INSTALL) -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
422 if [ -n "$(OLDHEADERS)" ]; then \
423 rm -f $(addprefix $(DESTDIR)$(ASTHEADERDIR)/,$(OLDHEADERS)) ;\
425 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
426 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-custom
427 mkdir -p $(DESTDIR)$(ASTDATADIR)/keys
428 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware
429 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware/iax
430 mkdir -p $(DESTDIR)$(ASTMANDIR)/man8
431 $(INSTALL) -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTDATADIR)/keys
432 $(INSTALL) -m 644 keys/freeworlddialup.pub $(DESTDIR)$(ASTDATADIR)/keys
433 $(INSTALL) -m 644 doc/asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
434 $(INSTALL) -m 644 contrib/scripts/astgenkey.8 $(DESTDIR)$(ASTMANDIR)/man8
435 $(INSTALL) -m 644 contrib/scripts/autosupport.8 $(DESTDIR)$(ASTMANDIR)/man8
436 $(INSTALL) -m 644 contrib/scripts/safe_asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
437 $(INSTALL) -m 644 contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTDATADIR)/firmware/iax/iaxy.bin; \
440 @DESTDIR="$(DESTDIR)" ASTSBINDIR="$(ASTSBINDIR)" $(MAKE) -C $(@:-install=) install
442 NEWMODS=$(notdir $(wildcard */*.so))
443 OLDMODS=$(filter-out $(NEWMODS),$(notdir $(wildcard $(DESTDIR)$(MODULES_DIR)/*.so)))
446 @if [ -n "$(OLDMODS)" ]; then \
447 echo " WARNING WARNING WARNING" ;\
449 echo " Your Asterisk modules directory, located at" ;\
450 echo " $(DESTDIR)$(MODULES_DIR)" ;\
451 echo " contains modules that were not installed by this " ;\
452 echo " version of Asterisk. Please ensure that these" ;\
453 echo " modules are compatible with this version before" ;\
454 echo " attempting to run Asterisk." ;\
456 for f in $(OLDMODS); do \
460 echo " WARNING WARNING WARNING" ;\
463 install: datafiles bininstall $(SUBDIRS_INSTALL)
464 @if [ -x /usr/sbin/asterisk-post-install ]; then \
465 /usr/sbin/asterisk-post-install $(DESTDIR) . ; \
467 @echo " +---- Asterisk Installation Complete -------+"
469 @echo " + YOU MUST READ THE SECURITY DOCUMENT +"
471 @echo " + Asterisk has successfully been installed. +"
472 @echo " + If you would like to install the sample +"
473 @echo " + configuration files (overwriting any +"
474 @echo " + existing config files), run: +"
476 @echo " + $(MAKE) samples +"
478 @echo " +----------------- or ---------------------+"
480 @echo " + You can go ahead and install the asterisk +"
481 @echo " + program documentation now or later run: +"
483 @echo " + $(MAKE) progdocs +"
485 @echo " + **Note** This requires that you have +"
486 @echo " + doxygen installed on your local system +"
487 @echo " +-------------------------------------------+"
488 @$(MAKE) -s oldmodcheck
493 mkdir -p $(DESTDIR)$(ASTETCDIR)
494 for x in configs/*.adsi; do \
495 if [ ! -f $(DESTDIR)$(ASTETCDIR)/$$x ]; then \
496 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x` ; \
501 mkdir -p $(DESTDIR)$(ASTETCDIR)
502 for x in configs/*.sample; do \
503 if [ -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ]; then \
504 if [ "$(OVERWRITE)" = "y" ]; then \
505 if cmp -s $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $$x ; then \
506 echo "Config file $$x is unchanged"; \
509 mv -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample`.old ; \
511 echo "Skipping config file $$x"; \
515 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ;\
517 if [ "$(OVERWRITE)" = "y" ] || [ ! -f $(DESTDIR)$(ASTCONFPATH) ]; then \
519 echo "[directories]" ; \
520 echo "astetcdir => $(ASTETCDIR)" ; \
521 echo "astmoddir => $(MODULES_DIR)" ; \
522 echo "astvarlibdir => $(ASTVARLIBDIR)" ; \
523 echo "astdatadir => $(ASTDATADIR)" ; \
524 echo "astagidir => $(AGI_DIR)" ; \
525 echo "astspooldir => $(ASTSPOOLDIR)" ; \
526 echo "astrundir => $(ASTVARRUNDIR)" ; \
527 echo "astlogdir => $(ASTLOGDIR)" ; \
529 echo "; Changing the following lines may compromise your security." ; \
531 echo ";astctlpermissions = 0660" ; \
532 echo ";astctlowner = root" ; \
533 echo ";astctlgroup = apache" ; \
534 echo ";astctl = asterisk.ctl" ; \
535 echo ";[options]" ; \
536 echo ";internal_timing = yes" ; \
537 ) > $(DESTDIR)$(ASTCONFPATH) ; \
539 echo "Skipping asterisk.conf creation"; \
541 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
542 :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm
543 for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isunavail; do \
544 cat $(DESTDIR)$(ASTDATADIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm ; \
546 :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm
547 for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isonphone; do \
548 cat $(DESTDIR)$(ASTDATADIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm ; \
552 @[ -d $(DESTDIR)$(HTTP_DOCSDIR)/ ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 )
553 @[ -d $(DESTDIR)$(HTTP_CGIDIR) ] || ( printf "cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit 1 )
554 $(INSTALL) -m 4755 -o root -g root contrib/scripts/vmail.cgi $(DESTDIR)$(HTTP_CGIDIR)/vmail.cgi
555 mkdir -p $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk
556 for x in images/*.gif; do \
557 $(INSTALL) -m 644 $$x $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk/; \
559 @echo " +--------- Asterisk Web Voicemail ----------+"
561 @echo " + Asterisk Web Voicemail is installed in +"
562 @echo " + your cgi-bin directory: +"
563 @echo " + $(DESTDIR)$(HTTP_CGIDIR)"
564 @echo " + IT USES A SETUID ROOT PERL SCRIPT, SO +"
565 @echo " + IF YOU DON'T LIKE THAT, UNINSTALL IT! +"
567 @echo " + Other static items have been stored in: +"
568 @echo " + $(DESTDIR)$(HTTP_DOCSDIR)"
570 @echo " + If these paths do not match your httpd +"
571 @echo " + installation, correct the definitions +"
572 @echo " + in your Makefile of HTTP_CGIDIR and +"
573 @echo " + HTTP_DOCSDIR +"
575 @echo " +-------------------------------------------+"
578 sed "s/^Version:.*/Version: $(RPMVERSION)/g" redhat/asterisk.spec > asterisk.spec ; \
582 __rpm: include/asterisk/version.h include/asterisk/buildopts.h spec
583 rm -rf /tmp/asterisk ; \
584 mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
585 $(MAKE) DESTDIR=/tmp/asterisk install ; \
586 $(MAKE) DESTDIR=/tmp/asterisk samples ; \
587 mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
588 cp -f contrib/init.d/rc.redhat.asterisk /tmp/asterisk/etc/rc.d/init.d/asterisk ; \
589 rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec
592 (cat contrib/asterisk-ng-doxygen; echo "HAVE_DOT=$(HAVEDOT)"; \
593 echo "PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen -
596 @if [ "${OSARCH}" = "linux-gnu" ]; then \
597 if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \
598 $(INSTALL) -m 755 contrib/init.d/rc.redhat.asterisk /etc/rc.d/init.d/asterisk; \
599 /sbin/chkconfig --add asterisk; \
600 elif [ -f /etc/debian_version ]; then \
601 $(INSTALL) -m 755 contrib/init.d/rc.debian.asterisk /etc/init.d/asterisk; \
602 /usr/sbin/update-rc.d asterisk start 10 2 3 4 5 . stop 91 2 3 4 5 .; \
603 elif [ -f /etc/gentoo-release ]; then \
604 $(INSTALL) -m 755 contrib/init.d/rc.gentoo.asterisk /etc/init.d/asterisk; \
605 /sbin/rc-update add asterisk default; \
606 elif [ -f /etc/mandrake-release ]; then \
607 $(INSTALL) -m 755 contrib/init.d/rc.mandrake.asterisk /etc/rc.d/init.d/asterisk; \
608 /sbin/chkconfig --add asterisk; \
609 elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then \
610 $(INSTALL) -m 755 contrib/init.d/rc.suse.asterisk /etc/init.d/asterisk; \
611 /sbin/chkconfig --add asterisk; \
612 elif [ -f /etc/slackware-version ]; then \
613 echo "Slackware is not currently supported, although an init script does exist for it." \
615 echo "We could not install init scripts for your distribution."; \
618 echo "We could not install init scripts for your operating system."; \
621 $(MOD_SUBDIRS_DEPEND):
622 @ASTCFLAGS="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" $(MAKE) --no-print-directory -C $(@:-depend=) depend
624 $(OTHER_SUBDIRS_DEPEND):
625 @ASTCFLAGS="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" $(MAKE) --no-print-directory -C $(@:-depend=) depend
627 depend: include/asterisk/version.h include/asterisk/buildopts.h defaults.h $(SUBDIRS_DEPEND)
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 menuselect: menuselect/menuselect menuselect-tree
677 -@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!"
679 menuselect/menuselect: makeopts menuselect/menuselect.c menuselect/menuselect_curses.c menuselect/menuselect_stub.c menuselect/menuselect.h menuselect/linkedlists.h makeopts
680 @unset CC LD AR RANLIB && $(MAKE) -C menuselect CONFIGURE_SILENT="--silent"
682 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
683 @echo "Generating input for menuselect ..."
684 @build_tools/prep_moduledeps > $@
686 .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)