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