DETECT_DEADLOCKS can't be enabled without DEBUG_THREADS or it does nothing
[asterisk-bristuff.git] / Makefile
blobfb8466a35bdc6e4a3ecae89dc12a1ebdc9ddd7bf
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 OSARCH
62 export CURSES_DIR
63 export NCURSES_DIR
64 export TERMCAP_DIR
65 export TINFO_DIR
66 export GTK2_LIB
67 export GTK2_INCLUDE
69 # even though we could use '-include makeopts' here, use a wildcard
70 # lookup anyway, so that make won't try to build makeopts if it doesn't
71 # exist (other rules will force it to be built if needed)
72 ifneq ($(wildcard makeopts),)
73 include makeopts
74 endif
76 #Uncomment this to see all build commands instead of 'quiet' output
77 #NOISY_BUILD=yes
79 # Create OPTIONS variable
80 OPTIONS=
82 ASTTOPDIR:=$(shell pwd)
84 # Overwite config files on "make samples"
85 OVERWRITE=y
87 # Include debug and macro symbols in the executables (-g) and profiling info (-pg)
88 DEBUG=-g3
90 # Staging directory
91 # Files are copied here temporarily during the install process
92 # For example, make DESTDIR=/tmp/asterisk woud put things in
93 # /tmp/asterisk/etc/asterisk
94 # !!! Watch out, put no spaces or comments after the value !!!
95 #DESTDIR?=/tmp/asterisk
97 # Define standard directories for various platforms
98 # These apply if they are not redefined in asterisk.conf
99 ifeq ($(OSARCH),SunOS)
100 ASTETCDIR=/var/etc/asterisk
101 ASTLIBDIR=/opt/asterisk/lib
102 ASTVARLIBDIR=/var/opt/asterisk
103 ASTSPOOLDIR=/var/spool/asterisk
104 ASTLOGDIR=/var/log/asterisk
105 ASTHEADERDIR=/opt/asterisk/include
106 ASTBINDIR=/opt/asterisk/bin
107 ASTSBINDIR=/opt/asterisk/sbin
108 ASTVARRUNDIR=/var/run/asterisk
109 ASTMANDIR=/opt/asterisk/man
110 else
111 ASTETCDIR=$(sysconfdir)/asterisk
112 ASTLIBDIR=$(libdir)/asterisk
113 ASTHEADERDIR=$(includedir)/asterisk
114 ASTBINDIR=$(bindir)
115 ASTSBINDIR=$(sbindir)
116 ASTSPOOLDIR=$(localstatedir)/spool/asterisk
117 ASTLOGDIR=$(localstatedir)/log/asterisk
118 ASTVARRUNDIR=$(localstatedir)/run
119 ASTMANDIR=$(mandir)
120 ifneq ($(findstring BSD,$(OSARCH)),)
121 ASTVARLIBDIR=$(prefix)/share/asterisk
122 ASTVARRUNDIR=$(localstatedir)/run/asterisk
123 else
124 ASTVARLIBDIR=$(localstatedir)/lib/asterisk
125 endif
126 endif
127 ifeq ($(ASTDATADIR),)
128 ASTDATADIR:=$(ASTVARLIBDIR)
129 endif
131 # Asterisk.conf is located in ASTETCDIR or by using the -C flag
132 # when starting Asterisk
133 ASTCONFPATH=$(ASTETCDIR)/asterisk.conf
134 MODULES_DIR=$(ASTLIBDIR)/modules
135 AGI_DIR=$(ASTDATADIR)/agi-bin
137 # If you use Apache, you may determine by a grep 'DocumentRoot' of your httpd.conf file
138 HTTP_DOCSDIR=/var/www/html
139 # Determine by a grep 'ScriptAlias' of your Apache httpd.conf file
140 HTTP_CGIDIR=/var/www/cgi-bin
142 # Uncomment this to use the older DSP routines
143 #ASTCFLAGS+=-DOLD_DSP_ROUTINES
145 # If the file .asterisk.makeopts is present in your home directory, you can
146 # include all of your favorite menuselect options so that every time you download
147 # a new version of Asterisk, you don't have to run menuselect to set them.
148 # The file /etc/asterisk.makeopts will also be included but can be overridden
149 # by the file in your home directory.
151 GLOBAL_MAKEOPTS=$(wildcard /etc/asterisk.makeopts)
152 USER_MAKEOPTS=$(wildcard ~/.asterisk.makeopts)
154 MOD_SUBDIR_CFLAGS=-I$(ASTTOPDIR)/include
155 OTHER_SUBDIR_CFLAGS=-I$(ASTTOPDIR)/include
157 ifeq ($(OSARCH),linux-gnu)
158 ifeq ($(PROC),x86_64)
159 # You must have GCC 3.4 to use k8, otherwise use athlon
160 PROC=k8
161 #PROC=athlon
162 endif
164 ifeq ($(PROC),sparc64)
165 #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
166 #This works for even old (2.96) versions of gcc and provides a small boost either way.
167 #A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
168 #So we go lowest common available by gcc and go a step down, still a step up from
169 #the default as we now have a better instruction set to work with. - Belgarath
170 PROC=ultrasparc
171 OPTIONS+=$(shell if $(CC) -mtune=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mtune=$(PROC)"; fi)
172 OPTIONS+=$(shell if $(CC) -mcpu=v8 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mcpu=v8"; fi)
173 OPTIONS+=-fomit-frame-pointer
174 endif
176 ifeq ($(PROC),arm)
177 # The Cirrus logic is the only heavily shipping arm processor with a real floating point unit
178 ifeq ($(SUB_PROC),maverick)
179 OPTIONS+=-fsigned-char -mcpu=ep9312
180 else
181 ifeq ($(SUB_PROC),xscale)
182 OPTIONS+=-fsigned-char -mcpu=xscale
183 else
184 OPTIONS+=-fsigned-char
185 endif
186 endif
187 endif
188 endif
190 ASTCFLAGS+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG)
192 ASTCFLAGS+=-include $(ASTTOPDIR)/include/asterisk/autoconfig.h
194 ifeq ($(AST_DEVMODE),yes)
195 ASTCFLAGS+=-Werror -Wunused $(AST_DECLARATION_AFTER_STATEMENT)
196 endif
198 ifneq ($(findstring BSD,$(OSARCH)),)
199 ASTCFLAGS+=-I/usr/local/include
200 ASTLDFLAGS+=-L/usr/local/lib
201 endif
203 ifneq ($(PROC),ultrasparc)
204 ASTCFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
205 endif
207 ifeq ($(PROC),ppc)
208 ASTCFLAGS+=-fsigned-char
209 endif
211 ifeq ($(OSARCH),FreeBSD)
212 # -V is understood by BSD Make, not by GNU make.
213 BSDVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk)
214 ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
215 AST_LIBS+=$(shell if test $(BSDVERSION) -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi)
216 endif
218 ifeq ($(OSARCH),NetBSD)
219 ASTCFLAGS+=-pthread -I/usr/pkg/include
220 endif
222 ifeq ($(OSARCH),OpenBSD)
223 ASTCFLAGS+=-pthread
224 endif
226 ifeq ($(OSARCH),SunOS)
227 ASTCFLAGS+=-Wcast-align -DSOLARIS -I../include/solaris-compat -I/opt/ssl/include -I/usr/local/ssl/include
228 endif
230 ASTERISKVERSION:=$(shell build_tools/make_version .)
232 ifneq ($(wildcard .version),)
233 ASTERISKVERSIONNUM:=$(shell awk -F. '{printf "%01d%02d%02d", $$1, $$2, $$3}' .version)
234 RPMVERSION:=$(shell sed 's/[-\/:]/_/g' .version)
235 else
236 RPMVERSION=unknown
237 endif
239 ifneq ($(wildcard .svn),)
240 ASTERISKVERSIONNUM=999999
241 endif
243 ASTCFLAGS+=$(MALLOC_DEBUG)$(BUSYDETECT)$(OPTIONS)
245 MOD_SUBDIRS:=res channels pbx apps codecs formats cdr funcs main
246 OTHER_SUBDIRS:=utils agi
247 SUBDIRS:=$(OTHER_SUBDIRS) $(MOD_SUBDIRS)
248 SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)
249 SUBDIRS_CLEAN:=$(SUBDIRS:%=%-clean)
250 SUBDIRS_UNINSTALL:=$(SUBDIRS:%=%-uninstall)
251 MOD_SUBDIRS_EMBED_LDSCRIPT:=$(MOD_SUBDIRS:%=%-embed-ldscript)
252 MOD_SUBDIRS_EMBED_LDFLAGS:=$(MOD_SUBDIRS:%=%-embed-ldflags)
253 MOD_SUBDIRS_EMBED_LIBS:=$(MOD_SUBDIRS:%=%-embed-libs)
255 ifneq ($(findstring darwin,$(OSARCH)),)
256 ASTCFLAGS+=-D__Darwin__
257 AUDIO_LIBS=-framework CoreAudio
258 SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
259 else
260 # These are used for all but Darwin
261 SOLINK=-shared -Xlinker -x
262 ifneq ($(findstring BSD,$(OSARCH)),)
263 LDFLAGS+=-L/usr/local/lib
264 endif
265 endif
267 ifeq ($(OSARCH),SunOS)
268 SOLINK=-shared -fpic -L/usr/local/ssl/lib
269 endif
271 # This is used when generating the doxygen documentation
272 ifneq ($(DOT),:)
273 HAVEDOT=yes
274 else
275 HAVEDOT=no
276 endif
278 all: _all
279 @echo " +--------- Asterisk Build Complete ---------+"
280 @echo " + Asterisk has successfully been built, and +"
281 @echo " + can be installed by running: +"
282 @echo " + +"
283 @echo " + $(MAKE) install +"
284 @echo " +-------------------------------------------+"
286 _all: cleantest $(SUBDIRS)
288 makeopts: configure
289 @echo "****"
290 @echo "**** The configure script must be executed before running '$(MAKE)'."
291 @echo "**** Please run \"./configure\"."
292 @echo "****"
293 @exit 1
295 menuselect.makeopts: menuselect/menuselect menuselect-tree
296 menuselect/menuselect --check-deps $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts
298 $(MOD_SUBDIRS_EMBED_LDSCRIPT):
299 @echo "EMBED_LDSCRIPTS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-ldscript=) SUBDIR=$(@:-embed-ldscript=) __embed_ldscript` >> makeopts.embed_rules
301 $(MOD_SUBDIRS_EMBED_LDFLAGS):
302 @echo "EMBED_LDFLAGS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-ldflags=) SUBDIR=$(@:-embed-ldflags=) __embed_ldflags` >> makeopts.embed_rules
304 $(MOD_SUBDIRS_EMBED_LIBS):
305 @echo "EMBED_LIBS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-libs=) SUBDIR=$(@:-embed-libs=) __embed_libs` >> makeopts.embed_rules
307 makeopts.embed_rules: menuselect.makeopts
308 @echo "Generating embedded module rules ..."
309 @rm -f $@
310 @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LDSCRIPT)
311 @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LDFLAGS)
312 @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LIBS)
314 $(SUBDIRS): include/asterisk/version.h include/asterisk/buildopts.h defaults.h makeopts.embed_rules
316 # ensure that all module subdirectories are processed before 'main' during
317 # a parallel build, since if there are modules selected to be embedded the
318 # directories containing them must be completed before the main Asterisk
319 # binary can be built
320 main: $(filter-out main,$(MOD_SUBDIRS))
322 $(MOD_SUBDIRS):
323 @ASTCFLAGS="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" AST_LIBS="$(AST_LIBS)" $(MAKE) --no-print-directory --no-builtin-rules -C $@ SUBDIR=$@ all
325 $(OTHER_SUBDIRS):
326 @ASTCFLAGS="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" AUDIO_LIBS="$(AUDIO_LIBS)" $(MAKE) --no-print-directory --no-builtin-rules -C $@ SUBDIR=$@ all
328 defaults.h: makeopts
329 @build_tools/make_defaults_h > $@.tmp
330 @if cmp -s $@.tmp $@ ; then : ; else \
331 mv $@.tmp $@ ; \
333 @rm -f $@.tmp
335 include/asterisk/version.h:
336 @build_tools/make_version_h > $@.tmp
337 @if cmp -s $@.tmp $@ ; then : ; else \
338 mv $@.tmp $@ ; \
340 @rm -f $@.tmp
342 include/asterisk/buildopts.h: menuselect.makeopts
343 @build_tools/make_buildopts_h > $@.tmp
344 @if cmp -s $@.tmp $@ ; then : ; else \
345 mv $@.tmp $@ ; \
347 @rm -f $@.tmp
349 $(SUBDIRS_CLEAN):
350 @$(MAKE) --no-print-directory -C $(@:-clean=) clean
352 clean: $(SUBDIRS_CLEAN)
353 rm -f defaults.h
354 rm -f include/asterisk/build.h
355 rm -f include/asterisk/version.h
356 @$(MAKE) -C menuselect clean
357 cp -f .cleancount .lastclean
359 dist-clean: distclean
361 distclean: clean
362 @$(MAKE) -C menuselect dist-clean
363 @$(MAKE) -C sounds dist-clean
364 rm -f menuselect.makeopts makeopts menuselect-tree menuselect.makedeps
365 rm -f makeopts.embed_rules
366 rm -f config.log config.status
367 rm -rf autom4te.cache
368 rm -f include/asterisk/autoconfig.h
369 rm -f include/asterisk/buildopts.h
370 rm -rf doc/api
371 rm -f build_tools/menuselect-deps
373 datafiles: _all
374 if [ x`$(ID) -un` = xroot ]; then CFLAGS="$(ASTCFLAGS)" sh build_tools/mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig; fi
375 # Should static HTTP be installed during make samples or even with its own target ala
376 # webvoicemail? There are portions here that *could* be customized but might also be
377 # improved a lot. I'll put it here for now.
378 mkdir -p $(DESTDIR)$(ASTDATADIR)/static-http
379 for x in static-http/*; do \
380 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/static-http ; \
381 done
382 mkdir -p $(DESTDIR)$(ASTDATADIR)/images
383 for x in images/*.jpg; do \
384 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/images ; \
385 done
386 mkdir -p $(DESTDIR)$(AGI_DIR)
387 $(MAKE) -C sounds install
389 update:
390 @if [ -d .svn ]; then \
391 echo "Updating from Subversion..." ; \
392 svn update | tee update.out; \
393 rm -f .version; \
394 if [ `grep -c ^C update.out` -gt 0 ]; then \
395 echo ; echo "The following files have conflicts:" ; \
396 grep ^C update.out | cut -b4- ; \
397 fi ; \
398 rm -f update.out; \
399 else \
400 echo "Not under version control"; \
403 NEWHEADERS=$(notdir $(wildcard include/asterisk/*.h))
404 OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h)))
406 bininstall: _all
407 mkdir -p $(DESTDIR)$(MODULES_DIR)
408 mkdir -p $(DESTDIR)$(ASTSBINDIR)
409 mkdir -p $(DESTDIR)$(ASTETCDIR)
410 mkdir -p $(DESTDIR)$(ASTBINDIR)
411 mkdir -p $(DESTDIR)$(ASTVARRUNDIR)
412 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail
413 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/dictate
414 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/system
415 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/tmp
416 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/meetme
417 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/monitor
418 $(INSTALL) -m 755 main/asterisk $(DESTDIR)$(ASTSBINDIR)/
419 $(LN) -sf asterisk $(DESTDIR)$(ASTSBINDIR)/rasterisk
420 $(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
421 $(INSTALL) -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/
422 if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \
423 cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;' > $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ;\
424 chmod 755 $(DESTDIR)$(ASTSBINDIR)/safe_asterisk;\
426 $(INSTALL) -d $(DESTDIR)$(ASTHEADERDIR)
427 $(INSTALL) -m 644 include/asterisk.h $(DESTDIR)$(includedir)
428 $(INSTALL) -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
429 if [ -n "$(OLDHEADERS)" ]; then \
430 rm -f $(addprefix $(DESTDIR)$(ASTHEADERDIR)/,$(OLDHEADERS)) ;\
432 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
433 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-custom
434 mkdir -p $(DESTDIR)$(ASTDATADIR)/keys
435 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware
436 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware/iax
437 mkdir -p $(DESTDIR)$(ASTMANDIR)/man8
438 $(INSTALL) -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTDATADIR)/keys
439 $(INSTALL) -m 644 keys/freeworlddialup.pub $(DESTDIR)$(ASTDATADIR)/keys
440 $(INSTALL) -m 644 doc/asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
441 $(INSTALL) -m 644 contrib/scripts/astgenkey.8 $(DESTDIR)$(ASTMANDIR)/man8
442 $(INSTALL) -m 644 contrib/scripts/autosupport.8 $(DESTDIR)$(ASTMANDIR)/man8
443 $(INSTALL) -m 644 contrib/scripts/safe_asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
444 if [ -f contrib/firmware/iax/iaxy.bin ] ; then \
445 $(INSTALL) -m 644 contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTDATADIR)/firmware/iax/iaxy.bin; \
448 $(SUBDIRS_INSTALL):
449 @DESTDIR="$(DESTDIR)" ASTSBINDIR="$(ASTSBINDIR)" $(MAKE) -C $(@:-install=) install
451 NEWMODS=$(notdir $(wildcard */*.so))
452 OLDMODS=$(filter-out $(NEWMODS),$(notdir $(wildcard $(DESTDIR)$(MODULES_DIR)/*.so)))
454 oldmodcheck:
455 @if [ -n "$(OLDMODS)" ]; then \
456 echo " WARNING WARNING WARNING" ;\
457 echo "" ;\
458 echo " Your Asterisk modules directory, located at" ;\
459 echo " $(DESTDIR)$(MODULES_DIR)" ;\
460 echo " contains modules that were not installed by this " ;\
461 echo " version of Asterisk. Please ensure that these" ;\
462 echo " modules are compatible with this version before" ;\
463 echo " attempting to run Asterisk." ;\
464 echo "" ;\
465 for f in $(OLDMODS); do \
466 echo " $$f" ;\
467 done ;\
468 echo "" ;\
469 echo " WARNING WARNING WARNING" ;\
472 install: datafiles bininstall $(SUBDIRS_INSTALL)
473 @if [ -x /usr/sbin/asterisk-post-install ]; then \
474 /usr/sbin/asterisk-post-install $(DESTDIR) . ; \
476 @echo " +---- Asterisk Installation Complete -------+"
477 @echo " + +"
478 @echo " + YOU MUST READ THE SECURITY DOCUMENT +"
479 @echo " + +"
480 @echo " + Asterisk has successfully been installed. +"
481 @echo " + If you would like to install the sample +"
482 @echo " + configuration files (overwriting any +"
483 @echo " + existing config files), run: +"
484 @echo " + +"
485 @echo " + $(MAKE) samples +"
486 @echo " + +"
487 @echo " +----------------- or ---------------------+"
488 @echo " + +"
489 @echo " + You can go ahead and install the asterisk +"
490 @echo " + program documentation now or later run: +"
491 @echo " + +"
492 @echo " + $(MAKE) progdocs +"
493 @echo " + +"
494 @echo " + **Note** This requires that you have +"
495 @echo " + doxygen installed on your local system +"
496 @echo " +-------------------------------------------+"
497 @$(MAKE) -s oldmodcheck
499 upgrade: bininstall
501 adsi:
502 mkdir -p $(DESTDIR)$(ASTETCDIR)
503 for x in configs/*.adsi; do \
504 if [ ! -f $(DESTDIR)$(ASTETCDIR)/$$x ]; then \
505 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x` ; \
506 fi ; \
507 done
509 samples: adsi
510 mkdir -p $(DESTDIR)$(ASTETCDIR)
511 for x in configs/*.sample; do \
512 if [ -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ]; then \
513 if [ "$(OVERWRITE)" = "y" ]; then \
514 if cmp -s $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $$x ; then \
515 echo "Config file $$x is unchanged"; \
516 continue; \
517 fi ; \
518 mv -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample`.old ; \
519 else \
520 echo "Skipping config file $$x"; \
521 continue; \
522 fi ;\
523 fi ; \
524 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ;\
525 done
526 if [ "$(OVERWRITE)" = "y" ] || [ ! -f $(DESTDIR)$(ASTCONFPATH) ]; then \
528 echo "[directories]" ; \
529 echo "astetcdir => $(ASTETCDIR)" ; \
530 echo "astmoddir => $(MODULES_DIR)" ; \
531 echo "astvarlibdir => $(ASTVARLIBDIR)" ; \
532 echo "astdatadir => $(ASTDATADIR)" ; \
533 echo "astagidir => $(AGI_DIR)" ; \
534 echo "astspooldir => $(ASTSPOOLDIR)" ; \
535 echo "astrundir => $(ASTVARRUNDIR)" ; \
536 echo "astlogdir => $(ASTLOGDIR)" ; \
537 echo "" ; \
538 echo ";[options]" ; \
539 echo ";internal_timing = yes" ; \
540 echo ";systemname = my_system_name ; prefix uniqueid with a system name for global uniqueness issues" ; \
541 echo "; Changing the following lines may compromise your security." ; \
542 echo ";[files]" ; \
543 echo ";astctlpermissions = 0660" ; \
544 echo ";astctlowner = root" ; \
545 echo ";astctlgroup = apache" ; \
546 echo ";astctl = asterisk.ctl" ; \
547 ) > $(DESTDIR)$(ASTCONFPATH) ; \
548 else \
549 echo "Skipping asterisk.conf creation"; \
551 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
552 build_tools/make_sample_voicemail $(DESTDIR)/$(ASTDATADIR) $(DESTDIR)/$(ASTSPOOLDIR)
554 webvmail:
555 @[ -d $(DESTDIR)$(HTTP_DOCSDIR)/ ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 )
556 @[ -d $(DESTDIR)$(HTTP_CGIDIR) ] || ( printf "cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit 1 )
557 $(INSTALL) -m 4755 -o root -g root contrib/scripts/vmail.cgi $(DESTDIR)$(HTTP_CGIDIR)/vmail.cgi
558 mkdir -p $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk
559 for x in images/*.gif; do \
560 $(INSTALL) -m 644 $$x $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk/; \
561 done
562 @echo " +--------- Asterisk Web Voicemail ----------+"
563 @echo " + +"
564 @echo " + Asterisk Web Voicemail is installed in +"
565 @echo " + your cgi-bin directory: +"
566 @echo " + $(DESTDIR)$(HTTP_CGIDIR)"
567 @echo " + IT USES A SETUID ROOT PERL SCRIPT, SO +"
568 @echo " + IF YOU DON'T LIKE THAT, UNINSTALL IT! +"
569 @echo " + +"
570 @echo " + Other static items have been stored in: +"
571 @echo " + $(DESTDIR)$(HTTP_DOCSDIR)"
572 @echo " + +"
573 @echo " + If these paths do not match your httpd +"
574 @echo " + installation, correct the definitions +"
575 @echo " + in your Makefile of HTTP_CGIDIR and +"
576 @echo " + HTTP_DOCSDIR +"
577 @echo " + +"
578 @echo " +-------------------------------------------+"
580 spec:
581 sed "s/^Version:.*/Version: $(RPMVERSION)/g" redhat/asterisk.spec > asterisk.spec ; \
583 rpm: __rpm
585 __rpm: include/asterisk/version.h include/asterisk/buildopts.h spec
586 rm -rf /tmp/asterisk ; \
587 mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
588 $(MAKE) DESTDIR=/tmp/asterisk install ; \
589 $(MAKE) DESTDIR=/tmp/asterisk samples ; \
590 mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
591 cp -f contrib/init.d/rc.redhat.asterisk /tmp/asterisk/etc/rc.d/init.d/asterisk ; \
592 rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec
594 progdocs:
595 (cat contrib/asterisk-ng-doxygen; echo "HAVE_DOT=$(HAVEDOT)"; \
596 echo "PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen -
598 config:
599 @if [ "${OSARCH}" = "linux-gnu" ]; then \
600 if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \
601 $(INSTALL) -m 755 contrib/init.d/rc.redhat.asterisk /etc/rc.d/init.d/asterisk; \
602 /sbin/chkconfig --add asterisk; \
603 elif [ -f /etc/debian_version ]; then \
604 $(INSTALL) -m 755 contrib/init.d/rc.debian.asterisk /etc/init.d/asterisk; \
605 /usr/sbin/update-rc.d asterisk start 10 2 3 4 5 . stop 91 2 3 4 5 .; \
606 elif [ -f /etc/gentoo-release ]; then \
607 $(INSTALL) -m 755 contrib/init.d/rc.gentoo.asterisk /etc/init.d/asterisk; \
608 /sbin/rc-update add asterisk default; \
609 elif [ -f /etc/mandrake-release ]; then \
610 $(INSTALL) -m 755 contrib/init.d/rc.mandrake.asterisk /etc/rc.d/init.d/asterisk; \
611 /sbin/chkconfig --add asterisk; \
612 elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then \
613 $(INSTALL) -m 755 contrib/init.d/rc.suse.asterisk /etc/init.d/asterisk; \
614 /sbin/chkconfig --add asterisk; \
615 elif [ -f /etc/slackware-version ]; then \
616 echo "Slackware is not currently supported, although an init script does exist for it." \
617 else \
618 echo "We could not install init scripts for your distribution."; \
619 fi \
620 else \
621 echo "We could not install init scripts for your operating system."; \
624 sounds:
625 $(MAKE) -C sounds all
627 # If the cleancount has been changed, force a make clean.
628 # .cleancount is the global clean count, and .lastclean is the
629 # last clean count we had
631 cleantest:
632 @if ! cmp -s .cleancount .lastclean ; then \
633 $(MAKE) clean;\
636 $(SUBDIRS_UNINSTALL):
637 @$(MAKE) --no-print-directory -C $(@:-uninstall=) uninstall
639 _uninstall: $(SUBDIRS_UNINSTALL)
640 rm -f $(DESTDIR)$(MODULES_DIR)/*
641 rm -f $(DESTDIR)$(ASTSBINDIR)/*asterisk*
642 rm -f $(DESTDIR)$(ASTSBINDIR)/astgenkey
643 rm -f $(DESTDIR)$(ASTSBINDIR)/autosupport
644 rm -rf $(DESTDIR)$(ASTHEADERDIR)
645 rm -rf $(DESTDIR)$(ASTDATADIR)/firmware
646 rm -f $(DESTDIR)$(ASTMANDIR)/man8/asterisk.8
647 rm -f $(DESTDIR)$(ASTMANDIR)/man8/astgenkey.8
648 rm -f $(DESTDIR)$(ASTMANDIR)/man8/autosupport.8
649 rm -f $(DESTDIR)$(ASTMANDIR)/man8/safe_asterisk.8
650 $(MAKE) -C sounds uninstall
652 uninstall: _uninstall
653 @echo " +--------- Asterisk Uninstall Complete -----+"
654 @echo " + Asterisk binaries, sounds, man pages, +"
655 @echo " + headers, modules, and firmware builds, +"
656 @echo " + have all been uninstalled. +"
657 @echo " + +"
658 @echo " + To remove ALL traces of Asterisk, +"
659 @echo " + including configuration, spool +"
660 @echo " + directories, and logs, run the following +"
661 @echo " + command: +"
662 @echo " + +"
663 @echo " + $(MAKE) uninstall-all +"
664 @echo " +-------------------------------------------+"
666 uninstall-all: _uninstall
667 rm -rf $(DESTDIR)$(ASTLIBDIR)
668 rm -rf $(DESTDIR)$(ASTVARLIBDIR)
669 rm -rf $(DESTDIR)$(ASTDATADIR)
670 rm -rf $(DESTDIR)$(ASTSPOOLDIR)
671 rm -rf $(DESTDIR)$(ASTETCDIR)
672 rm -rf $(DESTDIR)$(ASTLOGDIR)
674 menuconfig: menuselect
676 gmenuconfig: gmenuselect
678 menuselect: menuselect/menuselect menuselect-tree
679 -@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!"
681 gmenuselect: menuselect/gmenuselect menuselect-tree
682 -@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!"
684 menuselect/menuselect: makeopts menuselect/menuselect.c menuselect/menuselect_curses.c menuselect/menuselect_stub.c menuselect/menuselect.h menuselect/linkedlists.h makeopts
685 @CC="$(HOST_CC)" LD="" AR="" RANLIB="" CFLAGS="" $(MAKE) -C menuselect CONFIGURE_SILENT="--silent"
687 menuselect/gmenuselect: makeopts menuselect/menuselect.c menuselect/menuselect_gtk.c menuselect/menuselect_stub.c menuselect/menuselect.h menuselect/linkedlists.h makeopts
688 @CC="$(HOST_CC)" CXX="$(CXX)" LD="" AR="" RANLIB="" CFLAGS="" $(MAKE) -C menuselect _gmenuselect CONFIGURE_SILENT="--silent"
690 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
691 @echo "Generating input for menuselect ..."
692 @build_tools/prep_moduledeps > $@
694 .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