2 # Asterisk -- A telephony toolkit for Linux.
6 # Copyright (C) 1999-2006, Digium, Inc.
8 # Mark Spencer <markster@digium.com>
10 # This program is free software, distributed under the terms of
11 # the GNU General Public License
14 # All Makefiles use the following variables:
16 # ASTCFLAGS - compiler options
17 # ASTLDFLAGS - linker flags (not libraries)
18 # AST_LIBS - libraries to build binaries XXX
19 # LIBS - additional libraries, at top-level for all links,
20 # on a single object just for that object
21 # SOLINK - linker flags used only for creating shared objects (.so files),
22 # used for all .so links
24 # Default values fo ASTCFLAGS and ASTLDFLAGS can be specified in the
25 # environment when running make, as follows:
27 # $ ASTCFLAGS="-Werror" make
30 export ASTERISKVERSION
31 export ASTERISKVERSIONNUM
48 export MENUSELECT_CFLAGS
70 # even though we could use '-include makeopts' here, use a wildcard
71 # lookup anyway, so that make won't try to build makeopts if it doesn't
72 # exist (other rules will force it to be built if needed)
73 ifneq ($(wildcard makeopts),)
77 #Uncomment this to see all build commands instead of 'quiet' output
80 # Create OPTIONS variable
85 # Overwite config files on "make samples"
88 # Include debug and macro symbols in the executables (-g) and profiling info (-pg)
92 # Files are copied here temporarily during the install process
93 # For example, make DESTDIR=/tmp/asterisk woud put things in
94 # /tmp/asterisk/etc/asterisk
95 # !!! Watch out, put no spaces or comments after the value !!!
96 #DESTDIR?=/tmp/asterisk
98 # Define standard directories for various platforms
99 # These apply if they are not redefined in asterisk.conf
100 ifeq ($(OSARCH),SunOS)
101 ASTETCDIR=/var/etc/asterisk
102 ASTLIBDIR=/opt/asterisk/lib
103 ASTVARLIBDIR=/var/opt/asterisk
104 ASTSPOOLDIR=/var/spool/asterisk
105 ASTLOGDIR=/var/log/asterisk
106 ASTHEADERDIR=/opt/asterisk/include
107 ASTBINDIR=/opt/asterisk/bin
108 ASTSBINDIR=/opt/asterisk/sbin
109 ASTVARRUNDIR=/var/run/asterisk
110 ASTMANDIR=/opt/asterisk/man
112 ASTETCDIR=$(sysconfdir)/asterisk
113 ASTLIBDIR=$(libdir)/asterisk
114 ASTHEADERDIR=$(includedir)/asterisk
116 ASTSBINDIR=$(sbindir)
117 ASTSPOOLDIR=$(localstatedir)/spool/asterisk
118 ASTLOGDIR=$(localstatedir)/log/asterisk
119 ASTVARRUNDIR=$(localstatedir)/run
121 ifneq ($(findstring BSD,$(OSARCH)),)
122 ASTVARLIBDIR=$(prefix)/share/asterisk
123 ASTVARRUNDIR=$(localstatedir)/run/asterisk
125 ASTVARLIBDIR=$(localstatedir)/lib/asterisk
128 ifeq ($(ASTDATADIR),)
129 ASTDATADIR:=$(ASTVARLIBDIR)
132 # Asterisk.conf is located in ASTETCDIR or by using the -C flag
133 # when starting Asterisk
134 ASTCONFPATH=$(ASTETCDIR)/asterisk.conf
135 MODULES_DIR=$(ASTLIBDIR)/modules
136 AGI_DIR=$(ASTDATADIR)/agi-bin
138 # If you use Apache, you may determine by a grep 'DocumentRoot' of your httpd.conf file
139 HTTP_DOCSDIR=/var/www/html
140 # Determine by a grep 'ScriptAlias' of your Apache httpd.conf file
141 HTTP_CGIDIR=/var/www/cgi-bin
143 # Uncomment this to use the older DSP routines
144 #ASTCFLAGS+=-DOLD_DSP_ROUTINES
146 # If the file .asterisk.makeopts is present in your home directory, you can
147 # include all of your favorite menuselect options so that every time you download
148 # a new version of Asterisk, you don't have to run menuselect to set them.
149 # The file /etc/asterisk.makeopts will also be included but can be overridden
150 # by the file in your home directory.
152 GLOBAL_MAKEOPTS=$(wildcard /etc/asterisk.makeopts)
153 USER_MAKEOPTS=$(wildcard ~/.asterisk.makeopts)
155 MOD_SUBDIR_CFLAGS=-I$(ASTTOPDIR)/include
156 OTHER_SUBDIR_CFLAGS=-I$(ASTTOPDIR)/include
158 ifeq ($(OSARCH),linux-gnu)
159 ifeq ($(PROC),x86_64)
160 # You must have GCC 3.4 to use k8, otherwise use athlon
165 ifeq ($(PROC),sparc64)
166 #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
167 #This works for even old (2.96) versions of gcc and provides a small boost either way.
168 #A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
169 #So we go lowest common available by gcc and go a step down, still a step up from
170 #the default as we now have a better instruction set to work with. - Belgarath
172 OPTIONS+=$(shell if $(CC) -mtune=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mtune=$(PROC)"; fi)
173 OPTIONS+=$(shell if $(CC) -mcpu=v8 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mcpu=v8"; fi)
174 OPTIONS+=-fomit-frame-pointer
178 # The Cirrus logic is the only heavily shipping arm processor with a real floating point unit
179 ifeq ($(SUB_PROC),maverick)
180 OPTIONS+=-fsigned-char -mcpu=ep9312
182 ifeq ($(SUB_PROC),xscale)
183 OPTIONS+=-fsigned-char -mcpu=xscale
185 OPTIONS+=-fsigned-char
191 ASTCFLAGS+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG)
193 ASTCFLAGS+=-include $(ASTTOPDIR)/include/asterisk/autoconfig.h
195 ifeq ($(AST_DEVMODE),yes)
196 ASTCFLAGS+=-Werror -Wunused -Wundef $(AST_DECLARATION_AFTER_STATEMENT)
199 ifneq ($(findstring BSD,$(OSARCH)),)
200 ASTCFLAGS+=-I/usr/local/include
201 ASTLDFLAGS+=-L/usr/local/lib
204 ifneq ($(PROC),ultrasparc)
205 ASTCFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
209 ASTCFLAGS+=-fsigned-char
212 ifeq ($(OSARCH),FreeBSD)
213 # -V is understood by BSD Make, not by GNU make.
214 BSDVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk)
215 ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
216 AST_LIBS+=$(shell if test $(BSDVERSION) -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi)
219 ifeq ($(OSARCH),NetBSD)
220 ASTCFLAGS+=-pthread -I/usr/pkg/include
223 ifeq ($(OSARCH),OpenBSD)
227 ifeq ($(OSARCH),SunOS)
228 ASTCFLAGS+=-Wcast-align -DSOLARIS -I../include/solaris-compat -I/opt/ssl/include -I/usr/local/ssl/include
231 ASTERISKVERSION:=$(shell build_tools/make_version .)
233 ifneq ($(wildcard .version),)
234 ASTERISKVERSIONNUM:=$(shell awk -F. '{printf "%01d%02d%02d", $$1, $$2, $$3}' .version)
235 RPMVERSION:=$(shell sed 's/[-\/:]/_/g' .version)
240 ifneq ($(wildcard .svn),)
241 ASTERISKVERSIONNUM=999999
244 ASTCFLAGS+=$(MALLOC_DEBUG)$(BUSYDETECT)$(OPTIONS)
246 MOD_SUBDIRS:=res channels pbx apps codecs formats cdr funcs main
247 OTHER_SUBDIRS:=utils agi
248 SUBDIRS:=$(OTHER_SUBDIRS) $(MOD_SUBDIRS)
249 SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)
250 SUBDIRS_CLEAN:=$(SUBDIRS:%=%-clean)
251 SUBDIRS_UNINSTALL:=$(SUBDIRS:%=%-uninstall)
252 MOD_SUBDIRS_EMBED_LDSCRIPT:=$(MOD_SUBDIRS:%=%-embed-ldscript)
253 MOD_SUBDIRS_EMBED_LDFLAGS:=$(MOD_SUBDIRS:%=%-embed-ldflags)
254 MOD_SUBDIRS_EMBED_LIBS:=$(MOD_SUBDIRS:%=%-embed-libs)
256 ifneq ($(findstring darwin,$(OSARCH)),)
257 ASTCFLAGS+=-D__Darwin__
258 AUDIO_LIBS=-framework CoreAudio
259 SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
261 # These are used for all but Darwin
262 SOLINK=-shared -Xlinker -x
263 ifneq ($(findstring BSD,$(OSARCH)),)
264 LDFLAGS+=-L/usr/local/lib
268 ifeq ($(OSARCH),SunOS)
269 SOLINK=-shared -fpic -L/usr/local/ssl/lib
272 # This is used when generating the doxygen documentation
280 @echo " +--------- Asterisk Build Complete ---------+"
281 @echo " + Asterisk has successfully been built, and +"
282 @echo " + can be installed by running: +"
284 @echo " + $(MAKE) install +"
285 @echo " +-------------------------------------------+"
287 _all: cleantest $(SUBDIRS)
291 @echo "**** The configure script must be executed before running '$(MAKE)'."
292 @echo "**** Please run \"./configure\"."
296 menuselect.makeopts: menuselect/menuselect menuselect-tree
297 menuselect/menuselect --check-deps $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts
299 $(MOD_SUBDIRS_EMBED_LDSCRIPT):
300 @echo "EMBED_LDSCRIPTS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-ldscript=) SUBDIR=$(@:-embed-ldscript=) __embed_ldscript` >> makeopts.embed_rules
302 $(MOD_SUBDIRS_EMBED_LDFLAGS):
303 @echo "EMBED_LDFLAGS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-ldflags=) SUBDIR=$(@:-embed-ldflags=) __embed_ldflags` >> makeopts.embed_rules
305 $(MOD_SUBDIRS_EMBED_LIBS):
306 @echo "EMBED_LIBS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-libs=) SUBDIR=$(@:-embed-libs=) __embed_libs` >> makeopts.embed_rules
308 makeopts.embed_rules: menuselect.makeopts
309 @echo "Generating embedded module rules ..."
311 @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LDSCRIPT)
312 @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LDFLAGS)
313 @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LIBS)
315 $(SUBDIRS): include/asterisk/version.h include/asterisk/build.h include/asterisk/buildopts.h defaults.h makeopts.embed_rules
317 # ensure that all module subdirectories are processed before 'main' during
318 # a parallel build, since if there are modules selected to be embedded the
319 # directories containing them must be completed before the main Asterisk
320 # binary can be built
321 main: $(filter-out main,$(MOD_SUBDIRS))
324 @ASTCFLAGS="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" AST_LIBS="$(AST_LIBS)" $(MAKE) --no-print-directory --no-builtin-rules -C $@ SUBDIR=$@ all
327 @ASTCFLAGS="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" AUDIO_LIBS="$(AUDIO_LIBS)" $(MAKE) --no-print-directory --no-builtin-rules -C $@ SUBDIR=$@ all
330 @build_tools/make_defaults_h > $@.tmp
331 @if cmp -s $@.tmp $@ ; then : ; else \
336 include/asterisk/version.h:
337 @build_tools/make_version_h > $@.tmp
338 @if cmp -s $@.tmp $@ ; then : ; else \
343 include/asterisk/buildopts.h: menuselect.makeopts
344 @build_tools/make_buildopts_h > $@.tmp
345 @if cmp -s $@.tmp $@ ; then : ; else \
350 include/asterisk/build.h:
351 @build_tools/make_build_h > $@.tmp
352 @if cmp -s $@.tmp $@ ; then : ; else \
358 @$(MAKE) --no-print-directory -C $(@:-clean=) clean
360 clean: $(SUBDIRS_CLEAN)
362 rm -f include/asterisk/build.h
363 rm -f include/asterisk/version.h
364 @$(MAKE) -C menuselect clean
365 cp -f .cleancount .lastclean
367 dist-clean: distclean
370 @$(MAKE) -C menuselect dist-clean
371 @$(MAKE) -C sounds dist-clean
372 rm -f menuselect.makeopts makeopts menuselect-tree menuselect.makedeps
373 rm -f makeopts.embed_rules
374 rm -f config.log config.status
375 rm -rf autom4te.cache
376 rm -f include/asterisk/autoconfig.h
377 rm -f include/asterisk/buildopts.h
379 rm -f build_tools/menuselect-deps
382 if [ x`$(ID) -un` = xroot ]; then CFLAGS="$(ASTCFLAGS)" sh build_tools/mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig; fi
383 # Should static HTTP be installed during make samples or even with its own target ala
384 # webvoicemail? There are portions here that *could* be customized but might also be
385 # improved a lot. I'll put it here for now.
386 mkdir -p $(DESTDIR)$(ASTDATADIR)/static-http
387 for x in static-http/*; do \
388 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/static-http ; \
390 mkdir -p $(DESTDIR)$(ASTDATADIR)/images
391 for x in images/*.jpg; do \
392 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/images ; \
394 mkdir -p $(DESTDIR)$(AGI_DIR)
395 $(MAKE) -C sounds install
398 @if [ -d .svn ]; then \
399 echo "Updating from Subversion..." ; \
400 svn update | tee update.out; \
402 if [ `grep -c ^C update.out` -gt 0 ]; then \
403 echo ; echo "The following files have conflicts:" ; \
404 grep ^C update.out | cut -b4- ; \
408 echo "Not under version control"; \
411 NEWHEADERS=$(notdir $(wildcard include/asterisk/*.h))
412 OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h)))
415 mkdir -p $(DESTDIR)$(MODULES_DIR)
416 mkdir -p $(DESTDIR)$(ASTSBINDIR)
417 mkdir -p $(DESTDIR)$(ASTETCDIR)
418 mkdir -p $(DESTDIR)$(ASTBINDIR)
419 mkdir -p $(DESTDIR)$(ASTVARRUNDIR)
420 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail
421 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/dictate
422 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/system
423 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/tmp
424 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/meetme
425 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/monitor
426 $(INSTALL) -m 755 main/asterisk $(DESTDIR)$(ASTSBINDIR)/
427 $(LN) -sf asterisk $(DESTDIR)$(ASTSBINDIR)/rasterisk
428 $(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
429 $(INSTALL) -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/
430 if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \
431 cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;' > $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ;\
432 chmod 755 $(DESTDIR)$(ASTSBINDIR)/safe_asterisk;\
434 $(INSTALL) -d $(DESTDIR)$(ASTHEADERDIR)
435 $(INSTALL) -m 644 include/asterisk.h $(DESTDIR)$(includedir)
436 $(INSTALL) -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
437 if [ -n "$(OLDHEADERS)" ]; then \
438 rm -f $(addprefix $(DESTDIR)$(ASTHEADERDIR)/,$(OLDHEADERS)) ;\
440 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
441 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-custom
442 mkdir -p $(DESTDIR)$(ASTDATADIR)/keys
443 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware
444 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware/iax
445 mkdir -p $(DESTDIR)$(ASTMANDIR)/man8
446 $(INSTALL) -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTDATADIR)/keys
447 $(INSTALL) -m 644 keys/freeworlddialup.pub $(DESTDIR)$(ASTDATADIR)/keys
448 $(INSTALL) -m 644 doc/asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
449 $(INSTALL) -m 644 contrib/scripts/astgenkey.8 $(DESTDIR)$(ASTMANDIR)/man8
450 $(INSTALL) -m 644 contrib/scripts/autosupport.8 $(DESTDIR)$(ASTMANDIR)/man8
451 $(INSTALL) -m 644 contrib/scripts/safe_asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
452 if [ -f contrib/firmware/iax/iaxy.bin ] ; then \
453 $(INSTALL) -m 644 contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTDATADIR)/firmware/iax/iaxy.bin; \
457 @DESTDIR="$(DESTDIR)" ASTSBINDIR="$(ASTSBINDIR)" $(MAKE) -C $(@:-install=) install
459 NEWMODS=$(notdir $(wildcard */*.so))
460 OLDMODS=$(filter-out $(NEWMODS),$(notdir $(wildcard $(DESTDIR)$(MODULES_DIR)/*.so)))
463 @if [ -n "$(OLDMODS)" ]; then \
464 echo " WARNING WARNING WARNING" ;\
466 echo " Your Asterisk modules directory, located at" ;\
467 echo " $(DESTDIR)$(MODULES_DIR)" ;\
468 echo " contains modules that were not installed by this " ;\
469 echo " version of Asterisk. Please ensure that these" ;\
470 echo " modules are compatible with this version before" ;\
471 echo " attempting to run Asterisk." ;\
473 for f in $(OLDMODS); do \
477 echo " WARNING WARNING WARNING" ;\
480 install: datafiles bininstall $(SUBDIRS_INSTALL)
481 @if [ -x /usr/sbin/asterisk-post-install ]; then \
482 /usr/sbin/asterisk-post-install $(DESTDIR) . ; \
484 @echo " +---- Asterisk Installation Complete -------+"
486 @echo " + YOU MUST READ THE SECURITY DOCUMENT +"
488 @echo " + Asterisk has successfully been installed. +"
489 @echo " + If you would like to install the sample +"
490 @echo " + configuration files (overwriting any +"
491 @echo " + existing config files), run: +"
493 @echo " + $(MAKE) samples +"
495 @echo " +----------------- or ---------------------+"
497 @echo " + You can go ahead and install the asterisk +"
498 @echo " + program documentation now or later run: +"
500 @echo " + $(MAKE) progdocs +"
502 @echo " + **Note** This requires that you have +"
503 @echo " + doxygen installed on your local system +"
504 @echo " +-------------------------------------------+"
505 @$(MAKE) -s oldmodcheck
510 mkdir -p $(DESTDIR)$(ASTETCDIR)
511 for x in configs/*.adsi; do \
512 if [ ! -f $(DESTDIR)$(ASTETCDIR)/$$x ]; then \
513 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x` ; \
518 mkdir -p $(DESTDIR)$(ASTETCDIR)
519 for x in configs/*.sample; do \
520 if [ -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ]; then \
521 if [ "$(OVERWRITE)" = "y" ]; then \
522 if cmp -s $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $$x ; then \
523 echo "Config file $$x is unchanged"; \
526 mv -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample`.old ; \
528 echo "Skipping config file $$x"; \
532 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ;\
534 if [ "$(OVERWRITE)" = "y" ] || [ ! -f $(DESTDIR)$(ASTCONFPATH) ]; then \
536 echo "[directories]" ; \
537 echo "astetcdir => $(ASTETCDIR)" ; \
538 echo "astmoddir => $(MODULES_DIR)" ; \
539 echo "astvarlibdir => $(ASTVARLIBDIR)" ; \
540 echo "astdatadir => $(ASTDATADIR)" ; \
541 echo "astagidir => $(AGI_DIR)" ; \
542 echo "astspooldir => $(ASTSPOOLDIR)" ; \
543 echo "astrundir => $(ASTVARRUNDIR)" ; \
544 echo "astlogdir => $(ASTLOGDIR)" ; \
546 echo ";[options]" ; \
547 echo ";internal_timing = yes" ; \
548 echo ";systemname = my_system_name ; prefix uniqueid with a system name for global uniqueness issues" ; \
549 echo ";autosystemname = yes ; automatically set systemname to hostname - uses 'localhost' on failure, or systemname if set" ; \
550 echo "; Changing the following lines may compromise your security." ; \
552 echo ";astctlpermissions = 0660" ; \
553 echo ";astctlowner = root" ; \
554 echo ";astctlgroup = apache" ; \
555 echo ";astctl = asterisk.ctl" ; \
556 ) > $(DESTDIR)$(ASTCONFPATH) ; \
558 echo "Skipping asterisk.conf creation"; \
560 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
561 build_tools/make_sample_voicemail $(DESTDIR)/$(ASTDATADIR) $(DESTDIR)/$(ASTSPOOLDIR)
564 @[ -d $(DESTDIR)$(HTTP_DOCSDIR)/ ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 )
565 @[ -d $(DESTDIR)$(HTTP_CGIDIR) ] || ( printf "cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit 1 )
566 $(INSTALL) -m 4755 -o root -g root contrib/scripts/vmail.cgi $(DESTDIR)$(HTTP_CGIDIR)/vmail.cgi
567 mkdir -p $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk
568 for x in images/*.gif; do \
569 $(INSTALL) -m 644 $$x $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk/; \
571 @echo " +--------- Asterisk Web Voicemail ----------+"
573 @echo " + Asterisk Web Voicemail is installed in +"
574 @echo " + your cgi-bin directory: +"
575 @echo " + $(DESTDIR)$(HTTP_CGIDIR)"
576 @echo " + IT USES A SETUID ROOT PERL SCRIPT, SO +"
577 @echo " + IF YOU DON'T LIKE THAT, UNINSTALL IT! +"
579 @echo " + Other static items have been stored in: +"
580 @echo " + $(DESTDIR)$(HTTP_DOCSDIR)"
582 @echo " + If these paths do not match your httpd +"
583 @echo " + installation, correct the definitions +"
584 @echo " + in your Makefile of HTTP_CGIDIR and +"
585 @echo " + HTTP_DOCSDIR +"
587 @echo " +-------------------------------------------+"
590 sed "s/^Version:.*/Version: $(RPMVERSION)/g" redhat/asterisk.spec > asterisk.spec ; \
594 __rpm: include/asterisk/version.h include/asterisk/buildopts.h spec
595 rm -rf /tmp/asterisk ; \
596 mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
597 $(MAKE) DESTDIR=/tmp/asterisk install ; \
598 $(MAKE) DESTDIR=/tmp/asterisk samples ; \
599 mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
600 cp -f contrib/init.d/rc.redhat.asterisk /tmp/asterisk/etc/rc.d/init.d/asterisk ; \
601 rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec
604 (cat contrib/asterisk-ng-doxygen; echo "HAVE_DOT=$(HAVEDOT)"; \
605 echo "PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen -
608 @if [ "${OSARCH}" = "linux-gnu" ]; then \
609 if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \
610 $(INSTALL) -m 755 contrib/init.d/rc.redhat.asterisk /etc/rc.d/init.d/asterisk; \
611 /sbin/chkconfig --add asterisk; \
612 elif [ -f /etc/debian_version ]; then \
613 $(INSTALL) -m 755 contrib/init.d/rc.debian.asterisk /etc/init.d/asterisk; \
614 /usr/sbin/update-rc.d asterisk start 10 2 3 4 5 . stop 91 2 3 4 5 .; \
615 elif [ -f /etc/gentoo-release ]; then \
616 $(INSTALL) -m 755 contrib/init.d/rc.gentoo.asterisk /etc/init.d/asterisk; \
617 /sbin/rc-update add asterisk default; \
618 elif [ -f /etc/mandrake-release ]; then \
619 $(INSTALL) -m 755 contrib/init.d/rc.mandrake.asterisk /etc/rc.d/init.d/asterisk; \
620 /sbin/chkconfig --add asterisk; \
621 elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then \
622 $(INSTALL) -m 755 contrib/init.d/rc.suse.asterisk /etc/init.d/asterisk; \
623 /sbin/chkconfig --add asterisk; \
624 elif [ -f /etc/slackware-version ]; then \
625 echo "Slackware is not currently supported, although an init script does exist for it." \
627 echo "We could not install init scripts for your distribution."; \
630 echo "We could not install init scripts for your operating system."; \
634 $(MAKE) -C sounds all
636 # If the cleancount has been changed, force a make clean.
637 # .cleancount is the global clean count, and .lastclean is the
638 # last clean count we had
641 @if ! cmp -s .cleancount .lastclean ; then \
645 $(SUBDIRS_UNINSTALL):
646 @$(MAKE) --no-print-directory -C $(@:-uninstall=) uninstall
648 _uninstall: $(SUBDIRS_UNINSTALL)
649 rm -f $(DESTDIR)$(MODULES_DIR)/*
650 rm -f $(DESTDIR)$(ASTSBINDIR)/*asterisk*
651 rm -f $(DESTDIR)$(ASTSBINDIR)/astgenkey
652 rm -f $(DESTDIR)$(ASTSBINDIR)/autosupport
653 rm -rf $(DESTDIR)$(ASTHEADERDIR)
654 rm -rf $(DESTDIR)$(ASTDATADIR)/firmware
655 rm -f $(DESTDIR)$(ASTMANDIR)/man8/asterisk.8
656 rm -f $(DESTDIR)$(ASTMANDIR)/man8/astgenkey.8
657 rm -f $(DESTDIR)$(ASTMANDIR)/man8/autosupport.8
658 rm -f $(DESTDIR)$(ASTMANDIR)/man8/safe_asterisk.8
659 $(MAKE) -C sounds uninstall
661 uninstall: _uninstall
662 @echo " +--------- Asterisk Uninstall Complete -----+"
663 @echo " + Asterisk binaries, sounds, man pages, +"
664 @echo " + headers, modules, and firmware builds, +"
665 @echo " + have all been uninstalled. +"
667 @echo " + To remove ALL traces of Asterisk, +"
668 @echo " + including configuration, spool +"
669 @echo " + directories, and logs, run the following +"
670 @echo " + command: +"
672 @echo " + $(MAKE) uninstall-all +"
673 @echo " +-------------------------------------------+"
675 uninstall-all: _uninstall
676 rm -rf $(DESTDIR)$(ASTLIBDIR)
677 rm -rf $(DESTDIR)$(ASTVARLIBDIR)
678 rm -rf $(DESTDIR)$(ASTDATADIR)
679 rm -rf $(DESTDIR)$(ASTSPOOLDIR)
680 rm -rf $(DESTDIR)$(ASTETCDIR)
681 rm -rf $(DESTDIR)$(ASTLOGDIR)
683 menuconfig: menuselect
685 gmenuconfig: gmenuselect
687 menuselect: menuselect/menuselect menuselect-tree
688 -@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!"
690 gmenuselect: menuselect/gmenuselect menuselect-tree
691 -@menuselect/gmenuselect $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
693 menuselect/menuselect: makeopts menuselect/menuselect.c menuselect/menuselect_curses.c menuselect/menuselect_stub.c menuselect/menuselect.h menuselect/linkedlists.h makeopts
694 @CC="$(HOST_CC)" LD="" AR="" RANLIB="" CFLAGS="" $(MAKE) -C menuselect CONFIGURE_SILENT="--silent"
696 menuselect/gmenuselect: makeopts menuselect/menuselect.c menuselect/menuselect_gtk.c menuselect/menuselect_stub.c menuselect/menuselect.h menuselect/linkedlists.h makeopts
697 @CC="$(HOST_CC)" CXX="$(CXX)" LD="" AR="" RANLIB="" CFLAGS="" $(MAKE) -C menuselect _gmenuselect CONFIGURE_SILENT="--silent"
699 menuselect-tree: $(foreach dir,$(filter-out main,$(MOD_SUBDIRS)),$(wildcard $(dir)/*.c) $(wildcard $(dir)/*.cc)) build_tools/cflags.xml sounds/sounds.xml build_tools/embed_modules.xml
700 @echo "Generating input for menuselect ..."
701 @build_tools/prep_moduledeps > $@
703 asterisk.pdf: doc/asterisk.pdf
705 .PHONY: menuselect main sounds clean dist-clean distclean all prereqs cleantest uninstall _uninstall uninstall-all dont-optimize $(SUBDIRS_INSTALL) $(SUBDIRS_CLEAN) $(SUBDIRS_UNINSTALL) $(SUBDIRS) $(MOD_SUBDIRS_EMBED_LDSCRIPT) $(MOD_SUBDIRS_EMBED_LDFLAGS) $(MOD_SUBDIRS_EMBED_LIBS) menuselect.makeopts