Makefile 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  1. #
  2. # Asterisk -- A telephony toolkit for Linux.
  3. #
  4. # Top level Makefile
  5. #
  6. # Copyright (C) 1999, Mark Spencer
  7. #
  8. # Mark Spencer <markster@linux-support.net>
  9. #
  10. # This program is free software, distributed under the terms of
  11. # the GNU General Public License
  12. #
  13. .EXPORT_ALL_VARIABLES:
  14. # Create OPTIONS variable
  15. OPTIONS=
  16. OSARCH=$(shell uname -s)
  17. ifeq (${OSARCH},Linux)
  18. PROC=$(shell uname -m)
  19. ifeq ($(PROC),x86_64)
  20. # You must have GCC 3.4 to use k8, otherwise use athlon
  21. PROC=k8
  22. #PROC=athlon
  23. OPTIONS+=-m64
  24. endif
  25. ifeq ($(PROC),sparc64)
  26. #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
  27. #This works for even old (2.96) versions of gcc and provides a small boost either way.
  28. #A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
  29. #So we go lowest common available by gcc and go a step down, still a step up from
  30. #the default as we now have a better instruction set to work with. - Belgarath
  31. PROC=ultrasparc
  32. OPTIONS+=$(shell if $(CC) -mtune=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mtune=$(PROC)"; fi)
  33. OPTIONS+=$(shell if $(CC) -mcpu=v8 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mcpu=v8"; fi)
  34. OPTIONS+=-fomit-frame-pointer
  35. endif
  36. MPG123TARG=linux
  37. endif
  38. ifeq ($(findstring BSD,${OSARCH}),BSD)
  39. PROC=$(shell uname -m)
  40. endif
  41. # Pentium Pro Optimize
  42. #PROC=i686
  43. # Pentium & VIA processors optimize
  44. #PROC=i586
  45. #PROC=k6
  46. #PROC=ppc
  47. PWD=$(shell pwd)
  48. ######### More GSM codec optimization
  49. ######### Uncomment to enable MMXTM optimizations for x86 architecture CPU's
  50. ######### which support MMX instructions. This should be newer pentiums,
  51. ######### ppro's, etc, as well as the AMD K6 and K7.
  52. #K6OPT = -DK6OPT
  53. #Tell gcc to optimize the asterisk's code
  54. OPTIMIZE+=-O6
  55. #Include debug symbols in the executables (-g) and profiling info (-pg)
  56. DEBUG=-g #-pg
  57. # If you are running a radio application, define RADIO_RELAX so that the DTMF
  58. # will be received more reliably
  59. #OPTIONS += -DRADIO_RELAX
  60. # If you don't have a lot of memory (e.g. embedded Asterisk), uncomment the
  61. # following to reduce the size of certain static buffers
  62. #OPTIONS += -DLOW_MEMORY
  63. # Optional debugging parameters
  64. DEBUG_THREADS = #-DDEBUG_THREADS #-DDO_CRASH
  65. # Uncomment next one to enable ast_frame tracing (for debugging)
  66. TRACE_FRAMES = #-DTRACE_FRAMES
  67. # Uncomment next one to enable malloc debugging
  68. # You can view malloc debugging with:
  69. # *CLI> show memory allocations [filename]
  70. # *CLI> show memory summary [filename]
  71. #
  72. MALLOC_DEBUG = #-include $(PWD)/include/asterisk/astmm.h
  73. # Where to install asterisk after compiling
  74. # Default -> leave empty
  75. INSTALL_PREFIX=
  76. # Staging directory
  77. # Files are copied here temporarily during the install process
  78. # For example, make DESTDIR=/tmp/asterisk woud put things in
  79. # /tmp/asterisk/etc/asterisk
  80. DESTDIR=
  81. # Original busydetect routine
  82. BUSYDETECT = #-DBUSYDETECT
  83. # Improved busydetect routine, comment the previous one if you use this one
  84. BUSYDETECT+= -DBUSYDETECT_MARTIN
  85. # Detect the busy signal looking only at tone lengths
  86. # For example if you have 3 beeps 100ms tone, 100ms silence separated by 500 ms of silence
  87. BUSYDETECT+= #-DBUSYDETECT_TONEONLY
  88. # Inforce the detection of busy singal (get rid of false hangups)
  89. # Don't use together with -DBUSYDETECT_TONEONLY
  90. BUSYDETECT+= #-DBUSYDETECT_COMPARE_TONE_AND_SILENCE
  91. ASTLIBDIR=$(INSTALL_PREFIX)/usr/lib/asterisk
  92. ASTVARLIBDIR=$(INSTALL_PREFIX)/var/lib/asterisk
  93. ASTETCDIR=$(INSTALL_PREFIX)/etc/asterisk
  94. ASTSPOOLDIR=$(INSTALL_PREFIX)/var/spool/asterisk
  95. ASTLOGDIR=$(INSTALL_PREFIX)/var/log/asterisk
  96. ASTHEADERDIR=$(INSTALL_PREFIX)/usr/include/asterisk
  97. ASTCONFPATH=$(ASTETCDIR)/asterisk.conf
  98. ASTBINDIR=$(INSTALL_PREFIX)/usr/bin
  99. ASTSBINDIR=$(INSTALL_PREFIX)/usr/sbin
  100. ASTVARRUNDIR=$(INSTALL_PREFIX)/var/run
  101. ASTMANDIR=$(INSTALL_PREFIX)/usr/share/man
  102. MODULES_DIR=$(ASTLIBDIR)/modules
  103. AGI_DIR=$(ASTVARLIBDIR)/agi-bin
  104. INCLUDE=-Iinclude -I../include
  105. CFLAGS=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG) $(INCLUDE) -D_REENTRANT -D_GNU_SOURCE #-DMAKE_VALGRIND_HAPPY
  106. CFLAGS+=$(OPTIMIZE)
  107. ifneq ($(PROC),ultrasparc)
  108. CFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
  109. endif
  110. CFLAGS+=$(shell if uname -m | grep -q ppc; then echo "-fsigned-char"; fi)
  111. CFLAGS+=$(shell if [ -f /usr/include/osp/osp.h ]; then echo "-DOSP_SUPPORT -I/usr/include/osp" ; fi)
  112. ifeq (${OSARCH},FreeBSD)
  113. OSVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk)
  114. CFLAGS+=$(shell if test ${OSVERSION} -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
  115. LIBS+=$(shell if test ${OSVERSION} -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi)
  116. INCLUDE+=-I/usr/local/include
  117. CFLAGS+=$(shell if [ -d /usr/local/include/spandsp ]; then echo "-I/usr/local/include/spandsp"; fi)
  118. MPG123TARG=freebsd
  119. endif # FreeBSD
  120. ifeq (${OSARCH},NetBSD)
  121. CFLAGS+=-pthread
  122. INCLUDE+=-I/usr/local/include -I/usr/pkg/include
  123. MPG123TARG=netbsd
  124. endif
  125. ifeq (${OSARCH},OpenBSD)
  126. CFLAGS+=-pthread
  127. endif
  128. #Uncomment this to use the older DSP routines
  129. #CFLAGS+=-DOLD_DSP_ROUTINES
  130. CFLAGS+=$(shell if [ -f /usr/include/linux/zaptel.h ]; then echo "-DZAPTEL_OPTIMIZATIONS"; fi)
  131. CFLAGS+=$(shell if [ -f /usr/local/include/zaptel.h ]; then echo "-DZAPTEL_OPTIMIZATIONS"; fi)
  132. LIBEDIT=editline/libedit.a
  133. ASTERISKVERSION=$(shell if [ -f .version ]; then cat .version; else if [ -d CVS ]; then if [ -f CVS/Tag ] ; then echo "CVS-`sed 's/^T//g' CVS/Tag`-`date +"%D-%T"`"; else echo "CVS-HEAD-`date +"%D-%T"`"; fi; fi; fi)
  134. HTTPDIR=$(shell if [ -d /var/www ]; then echo "/var/www"; else echo "/home/httpd"; fi)
  135. RPMVERSION=$(shell if [ -f .version ]; then sed 's/[-\/:]/_/g' .version; else echo "unknown" ; fi)
  136. CFLAGS+=-DASTERISK_VERSION=\"$(ASTERISKVERSION)\"
  137. CFLAGS+=-DINSTALL_PREFIX=\"$(INSTALL_PREFIX)\"
  138. CFLAGS+=-DASTETCDIR=\"$(ASTETCDIR)\"
  139. CFLAGS+=-DASTLIBDIR=\"$(ASTLIBDIR)\"
  140. CFLAGS+=-DASTVARLIBDIR=\"$(ASTVARLIBDIR)\"
  141. CFLAGS+=-DASTVARRUNDIR=\"$(ASTVARRUNDIR)\"
  142. CFLAGS+=-DASTSPOOLDIR=\"$(ASTSPOOLDIR)\"
  143. CFLAGS+=-DASTLOGDIR=\"$(ASTLOGDIR)\"
  144. CFLAGS+=-DASTCONFPATH=\"$(ASTCONFPATH)\"
  145. CFLAGS+=-DASTMODDIR=\"$(MODULES_DIR)\"
  146. CFLAGS+=-DASTAGIDIR=\"$(AGI_DIR)\"
  147. CFLAGS+= $(DEBUG_THREADS)
  148. CFLAGS+= $(TRACE_FRAMES)
  149. CFLAGS+= $(MALLOC_DEBUG)
  150. CFLAGS+= $(BUSYDETECT)
  151. CFLAGS+= $(OPTIONS)
  152. CFLAGS+=# -fomit-frame-pointer
  153. SUBDIRS=res channels pbx apps codecs formats agi cdr astman stdtime
  154. ifeq (${OSARCH},Linux)
  155. LIBS=-ldl -lpthread
  156. endif
  157. LIBS+=-lncurses -lm
  158. ifeq (${OSARCH},Linux)
  159. LIBS+=-lresolv #-lnjamd
  160. endif
  161. ifeq (${OSARCH},Darwin)
  162. LIBS+=-lresolv
  163. endif
  164. ifeq (${OSARCH},FreeBSD)
  165. LIBS+=-lcrypto
  166. endif
  167. ifeq (${OSARCH},NetBSD)
  168. LIBS+=-lpthread -lcrypto -lm -L/usr/local/lib -L/usr/pkg/lib -lncurses
  169. endif
  170. ifeq (${OSARCH},OpenBSD)
  171. LIBS=-lcrypto -lpthread -lm -lncurses
  172. endif
  173. LIBS+=-lssl
  174. OBJS=io.o sched.o logger.o frame.o loader.o config.o channel.o \
  175. translate.o file.o say.o pbx.o cli.o md5.o term.o \
  176. ulaw.o alaw.o callerid.o fskmodem.o image.o app.o \
  177. cdr.o tdd.o acl.o rtp.o manager.o asterisk.o ast_expr.o \
  178. dsp.o chanvars.o indications.o autoservice.o db.o privacy.o \
  179. astmm.o enum.o srv.o dns.o aescrypt.o aestab.o aeskey.o \
  180. utils.o
  181. ifeq (${OSARCH},Darwin)
  182. ASTLINK=-Wl,-dynamic
  183. SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
  184. OBJS+= poll.o
  185. CFLAGS+=-DPOLLCOMPAT
  186. else
  187. ASTLINK=-Wl,-E
  188. SOLINK=-shared -Xlinker -x
  189. endif
  190. ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/sys/poll.h),)
  191. OBJS+= poll.o
  192. CFLAGS+=-DPOLLCOMPAT
  193. endif
  194. ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/dlfcn.h),)
  195. OBJS+= dhfcn.o
  196. CFLAGS+=-DDLFCNCOMPAT
  197. endif
  198. CC=gcc
  199. INSTALL=install
  200. _all: all
  201. @echo " +--------- Asterisk Build Complete ---------+"
  202. @echo " + Asterisk has successfully been built, but +"
  203. @echo " + cannot be run before being installed by +"
  204. @echo " + running: +"
  205. @echo " + +"
  206. @echo " + $(MAKE) install +"
  207. @echo " +-------------------------------------------+"
  208. all: depend asterisk subdirs
  209. editline/config.h:
  210. cd editline && unset CFLAGS LIBS && ./configure ; \
  211. editline/libedit.a: FORCE
  212. cd editline && unset CFLAGS LIBS && test -f config.h || ./configure
  213. $(MAKE) -C editline libedit.a
  214. db1-ast/libdb1.a: FORCE
  215. @if [ -d db1-ast ]; then \
  216. $(MAKE) -C db1-ast libdb1.a ; \
  217. else \
  218. echo "You need to do a cvs update -d not just cvs update"; \
  219. exit 1; \
  220. fi
  221. ifneq ($(wildcard .depend),)
  222. include .depend
  223. endif
  224. .PHONY: _version
  225. _version:
  226. if [ -d CVS ] && ! [ -f .version ]; then echo $(ASTERISKVERSION) > .version; fi
  227. .version: _version
  228. .y.c:
  229. bison $< --name-prefix=ast_yy -o $@
  230. ast_expr.o: ast_expr.c
  231. cli.o: cli.c build.h
  232. asterisk.o: asterisk.c build.h
  233. manpage: asterisk.8.gz
  234. asterisk.8.gz: asterisk.sgml
  235. rm -f asterisk.8
  236. docbook2man asterisk.sgml
  237. mv ./*.8 asterisk.8
  238. gzip asterisk.8
  239. ifneq ($(strip $(ASTERISKVERSION)),)
  240. build.h: .version
  241. ./make_build_h
  242. else
  243. build.h:
  244. ./make_build_h
  245. endif
  246. stdtime/libtime.a: FORCE
  247. @if [ -d stdtime ]; then \
  248. $(MAKE) -C stdtime libtime.a ; \
  249. else \
  250. echo "You need to do a cvs update -d not just cvs update"; \
  251. exit 1; \
  252. fi
  253. asterisk: editline/libedit.a db1-ast/libdb1.a stdtime/libtime.a $(OBJS)
  254. $(CC) $(DEBUG) -o asterisk $(ASTLINK) $(OBJS) $(LIBEDIT) db1-ast/libdb1.a stdtime/libtime.a $(LIBS)
  255. muted: muted.o
  256. $(CC) -o muted muted.o
  257. subdirs:
  258. for x in $(SUBDIRS); do $(MAKE) -C $$x || exit 1 ; done
  259. clean:
  260. for x in $(SUBDIRS); do $(MAKE) -C $$x clean || exit 1 ; done
  261. rm -f *.o *.so asterisk .depend
  262. rm -f build.h
  263. rm -f ast_expr.c
  264. @if [ -e editline/Makefile ]; then $(MAKE) -C editline distclean ; fi
  265. @if [ -d mpg123-0.59r ]; then $(MAKE) -C mpg123-0.59r clean; fi
  266. $(MAKE) -C db1-ast clean
  267. $(MAKE) -C stdtime clean
  268. datafiles: all
  269. mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/digits
  270. for x in sounds/digits/*.gsm; do \
  271. if grep -q "^%`basename $$x`%" sounds.txt; then \
  272. install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds/digits ; \
  273. else \
  274. echo "No description for $$x"; \
  275. exit 1; \
  276. fi; \
  277. done
  278. mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/letters
  279. for x in sounds/letters/*.gsm; do \
  280. if grep -q "^%`basename $$x`%" sounds.txt; then \
  281. install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds/letters ; \
  282. else \
  283. echo "No description for $$x"; \
  284. exit 1; \
  285. fi; \
  286. done
  287. mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/phonetic
  288. for x in sounds/phonetic/*.gsm; do \
  289. if grep -q "^%`basename $$x`%" sounds.txt; then \
  290. install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds/phonetic ; \
  291. else \
  292. echo "No description for $$x"; \
  293. exit 1; \
  294. fi; \
  295. done
  296. for x in 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/hello-*; do \
  297. if grep -q "^%`basename $$x`%" sounds.txt; then \
  298. install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds ; \
  299. else \
  300. echo "No description for $$x"; \
  301. exit 1; \
  302. fi; \
  303. done
  304. mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/mohmp3
  305. mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/images
  306. for x in images/*.jpg; do \
  307. install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/images ; \
  308. done
  309. mkdir -p $(DESTDIR)$(AGI_DIR)
  310. update:
  311. @if [ -d CVS ]; then \
  312. echo "Updating from CVS..." ; \
  313. cvs -q -z3 update -Pd; \
  314. rm -f .version; \
  315. else \
  316. echo "Not CVS"; \
  317. fi
  318. bininstall: all
  319. mkdir -p $(DESTDIR)$(MODULES_DIR)
  320. mkdir -p $(DESTDIR)$(ASTSBINDIR)
  321. mkdir -p $(DESTDIR)$(ASTETCDIR)
  322. mkdir -p $(DESTDIR)$(ASTBINDIR)
  323. mkdir -p $(DESTDIR)$(ASTSBINDIR)
  324. mkdir -p $(DESTDIR)$(ASTVARRUNDIR)
  325. mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail
  326. mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/tmp
  327. install -m 755 asterisk $(DESTDIR)$(ASTSBINDIR)/
  328. install -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
  329. install -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/
  330. if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \
  331. install -m 755 contrib/scripts/safe_asterisk $(DESTDIR)$(ASTSBINDIR)/ ;\
  332. fi
  333. for x in $(SUBDIRS); do $(MAKE) -C $$x install || exit 1 ; done
  334. install -d $(DESTDIR)$(ASTHEADERDIR)
  335. install -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
  336. rm -f $(DESTDIR)$(ASTVARLIBDIR)/sounds/vm
  337. rm -f $(DESTDIR)$(ASTVARLIBDIR)/sounds/voicemail
  338. if [ ! -h $(DESTDIR)$(ASTSPOOLDIR)/vm ] && [ -d $(DESTDIR)$(ASTSPOOLDIR)/vm ]; then \
  339. mv $(DESTDIR)$(ASTSPOOLDIR)/vm $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default; \
  340. else \
  341. mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default; \
  342. rm -f $(DESTDIR)$(ASTSPOOLDIR)/vm; \
  343. fi
  344. ln -s $(ASTSPOOLDIR)/voicemail/default $(DESTDIR)$(ASTSPOOLDIR)/vm
  345. mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds
  346. mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
  347. mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/keys
  348. mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/firmware
  349. mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/firmware/iax
  350. mkdir -p $(DESTDIR)$(ASTMANDIR)/man8
  351. install -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTVARLIBDIR)/keys
  352. install -m 644 keys/freeworlddialup.pub $(DESTDIR)$(ASTVARLIBDIR)/keys
  353. install -m 644 asterisk.8.gz $(DESTDIR)$(ASTMANDIR)/man8
  354. install -m 644 contrib/scripts/astgenkey.8 $(DESTDIR)$(ASTMANDIR)/man8
  355. install -m 644 contrib/scripts/autosupport.8 $(DESTDIR)$(ASTMANDIR)/man8
  356. install -m 644 contrib/scripts/safe_asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
  357. if [ -d contrib/firmware/iax ]; then \
  358. install -m 644 contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTVARLIBDIR)/firmware/iax/iaxy.bin; \
  359. else \
  360. echo "You need to do cvs update -d not just cvs update" ; \
  361. fi
  362. ( cd $(DESTDIR)$(ASTVARLIBDIR)/sounds ; ln -s $(ASTSPOOLDIR)/vm . )
  363. ( cd $(DESTDIR)$(ASTVARLIBDIR)/sounds ; ln -s $(ASTSPOOLDIR)/voicemail . )
  364. if [ -f mpg123-0.59r/mpg123 ]; then $(MAKE) -C mpg123-0.59r install; fi
  365. @echo " +---- Asterisk Installation Complete -------+"
  366. @echo " + +"
  367. @echo " + YOU MUST READ THE SECURITY DOCUMENT +"
  368. @echo " + +"
  369. @echo " + Asterisk has successfully been installed. +"
  370. @echo " + If you would like to install the sample +"
  371. @echo " + configuration files (overwriting any +"
  372. @echo " + existing config files), run: +"
  373. @echo " + +"
  374. @echo " + $(MAKE) samples +"
  375. @echo " + +"
  376. @echo " +----------------- or ---------------------+"
  377. @echo " + +"
  378. @echo " + You can go ahead and install the asterisk +"
  379. @echo " + program documentation now or later run: +"
  380. @echo " + +"
  381. @echo " + $(MAKE) progdocs +"
  382. @echo " + +"
  383. @echo " + **Note** This requires that you have +"
  384. @echo " + doxygen installed on your local system +"
  385. @echo " +-------------------------------------------+"
  386. @echo " + +"
  387. @echo " + ** NOTE FOR DOWNGRADING FROM CVS HEAD ** +"
  388. @echo " + +"
  389. @echo " + If you are downgrading from CVS HEAD to +"
  390. @echo " + a stable release, remember to delete +"
  391. @echo " + everything from your asterisk modules +"
  392. @echo " + directory (/usr/lib/asterisk/modules/) +"
  393. @echo " + and the asterisk header directory +"
  394. @echo " + (/usr/include/asterisk/) +"
  395. @echo " + before doing a '$(MAKE) install'. +"
  396. @echo " + +"
  397. @echo " +-------------------------------------------+"
  398. install: all datafiles bininstall
  399. upgrade: all bininstall
  400. adsi: all
  401. mkdir -p $(DESTDIR)$(ASTETCDIR)
  402. for x in configs/*.adsi; do \
  403. if ! [ -f $(DESTDIR)$(ASTETCDIRX)/$$x ]; then \
  404. install -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`basename $$x` ; \
  405. fi ; \
  406. done
  407. samples: all datafiles adsi
  408. mkdir -p $(DESTDIR)$(ASTETCDIR)
  409. for x in configs/*.sample; do \
  410. if [ -f $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` ]; then \
  411. mv -f $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample`.old ; \
  412. fi ; \
  413. install -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` ;\
  414. done
  415. echo "[directories]" > $(DESTDIR)$(ASTETCDIR)/asterisk.conf
  416. echo "astetcdir => $(ASTETCDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
  417. echo "astmoddir => $(MODULES_DIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
  418. echo "astvarlibdir => $(ASTVARLIBDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
  419. echo "astagidir => $(AGI_DIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
  420. echo "astspooldir => $(ASTSPOOLDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
  421. echo "astrundir => $(ASTVARRUNDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
  422. echo "astlogdir => $(ASTLOGDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
  423. for x in sounds/demo-*; do \
  424. if grep -q "^%`basename $$x`%" sounds.txt; then \
  425. install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds ; \
  426. else \
  427. echo "No description for $$x"; \
  428. exit 1; \
  429. fi; \
  430. done
  431. for x in sounds/*.mp3; do \
  432. install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/mohmp3 ; \
  433. done
  434. rm -f $(DESTDIR)$(ASTVARLIBDIR)/mohmp3/sample-hold.mp3
  435. mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
  436. :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm
  437. for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isunavail; do \
  438. cat $(DESTDIR)$(ASTVARLIBDIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm ; \
  439. done
  440. :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm
  441. for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isonphone; do \
  442. cat $(DESTDIR)$(ASTVARLIBDIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm ; \
  443. done
  444. webvmail:
  445. @[ -d $(DESTDIR)$(HTTPDIR) ] || ( echo "No HTTP directory" && exit 1 )
  446. @[ -d $(DESTDIR)$(HTTPDIR)/html ] || ( echo "No http directory" && exit 1 )
  447. @[ -d $(DESTDIR)$(HTTPDIR)/cgi-bin ] || ( echo "No cgi-bin directory" && exit 1 )
  448. install -m 4755 -o root -g root contrib/scripts/vmail.cgi $(DESTDIR)$(HTTPDIR)/cgi-bin/vmail.cgi
  449. mkdir -p $(DESTDIR)$(HTTPDIR)/html/_asterisk
  450. for x in images/*.gif; do \
  451. install -m 644 $$x $(DESTDIR)$(HTTPDIR)/html/_asterisk/; \
  452. done
  453. @echo " +--------- Asterisk Web Voicemail ----------+"
  454. @echo " + +"
  455. @echo " + Asterisk Web Voicemail is installed in +"
  456. @echo " + your cgi-bin directory. IT USES A SETUID +"
  457. @echo " + ROOT PERL SCRIPT, SO IF YOU DON'T LIKE +"
  458. @echo " + THAT, UNINSTALL IT! +"
  459. @echo " + +"
  460. @echo " +-------------------------------------------+"
  461. mailbox:
  462. ./contrib/scripts/addmailbox
  463. rpm: __rpm
  464. __rpm: _version
  465. rm -rf /tmp/asterisk ; \
  466. mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
  467. $(MAKE) DESTDIR=/tmp/asterisk install ; \
  468. $(MAKE) DESTDIR=/tmp/asterisk samples ; \
  469. mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
  470. cp -f redhat/asterisk /tmp/asterisk/etc/rc.d/init.d/ ; \
  471. sed "s/^Version:.*/Version: $(RPMVERSION)/g" redhat/asterisk.spec > asterisk.spec ; \
  472. rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec
  473. progdocs:
  474. doxygen contrib/asterisk-ng-doxygen
  475. mpg123:
  476. @wget -V >/dev/null || (echo "You need wget" ; false )
  477. [ -f mpg123-0.59r.tar.gz ] || wget http://www.mpg123.de/mpg123/mpg123-0.59r.tar.gz
  478. [ -d mpg123-0.59r ] || tar xfz mpg123-0.59r.tar.gz
  479. $(MAKE) -C mpg123-0.59r $(MPG123TARG)
  480. config:
  481. if [ -d /etc/rc.d/init.d ]; then \
  482. install -m 755 contrib/init.d/rc.redhat.asterisk /etc/rc.d/init.d/asterisk; \
  483. /sbin/chkconfig --add asterisk; \
  484. elif [ -d /etc/init.d ]; then \
  485. install -m 755 init.asterisk /etc/init.d/asterisk; \
  486. fi
  487. dont-optimize:
  488. $(MAKE) OPTIMIZE= K6OPT= install
  489. valgrind: dont-optimize
  490. depend: .depend
  491. for x in $(SUBDIRS); do $(MAKE) -C $$x depend || exit 1 ; done
  492. .depend:
  493. @if ! which mpg123 &>/dev/null ; then \
  494. echo "*** You don't have mpg123 installed. You're going to need ***";\
  495. echo "*** it if you want MusicOnHold ***";\
  496. elif ! mpg123 --longhelp 2>&1 | grep .59r &>/dev/null ; then \
  497. echo "*************************************************************";\
  498. echo "*** You have the WRONG version of mpg123... you need .59r ***";\
  499. echo "*** Use 'make mpg123' to get the right verison ***";\
  500. echo "*************************************************************";\
  501. fi
  502. ./mkdep ${CFLAGS} `ls *.c`
  503. FORCE:
  504. %_env:
  505. $(MAKE) -C $(shell echo $@ | sed "s/_env//g") env
  506. env:
  507. env