when building a version string for a developer branch, include the base branch in...
[asterisk-bristuff.git] / Makefile
blobb987a6fa7141c2a0e90918e01d8cca0979ad2699
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 ifeq ($(OSARCH),FreeBSD)
121 ASTVARLIBDIR=$(prefix)/share/asterisk
122 else
123 ASTVARLIBDIR=$(localstatedir)/lib/asterisk
124 endif
125 endif
126 ifeq ($(ASTDATADIR),)
127 ASTDATADIR:=$(ASTVARLIBDIR)
128 endif
130 # Asterisk.conf is located in ASTETCDIR or by using the -C flag
131 # when starting Asterisk
132 ASTCONFPATH=$(ASTETCDIR)/asterisk.conf
133 MODULES_DIR=$(ASTLIBDIR)/modules
134 AGI_DIR=$(ASTDATADIR)/agi-bin
136 # If you use Apache, you may determine by a grep 'DocumentRoot' of your httpd.conf file
137 HTTP_DOCSDIR=/var/www/html
138 # Determine by a grep 'ScriptAlias' of your Apache httpd.conf file
139 HTTP_CGIDIR=/var/www/cgi-bin
141 # Uncomment this to use the older DSP routines
142 #ASTCFLAGS+=-DOLD_DSP_ROUTINES
144 # If the file .asterisk.makeopts is present in your home directory, you can
145 # include all of your favorite menuselect options so that every time you download
146 # a new version of Asterisk, you don't have to run menuselect to set them.
147 # The file /etc/asterisk.makeopts will also be included but can be overridden
148 # by the file in your home directory.
150 GLOBAL_MAKEOPTS=$(wildcard /etc/asterisk.makeopts)
151 USER_MAKEOPTS=$(wildcard ~/.asterisk.makeopts)
153 MOD_SUBDIR_CFLAGS=-I$(ASTTOPDIR)/include
154 OTHER_SUBDIR_CFLAGS=-I$(ASTTOPDIR)/include
156 ifeq ($(OSARCH),linux-gnu)
157 ifeq ($(PROC),x86_64)
158 # You must have GCC 3.4 to use k8, otherwise use athlon
159 PROC=k8
160 #PROC=athlon
161 endif
163 ifeq ($(PROC),sparc64)
164 #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
165 #This works for even old (2.96) versions of gcc and provides a small boost either way.
166 #A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
167 #So we go lowest common available by gcc and go a step down, still a step up from
168 #the default as we now have a better instruction set to work with. - Belgarath
169 PROC=ultrasparc
170 OPTIONS+=$(shell if $(CC) -mtune=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mtune=$(PROC)"; fi)
171 OPTIONS+=$(shell if $(CC) -mcpu=v8 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mcpu=v8"; fi)
172 OPTIONS+=-fomit-frame-pointer
173 endif
175 ifeq ($(PROC),arm)
176 # The Cirrus logic is the only heavily shipping arm processor with a real floating point unit
177 ifeq ($(SUB_PROC),maverick)
178 OPTIONS+=-fsigned-char -mcpu=ep9312
179 else
180 ifeq ($(SUB_PROC),xscale)
181 OPTIONS+=-fsigned-char -mcpu=xscale
182 else
183 OPTIONS+=-fsigned-char
184 endif
185 endif
186 endif
187 endif
189 ASTCFLAGS+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG)
191 ASTCFLAGS+=-include $(ASTTOPDIR)/include/asterisk/autoconfig.h
193 ifeq ($(AST_DEVMODE),yes)
194 ASTCFLAGS+=-Werror -Wunused
195 endif
197 ifneq ($(findstring BSD,$(OSARCH)),)
198 ASTCFLAGS+=-I/usr/local/include
199 ASTLDFLAGS+=-L/usr/local/lib
200 endif
202 ifneq ($(PROC),ultrasparc)
203 ASTCFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
204 endif
206 ifeq ($(PROC),ppc)
207 ASTCFLAGS+=-fsigned-char
208 endif
210 ifeq ($(OSARCH),FreeBSD)
211 # -V is understood by BSD Make, not by GNU make.
212 BSDVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk)
213 ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
214 AST_LIBS+=$(shell if test $(BSDVERSION) -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi)
215 endif
217 ifeq ($(OSARCH),NetBSD)
218 ASTCFLAGS+=-pthread -I/usr/pkg/include
219 endif
221 ifeq ($(OSARCH),OpenBSD)
222 ASTCFLAGS+=-pthread
223 endif
225 ifeq ($(OSARCH),SunOS)
226 ASTCFLAGS+=-Wcast-align -DSOLARIS -I../include/solaris-compat -I/opt/ssl/include -I/usr/local/ssl/include
227 endif
229 ASTERISKVERSION:=$(shell build_tools/make_version .)
231 ifneq ($(wildcard .version),)
232 ASTERISKVERSIONNUM:=$(shell awk -F. '{printf "%01d%02d%02d", $$1, $$2, $$3}' .version)
233 RPMVERSION:=$(shell sed 's/[-\/:]/_/g' .version)
234 else
235 RPMVERSION=unknown
236 endif
238 ifneq ($(wildcard .svn),)
239 ASTERISKVERSIONNUM=999999
240 endif
242 ASTCFLAGS+=$(MALLOC_DEBUG)$(BUSYDETECT)$(OPTIONS)
244 MOD_SUBDIRS:=res channels pbx apps codecs formats cdr funcs main
245 OTHER_SUBDIRS:=utils agi
246 SUBDIRS:=$(OTHER_SUBDIRS) $(MOD_SUBDIRS)
247 SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)
248 SUBDIRS_CLEAN:=$(SUBDIRS:%=%-clean)
249 SUBDIRS_UNINSTALL:=$(SUBDIRS:%=%-uninstall)
250 MOD_SUBDIRS_EMBED_LDSCRIPT:=$(MOD_SUBDIRS:%=%-embed-ldscript)
251 MOD_SUBDIRS_EMBED_LDFLAGS:=$(MOD_SUBDIRS:%=%-embed-ldflags)
252 MOD_SUBDIRS_EMBED_LIBS:=$(MOD_SUBDIRS:%=%-embed-libs)
254 ifneq ($(findstring darwin,$(OSARCH)),)
255 ASTCFLAGS+=-D__Darwin__
256 AUDIO_LIBS=-framework CoreAudio
257 SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
258 else
259 # These are used for all but Darwin
260 SOLINK=-shared -Xlinker -x
261 ifneq ($(findstring BSD,$(OSARCH)),)
262 LDFLAGS+=-L/usr/local/lib
263 endif
264 endif
266 ifeq ($(OSARCH),SunOS)
267 SOLINK=-shared -fpic -L/usr/local/ssl/lib
268 endif
270 # This is used when generating the doxygen documentation
271 ifneq ($(DOT),:)
272 HAVEDOT=yes
273 else
274 HAVEDOT=no
275 endif
277 all: _all
278 @echo " +--------- Asterisk Build Complete ---------+"
279 @echo " + Asterisk has successfully been built, and +"
280 @echo " + can be installed by running: +"
281 @echo " + +"
282 @echo " + $(MAKE) install +"
283 @echo " +-------------------------------------------+"
285 _all: cleantest $(SUBDIRS)
287 makeopts: configure
288 @echo "****"
289 @echo "**** The configure script must be executed before running '$(MAKE)'."
290 @echo "**** Please run \"./configure\"."
291 @echo "****"
292 @exit 1
294 menuselect.makeopts: menuselect/menuselect menuselect-tree
295 menuselect/menuselect --check-deps $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts
297 $(MOD_SUBDIRS_EMBED_LDSCRIPT):
298 @echo "EMBED_LDSCRIPTS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-ldscript=) SUBDIR=$(@:-embed-ldscript=) __embed_ldscript` >> makeopts.embed_rules
300 $(MOD_SUBDIRS_EMBED_LDFLAGS):
301 @echo "EMBED_LDFLAGS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-ldflags=) SUBDIR=$(@:-embed-ldflags=) __embed_ldflags` >> makeopts.embed_rules
303 $(MOD_SUBDIRS_EMBED_LIBS):
304 @echo "EMBED_LIBS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-libs=) SUBDIR=$(@:-embed-libs=) __embed_libs` >> makeopts.embed_rules
306 makeopts.embed_rules: menuselect.makeopts
307 @echo "Generating embedded module rules ..."
308 @rm -f $@
309 @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LDSCRIPT)
310 @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LDFLAGS)
311 @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LIBS)
313 $(SUBDIRS): include/asterisk/version.h include/asterisk/buildopts.h defaults.h makeopts.embed_rules
315 # ensure that all module subdirectories are processed before 'main' during
316 # a parallel build, since if there are modules selected to be embedded the
317 # directories containing them must be completed before the main Asterisk
318 # binary can be built
319 main: $(filter-out main,$(MOD_SUBDIRS))
321 $(MOD_SUBDIRS):
322 @ASTCFLAGS="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" AST_LIBS="$(AST_LIBS)" $(MAKE) --no-print-directory --no-builtin-rules -C $@ SUBDIR=$@ all
324 $(OTHER_SUBDIRS):
325 @ASTCFLAGS="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" AUDIO_LIBS="$(AUDIO_LIBS)" $(MAKE) --no-print-directory --no-builtin-rules -C $@ SUBDIR=$@ all
327 defaults.h: makeopts
328 @build_tools/make_defaults_h > $@.tmp
329 @if cmp -s $@.tmp $@ ; then : ; else \
330 mv $@.tmp $@ ; \
332 @rm -f $@.tmp
334 include/asterisk/version.h:
335 @build_tools/make_version_h > $@.tmp
336 @if cmp -s $@.tmp $@ ; then : ; else \
337 mv $@.tmp $@ ; \
339 @rm -f $@.tmp
341 include/asterisk/buildopts.h: menuselect.makeopts
342 @build_tools/make_buildopts_h > $@.tmp
343 @if cmp -s $@.tmp $@ ; then : ; else \
344 mv $@.tmp $@ ; \
346 @rm -f $@.tmp
348 $(SUBDIRS_CLEAN):
349 @$(MAKE) --no-print-directory -C $(@:-clean=) clean
351 clean: $(SUBDIRS_CLEAN)
352 rm -f defaults.h
353 rm -f include/asterisk/build.h
354 rm -f include/asterisk/version.h
355 @$(MAKE) -C menuselect clean
356 cp -f .cleancount .lastclean
358 dist-clean: distclean
360 distclean: clean
361 @$(MAKE) -C menuselect dist-clean
362 @$(MAKE) -C sounds dist-clean
363 rm -f menuselect.makeopts makeopts menuselect-tree menuselect.makedeps
364 rm -f makeopts.embed_rules
365 rm -f config.log config.status
366 rm -rf autom4te.cache
367 rm -f include/asterisk/autoconfig.h
368 rm -f include/asterisk/buildopts.h
369 rm -rf doc/api
370 rm -f build_tools/menuselect-deps
372 datafiles: _all
373 if [ x`$(ID) -un` = xroot ]; then CFLAGS="$(ASTCFLAGS)" sh build_tools/mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig; fi
374 # Should static HTTP be installed during make samples or even with its own target ala
375 # webvoicemail? There are portions here that *could* be customized but might also be
376 # improved a lot. I'll put it here for now.
377 mkdir -p $(DESTDIR)$(ASTDATADIR)/static-http
378 for x in static-http/*; do \
379 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/static-http ; \
380 done
381 mkdir -p $(DESTDIR)$(ASTDATADIR)/images
382 for x in images/*.jpg; do \
383 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/images ; \
384 done
385 mkdir -p $(DESTDIR)$(AGI_DIR)
386 $(MAKE) -C sounds install
388 update:
389 @if [ -d .svn ]; then \
390 echo "Updating from Subversion..." ; \
391 svn update | tee update.out; \
392 rm -f .version; \
393 if [ `grep -c ^C update.out` -gt 0 ]; then \
394 echo ; echo "The following files have conflicts:" ; \
395 grep ^C update.out | cut -b4- ; \
396 fi ; \
397 rm -f update.out; \
398 else \
399 echo "Not under version control"; \
402 NEWHEADERS=$(notdir $(wildcard include/asterisk/*.h))
403 OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h)))
405 bininstall: _all
406 mkdir -p $(DESTDIR)$(MODULES_DIR)
407 mkdir -p $(DESTDIR)$(ASTSBINDIR)
408 mkdir -p $(DESTDIR)$(ASTETCDIR)
409 mkdir -p $(DESTDIR)$(ASTBINDIR)
410 mkdir -p $(DESTDIR)$(ASTVARRUNDIR)
411 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail
412 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/dictate
413 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/system
414 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/tmp
415 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/meetme
416 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/monitor
417 $(INSTALL) -m 755 main/asterisk $(DESTDIR)$(ASTSBINDIR)/
418 $(LN) -sf asterisk $(DESTDIR)$(ASTSBINDIR)/rasterisk
419 $(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
420 $(INSTALL) -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/
421 if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \
422 cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;' > $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ;\
423 chmod 755 $(DESTDIR)$(ASTSBINDIR)/safe_asterisk;\
425 $(INSTALL) -d $(DESTDIR)$(ASTHEADERDIR)
426 $(INSTALL) -m 644 include/asterisk.h $(DESTDIR)$(includedir)
427 $(INSTALL) -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
428 if [ -n "$(OLDHEADERS)" ]; then \
429 rm -f $(addprefix $(DESTDIR)$(ASTHEADERDIR)/,$(OLDHEADERS)) ;\
431 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
432 mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-custom
433 mkdir -p $(DESTDIR)$(ASTDATADIR)/keys
434 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware
435 mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware/iax
436 mkdir -p $(DESTDIR)$(ASTMANDIR)/man8
437 $(INSTALL) -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTDATADIR)/keys
438 $(INSTALL) -m 644 keys/freeworlddialup.pub $(DESTDIR)$(ASTDATADIR)/keys
439 $(INSTALL) -m 644 doc/asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
440 $(INSTALL) -m 644 contrib/scripts/astgenkey.8 $(DESTDIR)$(ASTMANDIR)/man8
441 $(INSTALL) -m 644 contrib/scripts/autosupport.8 $(DESTDIR)$(ASTMANDIR)/man8
442 $(INSTALL) -m 644 contrib/scripts/safe_asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
443 if [ -f contrib/firmware/iax/iaxy.bin ] ; then \
444 $(INSTALL) -m 644 contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTDATADIR)/firmware/iax/iaxy.bin; \
447 $(SUBDIRS_INSTALL):
448 @DESTDIR="$(DESTDIR)" ASTSBINDIR="$(ASTSBINDIR)" $(MAKE) -C $(@:-install=) install
450 NEWMODS=$(notdir $(wildcard */*.so))
451 OLDMODS=$(filter-out $(NEWMODS),$(notdir $(wildcard $(DESTDIR)$(MODULES_DIR)/*.so)))
453 oldmodcheck:
454 @if [ -n "$(OLDMODS)" ]; then \
455 echo " WARNING WARNING WARNING" ;\
456 echo "" ;\
457 echo " Your Asterisk modules directory, located at" ;\
458 echo " $(DESTDIR)$(MODULES_DIR)" ;\
459 echo " contains modules that were not installed by this " ;\
460 echo " version of Asterisk. Please ensure that these" ;\
461 echo " modules are compatible with this version before" ;\
462 echo " attempting to run Asterisk." ;\
463 echo "" ;\
464 for f in $(OLDMODS); do \
465 echo " $$f" ;\
466 done ;\
467 echo "" ;\
468 echo " WARNING WARNING WARNING" ;\
471 install: datafiles bininstall $(SUBDIRS_INSTALL)
472 @if [ -x /usr/sbin/asterisk-post-install ]; then \
473 /usr/sbin/asterisk-post-install $(DESTDIR) . ; \
475 @echo " +---- Asterisk Installation Complete -------+"
476 @echo " + +"
477 @echo " + YOU MUST READ THE SECURITY DOCUMENT +"
478 @echo " + +"
479 @echo " + Asterisk has successfully been installed. +"
480 @echo " + If you would like to install the sample +"
481 @echo " + configuration files (overwriting any +"
482 @echo " + existing config files), run: +"
483 @echo " + +"
484 @echo " + $(MAKE) samples +"
485 @echo " + +"
486 @echo " +----------------- or ---------------------+"
487 @echo " + +"
488 @echo " + You can go ahead and install the asterisk +"
489 @echo " + program documentation now or later run: +"
490 @echo " + +"
491 @echo " + $(MAKE) progdocs +"
492 @echo " + +"
493 @echo " + **Note** This requires that you have +"
494 @echo " + doxygen installed on your local system +"
495 @echo " +-------------------------------------------+"
496 @$(MAKE) -s oldmodcheck
498 upgrade: bininstall
500 adsi:
501 mkdir -p $(DESTDIR)$(ASTETCDIR)
502 for x in configs/*.adsi; do \
503 if [ ! -f $(DESTDIR)$(ASTETCDIR)/$$x ]; then \
504 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x` ; \
505 fi ; \
506 done
508 samples: adsi
509 mkdir -p $(DESTDIR)$(ASTETCDIR)
510 for x in configs/*.sample; do \
511 if [ -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ]; then \
512 if [ "$(OVERWRITE)" = "y" ]; then \
513 if cmp -s $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $$x ; then \
514 echo "Config file $$x is unchanged"; \
515 continue; \
516 fi ; \
517 mv -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample`.old ; \
518 else \
519 echo "Skipping config file $$x"; \
520 continue; \
521 fi ;\
522 fi ; \
523 $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ;\
524 done
525 if [ "$(OVERWRITE)" = "y" ] || [ ! -f $(DESTDIR)$(ASTCONFPATH) ]; then \
527 echo "[directories]" ; \
528 echo "astetcdir => $(ASTETCDIR)" ; \
529 echo "astmoddir => $(MODULES_DIR)" ; \
530 echo "astvarlibdir => $(ASTVARLIBDIR)" ; \
531 echo "astdatadir => $(ASTDATADIR)" ; \
532 echo "astagidir => $(AGI_DIR)" ; \
533 echo "astspooldir => $(ASTSPOOLDIR)" ; \
534 echo "astrundir => $(ASTVARRUNDIR)" ; \
535 echo "astlogdir => $(ASTLOGDIR)" ; \
536 echo "" ; \
537 echo ";[options]" ; \
538 echo ";internal_timing = yes" ; \
539 echo ";systemname = my_system_name ; prefix uniqueid with a system name for global uniqueness issues" ; \
540 echo "; Changing the following lines may compromise your security." ; \
541 echo ";[files]" ; \
542 echo ";astctlpermissions = 0660" ; \
543 echo ";astctlowner = root" ; \
544 echo ";astctlgroup = apache" ; \
545 echo ";astctl = asterisk.ctl" ; \
546 ) > $(DESTDIR)$(ASTCONFPATH) ; \
547 else \
548 echo "Skipping asterisk.conf creation"; \
550 mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
551 build_tools/make_sample_voicemail $(DESTDIR)/$(ASTDATADIR) $(DESTDIR)/$(ASTSPOOLDIR)
553 webvmail:
554 @[ -d $(DESTDIR)$(HTTP_DOCSDIR)/ ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 )
555 @[ -d $(DESTDIR)$(HTTP_CGIDIR) ] || ( printf "cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit 1 )
556 $(INSTALL) -m 4755 -o root -g root contrib/scripts/vmail.cgi $(DESTDIR)$(HTTP_CGIDIR)/vmail.cgi
557 mkdir -p $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk
558 for x in images/*.gif; do \
559 $(INSTALL) -m 644 $$x $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk/; \
560 done
561 @echo " +--------- Asterisk Web Voicemail ----------+"
562 @echo " + +"
563 @echo " + Asterisk Web Voicemail is installed in +"
564 @echo " + your cgi-bin directory: +"
565 @echo " + $(DESTDIR)$(HTTP_CGIDIR)"
566 @echo " + IT USES A SETUID ROOT PERL SCRIPT, SO +"
567 @echo " + IF YOU DON'T LIKE THAT, UNINSTALL IT! +"
568 @echo " + +"
569 @echo " + Other static items have been stored in: +"
570 @echo " + $(DESTDIR)$(HTTP_DOCSDIR)"
571 @echo " + +"
572 @echo " + If these paths do not match your httpd +"
573 @echo " + installation, correct the definitions +"
574 @echo " + in your Makefile of HTTP_CGIDIR and +"
575 @echo " + HTTP_DOCSDIR +"
576 @echo " + +"
577 @echo " +-------------------------------------------+"
579 spec:
580 sed "s/^Version:.*/Version: $(RPMVERSION)/g" redhat/asterisk.spec > asterisk.spec ; \
582 rpm: __rpm
584 __rpm: include/asterisk/version.h include/asterisk/buildopts.h spec
585 rm -rf /tmp/asterisk ; \
586 mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
587 $(MAKE) DESTDIR=/tmp/asterisk install ; \
588 $(MAKE) DESTDIR=/tmp/asterisk samples ; \
589 mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
590 cp -f contrib/init.d/rc.redhat.asterisk /tmp/asterisk/etc/rc.d/init.d/asterisk ; \
591 rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec
593 progdocs:
594 (cat contrib/asterisk-ng-doxygen; echo "HAVE_DOT=$(HAVEDOT)"; \
595 echo "PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen -
597 config:
598 @if [ "${OSARCH}" = "linux-gnu" ]; then \
599 if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \
600 $(INSTALL) -m 755 contrib/init.d/rc.redhat.asterisk /etc/rc.d/init.d/asterisk; \
601 /sbin/chkconfig --add asterisk; \
602 elif [ -f /etc/debian_version ]; then \
603 $(INSTALL) -m 755 contrib/init.d/rc.debian.asterisk /etc/init.d/asterisk; \
604 /usr/sbin/update-rc.d asterisk start 10 2 3 4 5 . stop 91 2 3 4 5 .; \
605 elif [ -f /etc/gentoo-release ]; then \
606 $(INSTALL) -m 755 contrib/init.d/rc.gentoo.asterisk /etc/init.d/asterisk; \
607 /sbin/rc-update add asterisk default; \
608 elif [ -f /etc/mandrake-release ]; then \
609 $(INSTALL) -m 755 contrib/init.d/rc.mandrake.asterisk /etc/rc.d/init.d/asterisk; \
610 /sbin/chkconfig --add asterisk; \
611 elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then \
612 $(INSTALL) -m 755 contrib/init.d/rc.suse.asterisk /etc/init.d/asterisk; \
613 /sbin/chkconfig --add asterisk; \
614 elif [ -f /etc/slackware-version ]; then \
615 echo "Slackware is not currently supported, although an init script does exist for it." \
616 else \
617 echo "We could not install init scripts for your distribution."; \
618 fi \
619 else \
620 echo "We could not install init scripts for your operating system."; \
623 sounds:
624 $(MAKE) -C sounds all
626 # If the cleancount has been changed, force a make clean.
627 # .cleancount is the global clean count, and .lastclean is the
628 # last clean count we had
630 cleantest:
631 @if ! cmp -s .cleancount .lastclean ; then \
632 $(MAKE) clean;\
635 $(SUBDIRS_UNINSTALL):
636 @$(MAKE) --no-print-directory -C $(@:-uninstall=) uninstall
638 _uninstall: $(SUBDIRS_UNINSTALL)
639 rm -f $(DESTDIR)$(MODULES_DIR)/*
640 rm -f $(DESTDIR)$(ASTSBINDIR)/*asterisk*
641 rm -f $(DESTDIR)$(ASTSBINDIR)/astgenkey
642 rm -f $(DESTDIR)$(ASTSBINDIR)/autosupport
643 rm -rf $(DESTDIR)$(ASTHEADERDIR)
644 rm -rf $(DESTDIR)$(ASTDATADIR)/firmware
645 rm -rf $(DESTDIR)$(ASTMANDIR)/man8
646 $(MAKE) -C sounds uninstall
648 uninstall: _uninstall
649 @echo " +--------- Asterisk Uninstall Complete -----+"
650 @echo " + Asterisk binaries, sounds, man pages, +"
651 @echo " + headers, modules, and firmware builds, +"
652 @echo " + have all been uninstalled. +"
653 @echo " + +"
654 @echo " + To remove ALL traces of Asterisk, +"
655 @echo " + including configuration, spool +"
656 @echo " + directories, and logs, run the following +"
657 @echo " + command: +"
658 @echo " + +"
659 @echo " + $(MAKE) uninstall-all +"
660 @echo " +-------------------------------------------+"
662 uninstall-all: _uninstall
663 rm -rf $(DESTDIR)$(ASTLIBDIR)
664 rm -rf $(DESTDIR)$(ASTVARLIBDIR)
665 rm -rf $(DESTDIR)$(ASTDATADIR)
666 rm -rf $(DESTDIR)$(ASTSPOOLDIR)
667 rm -rf $(DESTDIR)$(ASTETCDIR)
668 rm -rf $(DESTDIR)$(ASTLOGDIR)
670 menuconfig: menuselect
672 gmenuconfig: gmenuselect
674 menuselect: menuselect/menuselect menuselect-tree
675 -@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!"
677 gmenuselect: menuselect/gmenuselect menuselect-tree
678 -@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!"
680 menuselect/menuselect: makeopts menuselect/menuselect.c menuselect/menuselect_curses.c menuselect/menuselect_stub.c menuselect/menuselect.h menuselect/linkedlists.h makeopts
681 @CC="$(HOST_CC)" LD="" AR="" RANLIB="" $(MAKE) -C menuselect CONFIGURE_SILENT="--silent"
683 menuselect/gmenuselect: makeopts menuselect/menuselect.c menuselect/menuselect_gtk.c menuselect/menuselect_stub.c menuselect/menuselect.h menuselect/linkedlists.h makeopts
684 @CC="$(HOST_CC)" CXX="$(CXX)" LD="" AR="" RANLIB="" $(MAKE) -C menuselect _gmenuselect CONFIGURE_SILENT="--silent"
686 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
687 @echo "Generating input for menuselect ..."
688 @build_tools/prep_moduledeps > $@
690 .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