ensure that DAHDI_INCLUDE and ZAPTEL_INCLUDE are added in all the places needed
[asterisk-bristuff.git] / Makefile
blob11e35e10b57ec8183f60c2d13f5e0beb027c91a9
2 # Asterisk -- A telephony toolkit for Linux.
3 #
4 # Top level Makefile
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
29 export ASTTOPDIR
30 export ASTERISKVERSION
31 export ASTERISKVERSIONNUM
32 export INSTALL_PATH
33 export ASTETCDIR
34 export ASTVARRUNDIR
35 export MODULES_DIR
36 export ASTSPOOLDIR
37 export ASTVARLIBDIR
38 export ASTDATADIR
39 export ASTLOGDIR
40 export ASTLIBDIR
41 export ASTMANDIR
42 export ASTHEADERDIR
43 export ASTBINDIR
44 export ASTSBINDIR
45 export AGI_DIR
46 export ASTCONFPATH
47 export NOISY_BUILD
48 export MENUSELECT_CFLAGS
49 export CC
50 export CXX
51 export AR
52 export RANLIB
53 export HOST_CC
54 export STATIC_BUILD
55 export INSTALL
56 export DESTDIR
57 export PROC
58 export SOLINK
59 export STRIP
60 export DOWNLOAD
61 export AWK
62 export GREP
63 export ID
64 export OSARCH
65 export CURSES_DIR
66 export NCURSES_DIR
67 export TERMCAP_DIR
68 export TINFO_DIR
69 export GTK2_LIB
70 export GTK2_INCLUDE
72 # even though we could use '-include makeopts' here, use a wildcard
73 # lookup anyway, so that make won't try to build makeopts if it doesn't
74 # exist (other rules will force it to be built if needed)
75 ifneq ($(wildcard makeopts),)
76 include makeopts
77 endif
79 # Some build systems, such as the one in openwrt, like to pass custom target
80 # CFLAGS and LDFLAGS in the COPTS and LDOPTS variables.
81 ASTCFLAGS+=$(COPTS)
82 ASTLDFLAGS+=$(LDOPTS)
84 #Uncomment this to see all build commands instead of 'quiet' output
85 #NOISY_BUILD=yes
87 # Create OPTIONS variable
88 OPTIONS=
90 empty:=
91 space:=$(empty) $(empty)
92 ASTTOPDIR:=$(subst $(space),\$(space),$(CURDIR))
94 # Overwite config files on "make samples"
95 OVERWRITE=y
97 # Include debug and macro symbols in the executables (-g) and profiling info (-pg)
98 DEBUG=-g3
100 # Staging directory
101 # Files are copied here temporarily during the install process
102 # For example, make DESTDIR=/tmp/asterisk woud put things in
103 # /tmp/asterisk/etc/asterisk
104 # !!! Watch out, put no spaces or comments after the value !!!
105 #DESTDIR?=/tmp/asterisk
107 # Define standard directories for various platforms
108 # These apply if they are not redefined in asterisk.conf
109 ifeq ($(OSARCH),SunOS)
110 ASTETCDIR=/var/etc/asterisk
111 ASTLIBDIR=/opt/asterisk/lib
112 ASTVARLIBDIR=/var/opt/asterisk
113 ASTSPOOLDIR=/var/spool/asterisk
114 ASTLOGDIR=/var/log/asterisk
115 ASTHEADERDIR=/opt/asterisk/include
116 ASTBINDIR=/opt/asterisk/bin
117 ASTSBINDIR=/opt/asterisk/sbin
118 ASTVARRUNDIR=/var/run/asterisk
119 ASTMANDIR=/opt/asterisk/man
120 else
121 ASTETCDIR=$(sysconfdir)/asterisk
122 ASTLIBDIR=$(libdir)/asterisk
123 ASTHEADERDIR=$(includedir)/asterisk
124 ASTBINDIR=$(bindir)
125 ASTSBINDIR=$(sbindir)
126 ASTSPOOLDIR=$(localstatedir)/spool/asterisk
127 ASTLOGDIR=$(localstatedir)/log/asterisk
128 ASTVARRUNDIR=$(localstatedir)/run
129 ASTMANDIR=$(mandir)
130 ifneq ($(findstring BSD,$(OSARCH)),)
131 ASTVARLIBDIR=$(prefix)/share/asterisk
132 ASTVARRUNDIR=$(localstatedir)/run/asterisk
133 else
134 ASTVARLIBDIR=$(localstatedir)/lib/asterisk
135 endif
136 endif
137 ifeq ($(ASTDATADIR),)
138 ASTDATADIR:=$(ASTVARLIBDIR)
139 endif
141 # Asterisk.conf is located in ASTETCDIR or by using the -C flag
142 # when starting Asterisk
143 ASTCONFPATH=$(ASTETCDIR)/asterisk.conf
144 MODULES_DIR=$(ASTLIBDIR)/modules
145 AGI_DIR=$(ASTDATADIR)/agi-bin
147 # If you use Apache, you may determine by a grep 'DocumentRoot' of your httpd.conf file
148 HTTP_DOCSDIR=/var/www/html
149 # Determine by a grep 'ScriptAlias' of your Apache httpd.conf file
150 HTTP_CGIDIR=/var/www/cgi-bin
152 # Uncomment this to use the older DSP routines
153 #ASTCFLAGS+=-DOLD_DSP_ROUTINES
155 # If the file .asterisk.makeopts is present in your home directory, you can
156 # include all of your favorite menuselect options so that every time you download
157 # a new version of Asterisk, you don't have to run menuselect to set them.
158 # The file /etc/asterisk.makeopts will also be included but can be overridden
159 # by the file in your home directory.
161 GLOBAL_MAKEOPTS=$(wildcard /etc/asterisk.makeopts)
162 USER_MAKEOPTS=$(wildcard ~/.asterisk.makeopts)
164 MOD_SUBDIR_CFLAGS=-I$(ASTTOPDIR)/include
165 OTHER_SUBDIR_CFLAGS=-I$(ASTTOPDIR)/include
167 ifeq ($(OSARCH),linux-gnu)
168 ifeq ($(PROC),x86_64)
169 # You must have GCC 3.4 to use k8, otherwise use athlon
170 PROC=k8
171 #PROC=athlon
172 endif
174 ifeq ($(PROC),sparc64)
175 #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
176 #This works for even old (2.96) versions of gcc and provides a small boost either way.
177 #A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
178 #So we go lowest common available by gcc and go a step down, still a step up from
179 #the default as we now have a better instruction set to work with. - Belgarath
180 PROC=ultrasparc
181 OPTIONS+=$(shell if $(CC) -mtune=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mtune=$(PROC)"; fi)
182 OPTIONS+=$(shell if $(CC) -mcpu=v8 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mcpu=v8"; fi)
183 OPTIONS+=-fomit-frame-pointer
184 endif
186 ifeq ($(PROC),arm)
187 # The Cirrus logic is the only heavily shipping arm processor with a real floating point unit
188 ifeq ($(SUB_PROC),maverick)
189 OPTIONS+=-fsigned-char -mcpu=ep9312
190 else
191 ifeq ($(SUB_PROC),xscale)
192 OPTIONS+=-fsigned-char -mcpu=xscale
193 else
194 OPTIONS+=-fsigned-char
195 endif
196 endif
197 endif
198 endif
200 ifeq ($(findstring -save-temps,$(ASTCFLAGS)),)
201 ASTCFLAGS+=-pipe
202 endif
204 ASTCFLAGS+=-Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG)
206 ASTCFLAGS+=-include $(ASTTOPDIR)/include/asterisk/autoconfig.h
208 ifeq ($(AST_DEVMODE),yes)
209 ASTCFLAGS+=-Werror -Wunused $(AST_DECLARATION_AFTER_STATEMENT)
210 endif
212 ifneq ($(findstring BSD,$(OSARCH)),)
213 ASTCFLAGS+=-I/usr/local/include
214 ASTLDFLAGS+=-L/usr/local/lib
215 endif
217 ifneq ($(PROC),ultrasparc)
218 ASTCFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
219 endif
221 ifeq ($(PROC),ppc)
222 ASTCFLAGS+=-fsigned-char
223 endif
225 ifeq ($(OSARCH),FreeBSD)
226 # -V is understood by BSD Make, not by GNU make.
227 BSDVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk)
228 ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
229 AST_LIBS+=$(shell if test $(BSDVERSION) -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi)
230 endif
232 ifeq ($(OSARCH),NetBSD)
233 ASTCFLAGS+=-pthread -I/usr/pkg/include
234 endif
236 ifeq ($(OSARCH),OpenBSD)
237 ASTCFLAGS+=-pthread
238 endif
240 ifeq ($(OSARCH),SunOS)
241 ASTCFLAGS+=-Wcast-align -DSOLARIS -I../include/solaris-compat -I/opt/ssl/include -I/usr/local/ssl/include
242 endif
244 ASTERISKVERSION:=$(shell GREP=$(GREP) AWK=$(AWK) build_tools/make_version .)
246 ifneq ($(wildcard .version),)
247 ASTERISKVERSIONNUM:=$(shell $(AWK) -F. '{printf "%01d%02d%02d", $$1, $$2, $$3}' .version)
248 RPMVERSION:=$(shell sed 's/[-\/:]/_/g' .version)
249 else
250 RPMVERSION=unknown
251 endif
253 ifneq ($(wildcard .svn),)
254 ASTERISKVERSIONNUM=999999
255 endif
257 ASTCFLAGS+=$(MALLOC_DEBUG)$(BUSYDETECT)$(OPTIONS)
259 MOD_SUBDIRS:=res channels pbx apps codecs formats cdr funcs main
260 OTHER_SUBDIRS:=utils agi
261 SUBDIRS:=$(OTHER_SUBDIRS) $(MOD_SUBDIRS)
262 SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)
263 SUBDIRS_CLEAN:=$(SUBDIRS:%=%-clean)
264 SUBDIRS_DIST_CLEAN:=$(SUBDIRS:%=%-dist-clean)
265 SUBDIRS_UNINSTALL:=$(SUBDIRS:%=%-uninstall)
266 MOD_SUBDIRS_EMBED_LDSCRIPT:=$(MOD_SUBDIRS:%=%-embed-ldscript)
267 MOD_SUBDIRS_EMBED_LDFLAGS:=$(MOD_SUBDIRS:%=%-embed-ldflags)
268 MOD_SUBDIRS_EMBED_LIBS:=$(MOD_SUBDIRS:%=%-embed-libs)
269 MOD_SUBDIRS_MENUSELECT_TREE:=$(MOD_SUBDIRS:%=%-menuselect-tree)
271 ifneq ($(findstring darwin,$(OSARCH)),)
272 ASTCFLAGS+=-D__Darwin__
273 AUDIO_LIBS=-framework CoreAudio
274 SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
275 else
276 # These are used for all but Darwin
277 SOLINK=-shared -Xlinker -x
278 ifneq ($(findstring BSD,$(OSARCH)),)
279 LDFLAGS+=-L/usr/local/lib
280 endif
281 endif
283 ifeq ($(OSARCH),SunOS)
284 SOLINK=-shared -fpic -L/usr/local/ssl/lib
285 endif
287 SUBMAKE=$(MAKE) --quiet --no-print-directory
289 # This is used when generating the doxygen documentation
290 ifneq ($(DOT),:)
291 HAVEDOT=yes
292 else
293 HAVEDOT=no
294 endif
296 all: _all
297 @echo " +--------- Asterisk Build Complete ---------+"
298 @echo " + Asterisk has successfully been built, and +"
299 @echo " + can be installed by running: +"
300 @echo " + +"
301 ifeq ($(MAKE), gmake)
302 @echo " + $(MAKE) install +"
303 else
304 @echo " + $(MAKE) install +"
305 endif
306 @echo " +-------------------------------------------+"
308 _all: cleantest $(SUBDIRS)
310 makeopts: configure
311 @echo "****"
312 @echo "**** The configure script must be executed before running '$(MAKE)'."
313 @echo "**** Please run \"./configure\"."
314 @echo "****"
315 @exit 1
317 menuselect.makeopts: menuselect/menuselect menuselect-tree
318 menuselect/menuselect --check-deps menuselect.makeopts $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS)
320 $(MOD_SUBDIRS_EMBED_LDSCRIPT):
321 @echo "EMBED_LDSCRIPTS+="`$(SUBMAKE) -C $(@:-embed-ldscript=) SUBDIR=$(@:-embed-ldscript=) __embed_ldscript` >> makeopts.embed_rules
323 $(MOD_SUBDIRS_EMBED_LDFLAGS):
324 @echo "EMBED_LDFLAGS+="`$(SUBMAKE) -C $(@:-embed-ldflags=) SUBDIR=$(@:-embed-ldflags=) __embed_ldflags` >> makeopts.embed_rules
326 $(MOD_SUBDIRS_EMBED_LIBS):
327 @echo "EMBED_LIBS+="`$(SUBMAKE) -C $(@:-embed-libs=) SUBDIR=$(@:-embed-libs=) __embed_libs` >> makeopts.embed_rules
329 $(MOD_SUBDIRS_MENUSELECT_TREE):
330 @$(SUBMAKE) -C $(@:-menuselect-tree=) SUBDIR=$(@:-menuselect-tree=) moduleinfo
331 @$(SUBMAKE) -C $(@:-menuselect-tree=) SUBDIR=$(@:-menuselect-tree=) makeopts
333 makeopts.embed_rules: menuselect.makeopts
334 @echo "Generating embedded module rules ..."
335 @rm -f $@
336 @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LDSCRIPT)
337 @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LDFLAGS)
338 @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LIBS)
340 $(SUBDIRS): include/asterisk/version.h include/asterisk/buildopts.h defaults.h makeopts.embed_rules
342 # ensure that all module subdirectories are processed before 'main' during
343 # a parallel build, since if there are modules selected to be embedded the
344 # directories containing them must be completed before the main Asterisk
345 # binary can be built
346 main: $(filter-out main,$(MOD_SUBDIRS))
348 $(MOD_SUBDIRS):
349 @ASTCFLAGS="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" AST_LIBS="$(AST_LIBS)" $(MAKE) --no-print-directory --no-builtin-rules -C $@ SUBDIR=$@ all
351 $(OTHER_SUBDIRS):
352 @ASTCFLAGS="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" AUDIO_LIBS="$(AUDIO_LIBS)" $(MAKE) --no-print-directory --no-builtin-rules -C $@ SUBDIR=$@ all
354 defaults.h: makeopts
355 @build_tools/make_defaults_h > $@.tmp
356 @if cmp -s $@.tmp $@ ; then : ; else \
357 mv $@.tmp $@ ; \
359 @rm -f $@.tmp
361 include/asterisk/version.h:
362 @build_tools/make_version_h > $@.tmp
363 @if cmp -s $@.tmp $@ ; then : ; else \
364 mv $@.tmp $@ ; \
366 @rm -f $@.tmp
368 include/asterisk/buildopts.h: menuselect.makeopts
369 @build_tools/make_buildopts_h > $@.tmp
370 @if cmp -s $@.tmp $@ ; then : ; else \
371 mv $@.tmp $@ ; \
373 @rm -f $@.tmp
375 $(SUBDIRS_CLEAN):
376 @$(MAKE) --no-print-directory -C $(@:-clean=) clean
378 $(SUBDIRS_DIST_CLEAN):
379 @$(MAKE) --no-print-directory -C $(@:-dist-clean=) dist-clean
381 clean: $(SUBDIRS_CLEAN)
382 rm -f defaults.h
383 rm -f include/asterisk/build.h
384 rm -f include/asterisk/version.h
385 @$(MAKE) -C menuselect clean
386 cp -f .cleancount .lastclean
388 dist-clean: distclean
390 distclean: $(SUBDIRS_DIST_CLEAN) clean
391 @$(MAKE) -C menuselect dist-clean
392 @$(MAKE) -C sounds dist-clean
393 rm -f menuselect.makeopts makeopts menuselect-tree menuselect.makedeps
394 rm -f makeopts.embed_rules
395 rm -f config.log config.status
396 rm -rf autom4te.cache
397 rm -f include/asterisk/autoconfig.h
398 rm -f include/asterisk/buildopts.h
399 rm -rf doc/api
400 rm -f build_tools/menuselect-deps
402 datafiles: _all
403 if [ x`$(ID) -un` = xroot ]; then CFLAGS="$(ASTCFLAGS)" sh build_tools/mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig; fi
404 # Should static HTTP be installed during make samples or even with its own target ala
405 # webvoicemail? There are portions here that *could* be customized but might also be
406 # improved a lot. I'll put it here for now.
407 mkdir -p $(DESTDIR)$(ASTDATADIR)/static-http
408 for x in static-http/*; do \
409 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/static-http ; \
410 done
411 mkdir -p $(DESTDIR)$(ASTDATADIR)/images
412 for x in images/*.jpg; do \
413 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/images ; \
414 done
415 mkdir -p $(DESTDIR)$(AGI_DIR)
416 $(MAKE) -C sounds install
418 update:
419 @if [ -d .svn ]; then \
420 echo "Updating from Subversion..." ; \
421 svn update | tee update.out; \
422 rm -f .version; \
423 if [ `grep -c ^C update.out` -gt 0 ]; then \
424 echo ; echo "The following files have conflicts:" ; \
425 grep ^C update.out | cut -b4- ; \
426 fi ; \
427 rm -f update.out; \
428 else \
429 echo "Not under version control"; \
432 NEWHEADERS=$(notdir $(wildcard include/asterisk/*.h))
433 OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h)))
435 installdirs:
436 mkdir -p $(DESTDIR)$(MODULES_DIR)
437 mkdir -p $(DESTDIR)$(ASTSBINDIR)
438 mkdir -p $(DESTDIR)$(ASTETCDIR)
439 mkdir -p $(DESTDIR)$(ASTBINDIR)
440 mkdir -p $(DESTDIR)$(ASTVARRUNDIR)
441 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail
442 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/dictate
443 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/system
444 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/tmp
445 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/meetme
446 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/monitor
448 bininstall: _all installdirs $(SUBDIRS_INSTALL)
449 $(INSTALL) -m 755 main/asterisk $(DESTDIR)$(ASTSBINDIR)/
450 $(LN) -sf asterisk $(DESTDIR)$(ASTSBINDIR)/rasterisk
451 $(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
452 $(INSTALL) -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/
453 if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \
454 cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;' > $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ;\
455 chmod 755 $(DESTDIR)$(ASTSBINDIR)/safe_asterisk;\
457 $(INSTALL) -d $(DESTDIR)$(ASTHEADERDIR)
458 $(INSTALL) -m 644 include/asterisk.h $(DESTDIR)$(includedir)
459 $(INSTALL) -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
460 if [ -n "$(OLDHEADERS)" ]; then \
461 rm -f $(addprefix $(DESTDIR)$(ASTHEADERDIR)/,$(OLDHEADERS)) ;\
463 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
464 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-custom
465 mkdir -p $(DESTDIR)$(ASTDATADIR)/keys
466 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware
467 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware/iax
468 mkdir -p $(DESTDIR)$(ASTMANDIR)/man8
469 $(INSTALL) -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTDATADIR)/keys
470 $(INSTALL) -m 644 keys/freeworlddialup.pub $(DESTDIR)$(ASTDATADIR)/keys
471 $(INSTALL) -m 644 doc/asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
472 $(INSTALL) -m 644 contrib/scripts/astgenkey.8 $(DESTDIR)$(ASTMANDIR)/man8
473 $(INSTALL) -m 644 contrib/scripts/autosupport.8 $(DESTDIR)$(ASTMANDIR)/man8
474 $(INSTALL) -m 644 contrib/scripts/safe_asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
475 if [ -f contrib/firmware/iax/iaxy.bin ] ; then \
476 $(INSTALL) -m 644 contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTDATADIR)/firmware/iax/iaxy.bin; \
479 $(SUBDIRS_INSTALL):
480 @DESTDIR="$(DESTDIR)" ASTSBINDIR="$(ASTSBINDIR)" $(MAKE) -C $(@:-install=) install
482 NEWMODS=$(notdir $(wildcard */*.so))
483 OLDMODS=$(filter-out $(NEWMODS),$(notdir $(wildcard $(DESTDIR)$(MODULES_DIR)/*.so)))
485 oldmodcheck:
486 @if [ -n "$(OLDMODS)" ]; then \
487 echo " WARNING WARNING WARNING" ;\
488 echo "" ;\
489 echo " Your Asterisk modules directory, located at" ;\
490 echo " $(DESTDIR)$(MODULES_DIR)" ;\
491 echo " contains modules that were not installed by this " ;\
492 echo " version of Asterisk. Please ensure that these" ;\
493 echo " modules are compatible with this version before" ;\
494 echo " attempting to run Asterisk." ;\
495 echo "" ;\
496 for f in $(OLDMODS); do \
497 echo " $$f" ;\
498 done ;\
499 echo "" ;\
500 echo " WARNING WARNING WARNING" ;\
503 badshell:
504 ifneq ($(findstring ~,$(DESTDIR)),)
505 @echo "Your shell doesn't do ~ expansion when expected (specifically, when doing \"make install DESTDIR=~/path\")."
506 @echo "Try replacing ~ with \$$HOME, as in \"make install DESTDIR=\$$HOME/path\"."
507 @exit 1
508 endif
510 install: badshell datafiles bininstall
511 @if [ -x /usr/sbin/asterisk-post-install ]; then \
512 /usr/sbin/asterisk-post-install $(DESTDIR) . ; \
514 @echo " +---- Asterisk Installation Complete -------+"
515 @echo " + +"
516 @echo " + YOU MUST READ THE SECURITY DOCUMENT +"
517 @echo " + +"
518 @echo " + Asterisk has successfully been installed. +"
519 @echo " + If you would like to install the sample +"
520 @echo " + configuration files (overwriting any +"
521 @echo " + existing config files), run: +"
522 @echo " + +"
523 ifeq ($(MAKE), gmake)
524 @echo " + $(MAKE) samples +"
525 else
526 @echo " + $(MAKE) samples +"
527 endif
528 @echo " + +"
529 @echo " +----------------- or ---------------------+"
530 @echo " + +"
531 @echo " + You can go ahead and install the asterisk +"
532 @echo " + program documentation now or later run: +"
533 @echo " + +"
534 ifeq ($(MAKE), gmake)
535 @echo " + $(MAKE) progdocs +"
536 else
537 @echo " + $(MAKE) progdocs +"
538 endif
539 @echo " + +"
540 @echo " + **Note** This requires that you have +"
541 @echo " + doxygen installed on your local system +"
542 @echo " +-------------------------------------------+"
543 @$(MAKE) -s oldmodcheck
545 upgrade: bininstall
547 adsi:
548 mkdir -p $(DESTDIR)$(ASTETCDIR)
549 for x in configs/*.adsi; do \
550 if [ ! -f $(DESTDIR)$(ASTETCDIR)/$$x ]; then \
551 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x` ; \
552 fi ; \
553 done
555 samples: adsi
556 mkdir -p $(DESTDIR)$(ASTETCDIR)
557 for x in configs/*.sample; do \
558 if [ -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ]; then \
559 if [ "$(OVERWRITE)" = "y" ]; then \
560 if cmp -s $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $$x ; then \
561 echo "Config file $$x is unchanged"; \
562 continue; \
563 fi ; \
564 mv -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample`.old ; \
565 else \
566 echo "Skipping config file $$x"; \
567 continue; \
568 fi ;\
569 fi ; \
570 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ;\
571 done
572 if [ "$(OVERWRITE)" = "y" ] || [ ! -f $(DESTDIR)$(ASTCONFPATH) ]; then \
574 echo "[directories]" ; \
575 echo "astetcdir => $(ASTETCDIR)" ; \
576 echo "astmoddir => $(MODULES_DIR)" ; \
577 echo "astvarlibdir => $(ASTVARLIBDIR)" ; \
578 echo "astdatadir => $(ASTDATADIR)" ; \
579 echo "astagidir => $(AGI_DIR)" ; \
580 echo "astspooldir => $(ASTSPOOLDIR)" ; \
581 echo "astrundir => $(ASTVARRUNDIR)" ; \
582 echo "astlogdir => $(ASTLOGDIR)" ; \
583 echo "" ; \
584 echo ";[options]" ; \
585 echo ";verbose = 3" ; \
586 echo ";debug = 3" ; \
587 echo ";alwaysfork = yes ; same as -F at startup" ; \
588 echo ";nofork = yes ; same as -f at startup" ; \
589 echo ";quiet = yes ; same as -q at startup" ; \
590 echo ";timestamp = yes ; same as -T at startup" ; \
591 echo ";execincludes = yes ; support #exec in config files" ; \
592 echo ";console = yes ; Run as console (same as -c at startup)" ; \
593 echo ";highpriority = yes ; Run realtime priority (same as -p at startup)" ; \
594 echo ";initcrypto = yes ; Initialize crypto keys (same as -i at startup)" ; \
595 echo ";nocolor = yes ; Disable console colors" ; \
596 echo ";dontwarn = yes ; Disable some warnings" ; \
597 echo ";dumpcore = yes ; Dump core on crash (same as -g at startup)" ; \
598 echo ";languageprefix = yes ; Use the new sound prefix path syntax" ; \
599 echo ";internal_timing = yes" ; \
600 echo ";systemname = my_system_name ; prefix uniqueid with a system name for global uniqueness issues" ; \
601 echo ";maxcalls = 10 ; Maximum amount of calls allowed" ; \
602 echo ";maxload = 0.9 ; Asterisk stops accepting new calls if the load average exceed this limit" ; \
603 echo ";cache_record_files = yes ; Cache recorded sound files to another directory during recording" ; \
604 echo ";record_cache_dir = /tmp ; Specify cache directory (used in cnjunction with cache_record_files)" ; \
605 echo ";transmit_silence_during_record = yes ; Transmit SLINEAR silence while a channel is being recorded" ; \
606 echo ";transmit_silence = yes ; Transmit SLINEAR silence while a channel is being recorded or DTMF is being generated" ; \
607 echo ";transcode_via_sln = yes ; Build transcode paths via SLINEAR, instead of directly" ; \
608 echo ";runuser = asterisk ; The user to run as" ; \
609 echo ";rungroup = asterisk ; The group to run as" ; \
610 echo "" ; \
611 echo "; Changing the following lines may compromise your security." ; \
612 echo ";[files]" ; \
613 echo ";astctlpermissions = 0660" ; \
614 echo ";astctlowner = root" ; \
615 echo ";astctlgroup = apache" ; \
616 echo ";astctl = asterisk.ctl" ; \
617 ) > $(DESTDIR)$(ASTCONFPATH) ; \
618 else \
619 echo "Skipping asterisk.conf creation"; \
621 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
622 build_tools/make_sample_voicemail $(DESTDIR)/$(ASTDATADIR) $(DESTDIR)/$(ASTSPOOLDIR)
624 webvmail:
625 @[ -d $(DESTDIR)$(HTTP_DOCSDIR)/ ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 )
626 @[ -d $(DESTDIR)$(HTTP_CGIDIR) ] || ( printf "cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit 1 )
627 $(INSTALL) -m 4755 -o root -g root contrib/scripts/vmail.cgi $(DESTDIR)$(HTTP_CGIDIR)/vmail.cgi
628 mkdir -p $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk
629 for x in images/*.gif; do \
630 $(INSTALL) -m 644 $$x $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk/; \
631 done
632 @echo " +--------- Asterisk Web Voicemail ----------+"
633 @echo " + +"
634 @echo " + Asterisk Web Voicemail is installed in +"
635 @echo " + your cgi-bin directory: +"
636 @echo " + $(DESTDIR)$(HTTP_CGIDIR)"
637 @echo " + IT USES A SETUID ROOT PERL SCRIPT, SO +"
638 @echo " + IF YOU DON'T LIKE THAT, UNINSTALL IT! +"
639 @echo " + +"
640 @echo " + Other static items have been stored in: +"
641 @echo " + $(DESTDIR)$(HTTP_DOCSDIR)"
642 @echo " + +"
643 @echo " + If these paths do not match your httpd +"
644 @echo " + installation, correct the definitions +"
645 @echo " + in your Makefile of HTTP_CGIDIR and +"
646 @echo " + HTTP_DOCSDIR +"
647 @echo " + +"
648 @echo " +-------------------------------------------+"
650 spec:
651 sed "s/^Version:.*/Version: $(RPMVERSION)/g" redhat/asterisk.spec > asterisk.spec ; \
653 rpm: __rpm
655 __rpm: include/asterisk/version.h include/asterisk/buildopts.h spec
656 rm -rf /tmp/asterisk ; \
657 mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
658 $(MAKE) DESTDIR=/tmp/asterisk install ; \
659 $(MAKE) DESTDIR=/tmp/asterisk samples ; \
660 mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
661 cp -f contrib/init.d/rc.redhat.asterisk /tmp/asterisk/etc/rc.d/init.d/asterisk ; \
662 rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec
664 progdocs:
665 (cat contrib/asterisk-ng-doxygen; echo "HAVE_DOT=$(HAVEDOT)"; \
666 echo "PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen -
668 config:
669 @if [ "${OSARCH}" = "linux-gnu" ]; then \
670 if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \
671 $(INSTALL) -m 755 contrib/init.d/rc.redhat.asterisk $(DESTDIR)/etc/rc.d/init.d/asterisk; \
672 if [ -z "$(DESTDIR)" ]; then /sbin/chkconfig --add asterisk; fi; \
673 elif [ -f /etc/debian_version ]; then \
674 $(INSTALL) -m 755 contrib/init.d/rc.debian.asterisk $(DESTDIR)/etc/init.d/asterisk; \
675 if [ -z "$(DESTDIR)" ]; then /usr/sbin/update-rc.d asterisk start 50 2 3 4 5 . stop 91 2 3 4 5 .; fi; \
676 elif [ -f /etc/gentoo-release ]; then \
677 $(INSTALL) -m 755 contrib/init.d/rc.gentoo.asterisk $(DESTDIR)/etc/init.d/asterisk; \
678 if [ -z "$(DESTDIR)" ]; then /sbin/rc-update add asterisk default; fi; \
679 elif [ -f /etc/mandrake-release -o -f /etc/mandriva-release ]; then \
680 $(INSTALL) -m 755 contrib/init.d/rc.mandrake.asterisk $(DESTDIR)/etc/rc.d/init.d/asterisk; \
681 if [ -z "$(DESTDIR)" ]; then /sbin/chkconfig --add asterisk; fi; \
682 elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then \
683 $(INSTALL) -m 755 contrib/init.d/rc.suse.asterisk $(DESTDIR)/etc/init.d/asterisk; \
684 if [ -z "$(DESTDIR)" ]; then /sbin/chkconfig --add asterisk; fi; \
685 elif [ -f /etc/slackware-version ]; then \
686 echo "Slackware is not currently supported, although an init script does exist for it." \
687 else \
688 echo "We could not install init scripts for your distribution."; \
689 fi \
690 else \
691 echo "We could not install init scripts for your operating system."; \
694 sounds:
695 $(MAKE) -C sounds all
697 # If the cleancount has been changed, force a make clean.
698 # .cleancount is the global clean count, and .lastclean is the
699 # last clean count we had
701 cleantest:
702 @cmp -s .cleancount .lastclean || $(MAKE) clean
704 $(SUBDIRS_UNINSTALL):
705 @$(MAKE) --no-print-directory -C $(@:-uninstall=) uninstall
707 _uninstall: $(SUBDIRS_UNINSTALL)
708 rm -f $(DESTDIR)$(MODULES_DIR)/*
709 rm -f $(DESTDIR)$(ASTSBINDIR)/*asterisk*
710 rm -f $(DESTDIR)$(ASTSBINDIR)/astgenkey
711 rm -f $(DESTDIR)$(ASTSBINDIR)/autosupport
712 rm -rf $(DESTDIR)$(ASTHEADERDIR)
713 rm -rf $(DESTDIR)$(ASTDATADIR)/firmware
714 rm -f $(DESTDIR)$(ASTMANDIR)/man8/asterisk.8
715 rm -f $(DESTDIR)$(ASTMANDIR)/man8/astgenkey.8
716 rm -f $(DESTDIR)$(ASTMANDIR)/man8/autosupport.8
717 rm -f $(DESTDIR)$(ASTMANDIR)/man8/safe_asterisk.8
718 $(MAKE) -C sounds uninstall
720 uninstall: _uninstall
721 @echo " +--------- Asterisk Uninstall Complete -----+"
722 @echo " + Asterisk binaries, sounds, man pages, +"
723 @echo " + headers, modules, and firmware builds, +"
724 @echo " + have all been uninstalled. +"
725 @echo " + +"
726 @echo " + To remove ALL traces of Asterisk, +"
727 @echo " + including configuration, spool +"
728 @echo " + directories, and logs, run the following +"
729 @echo " + command: +"
730 @echo " + +"
731 ifeq ($(MAKE), gmake)
732 @echo " + $(MAKE) uninstall-all +"
733 else
734 @echo " + $(MAKE) uninstall-all +"
735 endif
736 @echo " +-------------------------------------------+"
738 uninstall-all: _uninstall
739 rm -rf $(DESTDIR)$(ASTLIBDIR)
740 rm -rf $(DESTDIR)$(ASTVARLIBDIR)
741 rm -rf $(DESTDIR)$(ASTDATADIR)
742 rm -rf $(DESTDIR)$(ASTSPOOLDIR)
743 rm -rf $(DESTDIR)$(ASTETCDIR)
744 rm -rf $(DESTDIR)$(ASTLOGDIR)
746 menuconfig: menuselect
748 gmenuconfig: gmenuselect
750 menuselect: menuselect/menuselect menuselect-tree
751 -@menuselect/menuselect menuselect.makeopts $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
753 gmenuselect: menuselect/gmenuselect menuselect-tree
754 -@menuselect/gmenuselect menuselect.makeopts $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
756 menuselect/menuselect: makeopts menuselect/menuselect.c menuselect/menuselect_curses.c menuselect/menuselect_stub.c menuselect/menuselect.h menuselect/linkedlists.h makeopts
757 @CC="$(HOST_CC)" LD="" AR="" RANLIB="" CFLAGS="" $(MAKE) -C menuselect CONFIGURE_SILENT="--silent"
759 menuselect/gmenuselect: makeopts menuselect/menuselect.c menuselect/menuselect_gtk.c menuselect/menuselect_stub.c menuselect/menuselect.h menuselect/linkedlists.h makeopts
760 @CC="$(HOST_CC)" CXX="$(CXX)" LD="" AR="" RANLIB="" CFLAGS="" $(MAKE) -C menuselect _gmenuselect CONFIGURE_SILENT="--silent"
762 menuselect-tree: $(foreach dir,$(filter-out main,$(MOD_SUBDIRS)),$(wildcard $(dir)/*.c) $(wildcard $(dir)/*.cc)) build_tools/cflags.xml build_tools/cflags-devmode.xml sounds/sounds.xml build_tools/embed_modules.xml configure
763 @echo "Generating input for menuselect ..."
764 @echo "<?xml version=\"1.0\"?>" > $@
765 @echo >> $@
766 @echo "<menu name=\"Asterisk Module and Build Option Selection\">" >> $@
767 @for dir in $(sort $(filter-out main,$(MOD_SUBDIRS))); do $(SUBMAKE) -C $${dir} SUBDIR=$${dir} moduleinfo >> $@; done
768 @for dir in $(sort $(filter-out main,$(MOD_SUBDIRS))); do $(SUBMAKE) -C $${dir} SUBDIR=$${dir} makeopts >> $@; done
769 @cat build_tools/cflags.xml >> $@
770 @if [ "${AST_DEVMODE}" = "yes" ]; then \
771 cat build_tools/cflags-devmode.xml >> $@; \
773 @cat build_tools/embed_modules.xml >> $@
774 @cat sounds/sounds.xml >> $@
775 @echo "</menu>" >> $@
777 .PHONY: menuselect main sounds clean dist-clean distclean all prereqs cleantest uninstall _uninstall uninstall-all dont-optimize $(SUBDIRS_INSTALL) $(SUBDIRS_DIST_CLEAN) $(SUBDIRS_CLEAN) $(SUBDIRS_UNINSTALL) $(SUBDIRS) $(MOD_SUBDIRS_EMBED_LDSCRIPT) $(MOD_SUBDIRS_EMBED_LDFLAGS) $(MOD_SUBDIRS_EMBED_LIBS) badshell menuselect.makeopts include/asterisk/version.h installdirs