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 # LDFLAGS - linker flags (not libraries), used for all links
17 # LIBS - additional libraries, at top-level for all links,
18 # on a single object just for that object
19 # SOLINK - linker flags used only for creating shared objects (.so files),
20 # used for all .so links
23 .EXPORT_ALL_VARIABLES:
25 # even though we could use '-include makeopts' here, use a wildcard
26 # lookup anyway, so that make won't try to build makeopts if it doesn't
27 # exist (other rules will force it to be built if needed)
28 ifneq ($(wildcard makeopts),)
32 #Uncomment this to see all build commands instead of 'quiet' output
35 # Create OPTIONS variable
38 ASTTOPDIR:=$(shell pwd)
40 # Overwite config files on "make samples"
43 # Include debug and macro symbols in the executables (-g) and profiling info (-pg)
47 # Files are copied here temporarily during the install process
48 # For example, make DESTDIR=/tmp/asterisk woud put things in
49 # /tmp/asterisk/etc/asterisk
50 # !!! Watch out, put no spaces or comments after the value !!!
51 #DESTDIR?=/tmp/asterisk
53 # Define standard directories for various platforms
54 # These apply if they are not redefined in asterisk.conf
55 ifeq ($(OSARCH),SunOS)
56 ASTETCDIR=/var/etc/asterisk
57 ASTLIBDIR=/opt/asterisk/lib
58 ASTVARLIBDIR=/var/opt/asterisk
59 ASTSPOOLDIR=/var/spool/asterisk
60 ASTLOGDIR=/var/log/asterisk
61 ASTHEADERDIR=/opt/asterisk/include
62 ASTBINDIR=/opt/asterisk/bin
63 ASTSBINDIR=/opt/asterisk/sbin
64 ASTVARRUNDIR=/var/run/asterisk
65 ASTMANDIR=/opt/asterisk/man
67 ASTETCDIR=$(sysconfdir)/asterisk
68 ASTLIBDIR=$(libdir)/asterisk
69 ASTHEADERDIR=$(includedir)/asterisk
72 ASTSPOOLDIR=$(localstatedir)/spool/asterisk
73 ASTLOGDIR=$(localstatedir)/log/asterisk
74 ASTVARRUNDIR=$(localstatedir)/run
76 ifeq ($(OSARCH),FreeBSD)
77 ASTVARLIBDIR=$(prefix)/share/asterisk
79 ASTVARLIBDIR=$(localstatedir)/lib/asterisk
82 ASTDATADIR?=$(ASTVARLIBDIR)
84 # Asterisk.conf is located in ASTETCDIR or by using the -C flag
85 # when starting Asterisk
86 ASTCONFPATH=$(ASTETCDIR)/asterisk.conf
87 MODULES_DIR=$(ASTLIBDIR)/modules
88 AGI_DIR=$(ASTDATADIR)/agi-bin
90 # If you use Apache, you may determine by a grep 'DocumentRoot' of your httpd.conf file
91 HTTP_DOCSDIR=/var/www/html
92 # Determine by a grep 'ScriptAlias' of your Apache httpd.conf file
93 HTTP_CGIDIR=/var/www/cgi-bin
97 # Uncomment this to use the older DSP routines
98 #ASTCFLAGS+=-DOLD_DSP_ROUTINES
100 # If the file .asterisk.makeopts is present in your home directory, you can
101 # include all of your favorite menuselect options so that every time you download
102 # a new version of Asterisk, you don't have to run menuselect to set them.
103 # The file /etc/asterisk.makeopts will also be included but can be overridden
104 # by the file in your home directory.
106 GLOBAL_MAKEOPTS=$(wildcard /etc/asterisk.makeopts)
107 USER_MAKEOPTS=$(wildcard ~/.asterisk.makeopts)
109 MOD_SUBDIR_CFLAGS=-I../include -I../main
110 OTHER_SUBDIR_CFLAGS=-I../include
112 ifeq ($(OSARCH),linux-gnu)
113 ifeq ($(PROC),x86_64)
114 # You must have GCC 3.4 to use k8, otherwise use athlon
119 ifeq ($(PROC),sparc64)
120 #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
121 #This works for even old (2.96) versions of gcc and provides a small boost either way.
122 #A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
123 #So we go lowest common available by gcc and go a step down, still a step up from
124 #the default as we now have a better instruction set to work with. - Belgarath
126 OPTIONS+=$(shell if $(CC) -mtune=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mtune=$(PROC)"; fi)
127 OPTIONS+=$(shell if $(CC) -mcpu=v8 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mcpu=v8"; fi)
128 OPTIONS+=-fomit-frame-pointer
132 # The Cirrus logic is the only heavily shipping arm processor with a real floating point unit
133 ifeq ($(SUB_PROC),maverick)
134 OPTIONS+=-fsigned-char -mcpu=ep9312
136 ifeq ($(SUB_PROC),xscale)
137 OPTIONS+=-fsigned-char -mcpu=xscale
139 OPTIONS+=-fsigned-char
147 ifeq ($(OSARCH),SunOS)
152 ASTCFLAGS+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG)
154 ifeq ($(AST_DEVMODE),yes)
155 ASTCFLAGS+=-Werror -Wunused
158 ifneq ($(findstring BSD,$(OSARCH)),)
159 ASTCFLAGS+=-I/usr/local/include -L/usr/local/lib
162 ifneq ($(PROC),ultrasparc)
163 ASTCFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
167 ASTCFLAGS+=-fsigned-char
170 ifeq ($(OSARCH),FreeBSD)
171 # -V is understood by BSD Make, not by GNU make.
172 BSDVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk)
173 ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
174 AST_LIBS+=$(shell if test $(BSDVERSION) -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi)
177 ifeq ($(OSARCH),NetBSD)
178 ASTCFLAGS+=-pthread -I/usr/pkg/include
181 ifeq ($(OSARCH),OpenBSD)
185 ifeq ($(OSARCH),SunOS)
186 ASTCFLAGS+=-Wcast-align -DSOLARIS -I../include/solaris-compat -I/opt/ssl/include -I/usr/local/ssl/include
189 ASTERISKVERSION:=$(shell build_tools/make_version .)
191 ifneq ($(wildcard .version),)
192 ASTERISKVERSIONNUM:=$(shell awk -F. '{printf "%02d%02d%02d", $$1, $$2, $$3}' .version)
193 RPMVERSION:=$(shell sed 's/[-\/:]/_/g' .version)
198 ifneq ($(wildcard .svn),)
199 ASTERISKVERSIONNUM=999999
202 ASTCFLAGS+=$(MALLOC_DEBUG)$(BUSYDETECT)$(OPTIONS)
204 MOD_SUBDIRS:=res channels pbx apps codecs formats cdr funcs main
205 OTHER_SUBDIRS:=utils agi
206 SUBDIRS:=$(OTHER_SUBDIRS) $(MOD_SUBDIRS)
207 SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)
208 SUBDIRS_CLEAN:=$(SUBDIRS:%=%-clean)
209 SUBDIRS_CLEAN_DEPEND:=$(SUBDIRS:%=%-clean-depend)
210 MOD_SUBDIRS_DEPEND:=$(MOD_SUBDIRS:%=%-depend)
211 OTHER_SUBDIRS_DEPEND:=$(OTHER_SUBDIRS:%=%-depend)
212 SUBDIRS_DEPEND:=$(OTHER_SUBDIRS_DEPEND) $(MOD_SUBDIRS_DEPEND)
213 SUBDIRS_UNINSTALL:=$(SUBDIRS:%=%-uninstall)
214 MOD_SUBDIRS_EMBED_LDSCRIPT:=$(MOD_SUBDIRS:%=%-embed-ldscript)
215 MOD_SUBDIRS_EMBED_LDFLAGS:=$(MOD_SUBDIRS:%=%-embed-ldflags)
216 MOD_SUBDIRS_EMBED_LIBS:=$(MOD_SUBDIRS:%=%-embed-libs)
218 ifneq ($(findstring darwin,$(OSARCH)),)
219 ASTCFLAGS+=-D__Darwin__
220 AUDIO_LIBS=-framework CoreAudio
221 SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
223 # These are used for all but Darwin
224 SOLINK=-shared -Xlinker -x
225 ifneq ($(findstring BSD,$(OSARCH)),)
226 LDFLAGS+=-L/usr/local/lib
230 ifeq ($(OSARCH),SunOS)
231 SOLINK=-shared -fpic -L/usr/local/ssl/lib
234 # This is used when generating the doxygen documentation
241 all: cleantest $(SUBDIRS)
242 @echo " +--------- Asterisk Build Complete ---------+"
243 @echo " + Asterisk has successfully been built, and +"
244 @echo " + can be installed by running: +"
246 @echo " + make install +"
247 @echo " +-------------------------------------------+"
251 @echo "**** The configure script must be executed before running 'make'."
255 menuselect.makeopts: menuselect/menuselect menuselect-tree
256 menuselect/menuselect --check-deps $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts
258 $(MOD_SUBDIRS_EMBED_LDSCRIPT):
259 @echo "EMBED_LDSCRIPTS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-ldscript=) SUBDIR=$(@:-embed-ldscript=) __embed_ldscript` >> makeopts.embed_rules
261 $(MOD_SUBDIRS_EMBED_LDFLAGS):
262 @echo "EMBED_LDFLAGS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-ldflags=) SUBDIR=$(@:-embed-ldflags=) __embed_ldflags` >> makeopts.embed_rules
264 $(MOD_SUBDIRS_EMBED_LIBS):
265 @echo "EMBED_LIBS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-libs=) SUBDIR=$(@:-embed-libs=) __embed_libs` >> makeopts.embed_rules
267 makeopts.embed_rules: menuselect.makeopts
268 @echo "Generating embedded module rules ..."
270 @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LDSCRIPT)
271 @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LDFLAGS)
272 @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LIBS)
274 $(SUBDIRS): depend makeopts.embed_rules
276 # ensure that all module subdirectories are processed before 'main' during
277 # a parallel build, since if there are modules selected to be embedded the
278 # directories containing them must be completed before the main Asterisk
279 # binary can be built
280 main: $(filter-out main,$(MOD_SUBDIRS))
283 @CFLAGS="$(MOD_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) --no-print-directory -C $@ SUBDIR=$@ all
286 @CFLAGS="$(OTHER_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) --no-print-directory -C $@ SUBDIR=$@ all
289 @build_tools/make_defaults_h > $@.tmp
290 @if cmp -s $@.tmp $@ ; then : ; else \
295 include/asterisk/version.h:
296 @build_tools/make_version_h > $@.tmp
297 @if cmp -s $@.tmp $@ ; then : ; else \
302 include/asterisk/buildopts.h: menuselect.makeopts
303 @build_tools/make_buildopts_h > $@.tmp
304 @if cmp -s $@.tmp $@ ; then : ; else \
309 $(SUBDIRS_CLEAN_DEPEND):
310 @$(MAKE) --no-print-directory -C $(@:-clean-depend=) clean-depend
313 @$(MAKE) --no-print-directory -C $(@:-clean=) clean
315 clean-depend: $(SUBDIRS_CLEAN_DEPEND)
317 clean: $(SUBDIRS_CLEAN) clean-depend
319 rm -f include/asterisk/build.h
320 rm -f include/asterisk/version.h
322 @$(MAKE) -C menuselect clean
323 cp -f .cleancount .lastclean
325 dist-clean: distclean
328 @$(MAKE) -C menuselect dist-clean
329 @$(MAKE) -C sounds dist-clean
330 rm -f menuselect.makeopts makeopts menuselect-tree menuselect.makedeps
331 rm -f makeopts.embed_rules
332 rm -f config.log config.status
333 rm -rf autom4te.cache
334 rm -f include/asterisk/autoconfig.h
335 rm -f include/asterisk/buildopts.h
337 rm -f build_tools/menuselect-deps
340 if [ x`$(ID) -un` = xroot ]; then CFLAGS="$(ASTCFLAGS)" sh build_tools/mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig; fi
341 # Should static HTTP be installed during make samples or even with its own target ala
342 # webvoicemail? There are portions here that *could* be customized but might also be
343 # improved a lot. I'll put it here for now.
344 mkdir -p $(DESTDIR)$(ASTDATADIR)/static-http
345 for x in static-http/*; do \
346 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/static-http ; \
348 mkdir -p $(DESTDIR)$(ASTDATADIR)/images
349 for x in images/*.jpg; do \
350 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/images ; \
352 mkdir -p $(DESTDIR)$(AGI_DIR)
353 $(MAKE) -C sounds install
356 @if [ -d .svn ]; then \
357 echo "Updating from Subversion..." ; \
358 svn update | tee update.out; \
360 if [ `grep -c ^C update.out` -gt 0 ]; then \
361 echo ; echo "The following files have conflicts:" ; \
362 grep ^C update.out | cut -b4- ; \
365 $(MAKE) clean-depend; \
367 echo "Not under version control"; \
370 NEWHEADERS=$(notdir $(wildcard include/asterisk/*.h))
371 OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h)))
374 mkdir -p $(DESTDIR)$(MODULES_DIR)
375 mkdir -p $(DESTDIR)$(ASTSBINDIR)
376 mkdir -p $(DESTDIR)$(ASTETCDIR)
377 mkdir -p $(DESTDIR)$(ASTBINDIR)
378 mkdir -p $(DESTDIR)$(ASTVARRUNDIR)
379 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail
380 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/dictate
381 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/system
382 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/tmp
383 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/meetme
384 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/monitor
385 $(INSTALL) -m 755 main/asterisk $(DESTDIR)$(ASTSBINDIR)/
386 $(LN) -sf asterisk $(DESTDIR)$(ASTSBINDIR)/rasterisk
387 $(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
388 $(INSTALL) -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/
389 if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \
390 cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;' > $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ;\
391 chmod 755 $(DESTDIR)$(ASTSBINDIR)/safe_asterisk;\
393 $(INSTALL) -d $(DESTDIR)$(ASTHEADERDIR)
394 $(INSTALL) -m 644 include/asterisk.h $(DESTDIR)$(includedir)
395 $(INSTALL) -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
396 if [ -n "$(OLDHEADERS)" ]; then \
397 rm -f $(addprefix $(DESTDIR)$(ASTHEADERDIR)/,$(OLDHEADERS)) ;\
399 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
400 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-custom
401 mkdir -p $(DESTDIR)$(ASTDATADIR)/keys
402 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware
403 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware/iax
404 mkdir -p $(DESTDIR)$(ASTMANDIR)/man8
405 $(INSTALL) -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTDATADIR)/keys
406 $(INSTALL) -m 644 keys/freeworlddialup.pub $(DESTDIR)$(ASTDATADIR)/keys
407 $(INSTALL) -m 644 doc/asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
408 $(INSTALL) -m 644 contrib/scripts/astgenkey.8 $(DESTDIR)$(ASTMANDIR)/man8
409 $(INSTALL) -m 644 contrib/scripts/autosupport.8 $(DESTDIR)$(ASTMANDIR)/man8
410 $(INSTALL) -m 644 contrib/scripts/safe_asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
411 $(INSTALL) -m 644 contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTDATADIR)/firmware/iax/iaxy.bin; \
414 @$(MAKE) -C $(@:-install=) install
416 NEWMODS=$(notdir $(wildcard */*.so))
417 OLDMODS=$(filter-out $(NEWMODS),$(notdir $(wildcard $(DESTDIR)$(MODULES_DIR)/*.so)))
420 @if [ -n "$(OLDMODS)" ]; then \
421 echo " WARNING WARNING WARNING" ;\
423 echo " Your Asterisk modules directory, located at" ;\
424 echo " $(DESTDIR)$(MODULES_DIR)" ;\
425 echo " contains modules that were not installed by this " ;\
426 echo " version of Asterisk. Please ensure that these" ;\
427 echo " modules are compatible with this version before" ;\
428 echo " attempting to run Asterisk." ;\
430 for f in $(OLDMODS); do \
434 echo " WARNING WARNING WARNING" ;\
437 install: all datafiles bininstall $(SUBDIRS_INSTALL)
438 @if [ -x /usr/sbin/asterisk-post-install ]; then \
439 /usr/sbin/asterisk-post-install $(DESTDIR) . ; \
441 @echo " +---- Asterisk Installation Complete -------+"
443 @echo " + YOU MUST READ THE SECURITY DOCUMENT +"
445 @echo " + Asterisk has successfully been installed. +"
446 @echo " + If you would like to install the sample +"
447 @echo " + configuration files (overwriting any +"
448 @echo " + existing config files), run: +"
450 @echo " + $(MAKE) samples +"
452 @echo " +----------------- or ---------------------+"
454 @echo " + You can go ahead and install the asterisk +"
455 @echo " + program documentation now or later run: +"
457 @echo " + $(MAKE) progdocs +"
459 @echo " + **Note** This requires that you have +"
460 @echo " + doxygen installed on your local system +"
461 @echo " +-------------------------------------------+"
462 @$(MAKE) -s oldmodcheck
464 upgrade: all bininstall
467 mkdir -p $(DESTDIR)$(ASTETCDIR)
468 for x in configs/*.adsi; do \
469 if [ ! -f $(DESTDIR)$(ASTETCDIR)/$$x ]; then \
470 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x` ; \
475 mkdir -p $(DESTDIR)$(ASTETCDIR)
476 for x in configs/*.sample; do \
477 if [ -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ]; then \
478 if [ "$(OVERWRITE)" = "y" ]; then \
479 if cmp -s $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $$x ; then \
480 echo "Config file $$x is unchanged"; \
483 mv -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample`.old ; \
485 echo "Skipping config file $$x"; \
489 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ;\
491 if [ "$(OVERWRITE)" = "y" ] || [ ! -f $(DESTDIR)$(ASTCONFPATH) ]; then \
493 echo "[directories]" ; \
494 echo "astetcdir => $(ASTETCDIR)" ; \
495 echo "astmoddir => $(MODULES_DIR)" ; \
496 echo "astvarlibdir => $(ASTVARLIBDIR)" ; \
497 echo "astdatadir => $(ASTDATADIR)" ; \
498 echo "astagidir => $(AGI_DIR)" ; \
499 echo "astspooldir => $(ASTSPOOLDIR)" ; \
500 echo "astrundir => $(ASTVARRUNDIR)" ; \
501 echo "astlogdir => $(ASTLOGDIR)" ; \
503 echo "; Changing the following lines may compromise your security." ; \
505 echo ";astctlpermissions = 0660" ; \
506 echo ";astctlowner = root" ; \
507 echo ";astctlgroup = apache" ; \
508 echo ";astctl = asterisk.ctl" ; \
509 echo ";[options]" ; \
510 echo ";internal_timing = yes" ; \
511 ) > $(DESTDIR)$(ASTCONFPATH) ; \
513 echo "Skipping asterisk.conf creation"; \
515 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
516 :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm
517 for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isunavail; do \
518 cat $(DESTDIR)$(ASTDATADIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm ; \
520 :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm
521 for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isonphone; do \
522 cat $(DESTDIR)$(ASTDATADIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm ; \
526 @[ -d $(DESTDIR)$(HTTP_DOCSDIR)/ ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 )
527 @[ -d $(DESTDIR)$(HTTP_CGIDIR) ] || ( printf "cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit 1 )
528 $(INSTALL) -m 4755 -o root -g root contrib/scripts/vmail.cgi $(DESTDIR)$(HTTP_CGIDIR)/vmail.cgi
529 mkdir -p $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk
530 for x in images/*.gif; do \
531 $(INSTALL) -m 644 $$x $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk/; \
533 @echo " +--------- Asterisk Web Voicemail ----------+"
535 @echo " + Asterisk Web Voicemail is installed in +"
536 @echo " + your cgi-bin directory: +"
537 @echo " + $(DESTDIR)$(HTTP_CGIDIR)"
538 @echo " + IT USES A SETUID ROOT PERL SCRIPT, SO +"
539 @echo " + IF YOU DON'T LIKE THAT, UNINSTALL IT! +"
541 @echo " + Other static items have been stored in: +"
542 @echo " + $(DESTDIR)$(HTTP_DOCSDIR)"
544 @echo " + If these paths do not match your httpd +"
545 @echo " + installation, correct the definitions +"
546 @echo " + in your Makefile of HTTP_CGIDIR and +"
547 @echo " + HTTP_DOCSDIR +"
549 @echo " +-------------------------------------------+"
552 sed "s/^Version:.*/Version: $(RPMVERSION)/g" redhat/asterisk.spec > asterisk.spec ; \
556 __rpm: include/asterisk/version.h include/asterisk/buildopts.h spec
557 rm -rf /tmp/asterisk ; \
558 mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
559 $(MAKE) DESTDIR=/tmp/asterisk install ; \
560 $(MAKE) DESTDIR=/tmp/asterisk samples ; \
561 mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
562 cp -f contrib/init.d/rc.redhat.asterisk /tmp/asterisk/etc/rc.d/init.d/asterisk ; \
563 rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec
566 (cat contrib/asterisk-ng-doxygen; echo "HAVE_DOT=$(HAVEDOT)"; \
567 echo "PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen -
570 @if [ "${OSARCH}" = "linux-gnu" ]; then \
571 if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \
572 $(INSTALL) -m 755 contrib/init.d/rc.redhat.asterisk /etc/rc.d/init.d/asterisk; \
573 /sbin/chkconfig --add asterisk; \
574 elif [ -f /etc/debian_version ]; then \
575 $(INSTALL) -m 755 contrib/init.d/rc.debian.asterisk /etc/init.d/asterisk; \
576 /usr/sbin/update-rc.d asterisk start 10 2 3 4 5 . stop 91 2 3 4 5 .; \
577 elif [ -f /etc/gentoo-release ]; then \
578 $(INSTALL) -m 755 contrib/init.d/rc.gentoo.asterisk /etc/init.d/asterisk; \
579 /sbin/rc-update add asterisk default; \
580 elif [ -f /etc/mandrake-release ]; then \
581 $(INSTALL) -m 755 contrib/init.d/rc.mandrake.asterisk /etc/rc.d/init.d/asterisk; \
582 /sbin/chkconfig --add asterisk; \
583 elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then \
584 $(INSTALL) -m 755 contrib/init.d/rc.suse.asterisk /etc/init.d/asterisk; \
585 /sbin/chkconfig --add asterisk; \
586 elif [ -f /etc/slackware-version ]; then \
587 echo "Slackware is not currently supported, although an init script does exist for it." \
589 echo "We could not install init scripts for your distribution."; \
592 echo "We could not install init scripts for your operating system."; \
595 $(MOD_SUBDIRS_DEPEND):
596 @CFLAGS="$(MOD_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) --no-print-directory -C $(@:-depend=) depend
598 $(OTHER_SUBDIRS_DEPEND):
599 @CFLAGS="$(OTHER_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) --no-print-directory -C $(@:-depend=) depend
601 depend: include/asterisk/version.h include/asterisk/buildopts.h defaults.h $(SUBDIRS_DEPEND)
604 $(MAKE) -C sounds all
606 # If the cleancount has been changed, force a make clean.
607 # .cleancount is the global clean count, and .lastclean is the
608 # last clean count we had
611 @if ! cmp -s .cleancount .lastclean ; then \
615 $(SUBDIRS_UNINSTALL):
616 @$(MAKE) --no-print-directory -C $(@:-uninstall=) uninstall
618 _uninstall: $(SUBDIRS_UNINSTALL)
619 rm -f $(DESTDIR)$(MODULES_DIR)/*
620 rm -f $(DESTDIR)$(ASTSBINDIR)/*asterisk*
621 rm -f $(DESTDIR)$(ASTSBINDIR)/astgenkey
622 rm -f $(DESTDIR)$(ASTSBINDIR)/autosupport
623 rm -rf $(DESTDIR)$(ASTHEADERDIR)
624 rm -rf $(DESTDIR)$(ASTDATADIR)/firmware
625 rm -rf $(DESTDIR)$(ASTMANDIR)/man8
626 $(MAKE) -C sounds uninstall
628 uninstall: _uninstall
629 @echo " +--------- Asterisk Uninstall Complete -----+"
630 @echo " + Asterisk binaries, sounds, man pages, +"
631 @echo " + headers, modules, and firmware builds, +"
632 @echo " + have all been uninstalled. +"
634 @echo " + To remove ALL traces of Asterisk, +"
635 @echo " + including configuration, spool +"
636 @echo " + directories, and logs, run the following +"
637 @echo " + command: +"
639 @echo " + $(MAKE) uninstall-all +"
640 @echo " +-------------------------------------------+"
642 uninstall-all: _uninstall
643 rm -rf $(DESTDIR)$(ASTLIBDIR)
644 rm -rf $(DESTDIR)$(ASTVARLIBDIR)
645 rm -rf $(DESTDIR)$(ASTDATADIR)
646 rm -rf $(DESTDIR)$(ASTSPOOLDIR)
647 rm -rf $(DESTDIR)$(ASTETCDIR)
648 rm -rf $(DESTDIR)$(ASTLOGDIR)
650 menuselect: menuselect/menuselect menuselect-tree
651 -@menuselect/menuselect $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts && echo "menuselect changes saved!" || echo "menuselect changes NOT saved!"
653 menuselect/menuselect: makeopts menuselect/menuselect.c menuselect/menuselect_curses.c menuselect/menuselect_stub.c menuselect/menuselect.h menuselect/linkedlists.h makeopts
654 @unset CC LD AR RANLIB && $(MAKE) -C menuselect CONFIGURE_SILENT="--silent"
656 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
657 @echo "Generating input for menuselect ..."
658 @build_tools/prep_moduledeps > $@
660 .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)