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 # LIBS - additional libraries, at top-level for all links,
19 # on a single object just for that object
20 # SOLINK - linker flags used only for creating shared objects (.so files),
21 # used for all .so links
23 # Default values fo ASTCFLAGS and ASTLDFLAGS can be specified in the
24 # environment when running make, as follows:
26 # $ ASTCFLAGS="-Werror" make
29 export ASTERISKVERSION
30 export ASTERISKVERSIONNUM
42 export MENUSELECT_CFLAGS
54 # even though we could use '-include makeopts' here, use a wildcard
55 # lookup anyway, so that make won't try to build makeopts if it doesn't
56 # exist (other rules will force it to be built if needed)
57 ifneq ($(wildcard makeopts),)
61 #Uncomment this to see all build commands instead of 'quiet' output
64 # Create OPTIONS variable
67 ASTTOPDIR:=$(shell pwd)
69 # Overwite config files on "make samples"
72 # Include debug and macro symbols in the executables (-g) and profiling info (-pg)
76 # Files are copied here temporarily during the install process
77 # For example, make DESTDIR=/tmp/asterisk woud put things in
78 # /tmp/asterisk/etc/asterisk
79 # !!! Watch out, put no spaces or comments after the value !!!
80 #DESTDIR?=/tmp/asterisk
82 # Define standard directories for various platforms
83 # These apply if they are not redefined in asterisk.conf
84 ifeq ($(OSARCH),SunOS)
85 ASTETCDIR=/var/etc/asterisk
86 ASTLIBDIR=/opt/asterisk/lib
87 ASTVARLIBDIR=/var/opt/asterisk
88 ASTSPOOLDIR=/var/spool/asterisk
89 ASTLOGDIR=/var/log/asterisk
90 ASTHEADERDIR=/opt/asterisk/include
91 ASTBINDIR=/opt/asterisk/bin
92 ASTSBINDIR=/opt/asterisk/sbin
93 ASTVARRUNDIR=/var/run/asterisk
94 ASTMANDIR=/opt/asterisk/man
96 ASTETCDIR=$(sysconfdir)/asterisk
97 ASTLIBDIR=$(libdir)/asterisk
98 ASTHEADERDIR=$(includedir)/asterisk
100 ASTSBINDIR=$(sbindir)
101 ASTSPOOLDIR=$(localstatedir)/spool/asterisk
102 ASTLOGDIR=$(localstatedir)/log/asterisk
103 ASTVARRUNDIR=$(localstatedir)/run
105 ifeq ($(OSARCH),FreeBSD)
106 ASTVARLIBDIR=$(prefix)/share/asterisk
108 ASTVARLIBDIR=$(localstatedir)/lib/asterisk
111 ASTDATADIR?=$(ASTVARLIBDIR)
113 # Asterisk.conf is located in ASTETCDIR or by using the -C flag
114 # when starting Asterisk
115 ASTCONFPATH=$(ASTETCDIR)/asterisk.conf
116 MODULES_DIR=$(ASTLIBDIR)/modules
117 AGI_DIR=$(ASTDATADIR)/agi-bin
119 # If you use Apache, you may determine by a grep 'DocumentRoot' of your httpd.conf file
120 HTTP_DOCSDIR=/var/www/html
121 # Determine by a grep 'ScriptAlias' of your Apache httpd.conf file
122 HTTP_CGIDIR=/var/www/cgi-bin
124 # Uncomment this to use the older DSP routines
125 #ASTCFLAGS+=-DOLD_DSP_ROUTINES
127 # If the file .asterisk.makeopts is present in your home directory, you can
128 # include all of your favorite menuselect options so that every time you download
129 # a new version of Asterisk, you don't have to run menuselect to set them.
130 # The file /etc/asterisk.makeopts will also be included but can be overridden
131 # by the file in your home directory.
133 GLOBAL_MAKEOPTS=$(wildcard /etc/asterisk.makeopts)
134 USER_MAKEOPTS=$(wildcard ~/.asterisk.makeopts)
136 MOD_SUBDIR_CFLAGS=-I../include
137 OTHER_SUBDIR_CFLAGS=-I../include
139 ifeq ($(OSARCH),linux-gnu)
140 ifeq ($(PROC),x86_64)
141 # You must have GCC 3.4 to use k8, otherwise use athlon
146 ifeq ($(PROC),sparc64)
147 #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
148 #This works for even old (2.96) versions of gcc and provides a small boost either way.
149 #A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
150 #So we go lowest common available by gcc and go a step down, still a step up from
151 #the default as we now have a better instruction set to work with. - Belgarath
153 OPTIONS+=$(shell if $(CC) -mtune=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mtune=$(PROC)"; fi)
154 OPTIONS+=$(shell if $(CC) -mcpu=v8 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mcpu=v8"; fi)
155 OPTIONS+=-fomit-frame-pointer
159 # The Cirrus logic is the only heavily shipping arm processor with a real floating point unit
160 ifeq ($(SUB_PROC),maverick)
161 OPTIONS+=-fsigned-char -mcpu=ep9312
163 ifeq ($(SUB_PROC),xscale)
164 OPTIONS+=-fsigned-char -mcpu=xscale
166 OPTIONS+=-fsigned-char
172 ASTCFLAGS+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG)
174 ifeq ($(AST_DEVMODE),yes)
175 ASTCFLAGS+=-Werror -Wunused
178 ifneq ($(findstring BSD,$(OSARCH)),)
179 ASTCFLAGS+=-I/usr/local/include -L/usr/local/lib
182 ifneq ($(PROC),ultrasparc)
183 ASTCFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
187 ASTCFLAGS+=-fsigned-char
190 ifeq ($(OSARCH),FreeBSD)
191 # -V is understood by BSD Make, not by GNU make.
192 BSDVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk)
193 ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
194 AST_LIBS+=$(shell if test $(BSDVERSION) -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi)
197 ifeq ($(OSARCH),NetBSD)
198 ASTCFLAGS+=-pthread -I/usr/pkg/include
201 ifeq ($(OSARCH),OpenBSD)
205 ifeq ($(OSARCH),SunOS)
206 ASTCFLAGS+=-Wcast-align -DSOLARIS -I../include/solaris-compat -I/opt/ssl/include -I/usr/local/ssl/include
209 ASTERISKVERSION:=$(shell build_tools/make_version .)
211 ifneq ($(wildcard .version),)
212 ASTERISKVERSIONNUM:=$(shell awk -F. '{printf "%02d%02d%02d", $$1, $$2, $$3}' .version)
213 RPMVERSION:=$(shell sed 's/[-\/:]/_/g' .version)
218 ifneq ($(wildcard .svn),)
219 ASTERISKVERSIONNUM=999999
222 ASTCFLAGS+=$(MALLOC_DEBUG)$(BUSYDETECT)$(OPTIONS)
224 MOD_SUBDIRS:=res channels pbx apps codecs formats cdr funcs main
225 OTHER_SUBDIRS:=utils agi
226 SUBDIRS:=$(OTHER_SUBDIRS) $(MOD_SUBDIRS)
227 SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)
228 SUBDIRS_CLEAN:=$(SUBDIRS:%=%-clean)
229 SUBDIRS_CLEAN_DEPEND:=$(SUBDIRS:%=%-clean-depend)
230 MOD_SUBDIRS_DEPEND:=$(MOD_SUBDIRS:%=%-depend)
231 OTHER_SUBDIRS_DEPEND:=$(OTHER_SUBDIRS:%=%-depend)
232 SUBDIRS_DEPEND:=$(OTHER_SUBDIRS_DEPEND) $(MOD_SUBDIRS_DEPEND)
233 SUBDIRS_UNINSTALL:=$(SUBDIRS:%=%-uninstall)
234 MOD_SUBDIRS_EMBED_LDSCRIPT:=$(MOD_SUBDIRS:%=%-embed-ldscript)
235 MOD_SUBDIRS_EMBED_LDFLAGS:=$(MOD_SUBDIRS:%=%-embed-ldflags)
236 MOD_SUBDIRS_EMBED_LIBS:=$(MOD_SUBDIRS:%=%-embed-libs)
238 ifneq ($(findstring darwin,$(OSARCH)),)
239 ASTCFLAGS+=-D__Darwin__
240 AUDIO_LIBS=-framework CoreAudio
241 SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
243 # These are used for all but Darwin
244 SOLINK=-shared -Xlinker -x
245 ifneq ($(findstring BSD,$(OSARCH)),)
246 LDFLAGS+=-L/usr/local/lib
250 ifeq ($(OSARCH),SunOS)
251 SOLINK=-shared -fpic -L/usr/local/ssl/lib
254 # This is used when generating the doxygen documentation
262 @echo " +--------- Asterisk Build Complete ---------+"
263 @echo " + Asterisk has successfully been built, and +"
264 @echo " + can be installed by running: +"
266 @echo " + make install +"
267 @echo " +-------------------------------------------+"
269 _all: cleantest $(SUBDIRS)
273 @echo "**** The configure script must be executed before running 'make'."
277 menuselect.makeopts: menuselect/menuselect menuselect-tree
278 menuselect/menuselect --check-deps $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts
280 $(MOD_SUBDIRS_EMBED_LDSCRIPT):
281 @echo "EMBED_LDSCRIPTS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-ldscript=) SUBDIR=$(@:-embed-ldscript=) __embed_ldscript` >> makeopts.embed_rules
283 $(MOD_SUBDIRS_EMBED_LDFLAGS):
284 @echo "EMBED_LDFLAGS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-ldflags=) SUBDIR=$(@:-embed-ldflags=) __embed_ldflags` >> makeopts.embed_rules
286 $(MOD_SUBDIRS_EMBED_LIBS):
287 @echo "EMBED_LIBS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-libs=) SUBDIR=$(@:-embed-libs=) __embed_libs` >> makeopts.embed_rules
289 makeopts.embed_rules: menuselect.makeopts
290 @echo "Generating embedded module rules ..."
292 @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LDSCRIPT)
293 @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LDFLAGS)
294 @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LIBS)
296 $(SUBDIRS): depend makeopts.embed_rules
298 # ensure that all module subdirectories are processed before 'main' during
299 # a parallel build, since if there are modules selected to be embedded the
300 # directories containing them must be completed before the main Asterisk
301 # binary can be built
302 main: $(filter-out main,$(MOD_SUBDIRS))
305 @ASTCFLAGS="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" $(MAKE) --no-print-directory -C $@ SUBDIR=$@ all
308 @ASTCFLAGS="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" $(MAKE) --no-print-directory -C $@ SUBDIR=$@ all
311 @build_tools/make_defaults_h > $@.tmp
312 @if cmp -s $@.tmp $@ ; then : ; else \
317 include/asterisk/version.h:
318 @build_tools/make_version_h > $@.tmp
319 @if cmp -s $@.tmp $@ ; then : ; else \
324 include/asterisk/buildopts.h: menuselect.makeopts
325 @build_tools/make_buildopts_h > $@.tmp
326 @if cmp -s $@.tmp $@ ; then : ; else \
331 $(SUBDIRS_CLEAN_DEPEND):
332 @$(MAKE) --no-print-directory -C $(@:-clean-depend=) clean-depend
335 @$(MAKE) --no-print-directory -C $(@:-clean=) clean
337 clean-depend: $(SUBDIRS_CLEAN_DEPEND)
339 clean: $(SUBDIRS_CLEAN) clean-depend
341 rm -f include/asterisk/build.h
342 rm -f include/asterisk/version.h
344 @$(MAKE) -C menuselect clean
345 cp -f .cleancount .lastclean
347 dist-clean: distclean
350 @$(MAKE) -C menuselect dist-clean
351 @$(MAKE) -C sounds dist-clean
352 rm -f menuselect.makeopts makeopts menuselect-tree menuselect.makedeps
353 rm -f makeopts.embed_rules
354 rm -f config.log config.status
355 rm -rf autom4te.cache
356 rm -f include/asterisk/autoconfig.h
357 rm -f include/asterisk/buildopts.h
359 rm -f build_tools/menuselect-deps
362 if [ x`$(ID) -un` = xroot ]; then CFLAGS="$(ASTCFLAGS)" sh build_tools/mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig; fi
363 # Should static HTTP be installed during make samples or even with its own target ala
364 # webvoicemail? There are portions here that *could* be customized but might also be
365 # improved a lot. I'll put it here for now.
366 mkdir -p $(DESTDIR)$(ASTDATADIR)/static-http
367 for x in static-http/*; do \
368 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/static-http ; \
370 mkdir -p $(DESTDIR)$(ASTDATADIR)/images
371 for x in images/*.jpg; do \
372 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/images ; \
374 mkdir -p $(DESTDIR)$(AGI_DIR)
375 $(MAKE) -C sounds install
378 @if [ -d .svn ]; then \
379 echo "Updating from Subversion..." ; \
380 svn update | tee update.out; \
382 if [ `grep -c ^C update.out` -gt 0 ]; then \
383 echo ; echo "The following files have conflicts:" ; \
384 grep ^C update.out | cut -b4- ; \
387 $(MAKE) clean-depend; \
389 echo "Not under version control"; \
392 NEWHEADERS=$(notdir $(wildcard include/asterisk/*.h))
393 OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h)))
396 mkdir -p $(DESTDIR)$(MODULES_DIR)
397 mkdir -p $(DESTDIR)$(ASTSBINDIR)
398 mkdir -p $(DESTDIR)$(ASTETCDIR)
399 mkdir -p $(DESTDIR)$(ASTBINDIR)
400 mkdir -p $(DESTDIR)$(ASTVARRUNDIR)
401 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail
402 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/dictate
403 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/system
404 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/tmp
405 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/meetme
406 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/monitor
407 $(INSTALL) -m 755 main/asterisk $(DESTDIR)$(ASTSBINDIR)/
408 $(LN) -sf asterisk $(DESTDIR)$(ASTSBINDIR)/rasterisk
409 $(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
410 $(INSTALL) -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/
411 if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \
412 cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;' > $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ;\
413 chmod 755 $(DESTDIR)$(ASTSBINDIR)/safe_asterisk;\
415 $(INSTALL) -d $(DESTDIR)$(ASTHEADERDIR)
416 $(INSTALL) -m 644 include/asterisk.h $(DESTDIR)$(includedir)
417 $(INSTALL) -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
418 if [ -n "$(OLDHEADERS)" ]; then \
419 rm -f $(addprefix $(DESTDIR)$(ASTHEADERDIR)/,$(OLDHEADERS)) ;\
421 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
422 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-custom
423 mkdir -p $(DESTDIR)$(ASTDATADIR)/keys
424 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware
425 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware/iax
426 mkdir -p $(DESTDIR)$(ASTMANDIR)/man8
427 $(INSTALL) -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTDATADIR)/keys
428 $(INSTALL) -m 644 keys/freeworlddialup.pub $(DESTDIR)$(ASTDATADIR)/keys
429 $(INSTALL) -m 644 doc/asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
430 $(INSTALL) -m 644 contrib/scripts/astgenkey.8 $(DESTDIR)$(ASTMANDIR)/man8
431 $(INSTALL) -m 644 contrib/scripts/autosupport.8 $(DESTDIR)$(ASTMANDIR)/man8
432 $(INSTALL) -m 644 contrib/scripts/safe_asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
433 $(INSTALL) -m 644 contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTDATADIR)/firmware/iax/iaxy.bin; \
436 @$(MAKE) -C $(@:-install=) install
438 NEWMODS=$(notdir $(wildcard */*.so))
439 OLDMODS=$(filter-out $(NEWMODS),$(notdir $(wildcard $(DESTDIR)$(MODULES_DIR)/*.so)))
442 @if [ -n "$(OLDMODS)" ]; then \
443 echo " WARNING WARNING WARNING" ;\
445 echo " Your Asterisk modules directory, located at" ;\
446 echo " $(DESTDIR)$(MODULES_DIR)" ;\
447 echo " contains modules that were not installed by this " ;\
448 echo " version of Asterisk. Please ensure that these" ;\
449 echo " modules are compatible with this version before" ;\
450 echo " attempting to run Asterisk." ;\
452 for f in $(OLDMODS); do \
456 echo " WARNING WARNING WARNING" ;\
459 install: datafiles bininstall $(SUBDIRS_INSTALL)
460 @if [ -x /usr/sbin/asterisk-post-install ]; then \
461 /usr/sbin/asterisk-post-install $(DESTDIR) . ; \
463 @echo " +---- Asterisk Installation Complete -------+"
465 @echo " + YOU MUST READ THE SECURITY DOCUMENT +"
467 @echo " + Asterisk has successfully been installed. +"
468 @echo " + If you would like to install the sample +"
469 @echo " + configuration files (overwriting any +"
470 @echo " + existing config files), run: +"
472 @echo " + $(MAKE) samples +"
474 @echo " +----------------- or ---------------------+"
476 @echo " + You can go ahead and install the asterisk +"
477 @echo " + program documentation now or later run: +"
479 @echo " + $(MAKE) progdocs +"
481 @echo " + **Note** This requires that you have +"
482 @echo " + doxygen installed on your local system +"
483 @echo " +-------------------------------------------+"
484 @$(MAKE) -s oldmodcheck
489 mkdir -p $(DESTDIR)$(ASTETCDIR)
490 for x in configs/*.adsi; do \
491 if [ ! -f $(DESTDIR)$(ASTETCDIR)/$$x ]; then \
492 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x` ; \
497 mkdir -p $(DESTDIR)$(ASTETCDIR)
498 for x in configs/*.sample; do \
499 if [ -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ]; then \
500 if [ "$(OVERWRITE)" = "y" ]; then \
501 if cmp -s $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $$x ; then \
502 echo "Config file $$x is unchanged"; \
505 mv -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample`.old ; \
507 echo "Skipping config file $$x"; \
511 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ;\
513 if [ "$(OVERWRITE)" = "y" ] || [ ! -f $(DESTDIR)$(ASTCONFPATH) ]; then \
515 echo "[directories]" ; \
516 echo "astetcdir => $(ASTETCDIR)" ; \
517 echo "astmoddir => $(MODULES_DIR)" ; \
518 echo "astvarlibdir => $(ASTVARLIBDIR)" ; \
519 echo "astdatadir => $(ASTDATADIR)" ; \
520 echo "astagidir => $(AGI_DIR)" ; \
521 echo "astspooldir => $(ASTSPOOLDIR)" ; \
522 echo "astrundir => $(ASTVARRUNDIR)" ; \
523 echo "astlogdir => $(ASTLOGDIR)" ; \
525 echo "; Changing the following lines may compromise your security." ; \
527 echo ";astctlpermissions = 0660" ; \
528 echo ";astctlowner = root" ; \
529 echo ";astctlgroup = apache" ; \
530 echo ";astctl = asterisk.ctl" ; \
531 echo ";[options]" ; \
532 echo ";internal_timing = yes" ; \
533 ) > $(DESTDIR)$(ASTCONFPATH) ; \
535 echo "Skipping asterisk.conf creation"; \
537 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
538 :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm
539 for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isunavail; do \
540 cat $(DESTDIR)$(ASTDATADIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm ; \
542 :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm
543 for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isonphone; do \
544 cat $(DESTDIR)$(ASTDATADIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm ; \
548 @[ -d $(DESTDIR)$(HTTP_DOCSDIR)/ ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 )
549 @[ -d $(DESTDIR)$(HTTP_CGIDIR) ] || ( printf "cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit 1 )
550 $(INSTALL) -m 4755 -o root -g root contrib/scripts/vmail.cgi $(DESTDIR)$(HTTP_CGIDIR)/vmail.cgi
551 mkdir -p $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk
552 for x in images/*.gif; do \
553 $(INSTALL) -m 644 $$x $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk/; \
555 @echo " +--------- Asterisk Web Voicemail ----------+"
557 @echo " + Asterisk Web Voicemail is installed in +"
558 @echo " + your cgi-bin directory: +"
559 @echo " + $(DESTDIR)$(HTTP_CGIDIR)"
560 @echo " + IT USES A SETUID ROOT PERL SCRIPT, SO +"
561 @echo " + IF YOU DON'T LIKE THAT, UNINSTALL IT! +"
563 @echo " + Other static items have been stored in: +"
564 @echo " + $(DESTDIR)$(HTTP_DOCSDIR)"
566 @echo " + If these paths do not match your httpd +"
567 @echo " + installation, correct the definitions +"
568 @echo " + in your Makefile of HTTP_CGIDIR and +"
569 @echo " + HTTP_DOCSDIR +"
571 @echo " +-------------------------------------------+"
574 sed "s/^Version:.*/Version: $(RPMVERSION)/g" redhat/asterisk.spec > asterisk.spec ; \
578 __rpm: include/asterisk/version.h include/asterisk/buildopts.h spec
579 rm -rf /tmp/asterisk ; \
580 mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
581 $(MAKE) DESTDIR=/tmp/asterisk install ; \
582 $(MAKE) DESTDIR=/tmp/asterisk samples ; \
583 mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
584 cp -f contrib/init.d/rc.redhat.asterisk /tmp/asterisk/etc/rc.d/init.d/asterisk ; \
585 rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec
588 (cat contrib/asterisk-ng-doxygen; echo "HAVE_DOT=$(HAVEDOT)"; \
589 echo "PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen -
592 @if [ "${OSARCH}" = "linux-gnu" ]; then \
593 if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \
594 $(INSTALL) -m 755 contrib/init.d/rc.redhat.asterisk /etc/rc.d/init.d/asterisk; \
595 /sbin/chkconfig --add asterisk; \
596 elif [ -f /etc/debian_version ]; then \
597 $(INSTALL) -m 755 contrib/init.d/rc.debian.asterisk /etc/init.d/asterisk; \
598 /usr/sbin/update-rc.d asterisk start 10 2 3 4 5 . stop 91 2 3 4 5 .; \
599 elif [ -f /etc/gentoo-release ]; then \
600 $(INSTALL) -m 755 contrib/init.d/rc.gentoo.asterisk /etc/init.d/asterisk; \
601 /sbin/rc-update add asterisk default; \
602 elif [ -f /etc/mandrake-release ]; then \
603 $(INSTALL) -m 755 contrib/init.d/rc.mandrake.asterisk /etc/rc.d/init.d/asterisk; \
604 /sbin/chkconfig --add asterisk; \
605 elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then \
606 $(INSTALL) -m 755 contrib/init.d/rc.suse.asterisk /etc/init.d/asterisk; \
607 /sbin/chkconfig --add asterisk; \
608 elif [ -f /etc/slackware-version ]; then \
609 echo "Slackware is not currently supported, although an init script does exist for it." \
611 echo "We could not install init scripts for your distribution."; \
614 echo "We could not install init scripts for your operating system."; \
617 $(MOD_SUBDIRS_DEPEND):
618 @ASTCFLAGS="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" $(MAKE) --no-print-directory -C $(@:-depend=) depend
620 $(OTHER_SUBDIRS_DEPEND):
621 @ASTCFLAGS="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" $(MAKE) --no-print-directory -C $(@:-depend=) depend
623 depend: include/asterisk/version.h include/asterisk/buildopts.h defaults.h $(SUBDIRS_DEPEND)
626 $(MAKE) -C sounds all
628 # If the cleancount has been changed, force a make clean.
629 # .cleancount is the global clean count, and .lastclean is the
630 # last clean count we had
633 @if ! cmp -s .cleancount .lastclean ; then \
637 $(SUBDIRS_UNINSTALL):
638 @$(MAKE) --no-print-directory -C $(@:-uninstall=) uninstall
640 _uninstall: $(SUBDIRS_UNINSTALL)
641 rm -f $(DESTDIR)$(MODULES_DIR)/*
642 rm -f $(DESTDIR)$(ASTSBINDIR)/*asterisk*
643 rm -f $(DESTDIR)$(ASTSBINDIR)/astgenkey
644 rm -f $(DESTDIR)$(ASTSBINDIR)/autosupport
645 rm -rf $(DESTDIR)$(ASTHEADERDIR)
646 rm -rf $(DESTDIR)$(ASTDATADIR)/firmware
647 rm -rf $(DESTDIR)$(ASTMANDIR)/man8
648 $(MAKE) -C sounds uninstall
650 uninstall: _uninstall
651 @echo " +--------- Asterisk Uninstall Complete -----+"
652 @echo " + Asterisk binaries, sounds, man pages, +"
653 @echo " + headers, modules, and firmware builds, +"
654 @echo " + have all been uninstalled. +"
656 @echo " + To remove ALL traces of Asterisk, +"
657 @echo " + including configuration, spool +"
658 @echo " + directories, and logs, run the following +"
659 @echo " + command: +"
661 @echo " + $(MAKE) uninstall-all +"
662 @echo " +-------------------------------------------+"
664 uninstall-all: _uninstall
665 rm -rf $(DESTDIR)$(ASTLIBDIR)
666 rm -rf $(DESTDIR)$(ASTVARLIBDIR)
667 rm -rf $(DESTDIR)$(ASTDATADIR)
668 rm -rf $(DESTDIR)$(ASTSPOOLDIR)
669 rm -rf $(DESTDIR)$(ASTETCDIR)
670 rm -rf $(DESTDIR)$(ASTLOGDIR)
672 menuselect: menuselect/menuselect menuselect-tree
673 -@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!"
675 menuselect/menuselect: makeopts menuselect/menuselect.c menuselect/menuselect_curses.c menuselect/menuselect_stub.c menuselect/menuselect.h menuselect/linkedlists.h makeopts
676 @unset CC LD AR RANLIB && $(MAKE) -C menuselect CONFIGURE_SILENT="--silent"
678 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
679 @echo "Generating input for menuselect ..."
680 @build_tools/prep_moduledeps > $@
682 .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)