add ExtenSpy variant of ChanSpy
[asterisk-bristuff.git] / Makefile
blob9e250b194810192451458e591875e9d17f88684d
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 # 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 #Uncomment this to see all build commands instead of 'quiet' output
26 #NOISY_BUILD=yes
28 # Create OPTIONS variable
29 OPTIONS=
31 # If cross compiling, define these to suit
32 #CROSS_COMPILE=/opt/montavista/pro/devkit/arm/xscale_be/bin/xscale_be-
33 #CROSS_COMPILE_BIN=/opt/montavista/pro/devkit/arm/xscale_be/bin/
34 #CROSS_COMPILE_TARGET=/opt/montavista/pro/devkit/arm/xscale_be/target
35 #CROSS_ARCH=Linux
36 #CROSS_PROC=arm
37 #SUB_PROC=xscale # or maverick
39 ifeq ($(CROSS_COMPILE),)
40 OSARCH:=$(shell uname -s)
41 PROC?:=$(shell uname -m)
42 else
43 OSARCH=$(CROSS_ARCH)
44 PROC=$(CROSS_PROC)
45 endif
47 ASTTOPDIR:=$(shell pwd)
49 # Remember the MAKELEVEL at the top
50 MAKETOPLEVEL?=$(MAKELEVEL)
52 # Overwite config files on "make samples"
53 OVERWRITE=y
55 # Include debug and macro symbols in the executables (-g) and profiling info (-pg)
56 DEBUG=-g3
58 # Staging directory
59 # Files are copied here temporarily during the install process
60 # For example, make DESTDIR=/tmp/asterisk woud put things in
61 # /tmp/asterisk/etc/asterisk
62 # !!! Watch out, put no spaces or comments after the value !!!
63 DESTDIR?=
64 #DESTDIR?=/tmp/asterisk
66 # Original busydetect routine
67 #BUSYDETECT = -DBUSYDETECT
69 # Improved busydetect routine, comment the previous one if you use this one
70 #BUSYDETECT+= -DBUSYDETECT_MARTIN
71 # Detect the busy signal looking only at tone lengths
72 # For example if you have 3 beeps 100ms tone, 100ms silence separated by 500 ms of silence
73 #BUSYDETECT+= -DBUSYDETECT_TONEONLY
74 # Enforce the detection of busy signal (get rid of false hangups)
75 # Don't use together with -DBUSYDETECT_TONEONLY
76 #BUSYDETECT+= -DBUSYDETECT_COMPARE_TONE_AND_SILENCE
78 # Define standard directories for various platforms
79 # These apply if they are not redefined in asterisk.conf
80 ifeq ($(OSARCH),SunOS)
81 ASTETCDIR=/var/etc/asterisk
82 ASTLIBDIR=/opt/asterisk/lib
83 ASTVARLIBDIR=/var/opt/asterisk
84 ASTSPOOLDIR=/var/spool/asterisk
85 ASTLOGDIR=/var/log/asterisk
86 ASTHEADERDIR=/opt/asterisk/include
87 ASTBINDIR=/opt/asterisk/bin
88 ASTSBINDIR=/opt/asterisk/sbin
89 ASTVARRUNDIR=/var/run/asterisk
90 ASTMANDIR=/opt/asterisk/man
91 else
92 ASTETCDIR=$(sysconfdir)/asterisk
93 ASTLIBDIR=$(libdir)/asterisk
94 ASTHEADERDIR=$(includedir)/asterisk
95 ASTBINDIR=$(bindir)
96 ASTSBINDIR=$(sbindir)
97 ASTSPOOLDIR=$(localstatedir)/spool/asterisk
98 ASTLOGDIR=$(localstatedir)/log/asterisk
99 ASTVARRUNDIR=$(localstatedir)/run
100 ASTMANDIR=$(mandir)
101 ifeq ($(OSARCH),FreeBSD)
102 ASTVARLIBDIR=$(prefix)/share/asterisk
103 else
104 ASTVARLIBDIR=$(localstatedir)/lib/asterisk
105 endif
106 endif
107 ASTDATADIR?=$(ASTVARLIBDIR)
109 # Asterisk.conf is located in ASTETCDIR or by using the -C flag
110 # when starting Asterisk
111 ASTCONFPATH=$(ASTETCDIR)/asterisk.conf
112 MODULES_DIR=$(ASTLIBDIR)/modules
113 AGI_DIR=$(ASTDATADIR)/agi-bin
115 # If you use Apache, you may determine by a grep 'DocumentRoot' of your httpd.conf file
116 HTTP_DOCSDIR=/var/www/html
117 # Determine by a grep 'ScriptAlias' of your Apache httpd.conf file
118 HTTP_CGIDIR=/var/www/cgi-bin
120 ASTCFLAGS=
122 # Uncomment this to use the older DSP routines
123 #ASTCFLAGS+=-DOLD_DSP_ROUTINES
125 # If the file .asterisk.makeopts is present in your home directory, you can
126 # include all of your favorite menuselect options so that every time you download
127 # a new version of Asterisk, you don't have to run menuselect to set them.
128 # The file /etc/asterisk.makeopts will also be included but can be overridden
129 # by the file in your home directory.
131 GLOBAL_MAKEOPTS=$(wildcard /etc/asterisk.makeopts)
132 USER_MAKEOPTS=$(wildcard ~/.asterisk.makeopts)
134 ifneq ($(wildcard menuselect.makeopts),)
135 include menuselect.makeopts
136 include menuselect.makedeps
137 endif
139 ifneq ($(wildcard makeopts),)
140 include makeopts
141 endif
143 TOPDIR_CFLAGS=-Iinclude
144 MOD_SUBDIR_CFLAGS=-I../include -I..
145 OTHER_SUBDIR_CFLAGS=-I../include -I..
147 ifeq ($(origin MENUSELECT_CFLAGS),undefined)
148 MENUSELECT_CFLAGS:=$(shell grep MENUSELECT_CFLAGS $(USER_MAKEOPTS) .)
149 ifeq ($(MENUSELECT_CFLAGS),)
150 MENUSELECT_CFLAGS:=$(shell grep MENUSELECT_CFLAGS $(GLOBAL_MAKEOPTS) .)
151 endif
152 ifneq ($(MENUSELECT_CFLAGS),)
153 MENUSELECT_CFLAGS:=$(shell echo $(MENUSELECT_CFLAGS) | cut -f2 -d'=')
154 endif
155 endif
157 ifeq ($(findstring dont-optimize,$(MAKECMDGOALS)),$(findstring DONT_OPTIMIZE,$(MENUSELECT_CFLAGS)))
158 # More GSM codec optimization
159 # Uncomment to enable MMXTM optimizations for x86 architecture CPU's
160 # which support MMX instructions. This should be newer pentiums,
161 # ppro's, etc, as well as the AMD K6 and K7.
162 #K6OPT = -DK6OPT
164 # Tell gcc to optimize the code
165 OPTIMIZE+=-O6
166 else
167 # Stack backtraces, while useful for debugging, are incompatible with optimizations
168 ifeq ($(OSARCH),Linux)
169 CFLAGS+=-DSTACK_BACKTRACES
170 endif
171 endif
173 # *CLI> show memory allocations [filename]
174 # *CLI> show memory summary [filename]
175 ifneq ($(findstring MALLOC_DEBUG,$(MENUSELECT_CFLAGS)),)
176 TOPDIR_CFLAGS+=-include include/asterisk/astmm.h
177 MOD_SUBDIR_CFLAGS+=-include ../include/asterisk/astmm.h
178 endif
180 MOD_SUBDIR_CFLAGS+=-fPIC
182 ifeq ($(OSARCH),Linux)
183 ifeq ($(PROC),x86_64)
184 # You must have GCC 3.4 to use k8, otherwise use athlon
185 PROC=k8
186 #PROC=athlon
187 endif
189 ifeq ($(PROC),sparc64)
190 #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
191 #This works for even old (2.96) versions of gcc and provides a small boost either way.
192 #A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
193 #So we go lowest common available by gcc and go a step down, still a step up from
194 #the default as we now have a better instruction set to work with. - Belgarath
195 PROC=ultrasparc
196 OPTIONS+=$(shell if $(CC) -mtune=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mtune=$(PROC)"; fi)
197 OPTIONS+=$(shell if $(CC) -mcpu=v8 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mcpu=v8"; fi)
198 OPTIONS+=-fomit-frame-pointer
199 endif
201 ifeq ($(PROC),arm)
202 # The Cirrus logic is the only heavily shipping arm processor with a real floating point unit
203 ifeq ($(SUB_PROC),maverick)
204 OPTIONS+=-fsigned-char -mcpu=ep9312
205 else
206 ifeq ($(SUB_PROC),xscale)
207 OPTIONS+=-fsigned-char -mcpu=xscale
208 else
209 OPTIONS+=-fsigned-char
210 endif
211 endif
212 endif
213 endif
215 GREP=grep
216 ID=id
218 ifeq ($(OSARCH),SunOS)
219 GREP=/usr/xpg4/bin/grep
220 M4=/usr/local/bin/m4
221 ID=/usr/xpg4/bin/id
222 endif
224 ASTCFLAGS+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG)
225 ifneq ($(OPTIMIZE),)
226 ASTCFLAGS+=$(OPTIMIZE)
227 endif
229 ifeq ($(AST_DEVMODE),yes)
230 ASTCFLAGS+=-Werror -Wunused
231 endif
233 ASTOBJ=-o asterisk
235 ifeq ($(findstring BSD,$(OSARCH)),BSD)
236 ASTCFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include -L$(CROSS_COMPILE_TARGET)/usr/local/lib
237 endif
239 ifneq ($(PROC),ultrasparc)
240 ASTCFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
241 endif
243 ifeq ($(PROC),ppc)
244 ASTCFLAGS+=-fsigned-char
245 endif
247 ifeq ($(OSARCH),FreeBSD)
248 BSDVERSION=$(shell make -V OSVERSION -f $(CROSS_COMPILE_TARGET)/usr/share/mk/bsd.port.subdir.mk)
249 ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
250 AST_LIBS+=$(shell if test $(BSDVERSION) -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi)
251 endif # FreeBSD
253 ifeq ($(OSARCH),NetBSD)
254 AST_CFLAGS+=-pthread -I$(CROSS_COMPILE_TARGET)/usr/pkg/include
255 endif
257 ifeq ($(OSARCH),OpenBSD)
258 ASTCFLAGS+=-pthread
259 endif
261 ifeq ($(OSARCH),SunOS)
262 ASTCFLAGS+=-Wcast-align -DSOLARIS -Iinclude/solaris-compat -I$(CROSS_COMPILE_TARGET)/opt/ssl/include -I$(CROSS_COMPILE_TARGET)/usr/local/ssl/include
263 endif
265 LIBEDIT=editline/libedit.a
267 ASTERISKVERSION:=$(shell build_tools/make_version .)
269 ifneq ($(wildcard .version),)
270 ASTERISKVERSIONNUM:=$(shell awk -F. '{printf "%02d%02d%02d", $$1, $$2, $$3}' .version)
271 RPMVERSION:=$(shell sed 's/[-\/:]/_/g' .version)
272 else
273 RPMVERSION=unknown
274 endif
276 ifneq ($(wildcard .svn),)
277 ASTERISKVERSIONNUM=999999
278 endif
280 ASTCFLAGS+=$(MALLOC_DEBUG)$(BUSYDETECT)$(OPTIONS)
282 MOD_SUBDIRS:=res channels pbx apps codecs formats cdr funcs
283 OTHER_SUBDIRS:=utils agi
284 SUBDIRS:=$(MOD_SUBDIRS) $(OTHER_SUBDIRS)
285 SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)
286 SUBDIRS_CLEAN:=$(SUBDIRS:%=%-clean)
287 SUBDIRS_CLEAN_DEPEND:=$(SUBDIRS:%=%-clean-depend)
288 MOD_SUBDIRS_DEPEND:=$(MOD_SUBDIRS:%=%-depend)
289 OTHER_SUBDIRS_DEPEND:=$(OTHER_SUBDIRS:%=%-depend)
290 SUBDIRS_DEPEND:=$(MOD_SUBDIRS_DEPEND) $(OTHER_SUBDIRS_DEPEND)
291 SUBDIRS_UNINSTALL:=$(SUBDIRS:%=%-uninstall)
293 OBJS=io.o sched.o logger.o frame.o loader.o config.o channel.o \
294 translate.o file.o pbx.o cli.o md5.o term.o \
295 ulaw.o alaw.o callerid.o fskmodem.o image.o app.o \
296 cdr.o tdd.o acl.o rtp.o udptl.o manager.o asterisk.o \
297 dsp.o chanvars.o indications.o autoservice.o db.o privacy.o \
298 astmm.o enum.o srv.o dns.o aescrypt.o aestab.o aeskey.o \
299 utils.o plc.o jitterbuf.o dnsmgr.o devicestate.o \
300 netsock.o slinfactory.o ast_expr2.o ast_expr2f.o \
301 cryptostub.o sha1.o http.o fixedjitterbuf.o abstract_jb.o
303 # we need to link in the objects statically, not as a library, because
304 # otherwise modules will not have them available if none of the static
305 # objects use it.
306 OBJS+=stdtime/localtime.o
308 # At the moment say.o is an optional component which can be overridden
309 # by a module.
310 OBJS+=say.o
312 ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/sys/poll.h),)
313 OBJS+= poll.o
314 ASTCFLAGS+=-DPOLLCOMPAT
315 endif
317 ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/dlfcn.h),)
318 OBJS+= dlfcn.o
319 ASTCFLAGS+=-DDLFCNCOMPAT
320 endif
322 ifeq ($(OSARCH),Linux)
323 AST_LIBS+=-ldl -lpthread $(EDITLINE_LIB) -lm -lresolv #-lnjamd
324 else
325 AST_LIBS+=$(EDITLINE_LIB) -lm
326 endif
328 ifeq ($(OSARCH),Darwin)
329 AST_LIBS+=-lresolv
330 ASTCFLAGS+=-D__Darwin__
331 AUDIO_LIBS=-framework CoreAudio
332 ASTLINK=-Wl,-dynamic
333 SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
334 # Mac on Intel CoreDuo does not need poll compatibility layer
335 ifneq ($(PROC),i386)
336 OBJS+=poll.o
337 ASTCFLAGS+=-DPOLLCOMPAT
338 endif
339 else
340 # These are used for all but Darwin
341 ASTLINK=-Wl,-E
342 SOLINK=-shared -Xlinker -x
343 ifeq ($(findstring BSD,$(OSARCH)),BSD)
344 LDFLAGS+=-L$(CROSS_COMPILE_TARGET)/usr/local/lib
345 endif
346 endif
348 ifeq ($(OSARCH),FreeBSD)
349 AST_LIBS+=-lcrypto
350 endif
352 ifeq ($(OSARCH),NetBSD)
353 AST_LIBS+=-lpthread -lcrypto -lm -L$(CROSS_COMPILE_TARGET)/usr/pkg/lib $(EDITLINE_LIB)
354 endif
356 ifeq ($(OSARCH),OpenBSD)
357 AST_LIBS+=-lcrypto -lpthread -lm $(EDITLINE_LIB)
358 endif
360 ifeq ($(OSARCH),SunOS)
361 AST_LIBS+=-lpthread -ldl -lnsl -lsocket -lresolv -L$(CROSS_COMPILE_TARGET)/opt/ssl/lib -L$(CROSS_COMPILE_TARGET)/usr/local/ssl/lib
362 OBJS+=strcompat.o
363 ASTLINK=
364 SOLINK=-shared -fpic -L$(CROSS_COMPILE_TARGET)/usr/local/ssl/lib
365 endif
367 ifeq ($(MAKETOPLEVEL),$(MAKELEVEL))
368 CFLAGS+=$(TOPDIR_CFLAGS)$(ASTCFLAGS)
369 endif
371 # This is used when generating the doxygen documentation
372 ifneq ($(DOT),:)
373 HAVEDOT=yes
374 else
375 HAVEDOT=no
376 endif
378 include Makefile.rules
380 _all: all
381 @echo " +--------- Asterisk Build Complete ---------+"
382 @echo " + Asterisk has successfully been built, but +"
383 @echo " + cannot be run before being installed by +"
384 @echo " + running: +"
385 @echo " + +"
386 @echo " + make install +"
387 @echo " +-------------------------------------------+"
389 all: cleantest config.status menuselect.makeopts depend $(SUBDIRS) asterisk
391 $(MOD_SUBDIRS):
392 @CFLAGS="$(MOD_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $@
394 $(OTHER_SUBDIRS):
395 @CFLAGS="$(OTHER_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $@
397 config.status: configure
398 @CFLAGS="" ./configure
399 @echo "****"
400 @echo "**** The configure script was just executed, so 'make' needs to be"
401 @echo "**** restarted."
402 @echo "****"
403 @exit 1
405 makeopts: configure
406 @CFLAGS="" ./configure
407 @echo "****"
408 @echo "**** The configure script was just executed, so 'make' needs to be"
409 @echo "**** restarted."
410 @echo "****"
411 @exit 1
413 menuselect.makeopts menuselect.makedeps: menuselect/menuselect makeopts.xml
414 menuselect/menuselect --check-deps $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts
416 #ifneq ($(wildcard tags),)
417 ctags: tags
418 #endif
420 ifneq ($(wildcard TAGS),)
421 all: TAGS
422 endif
424 editline/config.h:
425 cd editline && unset CFLAGS AST_LIBS && CFLAGS="$(OPTIMIZE)" ./configure ; \
427 editline/libedit.a:
428 cd editline && unset CFLAGS AST_LIBS && test -f config.h || CFLAGS="$(OPTIMIZE)" ./configure
429 $(MAKE) -C editline libedit.a
431 db1-ast/libdb1.a:
432 $(MAKE) -C db1-ast libdb1.a
434 ifneq ($(wildcard .depend),)
435 include .depend
436 endif
438 ifneq ($(wildcard .tags-depend),)
439 include .tags-depend
440 endif
442 ast_expr2.c ast_expr2.h:
443 bison -o $@ -d --name-prefix=ast_yy ast_expr2.y
445 ast_expr2f.c:
446 flex -o $@ --full ast_expr2.fl
448 testexpr2: config.status include/asterisk/buildopts.h ast_expr2f.c ast_expr2.c ast_expr2.h
449 $(CC) -g -c -Iinclude -DSTANDALONE ast_expr2f.c
450 $(CC) -g -c -Iinclude -DSTANDALONE ast_expr2.c
451 $(CC) -g -o testexpr2 ast_expr2f.o ast_expr2.o
452 rm ast_expr2.o ast_expr2f.o
454 manpage: asterisk.8
456 asterisk.8: asterisk.sgml
457 rm -f asterisk.8
458 docbook2man asterisk.sgml
459 mv ./*.8 asterisk.8
461 asterisk.pdf: asterisk.sgml
462 docbook2pdf asterisk.sgml
464 asterisk.ps: asterisk.sgml
465 docbook2ps asterisk.sgml
467 asterisk.html: asterisk.sgml
468 docbook2html asterisk.sgml
469 mv r1.html asterisk.html
471 asterisk.txt: asterisk.sgml
472 docbook2txt asterisk.sgml
474 defaults.h: makeopts
475 @build_tools/make_defaults_h > $@.tmp
476 @if cmp -s $@.tmp $@ ; then : ; else \
477 mv $@.tmp $@ ; \
479 @rm -f $@.tmp
481 include/asterisk/version.h:
482 @build_tools/make_version_h > $@.tmp
483 @if cmp -s $@.tmp $@ ; then : ; else \
484 mv $@.tmp $@ ; \
486 @rm -f $@.tmp
488 include/asterisk/buildopts.h: menuselect.makeopts
489 @build_tools/make_buildopts_h > $@.tmp
490 @if cmp -s $@.tmp $@ ; then : ; else \
491 mv $@.tmp $@ ; \
493 @rm -f $@.tmp
495 channel.o: CFLAGS+=$(ZAPTEL_INCLUDE)
497 asterisk: include/asterisk/buildopts.h editline/libedit.a db1-ast/libdb1.a $(OBJS)
498 @build_tools/make_build_h > include/asterisk/build.h.tmp
499 @if cmp -s include/asterisk/build.h.tmp include/asterisk/build.h ; then echo ; else \
500 mv include/asterisk/build.h.tmp include/asterisk/build.h ; \
502 @rm -f include/asterisk/build.h.tmp
503 @$(CC) -c -o buildinfo.o $(CFLAGS) buildinfo.c
504 @echo " [LD] $(OBJS) buildinfo.o $(LIBEDIT) db1-ast/libdb1.1 $(AST_LIBS) -> $@"
505 @$(CC) $(DEBUG) $(ASTOBJ) $(ASTLINK) $(OBJS) buildinfo.o $(LIBEDIT) db1-ast/libdb1.a $(AST_LIBS)
507 muted: muted.o
508 muted: LIBS+=$(AUDIO_LIBS)
510 $(SUBDIRS_CLEAN_DEPEND):
511 @$(MAKE) -C $(@:-clean-depend=) clean-depend
513 $(SUBDIRS_CLEAN):
514 @$(MAKE) -C $(@:-clean=) clean
516 clean-depend: $(SUBDIRS_CLEAN_DEPEND)
518 clean: $(SUBDIRS_CLEAN) clean-depend
519 rm -f *.o *.so asterisk
520 rm -f defaults.h
521 rm -f include/asterisk/build.h
522 rm -f include/asterisk/version.h
523 rm -f .tags-sources tags TAGS
524 rm -f .depend .tags-depend
525 @if [ -f editline/Makefile ]; then $(MAKE) -C editline distclean ; fi
526 @$(MAKE) -C db1-ast clean
527 @$(MAKE) -C stdtime clean
528 @$(MAKE) -C menuselect clean
530 dist-clean: distclean
532 distclean: clean
533 @$(MAKE) -C mxml clean
534 @$(MAKE) -C menuselect dist-clean
535 @$(MAKE) -C sounds dist-clean
536 rm -f menuselect.makeopts makeopts makeopts.xml menuselect.makedeps
537 rm -f config.log config.status
538 rm -rf autom4te.cache
539 rm -f include/asterisk/autoconfig.h
540 rm -f include/asterisk/buildopts.h
541 rm -rf doc/api
542 rm -f build_tools/menuselect-deps
544 datafiles: all
545 if [ x`$(ID) -un` = xroot ]; then sh build_tools/mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig; fi
546 # Should static HTTP be installed during make samples or even with its own target ala
547 # webvoicemail? There are portions here that *could* be customized but might also be
548 # improved a lot. I'll put it here for now.
549 mkdir -p $(DESTDIR)$(ASTDATADIR)/static-http
550 for x in static-http/*; do \
551 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/static-http ; \
552 done
553 mkdir -p $(DESTDIR)$(ASTDATADIR)/images
554 for x in images/*.jpg; do \
555 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/images ; \
556 done
557 mkdir -p $(DESTDIR)$(AGI_DIR)
558 $(MAKE) -C sounds install
560 update:
561 @if [ -d .svn ]; then \
562 echo "Updating from Subversion..." ; \
563 svn update | tee update.out; \
564 rm -f .version; \
565 if [ `grep -c ^C update.out` -gt 0 ]; then \
566 echo ; echo "The following files have conflicts:" ; \
567 grep ^C update.out | cut -b4- ; \
568 fi ; \
569 rm -f update.out; \
570 $(MAKE) clean-depend; \
571 else \
572 echo "Not under version control"; \
575 NEWHEADERS=$(notdir $(wildcard include/asterisk/*.h))
576 OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h)))
578 bininstall: all
579 mkdir -p $(DESTDIR)$(MODULES_DIR)
580 mkdir -p $(DESTDIR)$(ASTSBINDIR)
581 mkdir -p $(DESTDIR)$(ASTETCDIR)
582 mkdir -p $(DESTDIR)$(ASTBINDIR)
583 mkdir -p $(DESTDIR)$(ASTVARRUNDIR)
584 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail
585 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/dictate
586 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/system
587 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/tmp
588 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/meetme
589 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/monitor
590 if [ -f asterisk ]; then $(INSTALL) -m 755 asterisk $(DESTDIR)$(ASTSBINDIR)/; fi
591 if [ -f asterisk.dll ]; then $(INSTALL) -m 755 asterisk.dll $(DESTDIR)$(ASTSBINDIR)/; fi
592 $(LN) -sf asterisk $(DESTDIR)$(ASTSBINDIR)/rasterisk
593 $(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
594 $(INSTALL) -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/
595 if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \
596 cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;' > $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ;\
597 chmod 755 $(DESTDIR)$(ASTSBINDIR)/safe_asterisk;\
599 $(INSTALL) -d $(DESTDIR)$(ASTHEADERDIR)
600 $(INSTALL) -m 644 include/asterisk.h $(DESTDIR)$(includedir)
601 $(INSTALL) -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
602 if [ -n "$(OLDHEADERS)" ]; then \
603 rm -f $(addprefix $(DESTDIR)$(ASTHEADERDIR)/,$(OLDHEADERS)) ;\
605 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
606 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-custom
607 mkdir -p $(DESTDIR)$(ASTDATADIR)/keys
608 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware
609 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware/iax
610 mkdir -p $(DESTDIR)$(ASTMANDIR)/man8
611 $(INSTALL) -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTDATADIR)/keys
612 $(INSTALL) -m 644 keys/freeworlddialup.pub $(DESTDIR)$(ASTDATADIR)/keys
613 $(INSTALL) -m 644 asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
614 $(INSTALL) -m 644 contrib/scripts/astgenkey.8 $(DESTDIR)$(ASTMANDIR)/man8
615 $(INSTALL) -m 644 contrib/scripts/autosupport.8 $(DESTDIR)$(ASTMANDIR)/man8
616 $(INSTALL) -m 644 contrib/scripts/safe_asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
617 $(INSTALL) -m 644 contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTDATADIR)/firmware/iax/iaxy.bin; \
619 $(SUBDIRS_INSTALL):
620 @$(MAKE) -C $(@:-install=) install
622 NEWMODS=$(notdir $(wildcard */*.so))
623 OLDMODS=$(filter-out $(NEWMODS),$(notdir $(wildcard $(DESTDIR)$(MODULES_DIR)/*.so)))
625 oldmodcheck:
626 @if [ -n "$(OLDMODS)" ]; then \
627 echo " WARNING WARNING WARNING" ;\
628 echo "" ;\
629 echo " Your Asterisk modules directory, located at" ;\
630 echo " $(DESTDIR)$(MODULES_DIR)" ;\
631 echo " contains modules that were not installed by this " ;\
632 echo " version of Asterisk. Please ensure that these" ;\
633 echo " modules are compatible with this version before" ;\
634 echo " attempting to run Asterisk." ;\
635 echo "" ;\
636 for f in $(OLDMODS); do \
637 echo " $$f" ;\
638 done ;\
639 echo "" ;\
640 echo " WARNING WARNING WARNING" ;\
643 install: all datafiles bininstall $(SUBDIRS_INSTALL)
644 @if [ -x /usr/sbin/asterisk-post-install ]; then \
645 /usr/sbin/asterisk-post-install $(DESTDIR) . ; \
647 @echo " +---- Asterisk Installation Complete -------+"
648 @echo " + +"
649 @echo " + YOU MUST READ THE SECURITY DOCUMENT +"
650 @echo " + +"
651 @echo " + Asterisk has successfully been installed. +"
652 @echo " + If you would like to install the sample +"
653 @echo " + configuration files (overwriting any +"
654 @echo " + existing config files), run: +"
655 @echo " + +"
656 @echo " + $(MAKE) samples +"
657 @echo " + +"
658 @echo " +----------------- or ---------------------+"
659 @echo " + +"
660 @echo " + You can go ahead and install the asterisk +"
661 @echo " + program documentation now or later run: +"
662 @echo " + +"
663 @echo " + $(MAKE) progdocs +"
664 @echo " + +"
665 @echo " + **Note** This requires that you have +"
666 @echo " + doxygen installed on your local system +"
667 @echo " +-------------------------------------------+"
668 @$(MAKE) -s oldmodcheck
670 upgrade: all bininstall
672 adsi:
673 mkdir -p $(DESTDIR)$(ASTETCDIR)
674 for x in configs/*.adsi; do \
675 if [ ! -f $(DESTDIR)$(ASTETCDIR)/$$x ]; then \
676 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x` ; \
677 fi ; \
678 done
680 samples: adsi
681 mkdir -p $(DESTDIR)$(ASTETCDIR)
682 for x in configs/*.sample; do \
683 if [ -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ]; then \
684 if [ "$(OVERWRITE)" = "y" ]; then \
685 if cmp -s $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $$x ; then \
686 echo "Config file $$x is unchanged"; \
687 continue; \
688 fi ; \
689 mv -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample`.old ; \
690 else \
691 echo "Skipping config file $$x"; \
692 continue; \
693 fi ;\
694 fi ; \
695 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ;\
696 done
697 if [ "$(OVERWRITE)" = "y" ] || [ ! -f $(DESTDIR)$(ASTCONFPATH) ]; then \
699 echo "[directories]" ; \
700 echo "astetcdir => $(ASTETCDIR)" ; \
701 echo "astmoddir => $(MODULES_DIR)" ; \
702 echo "astvarlibdir => $(ASTVARLIBDIR)" ; \
703 echo "astdatadir => $(ASTDATADIR)" ; \
704 echo "astagidir => $(AGI_DIR)" ; \
705 echo "astspooldir => $(ASTSPOOLDIR)" ; \
706 echo "astrundir => $(ASTVARRUNDIR)" ; \
707 echo "astlogdir => $(ASTLOGDIR)" ; \
708 echo "" ; \
709 echo "; Changing the following lines may compromise your security." ; \
710 echo ";[files]" ; \
711 echo ";astctlpermissions = 0660" ; \
712 echo ";astctlowner = root" ; \
713 echo ";astctlgroup = apache" ; \
714 echo ";astctl = asterisk.ctl" ; \
715 echo ";[options]" ; \
716 echo ";internal_timing = yes" ; \
717 ) > $(DESTDIR)$(ASTCONFPATH) ; \
718 else \
719 echo "Skipping asterisk.conf creation"; \
721 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
722 :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm
723 for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isunavail; do \
724 cat $(DESTDIR)$(ASTDATADIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm ; \
725 done
726 :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm
727 for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isonphone; do \
728 cat $(DESTDIR)$(ASTDATADIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm ; \
729 done
731 webvmail:
732 @[ -d $(DESTDIR)$(HTTP_DOCSDIR)/ ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 )
733 @[ -d $(DESTDIR)$(HTTP_CGIDIR) ] || ( printf "cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit 1 )
734 $(INSTALL) -m 4755 -o root -g root contrib/scripts/vmail.cgi $(DESTDIR)$(HTTP_CGIDIR)/vmail.cgi
735 mkdir -p $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk
736 for x in images/*.gif; do \
737 $(INSTALL) -m 644 $$x $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk/; \
738 done
739 @echo " +--------- Asterisk Web Voicemail ----------+"
740 @echo " + +"
741 @echo " + Asterisk Web Voicemail is installed in +"
742 @echo " + your cgi-bin directory: +"
743 @echo " + $(DESTDIR)$(HTTP_CGIDIR)"
744 @echo " + IT USES A SETUID ROOT PERL SCRIPT, SO +"
745 @echo " + IF YOU DON'T LIKE THAT, UNINSTALL IT! +"
746 @echo " + +"
747 @echo " + Other static items have been stored in: +"
748 @echo " + $(DESTDIR)$(HTTP_DOCSDIR)"
749 @echo " + +"
750 @echo " + If these paths do not match your httpd +"
751 @echo " + installation, correct the definitions +"
752 @echo " + in your Makefile of HTTP_CGIDIR and +"
753 @echo " + HTTP_DOCSDIR +"
754 @echo " + +"
755 @echo " +-------------------------------------------+"
757 spec:
758 sed "s/^Version:.*/Version: $(RPMVERSION)/g" redhat/asterisk.spec > asterisk.spec ; \
760 rpm: __rpm
762 __rpm: include/asterisk/version.h include/asterisk/buildopts.h spec
763 rm -rf /tmp/asterisk ; \
764 mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
765 $(MAKE) DESTDIR=/tmp/asterisk install ; \
766 $(MAKE) DESTDIR=/tmp/asterisk samples ; \
767 mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
768 cp -f contrib/init.d/rc.redhat.asterisk /tmp/asterisk/etc/rc.d/init.d/asterisk ; \
769 rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec
771 progdocs:
772 (cat contrib/asterisk-ng-doxygen; echo "HAVE_DOT=$(HAVEDOT)"; \
773 echo "PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen -
775 config:
776 @if [ "${OSARCH}" = "Linux" ]; then \
777 if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \
778 $(INSTALL) -m 755 contrib/init.d/rc.redhat.asterisk /etc/rc.d/init.d/asterisk; \
779 /sbin/chkconfig --add asterisk; \
780 elif [ -f /etc/debian_version ]; then \
781 $(INSTALL) -m 755 contrib/init.d/rc.debian.asterisk /etc/init.d/asterisk; \
782 /usr/sbin/update-rc.d asterisk start 10 2 3 4 5 . stop 91 2 3 4 5 .; \
783 elif [ -f /etc/gentoo-release ]; then \
784 $(INSTALL) -m 755 contrib/init.d/rc.gentoo.asterisk /etc/init.d/asterisk; \
785 /sbin/rc-update add asterisk default; \
786 elif [ -f /etc/mandrake-release ]; then \
787 $(INSTALL) -m 755 contrib/init.d/rc.mandrake.asterisk /etc/rc.d/init.d/asterisk; \
788 /sbin/chkconfig --add asterisk; \
789 elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then \
790 $(INSTALL) -m 755 contrib/init.d/rc.suse.asterisk /etc/init.d/asterisk; \
791 /sbin/chkconfig --add asterisk; \
792 elif [ -f /etc/slackware-version ]; then \
793 echo "Slackware is not currently supported, although an init script does exist for it." \
794 else \
795 echo "We could not install init scripts for your distribution."; \
796 fi \
797 else \
798 echo "We could not install init scripts for your operating system."; \
801 dont-optimize: _all
803 valgrind: dont-optimize
805 $(MOD_SUBDIRS_DEPEND):
806 @CFLAGS="$(MOD_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $(@:-depend=) depend
808 $(OTHER_SUBDIRS_DEPEND):
809 @CFLAGS="$(OTHER_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $(@:-depend=) depend
811 depend: include/asterisk/version.h include/asterisk/buildopts.h .depend defaults.h $(SUBDIRS_DEPEND)
813 .depend: include/asterisk/version.h include/asterisk/buildopts.h defaults.h
814 build_tools/mkdep $(CFLAGS) $(wildcard *.c)
816 .tags-depend:
817 @echo -n ".tags-depend: " > $@
818 @$(FIND) . -maxdepth 1 -name \*.c -printf "\t%p \\\\\n" >> $@
819 @$(FIND) . -maxdepth 1 -name \*.h -printf "\t%p \\\\\n" >> $@
820 @$(FIND) $(SUBDIRS) -name \*.c -printf "\t%p \\\\\n" >> $@
821 @$(FIND) $(SUBDIRS) -name \*.h -printf "\t%p \\\\\n" >> $@
822 @$(FIND) include -name \*.h -printf "\t%p \\\\\n" >> $@
823 @echo >> $@
825 .tags-sources:
826 @rm -f $@
827 @$(FIND) . -maxdepth 1 -name \*.c -print >> $@
828 @$(FIND) . -maxdepth 1 -name \*.h -print >> $@
829 @$(FIND) $(SUBDIRS) -name \*.c -print >> $@
830 @$(FIND) $(SUBDIRS) -name \*.h -print >> $@
831 @$(FIND) include -name \*.h -print >> $@
833 tags: .tags-depend .tags-sources
834 ctags -L .tags-sources -o $@
836 ctags: tags
838 TAGS: .tags-depend .tags-sources
839 etags -o $@ `cat .tags-sources`
841 etags: TAGS
843 %_env:
844 $(MAKE) -C $(shell echo $@ | sed "s/_env//g") env
846 sounds:
847 $(MAKE) -C sounds all
849 env:
852 # If the cleancount has been changed, force a make clean.
853 # .cleancount is the global clean count, and .lastclean is the
854 # last clean count we had
856 cleantest:
857 @if cmp -s .cleancount .lastclean ; then echo ; else \
858 $(MAKE) clean; cp -f .cleancount .lastclean;\
859 $(MAKE) defaults.h;\
862 $(SUBDIRS_UNINSTALL):
863 @$(MAKE) -C $(@:-uninstall=) uninstall
865 _uninstall: $(SUBDIRS_UNINSTALL)
866 rm -f $(DESTDIR)$(MODULES_DIR)/*
867 rm -f $(DESTDIR)$(ASTSBINDIR)/*asterisk*
868 rm -f $(DESTDIR)$(ASTSBINDIR)/astgenkey
869 rm -f $(DESTDIR)$(ASTSBINDIR)/autosupport
870 rm -rf $(DESTDIR)$(ASTHEADERDIR)
871 rm -rf $(DESTDIR)$(ASTDATADIR)/firmware
872 rm -rf $(DESTDIR)$(ASTMANDIR)/man8
873 $(MAKE) -C sounds uninstall
875 uninstall: _uninstall
876 @echo " +--------- Asterisk Uninstall Complete -----+"
877 @echo " + Asterisk binaries, sounds, man pages, +"
878 @echo " + headers, modules, and firmware builds, +"
879 @echo " + have all been uninstalled. +"
880 @echo " + +"
881 @echo " + To remove ALL traces of Asterisk, +"
882 @echo " + including configuration, spool +"
883 @echo " + directories, and logs, run the following +"
884 @echo " + command: +"
885 @echo " + +"
886 @echo " + $(MAKE) uninstall-all +"
887 @echo " +-------------------------------------------+"
889 uninstall-all: _uninstall
890 rm -rf $(DESTDIR)$(ASTLIBDIR)
891 rm -rf $(DESTDIR)$(ASTVARLIBDIR)
892 rm -rf $(DESTDIR)$(ASTDATADIR)
893 rm -rf $(DESTDIR)$(ASTSPOOLDIR)
894 rm -rf $(DESTDIR)$(ASTETCDIR)
895 rm -rf $(DESTDIR)$(ASTLOGDIR)
897 menuselect: menuselect/menuselect makeopts.xml
898 -@menuselect/menuselect $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts && echo "menuselect changes saved!" || echo "menuselect changes NOT saved!"
900 menuselect/menuselect: menuselect/menuselect.c menuselect/menuselect_curses.c menuselect/menuselect_stub.c menuselect/menuselect.h menuselect/linkedlists.h config.status mxml/libmxml.a
901 @CFLAGS="-include $(ASTTOPDIR)/include/asterisk/autoconfig.h -I$(ASTTOPDIR)/include" PARENTSRC="$(ASTTOPDIR)" $(MAKE) -C menuselect menuselect
903 mxml/libmxml.a:
904 @cd mxml && unset CFLAGS AST_LIBS && test -f config.h || ./configure
905 $(MAKE) -C mxml libmxml.a
907 makeopts.xml: $(foreach dir,$(MOD_SUBDIRS),$(wildcard $(dir)/*.c) $(wildcard $(dir)/*.cc)) build_tools/cflags.xml sounds/sounds.xml
908 @echo "Generating list of available modules ..."
909 @build_tools/prep_moduledeps > $@
911 .PHONY: menuselect sounds clean clean-depend dist-clean distclean all _all depend cleantest uninstall _uninstall uninstall-all dont-optimize valgrind $(SUBDIRS_INSTALL) $(SUBDIRS_CLEAN) $(SUBDIRS_CLEAN_DEPEND) $(SUBDIRS_DEPEND) $(SUBDIRS_UNINSTALL) $(SUBDIRS)