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
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
145 ASTCFLAGS+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG)
147 ifeq ($(AST_DEVMODE),yes)
148 ASTCFLAGS+=-Werror -Wunused
151 ifneq ($(findstring BSD,$(OSARCH)),)
152 ASTCFLAGS+=-I/usr/local/include -L/usr/local/lib
155 ifneq ($(PROC),ultrasparc)
156 ASTCFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
160 ASTCFLAGS+=-fsigned-char
163 ifeq ($(OSARCH),FreeBSD)
164 # -V is understood by BSD Make, not by GNU make.
165 BSDVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk)
166 ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
167 AST_LIBS+=$(shell if test $(BSDVERSION) -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi)
170 ifeq ($(OSARCH),NetBSD)
171 ASTCFLAGS+=-pthread -I/usr/pkg/include
174 ifeq ($(OSARCH),OpenBSD)
178 ifeq ($(OSARCH),SunOS)
179 ASTCFLAGS+=-Wcast-align -DSOLARIS -I../include/solaris-compat -I/opt/ssl/include -I/usr/local/ssl/include
182 ASTERISKVERSION:=$(shell build_tools/make_version .)
184 ifneq ($(wildcard .version),)
185 ASTERISKVERSIONNUM:=$(shell awk -F. '{printf "%02d%02d%02d", $$1, $$2, $$3}' .version)
186 RPMVERSION:=$(shell sed 's/[-\/:]/_/g' .version)
191 ifneq ($(wildcard .svn),)
192 ASTERISKVERSIONNUM=999999
195 ASTCFLAGS+=$(MALLOC_DEBUG)$(BUSYDETECT)$(OPTIONS)
197 MOD_SUBDIRS:=res channels pbx apps codecs formats cdr funcs main
198 OTHER_SUBDIRS:=utils agi
199 SUBDIRS:=$(OTHER_SUBDIRS) $(MOD_SUBDIRS)
200 SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)
201 SUBDIRS_CLEAN:=$(SUBDIRS:%=%-clean)
202 SUBDIRS_CLEAN_DEPEND:=$(SUBDIRS:%=%-clean-depend)
203 MOD_SUBDIRS_DEPEND:=$(MOD_SUBDIRS:%=%-depend)
204 OTHER_SUBDIRS_DEPEND:=$(OTHER_SUBDIRS:%=%-depend)
205 SUBDIRS_DEPEND:=$(OTHER_SUBDIRS_DEPEND) $(MOD_SUBDIRS_DEPEND)
206 SUBDIRS_UNINSTALL:=$(SUBDIRS:%=%-uninstall)
207 MOD_SUBDIRS_EMBED_LDSCRIPT:=$(MOD_SUBDIRS:%=%-embed-ldscript)
208 MOD_SUBDIRS_EMBED_LDFLAGS:=$(MOD_SUBDIRS:%=%-embed-ldflags)
209 MOD_SUBDIRS_EMBED_LIBS:=$(MOD_SUBDIRS:%=%-embed-libs)
211 ifneq ($(findstring darwin,$(OSARCH)),)
212 ASTCFLAGS+=-D__Darwin__
213 AUDIO_LIBS=-framework CoreAudio
214 SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
216 # These are used for all but Darwin
217 SOLINK=-shared -Xlinker -x
218 ifneq ($(findstring BSD,$(OSARCH)),)
219 LDFLAGS+=-L/usr/local/lib
223 ifeq ($(OSARCH),SunOS)
224 SOLINK=-shared -fpic -L/usr/local/ssl/lib
227 # This is used when generating the doxygen documentation
234 all: cleantest $(SUBDIRS)
235 @echo " +--------- Asterisk Build Complete ---------+"
236 @echo " + Asterisk has successfully been built, and +"
237 @echo " + can be installed by running: +"
239 @echo " + make install +"
240 @echo " +-------------------------------------------+"
244 @echo "**** The configure script must be executed before running 'make'."
248 menuselect.makeopts: menuselect/menuselect menuselect-tree
249 menuselect/menuselect --check-deps $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts
251 $(MOD_SUBDIRS_EMBED_LDSCRIPT):
252 @echo "EMBED_LDSCRIPTS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-ldscript=) SUBDIR=$(@:-embed-ldscript=) __embed_ldscript` >> makeopts.embed_rules
254 $(MOD_SUBDIRS_EMBED_LDFLAGS):
255 @echo "EMBED_LDFLAGS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-ldflags=) SUBDIR=$(@:-embed-ldflags=) __embed_ldflags` >> makeopts.embed_rules
257 $(MOD_SUBDIRS_EMBED_LIBS):
258 @echo "EMBED_LIBS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-libs=) SUBDIR=$(@:-embed-libs=) __embed_libs` >> makeopts.embed_rules
260 makeopts.embed_rules: menuselect.makeopts
261 @echo "Generating embedded module rules ..."
263 @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LDSCRIPT)
264 @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LDFLAGS)
265 @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LIBS)
267 $(SUBDIRS): depend makeopts.embed_rules
269 # ensure that all module subdirectories are processed before 'main' during
270 # a parallel build, since if there are modules selected to be embedded the
271 # directories containing them must be completed before the main Asterisk
272 # binary can be built
273 main: $(filter-out main,$(MOD_SUBDIRS))
276 @CFLAGS="$(MOD_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) --no-print-directory -C $@ SUBDIR=$@ all
279 @CFLAGS="$(OTHER_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) --no-print-directory -C $@ SUBDIR=$@ all
282 @build_tools/make_defaults_h > $@.tmp
283 @if cmp -s $@.tmp $@ ; then : ; else \
288 include/asterisk/version.h:
289 @build_tools/make_version_h > $@.tmp
290 @if cmp -s $@.tmp $@ ; then : ; else \
295 include/asterisk/buildopts.h: menuselect.makeopts
296 @build_tools/make_buildopts_h > $@.tmp
297 @if cmp -s $@.tmp $@ ; then : ; else \
302 $(SUBDIRS_CLEAN_DEPEND):
303 @$(MAKE) --no-print-directory -C $(@:-clean-depend=) clean-depend
306 @$(MAKE) --no-print-directory -C $(@:-clean=) clean
308 clean-depend: $(SUBDIRS_CLEAN_DEPEND)
310 clean: $(SUBDIRS_CLEAN) clean-depend
312 rm -f include/asterisk/build.h
313 rm -f include/asterisk/version.h
315 @$(MAKE) -C menuselect clean
316 cp -f .cleancount .lastclean
318 dist-clean: distclean
321 @$(MAKE) -C menuselect dist-clean
322 @$(MAKE) -C sounds dist-clean
323 rm -f menuselect.makeopts makeopts menuselect-tree menuselect.makedeps
324 rm -f makeopts.embed_rules
325 rm -f config.log config.status
326 rm -rf autom4te.cache
327 rm -f include/asterisk/autoconfig.h
328 rm -f include/asterisk/buildopts.h
330 rm -f build_tools/menuselect-deps
333 if [ x`$(ID) -un` = xroot ]; then CFLAGS="$(ASTCFLAGS)" sh build_tools/mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig; fi
334 # Should static HTTP be installed during make samples or even with its own target ala
335 # webvoicemail? There are portions here that *could* be customized but might also be
336 # improved a lot. I'll put it here for now.
337 mkdir -p $(DESTDIR)$(ASTDATADIR)/static-http
338 for x in static-http/*; do \
339 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/static-http ; \
341 mkdir -p $(DESTDIR)$(ASTDATADIR)/images
342 for x in images/*.jpg; do \
343 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/images ; \
345 mkdir -p $(DESTDIR)$(AGI_DIR)
346 $(MAKE) -C sounds install
349 @if [ -d .svn ]; then \
350 echo "Updating from Subversion..." ; \
351 svn update | tee update.out; \
353 if [ `grep -c ^C update.out` -gt 0 ]; then \
354 echo ; echo "The following files have conflicts:" ; \
355 grep ^C update.out | cut -b4- ; \
358 $(MAKE) clean-depend; \
360 echo "Not under version control"; \
363 NEWHEADERS=$(notdir $(wildcard include/asterisk/*.h))
364 OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h)))
367 mkdir -p $(DESTDIR)$(MODULES_DIR)
368 mkdir -p $(DESTDIR)$(ASTSBINDIR)
369 mkdir -p $(DESTDIR)$(ASTETCDIR)
370 mkdir -p $(DESTDIR)$(ASTBINDIR)
371 mkdir -p $(DESTDIR)$(ASTVARRUNDIR)
372 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail
373 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/dictate
374 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/system
375 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/tmp
376 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/meetme
377 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/monitor
378 $(INSTALL) -m 755 main/asterisk $(DESTDIR)$(ASTSBINDIR)/
379 $(LN) -sf asterisk $(DESTDIR)$(ASTSBINDIR)/rasterisk
380 $(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
381 $(INSTALL) -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/
382 if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \
383 cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;' > $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ;\
384 chmod 755 $(DESTDIR)$(ASTSBINDIR)/safe_asterisk;\
386 $(INSTALL) -d $(DESTDIR)$(ASTHEADERDIR)
387 $(INSTALL) -m 644 include/asterisk.h $(DESTDIR)$(includedir)
388 $(INSTALL) -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
389 if [ -n "$(OLDHEADERS)" ]; then \
390 rm -f $(addprefix $(DESTDIR)$(ASTHEADERDIR)/,$(OLDHEADERS)) ;\
392 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
393 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-custom
394 mkdir -p $(DESTDIR)$(ASTDATADIR)/keys
395 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware
396 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware/iax
397 mkdir -p $(DESTDIR)$(ASTMANDIR)/man8
398 $(INSTALL) -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTDATADIR)/keys
399 $(INSTALL) -m 644 keys/freeworlddialup.pub $(DESTDIR)$(ASTDATADIR)/keys
400 $(INSTALL) -m 644 doc/asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
401 $(INSTALL) -m 644 contrib/scripts/astgenkey.8 $(DESTDIR)$(ASTMANDIR)/man8
402 $(INSTALL) -m 644 contrib/scripts/autosupport.8 $(DESTDIR)$(ASTMANDIR)/man8
403 $(INSTALL) -m 644 contrib/scripts/safe_asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
404 $(INSTALL) -m 644 contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTDATADIR)/firmware/iax/iaxy.bin; \
407 @$(MAKE) -C $(@:-install=) install
409 NEWMODS=$(notdir $(wildcard */*.so))
410 OLDMODS=$(filter-out $(NEWMODS),$(notdir $(wildcard $(DESTDIR)$(MODULES_DIR)/*.so)))
413 @if [ -n "$(OLDMODS)" ]; then \
414 echo " WARNING WARNING WARNING" ;\
416 echo " Your Asterisk modules directory, located at" ;\
417 echo " $(DESTDIR)$(MODULES_DIR)" ;\
418 echo " contains modules that were not installed by this " ;\
419 echo " version of Asterisk. Please ensure that these" ;\
420 echo " modules are compatible with this version before" ;\
421 echo " attempting to run Asterisk." ;\
423 for f in $(OLDMODS); do \
427 echo " WARNING WARNING WARNING" ;\
430 install: all datafiles bininstall $(SUBDIRS_INSTALL)
431 @if [ -x /usr/sbin/asterisk-post-install ]; then \
432 /usr/sbin/asterisk-post-install $(DESTDIR) . ; \
434 @echo " +---- Asterisk Installation Complete -------+"
436 @echo " + YOU MUST READ THE SECURITY DOCUMENT +"
438 @echo " + Asterisk has successfully been installed. +"
439 @echo " + If you would like to install the sample +"
440 @echo " + configuration files (overwriting any +"
441 @echo " + existing config files), run: +"
443 @echo " + $(MAKE) samples +"
445 @echo " +----------------- or ---------------------+"
447 @echo " + You can go ahead and install the asterisk +"
448 @echo " + program documentation now or later run: +"
450 @echo " + $(MAKE) progdocs +"
452 @echo " + **Note** This requires that you have +"
453 @echo " + doxygen installed on your local system +"
454 @echo " +-------------------------------------------+"
455 @$(MAKE) -s oldmodcheck
457 upgrade: all bininstall
460 mkdir -p $(DESTDIR)$(ASTETCDIR)
461 for x in configs/*.adsi; do \
462 if [ ! -f $(DESTDIR)$(ASTETCDIR)/$$x ]; then \
463 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x` ; \
468 mkdir -p $(DESTDIR)$(ASTETCDIR)
469 for x in configs/*.sample; do \
470 if [ -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ]; then \
471 if [ "$(OVERWRITE)" = "y" ]; then \
472 if cmp -s $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $$x ; then \
473 echo "Config file $$x is unchanged"; \
476 mv -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample`.old ; \
478 echo "Skipping config file $$x"; \
482 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ;\
484 if [ "$(OVERWRITE)" = "y" ] || [ ! -f $(DESTDIR)$(ASTCONFPATH) ]; then \
486 echo "[directories]" ; \
487 echo "astetcdir => $(ASTETCDIR)" ; \
488 echo "astmoddir => $(MODULES_DIR)" ; \
489 echo "astvarlibdir => $(ASTVARLIBDIR)" ; \
490 echo "astdatadir => $(ASTDATADIR)" ; \
491 echo "astagidir => $(AGI_DIR)" ; \
492 echo "astspooldir => $(ASTSPOOLDIR)" ; \
493 echo "astrundir => $(ASTVARRUNDIR)" ; \
494 echo "astlogdir => $(ASTLOGDIR)" ; \
496 echo "; Changing the following lines may compromise your security." ; \
498 echo ";astctlpermissions = 0660" ; \
499 echo ";astctlowner = root" ; \
500 echo ";astctlgroup = apache" ; \
501 echo ";astctl = asterisk.ctl" ; \
502 echo ";[options]" ; \
503 echo ";internal_timing = yes" ; \
504 ) > $(DESTDIR)$(ASTCONFPATH) ; \
506 echo "Skipping asterisk.conf creation"; \
508 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
509 :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm
510 for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isunavail; do \
511 cat $(DESTDIR)$(ASTDATADIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm ; \
513 :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm
514 for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isonphone; do \
515 cat $(DESTDIR)$(ASTDATADIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm ; \
519 @[ -d $(DESTDIR)$(HTTP_DOCSDIR)/ ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 )
520 @[ -d $(DESTDIR)$(HTTP_CGIDIR) ] || ( printf "cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit 1 )
521 $(INSTALL) -m 4755 -o root -g root contrib/scripts/vmail.cgi $(DESTDIR)$(HTTP_CGIDIR)/vmail.cgi
522 mkdir -p $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk
523 for x in images/*.gif; do \
524 $(INSTALL) -m 644 $$x $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk/; \
526 @echo " +--------- Asterisk Web Voicemail ----------+"
528 @echo " + Asterisk Web Voicemail is installed in +"
529 @echo " + your cgi-bin directory: +"
530 @echo " + $(DESTDIR)$(HTTP_CGIDIR)"
531 @echo " + IT USES A SETUID ROOT PERL SCRIPT, SO +"
532 @echo " + IF YOU DON'T LIKE THAT, UNINSTALL IT! +"
534 @echo " + Other static items have been stored in: +"
535 @echo " + $(DESTDIR)$(HTTP_DOCSDIR)"
537 @echo " + If these paths do not match your httpd +"
538 @echo " + installation, correct the definitions +"
539 @echo " + in your Makefile of HTTP_CGIDIR and +"
540 @echo " + HTTP_DOCSDIR +"
542 @echo " +-------------------------------------------+"
545 sed "s/^Version:.*/Version: $(RPMVERSION)/g" redhat/asterisk.spec > asterisk.spec ; \
549 __rpm: include/asterisk/version.h include/asterisk/buildopts.h spec
550 rm -rf /tmp/asterisk ; \
551 mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
552 $(MAKE) DESTDIR=/tmp/asterisk install ; \
553 $(MAKE) DESTDIR=/tmp/asterisk samples ; \
554 mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
555 cp -f contrib/init.d/rc.redhat.asterisk /tmp/asterisk/etc/rc.d/init.d/asterisk ; \
556 rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec
559 (cat contrib/asterisk-ng-doxygen; echo "HAVE_DOT=$(HAVEDOT)"; \
560 echo "PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen -
563 @if [ "${OSARCH}" = "linux-gnu" ]; then \
564 if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \
565 $(INSTALL) -m 755 contrib/init.d/rc.redhat.asterisk /etc/rc.d/init.d/asterisk; \
566 /sbin/chkconfig --add asterisk; \
567 elif [ -f /etc/debian_version ]; then \
568 $(INSTALL) -m 755 contrib/init.d/rc.debian.asterisk /etc/init.d/asterisk; \
569 /usr/sbin/update-rc.d asterisk start 10 2 3 4 5 . stop 91 2 3 4 5 .; \
570 elif [ -f /etc/gentoo-release ]; then \
571 $(INSTALL) -m 755 contrib/init.d/rc.gentoo.asterisk /etc/init.d/asterisk; \
572 /sbin/rc-update add asterisk default; \
573 elif [ -f /etc/mandrake-release ]; then \
574 $(INSTALL) -m 755 contrib/init.d/rc.mandrake.asterisk /etc/rc.d/init.d/asterisk; \
575 /sbin/chkconfig --add asterisk; \
576 elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then \
577 $(INSTALL) -m 755 contrib/init.d/rc.suse.asterisk /etc/init.d/asterisk; \
578 /sbin/chkconfig --add asterisk; \
579 elif [ -f /etc/slackware-version ]; then \
580 echo "Slackware is not currently supported, although an init script does exist for it." \
582 echo "We could not install init scripts for your distribution."; \
585 echo "We could not install init scripts for your operating system."; \
588 $(MOD_SUBDIRS_DEPEND):
589 @CFLAGS="$(MOD_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) --no-print-directory -C $(@:-depend=) depend
591 $(OTHER_SUBDIRS_DEPEND):
592 @CFLAGS="$(OTHER_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) --no-print-directory -C $(@:-depend=) depend
594 depend: include/asterisk/version.h include/asterisk/buildopts.h defaults.h $(SUBDIRS_DEPEND)
597 $(MAKE) -C sounds all
599 # If the cleancount has been changed, force a make clean.
600 # .cleancount is the global clean count, and .lastclean is the
601 # last clean count we had
604 @if ! cmp -s .cleancount .lastclean ; then \
608 $(SUBDIRS_UNINSTALL):
609 @$(MAKE) --no-print-directory -C $(@:-uninstall=) uninstall
611 _uninstall: $(SUBDIRS_UNINSTALL)
612 rm -f $(DESTDIR)$(MODULES_DIR)/*
613 rm -f $(DESTDIR)$(ASTSBINDIR)/*asterisk*
614 rm -f $(DESTDIR)$(ASTSBINDIR)/astgenkey
615 rm -f $(DESTDIR)$(ASTSBINDIR)/autosupport
616 rm -rf $(DESTDIR)$(ASTHEADERDIR)
617 rm -rf $(DESTDIR)$(ASTDATADIR)/firmware
618 rm -rf $(DESTDIR)$(ASTMANDIR)/man8
619 $(MAKE) -C sounds uninstall
621 uninstall: _uninstall
622 @echo " +--------- Asterisk Uninstall Complete -----+"
623 @echo " + Asterisk binaries, sounds, man pages, +"
624 @echo " + headers, modules, and firmware builds, +"
625 @echo " + have all been uninstalled. +"
627 @echo " + To remove ALL traces of Asterisk, +"
628 @echo " + including configuration, spool +"
629 @echo " + directories, and logs, run the following +"
630 @echo " + command: +"
632 @echo " + $(MAKE) uninstall-all +"
633 @echo " +-------------------------------------------+"
635 uninstall-all: _uninstall
636 rm -rf $(DESTDIR)$(ASTLIBDIR)
637 rm -rf $(DESTDIR)$(ASTVARLIBDIR)
638 rm -rf $(DESTDIR)$(ASTDATADIR)
639 rm -rf $(DESTDIR)$(ASTSPOOLDIR)
640 rm -rf $(DESTDIR)$(ASTETCDIR)
641 rm -rf $(DESTDIR)$(ASTLOGDIR)
643 menuselect: menuselect/menuselect menuselect-tree
644 -@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!"
646 menuselect/menuselect: makeopts menuselect/menuselect.c menuselect/menuselect_curses.c menuselect/menuselect_stub.c menuselect/menuselect.h menuselect/linkedlists.h makeopts
647 @unset CC LD AR RANLIB && $(MAKE) -C menuselect CONFIGURE_SILENT="--silent"
649 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
650 @echo "Generating input for menuselect ..."
651 @build_tools/prep_moduledeps > $@
653 .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)