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