Makefile 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961
  1. #
  2. # Asterisk -- A telephony toolkit for Linux.
  3. #
  4. # Top level Makefile
  5. #
  6. # Copyright (C) 1999-2010, 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. # All Makefiles use the following variables:
  14. #
  15. # ASTCFLAGS - compiler options provided by the user (if any)
  16. # _ASTCFLAGS - compiler options provided by the build system
  17. # ASTLDFLAGS - linker flags (not libraries) provided by the user (if any)
  18. # _ASTLDFLAGS - linker flags (not libraries) provided by the build system
  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
  23. #
  24. # Values for ASTCFLAGS and ASTLDFLAGS can be specified in the
  25. # environment when running make, as follows:
  26. #
  27. # $ ASTCFLAGS="-Werror" make ...
  28. #
  29. # or as a variable value on the make command line itself:
  30. #
  31. # $ make ASTCFLAGS="-Werror" ...
  32. export ASTTOPDIR # Top level dir, used in subdirs' Makefiles
  33. export ASTERISKVERSION
  34. export ASTERISKVERSIONNUM
  35. #--- values used for default paths
  36. # DESTDIR is the staging (or final) directory where files are copied
  37. # during the install process. Define it before 'export', otherwise
  38. # export will set it to the empty string making ?= fail.
  39. # WARNING: do not put spaces or comments after the value.
  40. DESTDIR?=$(INSTALL_PATH)
  41. export DESTDIR
  42. export INSTALL_PATH # Additional prefix for the following paths
  43. export ASTETCDIR # Path for config files
  44. export ASTVARRUNDIR
  45. export MODULES_DIR
  46. export ASTSPOOLDIR
  47. export ASTVARLIBDIR
  48. export ASTDATADIR
  49. export ASTDBDIR
  50. export ASTLOGDIR
  51. export ASTLIBDIR
  52. export ASTMANDIR
  53. export ASTHEADERDIR
  54. export ASTSBINDIR
  55. export AGI_DIR
  56. export ASTCONFPATH
  57. export ASTKEYDIR
  58. export OSARCH # Operating system
  59. export PROC # Processor type
  60. export NOISY_BUILD # Used in Makefile.rules
  61. export MENUSELECT_CFLAGS # Options selected in menuselect.
  62. export AST_DEVMODE # Set to "yes" for additional compiler
  63. # and runtime checks
  64. export SOLINK # linker flags for shared objects
  65. export STATIC_BUILD # Additional cflags, set to -static
  66. # for static builds. Probably
  67. # should go directly to ASTLDFLAGS
  68. #--- paths to various commands
  69. export CC
  70. export CXX
  71. export AR
  72. export RANLIB
  73. export HOST_CC
  74. export BUILD_CC
  75. export INSTALL
  76. export STRIP
  77. export DOWNLOAD
  78. export AWK
  79. export GREP
  80. export MD5
  81. export WGET_EXTRA_ARGS
  82. # even though we could use '-include makeopts' here, use a wildcard
  83. # lookup anyway, so that make won't try to build makeopts if it doesn't
  84. # exist (other rules will force it to be built if needed)
  85. ifneq ($(wildcard makeopts),)
  86. include makeopts
  87. endif
  88. # start the primary CFLAGS and LDFLAGS with any that were provided
  89. # to the configure script
  90. _ASTCFLAGS:=$(CONFIG_CFLAGS)
  91. _ASTLDFLAGS:=$(CONFIG_LDFLAGS)
  92. # Some build systems, such as the one in openwrt, like to pass custom target
  93. # CFLAGS and LDFLAGS in the COPTS and LDOPTS variables; these should also
  94. # go before any build-system computed flags, since they are defaults, not
  95. # overrides
  96. _ASTCFLAGS+=$(COPTS)
  97. _ASTLDFLAGS+=$(LDOPTS)
  98. # libxml2 cflags
  99. _ASTCFLAGS+=$(LIBXML2_INCLUDE)
  100. #Uncomment this to see all build commands instead of 'quiet' output
  101. #NOISY_BUILD=yes
  102. empty:=
  103. space:=$(empty) $(empty)
  104. ASTTOPDIR:=$(subst $(space),\$(space),$(CURDIR))
  105. # Overwite config files on "make samples"
  106. OVERWRITE=y
  107. # Include debug and macro symbols in the executables (-g) and profiling info (-pg)
  108. DEBUG=-g3
  109. # Asterisk.conf is located in ASTETCDIR or by using the -C flag
  110. # when starting Asterisk
  111. ASTCONFPATH=$(ASTETCDIR)/asterisk.conf
  112. MODULES_DIR=$(ASTLIBDIR)/modules
  113. AGI_DIR=$(ASTDATADIR)/agi-bin
  114. # If you use Apache, you may determine by a grep 'DocumentRoot' of your httpd.conf file
  115. HTTP_DOCSDIR=/var/www/html
  116. # Determine by a grep 'ScriptAlias' of your Apache httpd.conf file
  117. HTTP_CGIDIR=/var/www/cgi-bin
  118. # If your platform's linker expects a prefix on symbols generated from compiling C
  119. # source files, set LINKER_SYMBOL_PREFIX to that value. On some systems, exported symbols
  120. # from C source files are prefixed with '_', for example. If this value is not set
  121. # properly, the linker scripts that live in the '*.exports' files in various places
  122. # in this tree will unintentionally suppress symbols that should be visible
  123. # in the final binary objects.
  124. LINKER_SYMBOL_PREFIX=
  125. # Uncomment this to use the older DSP routines
  126. #_ASTCFLAGS+=-DOLD_DSP_ROUTINES
  127. # If the file .asterisk.makeopts is present in your home directory, you can
  128. # include all of your favorite menuselect options so that every time you download
  129. # a new version of Asterisk, you don't have to run menuselect to set them.
  130. # The file /etc/asterisk.makeopts will also be included but can be overridden
  131. # by the file in your home directory.
  132. GLOBAL_MAKEOPTS=$(wildcard /etc/asterisk.makeopts)
  133. USER_MAKEOPTS=$(wildcard ~/.asterisk.makeopts)
  134. MOD_SUBDIR_CFLAGS="-I$(ASTTOPDIR)/include"
  135. OTHER_SUBDIR_CFLAGS="-I$(ASTTOPDIR)/include"
  136. # Create OPTIONS variable, but probably we can assign directly to ASTCFLAGS
  137. OPTIONS=
  138. ifeq ($(OSARCH),linux-gnu)
  139. ifeq ($(PROC),x86_64)
  140. # You must have GCC 3.4 to use k8, otherwise use athlon
  141. PROC=k8
  142. #PROC=athlon
  143. endif
  144. ifeq ($(PROC),sparc64)
  145. #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
  146. #This works for even old (2.96) versions of gcc and provides a small boost either way.
  147. #A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
  148. #So we go lowest common available by gcc and go a step down, still a step up from
  149. #the default as we now have a better instruction set to work with. - Belgarath
  150. PROC=ultrasparc
  151. OPTIONS+=$(shell if $(CC) -mtune=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mtune=$(PROC)"; fi)
  152. OPTIONS+=$(shell if $(CC) -mcpu=v8 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mcpu=v8"; fi)
  153. OPTIONS+=-fomit-frame-pointer
  154. endif
  155. ifeq ($(PROC),arm)
  156. # The Cirrus logic is the only heavily shipping arm processor with a real floating point unit
  157. ifeq ($(SUB_PROC),maverick)
  158. OPTIONS+=-fsigned-char -mcpu=ep9312
  159. else
  160. ifeq ($(SUB_PROC),xscale)
  161. OPTIONS+=-fsigned-char -mcpu=xscale
  162. else
  163. OPTIONS+=-fsigned-char
  164. endif
  165. endif
  166. endif
  167. endif
  168. ifeq ($(findstring -save-temps,$(_ASTCFLAGS) $(ASTCFLAGS)),)
  169. ifeq ($(findstring -pipe,$(_ASTCFLAGS) $(ASTCFLAGS)),)
  170. _ASTCFLAGS+=-pipe
  171. endif
  172. endif
  173. ifeq ($(findstring -Wall,$(_ASTCFLAGS) $(ASTCFLAGS)),)
  174. _ASTCFLAGS+=-Wall
  175. endif
  176. _ASTCFLAGS+=-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG)
  177. ifeq ($(AST_DEVMODE),yes)
  178. _ASTCFLAGS+=-Werror
  179. _ASTCFLAGS+=-Wunused
  180. _ASTCFLAGS+=$(AST_DECLARATION_AFTER_STATEMENT)
  181. _ASTCFLAGS+=$(AST_FORTIFY_SOURCE)
  182. _ASTCFLAGS+=-Wundef
  183. _ASTCFLAGS+=-Wmissing-format-attribute
  184. _ASTCFLAGS+=-Wformat=2
  185. endif
  186. ifneq ($(findstring BSD,$(OSARCH)),)
  187. _ASTCFLAGS+=-isystem /usr/local/include
  188. endif
  189. ifeq ($(findstring -march,$(_ASTCFLAGS) $(ASTCFLAGS)),)
  190. ifneq ($(PROC),ultrasparc)
  191. _ASTCFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
  192. endif
  193. endif
  194. ifeq ($(PROC),ppc)
  195. _ASTCFLAGS+=-fsigned-char
  196. endif
  197. ifeq ($(OSARCH),FreeBSD)
  198. ifeq ($(PROC),i386)
  199. _ASTCFLAGS+=-march=i686
  200. endif
  201. # -V is understood by BSD Make, not by GNU make.
  202. BSDVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk)
  203. _ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
  204. endif
  205. ifeq ($(OSARCH),NetBSD)
  206. _ASTCFLAGS+=-pthread -I/usr/pkg/include
  207. endif
  208. ifeq ($(OSARCH),OpenBSD)
  209. _ASTCFLAGS+=-pthread -ftrampolines
  210. endif
  211. ifeq ($(OSARCH),SunOS)
  212. _ASTCFLAGS+=-Wcast-align -DSOLARIS -I../include/solaris-compat -I/opt/ssl/include -I/usr/local/ssl/include -D_XPG4_2 -D__EXTENSIONS__
  213. endif
  214. ASTERISKVERSION:=$(shell GREP=$(GREP) AWK=$(AWK) build_tools/make_version .)
  215. ifneq ($(wildcard .version),)
  216. ASTERISKVERSIONNUM:=$(shell $(AWK) -F. '{printf "%01d%02d%02d", $$1, $$2, $$3}' .version)
  217. endif
  218. ifneq ($(wildcard .svn),)
  219. ASTERISKVERSIONNUM:=999999
  220. endif
  221. _ASTCFLAGS+=$(OPTIONS)
  222. MOD_SUBDIRS:=channels pbx apps codecs formats cdr cel bridges funcs tests main res addons $(LOCAL_MOD_SUBDIRS)
  223. OTHER_SUBDIRS:=utils agi
  224. SUBDIRS:=$(OTHER_SUBDIRS) $(MOD_SUBDIRS)
  225. SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)
  226. SUBDIRS_CLEAN:=$(SUBDIRS:%=%-clean)
  227. SUBDIRS_DIST_CLEAN:=$(SUBDIRS:%=%-dist-clean)
  228. SUBDIRS_UNINSTALL:=$(SUBDIRS:%=%-uninstall)
  229. MOD_SUBDIRS_EMBED_LDSCRIPT:=$(MOD_SUBDIRS:%=%-embed-ldscript)
  230. MOD_SUBDIRS_EMBED_LDFLAGS:=$(MOD_SUBDIRS:%=%-embed-ldflags)
  231. MOD_SUBDIRS_EMBED_LIBS:=$(MOD_SUBDIRS:%=%-embed-libs)
  232. MOD_SUBDIRS_MENUSELECT_TREE:=$(MOD_SUBDIRS:%=%-menuselect-tree)
  233. ifneq ($(findstring darwin,$(OSARCH)),)
  234. _ASTCFLAGS+=-D__Darwin__
  235. SOLINK=-bundle -Xlinker -macosx_version_min -Xlinker 10.4 -Xlinker -undefined -Xlinker dynamic_lookup -force_flat_namespace
  236. ifeq ($(shell if test `/usr/bin/sw_vers -productVersion | cut -c4` -gt 5; then echo 6; else echo 0; fi),6)
  237. SOLINK+=/usr/lib/bundle1.o
  238. endif
  239. _ASTLDFLAGS+=-L/usr/local/lib
  240. else
  241. # These are used for all but Darwin
  242. SOLINK=-shared
  243. ifneq ($(findstring BSD,$(OSARCH)),)
  244. _ASTLDFLAGS+=-L/usr/local/lib
  245. endif
  246. endif
  247. ifeq ($(OSARCH),SunOS)
  248. SOLINK=-shared -fpic -L/usr/local/ssl/lib -lrt
  249. endif
  250. ifeq ($(OSARCH),OpenBSD)
  251. SOLINK=-shared -fpic
  252. endif
  253. # comment to print directories during submakes
  254. #PRINT_DIR=yes
  255. ifneq ($(INSIDE_EMACS),)
  256. PRINT_DIR=yes
  257. endif
  258. SILENTMAKE:=$(MAKE) --quiet --no-print-directory
  259. ifneq ($(PRINT_DIR)$(NOISY_BUILD),)
  260. SUBMAKE:=$(MAKE)
  261. else
  262. SUBMAKE:=$(MAKE) --quiet --no-print-directory
  263. endif
  264. # This is used when generating the doxygen documentation
  265. ifneq ($(DOT),:)
  266. HAVEDOT=yes
  267. else
  268. HAVEDOT=no
  269. endif
  270. # $(MAKE) is printed in several places, and we want it to be a
  271. # fixed size string. Define a variable whose name has also the
  272. # same size, so we can easily align text.
  273. ifeq ($(MAKE), gmake)
  274. mK="gmake"
  275. else
  276. mK=" make"
  277. endif
  278. all: _all
  279. @echo " +--------- Asterisk Build Complete ---------+"
  280. @echo " + Asterisk has successfully been built, and +"
  281. @echo " + can be installed by running: +"
  282. @echo " + +"
  283. @echo " + $(mK) install +"
  284. @echo " +-------------------------------------------+"
  285. _all: cleantest makeopts $(SUBDIRS) doc/core-en_US.xml
  286. makeopts: configure
  287. @echo "****"
  288. @echo "**** The configure script must be executed before running '$(MAKE)'."
  289. @echo "**** Please run \"./configure\"."
  290. @echo "****"
  291. @exit 1
  292. menuselect.makeopts: menuselect/menuselect menuselect-tree makeopts build_tools/menuselect-deps $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS)
  293. ifeq ($(filter %menuselect,$(MAKECMDGOALS)),)
  294. menuselect/menuselect --check-deps $@
  295. menuselect/menuselect --check-deps $@ $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS)
  296. endif
  297. $(MOD_SUBDIRS_EMBED_LDSCRIPT):
  298. +@echo "EMBED_LDSCRIPTS+="`$(SILENTMAKE) -C $(@:-embed-ldscript=) SUBDIR=$(@:-embed-ldscript=) __embed_ldscript` >> makeopts.embed_rules
  299. $(MOD_SUBDIRS_EMBED_LDFLAGS):
  300. +@echo "EMBED_LDFLAGS+="`$(SILENTMAKE) -C $(@:-embed-ldflags=) SUBDIR=$(@:-embed-ldflags=) __embed_ldflags` >> makeopts.embed_rules
  301. $(MOD_SUBDIRS_EMBED_LIBS):
  302. +@echo "EMBED_LIBS+="`$(SILENTMAKE) -C $(@:-embed-libs=) SUBDIR=$(@:-embed-libs=) __embed_libs` >> makeopts.embed_rules
  303. $(MOD_SUBDIRS_MENUSELECT_TREE):
  304. +@$(SUBMAKE) -C $(@:-menuselect-tree=) SUBDIR=$(@:-menuselect-tree=) moduleinfo
  305. +@$(SUBMAKE) -C $(@:-menuselect-tree=) SUBDIR=$(@:-menuselect-tree=) makeopts
  306. makeopts.embed_rules: menuselect.makeopts
  307. @echo "Generating embedded module rules ..."
  308. @rm -f $@
  309. +@$(SUBMAKE) $(MOD_SUBDIRS_EMBED_LDSCRIPT)
  310. +@$(SUBMAKE) $(MOD_SUBDIRS_EMBED_LDFLAGS)
  311. +@$(SUBMAKE) $(MOD_SUBDIRS_EMBED_LIBS)
  312. $(SUBDIRS): main/version.c include/asterisk/version.h include/asterisk/build.h include/asterisk/buildopts.h defaults.h makeopts.embed_rules
  313. ifeq ($(findstring $(OSARCH), mingw32 cygwin ),)
  314. # Non-windows:
  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))
  320. else
  321. # Windows: we need to build main (i.e. the asterisk dll) first,
  322. # followed by res, followed by the other directories, because
  323. # dll symbols must be resolved during linking and not at runtime.
  324. D1:= $(filter-out main,$(MOD_SUBDIRS))
  325. D1:= $(filter-out res,$(D1))
  326. $(D1): res
  327. res: main
  328. endif
  329. $(MOD_SUBDIRS):
  330. +@_ASTCFLAGS="$(MOD_SUBDIR_CFLAGS) $(_ASTCFLAGS)" ASTCFLAGS="$(ASTCFLAGS)" _ASTLDFLAGS="$(_ASTLDFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" $(SUBMAKE) --no-builtin-rules -C $@ SUBDIR=$@ all
  331. $(OTHER_SUBDIRS):
  332. +@_ASTCFLAGS="$(OTHER_SUBDIR_CFLAGS) $(_ASTCFLAGS)" ASTCFLAGS="$(ASTCFLAGS)" _ASTLDFLAGS="$(_ASTLDFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" $(SUBMAKE) --no-builtin-rules -C $@ SUBDIR=$@ all
  333. defaults.h: makeopts
  334. @build_tools/make_defaults_h > $@.tmp
  335. @cmp -s $@.tmp $@ || mv $@.tmp $@
  336. @rm -f $@.tmp
  337. main/version.c: FORCE
  338. @build_tools/make_version_c > $@.tmp
  339. @cmp -s $@.tmp $@ || mv $@.tmp $@
  340. @rm -f $@.tmp
  341. include/asterisk/version.h: FORCE
  342. @build_tools/make_version_h > $@.tmp
  343. @cmp -s $@.tmp $@ || mv $@.tmp $@
  344. @rm -f $@.tmp
  345. include/asterisk/buildopts.h: menuselect.makeopts
  346. @build_tools/make_buildopts_h > $@.tmp
  347. @cmp -s $@.tmp $@ || mv $@.tmp $@
  348. @rm -f $@.tmp
  349. include/asterisk/build.h:
  350. @build_tools/make_build_h > $@.tmp
  351. @cmp -s $@.tmp $@ || mv $@.tmp $@
  352. @rm -f $@.tmp
  353. $(SUBDIRS_CLEAN):
  354. +@$(SUBMAKE) -C $(@:-clean=) clean
  355. $(SUBDIRS_DIST_CLEAN):
  356. +@$(SUBMAKE) -C $(@:-dist-clean=) dist-clean
  357. clean: $(SUBDIRS_CLEAN) _clean
  358. _clean:
  359. rm -f defaults.h
  360. rm -f include/asterisk/build.h
  361. rm -f main/version.c
  362. rm -f include/asterisk/version.h
  363. @$(MAKE) -C menuselect clean
  364. cp -f .cleancount .lastclean
  365. dist-clean: distclean
  366. distclean: $(SUBDIRS_DIST_CLEAN) _clean
  367. @$(MAKE) -C menuselect dist-clean
  368. @$(MAKE) -C sounds dist-clean
  369. rm -f menuselect.makeopts makeopts menuselect-tree menuselect.makedeps
  370. rm -f makeopts.embed_rules
  371. rm -f config.log config.status config.cache
  372. rm -rf autom4te.cache
  373. rm -f include/asterisk/autoconfig.h
  374. rm -f include/asterisk/buildopts.h
  375. rm -rf doc/api
  376. rm -f build_tools/menuselect-deps
  377. datafiles: _all doc/core-en_US.xml
  378. CFLAGS="$(_ASTCFLAGS) $(ASTCFLAGS)" build_tools/mkpkgconfig "$(DESTDIR)$(libdir)/pkgconfig";
  379. # Should static HTTP be installed during make samples or even with its own target ala
  380. # webvoicemail? There are portions here that *could* be customized but might also be
  381. # improved a lot. I'll put it here for now.
  382. for x in static-http/*; do \
  383. $(INSTALL) -m 644 $$x "$(DESTDIR)$(ASTDATADIR)/static-http" ; \
  384. done
  385. $(INSTALL) -m 644 doc/core-en_US.xml "$(DESTDIR)$(ASTDATADIR)/static-http";
  386. for x in images/*.jpg; do \
  387. $(INSTALL) -m 644 $$x "$(DESTDIR)$(ASTDATADIR)/images" ; \
  388. done
  389. $(MAKE) -C sounds install
  390. doc/core-en_US.xml: $(foreach dir,$(MOD_SUBDIRS),$(shell $(GREP) -l "language=\"en_US\"" $(dir)/*.c $(dir)/*.cc 2>/dev/null))
  391. @printf "Building Documentation For: "
  392. @echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > $@
  393. @echo "<!DOCTYPE docs SYSTEM \"appdocsxml.dtd\">" >> $@
  394. @echo "<docs xmlns:xi=\"http://www.w3.org/2001/XInclude\">" >> $@
  395. @for x in $(MOD_SUBDIRS); do \
  396. printf "$$x " ; \
  397. for i in $$x/*.c; do \
  398. $(AWK) -f build_tools/get_documentation $$i >> $@ ; \
  399. done ; \
  400. done
  401. @echo
  402. @echo "</docs>" >> $@
  403. validate-docs: doc/core-en_US.xml
  404. ifeq ($(XMLSTARLET)$(XMLLINT),::)
  405. @echo "--------------------------------------------------------------------------"
  406. @echo "--- Please install xmllint or xmlstarlet to validate the documentation ---"
  407. @echo "--------------------------------------------------------------------------"
  408. else
  409. ifneq ($(XMLLINT),:)
  410. $(XMLLINT) --dtdvalid doc/appdocsxml.dtd --noout $<
  411. else
  412. $(XMLSTARLET) val -d doc/appdocsxml.dtd $<
  413. endif
  414. endif
  415. update:
  416. @if [ -d .svn ]; then \
  417. echo "Updating from Subversion..." ; \
  418. fromrev="`svn info | $(AWK) '/Revision: / {print $$2}'`"; \
  419. svn update | tee update.out; \
  420. torev="`svn info | $(AWK) '/Revision: / {print $$2}'`"; \
  421. echo "`date` Updated from revision $${fromrev} to $${torev}." >> update.log; \
  422. rm -f .version; \
  423. if [ `grep -c ^C update.out` -gt 0 ]; then \
  424. echo ; echo "The following files have conflicts:" ; \
  425. grep ^C update.out | cut -b4- ; \
  426. fi ; \
  427. rm -f update.out; \
  428. else \
  429. echo "Not under version control"; \
  430. fi
  431. NEWHEADERS=$(notdir $(wildcard include/asterisk/*.h))
  432. OLDHEADERS=$(filter-out $(NEWHEADERS) $(notdir $(DESTDIR)$(ASTHEADERDIR)),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h)))
  433. installdirs:
  434. $(INSTALL) -d "$(DESTDIR)$(MODULES_DIR)"
  435. $(INSTALL) -d "$(DESTDIR)$(ASTSBINDIR)"
  436. $(INSTALL) -d "$(DESTDIR)$(ASTETCDIR)"
  437. $(INSTALL) -d "$(DESTDIR)$(ASTVARRUNDIR)"
  438. $(INSTALL) -d "$(DESTDIR)$(ASTSPOOLDIR)"
  439. $(INSTALL) -d "$(DESTDIR)$(ASTSPOOLDIR)/dictate"
  440. $(INSTALL) -d "$(DESTDIR)$(ASTSPOOLDIR)/meetme"
  441. $(INSTALL) -d "$(DESTDIR)$(ASTSPOOLDIR)/monitor"
  442. $(INSTALL) -d "$(DESTDIR)$(ASTSPOOLDIR)/system"
  443. $(INSTALL) -d "$(DESTDIR)$(ASTSPOOLDIR)/tmp"
  444. $(INSTALL) -d "$(DESTDIR)$(ASTSPOOLDIR)/voicemail"
  445. $(INSTALL) -d "$(DESTDIR)$(ASTHEADERDIR)"
  446. $(INSTALL) -d "$(DESTDIR)$(ASTHEADERDIR)/doxygen"
  447. $(INSTALL) -d "$(DESTDIR)$(ASTLOGDIR)"
  448. $(INSTALL) -d "$(DESTDIR)$(ASTLOGDIR)/cdr-csv"
  449. $(INSTALL) -d "$(DESTDIR)$(ASTLOGDIR)/cdr-custom"
  450. $(INSTALL) -d "$(DESTDIR)$(ASTLOGDIR)/cel-custom"
  451. $(INSTALL) -d "$(DESTDIR)$(ASTDATADIR)"
  452. $(INSTALL) -d "$(DESTDIR)$(ASTDATADIR)/documentation"
  453. $(INSTALL) -d "$(DESTDIR)$(ASTDATADIR)/documentation/thirdparty"
  454. $(INSTALL) -d "$(DESTDIR)$(ASTDATADIR)/firmware"
  455. $(INSTALL) -d "$(DESTDIR)$(ASTDATADIR)/firmware/iax"
  456. $(INSTALL) -d "$(DESTDIR)$(ASTDATADIR)/images"
  457. $(INSTALL) -d "$(DESTDIR)$(ASTDATADIR)/keys"
  458. $(INSTALL) -d "$(DESTDIR)$(ASTDATADIR)/phoneprov"
  459. $(INSTALL) -d "$(DESTDIR)$(ASTDATADIR)/static-http"
  460. $(INSTALL) -d "$(DESTDIR)$(ASTDATADIR)/sounds"
  461. $(INSTALL) -d "$(DESTDIR)$(ASTDATADIR)/moh"
  462. $(INSTALL) -d "$(DESTDIR)$(ASTMANDIR)/man8"
  463. $(INSTALL) -d "$(DESTDIR)$(AGI_DIR)"
  464. $(INSTALL) -d "$(DESTDIR)$(ASTDBDIR)"
  465. bininstall: _all installdirs $(SUBDIRS_INSTALL)
  466. $(INSTALL) -m 755 main/asterisk "$(DESTDIR)$(ASTSBINDIR)/"
  467. $(LN) -sf asterisk "$(DESTDIR)$(ASTSBINDIR)/rasterisk"
  468. $(INSTALL) -m 755 contrib/scripts/astgenkey "$(DESTDIR)$(ASTSBINDIR)/"
  469. $(INSTALL) -m 755 contrib/scripts/autosupport "$(DESTDIR)$(ASTSBINDIR)/"
  470. if [ ! -f "$(DESTDIR)$(ASTSBINDIR)/safe_asterisk" -a ! -f /sbin/launchd ]; then \
  471. cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;' > contrib/scripts/safe.tmp ; \
  472. $(INSTALL) -m 755 contrib/scripts/safe.tmp "$(DESTDIR)$(ASTSBINDIR)/safe_asterisk" ; \
  473. rm -f contrib/scripts/safe.tmp ; \
  474. fi
  475. $(INSTALL) -m 644 include/asterisk.h "$(DESTDIR)$(includedir)"
  476. $(INSTALL) -m 644 include/asterisk/*.h "$(DESTDIR)$(ASTHEADERDIR)"
  477. $(INSTALL) -m 644 include/asterisk/doxygen/*.h "$(DESTDIR)$(ASTHEADERDIR)/doxygen"
  478. if [ -n "$(OLDHEADERS)" ]; then \
  479. for h in $(OLDHEADERS); do rm -f "$(DESTDIR)$(ASTHEADERDIR)/$$h"; done \
  480. fi
  481. $(INSTALL) -m 644 doc/core-*.xml "$(DESTDIR)$(ASTDATADIR)/documentation"
  482. $(INSTALL) -m 644 doc/appdocsxml.dtd "$(DESTDIR)$(ASTDATADIR)/documentation"
  483. $(INSTALL) -m 644 doc/asterisk.8 "$(DESTDIR)$(ASTMANDIR)/man8"
  484. $(INSTALL) -m 644 contrib/scripts/astgenkey.8 "$(DESTDIR)$(ASTMANDIR)/man8"
  485. $(INSTALL) -m 644 contrib/scripts/autosupport.8 "$(DESTDIR)$(ASTMANDIR)/man8"
  486. $(INSTALL) -m 644 contrib/scripts/safe_asterisk.8 "$(DESTDIR)$(ASTMANDIR)/man8"
  487. if [ -f contrib/firmware/iax/iaxy.bin ] ; then \
  488. $(INSTALL) -m 644 contrib/firmware/iax/iaxy.bin "$(DESTDIR)$(ASTDATADIR)/firmware/iax/iaxy.bin"; \
  489. fi
  490. $(SUBDIRS_INSTALL):
  491. +@DESTDIR="$(DESTDIR)" ASTSBINDIR="$(ASTSBINDIR)" $(SUBMAKE) -C $(@:-install=) install
  492. NEWMODS:=$(foreach d,$(MOD_SUBDIRS),$(notdir $(wildcard $(d)/*.so)))
  493. OLDMODS=$(filter-out $(NEWMODS) $(notdir $(DESTDIR)$(MODULES_DIR)),$(notdir $(wildcard $(DESTDIR)$(MODULES_DIR)/*.so)))
  494. oldmodcheck:
  495. @if [ -n "$(OLDMODS)" ]; then \
  496. echo " WARNING WARNING WARNING" ;\
  497. echo "" ;\
  498. echo " Your Asterisk modules directory, located at" ;\
  499. echo " $(DESTDIR)$(MODULES_DIR)" ;\
  500. echo " contains modules that were not installed by this " ;\
  501. echo " version of Asterisk. Please ensure that these" ;\
  502. echo " modules are compatible with this version before" ;\
  503. echo " attempting to run Asterisk." ;\
  504. echo "" ;\
  505. for f in $(OLDMODS); do \
  506. echo " $$f" ;\
  507. done ;\
  508. echo "" ;\
  509. echo " WARNING WARNING WARNING" ;\
  510. fi
  511. badshell:
  512. ifneq ($(findstring ~,$(DESTDIR)),)
  513. @echo "Your shell doesn't do ~ expansion when expected (specifically, when doing \"make install DESTDIR=~/path\")."
  514. @echo "Try replacing ~ with \$$HOME, as in \"make install DESTDIR=\$$HOME/path\"."
  515. @exit 1
  516. endif
  517. install: badshell bininstall datafiles
  518. @if [ -x /usr/sbin/asterisk-post-install ]; then \
  519. /usr/sbin/asterisk-post-install "$(DESTDIR)" . ; \
  520. fi
  521. @echo " +---- Asterisk Installation Complete -------+"
  522. @echo " + +"
  523. @echo " + YOU MUST READ THE SECURITY DOCUMENT +"
  524. @echo " + +"
  525. @echo " + Asterisk has successfully been installed. +"
  526. @echo " + If you would like to install the sample +"
  527. @echo " + configuration files (overwriting any +"
  528. @echo " + existing config files), run: +"
  529. @echo " + +"
  530. @echo " + $(mK) samples +"
  531. @echo " + +"
  532. @echo " +----------------- or ---------------------+"
  533. @echo " + +"
  534. @echo " + You can go ahead and install the asterisk +"
  535. @echo " + program documentation now or later run: +"
  536. @echo " + +"
  537. @echo " + $(mK) progdocs +"
  538. @echo " + +"
  539. @echo " + **Note** This requires that you have +"
  540. @echo " + doxygen installed on your local system +"
  541. @echo " +-------------------------------------------+"
  542. @$(MAKE) -s oldmodcheck
  543. isntall: install
  544. upgrade: bininstall
  545. # XXX why *.adsi is installed first ?
  546. adsi:
  547. @echo Installing adsi config files...
  548. $(INSTALL) -d "$(DESTDIR)$(ASTETCDIR)"
  549. @for x in configs/*.adsi; do \
  550. dst="$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x`" ; \
  551. if [ -f "$${dst}" ] ; then \
  552. echo "Overwriting $$x" ; \
  553. else \
  554. echo "Installing $$x" ; \
  555. fi ; \
  556. $(INSTALL) -m 644 "$$x" "$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x`" ; \
  557. done
  558. samples: adsi
  559. @echo Installing other config files...
  560. @for x in configs/*.sample; do \
  561. dst="$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample`" ; \
  562. if [ -f "$${dst}" ]; then \
  563. if [ "$(OVERWRITE)" = "y" ]; then \
  564. if cmp -s "$${dst}" "$$x" ; then \
  565. echo "Config file $$x is unchanged"; \
  566. continue; \
  567. fi ; \
  568. mv -f "$${dst}" "$${dst}.old" ; \
  569. else \
  570. echo "Skipping config file $$x"; \
  571. continue; \
  572. fi ;\
  573. fi ; \
  574. echo "Installing file $$x"; \
  575. $(INSTALL) -m 644 "$$x" "$${dst}" ;\
  576. done
  577. if [ "$(OVERWRITE)" = "y" ]; then \
  578. echo "Updating asterisk.conf" ; \
  579. sed -e 's|^astetcdir.*$$|astetcdir => $(ASTETCDIR)|' \
  580. -e 's|^astmoddir.*$$|astmoddir => $(MODULES_DIR)|' \
  581. -e 's|^astvarlibdir.*$$|astvarlibdir => $(ASTVARLIBDIR)|' \
  582. -e 's|^astdbdir.*$$|astdbdir => $(ASTDBDIR)|' \
  583. -e 's|^astkeydir.*$$|astkeydir => $(ASTKEYDIR)|' \
  584. -e 's|^astdatadir.*$$|astdatadir => $(ASTDATADIR)|' \
  585. -e 's|^astagidir.*$$|astagidir => $(AGI_DIR)|' \
  586. -e 's|^astspooldir.*$$|astspooldir => $(ASTSPOOLDIR)|' \
  587. -e 's|^astrundir.*$$|astrundir => $(ASTVARRUNDIR)|' \
  588. -e 's|^astlogdir.*$$|astlogdir => $(ASTLOGDIR)|' \
  589. "$(DESTDIR)$(ASTCONFPATH)" > "$(DESTDIR)$(ASTCONFPATH).tmp" ; \
  590. $(INSTALL) -m 644 "$(DESTDIR)$(ASTCONFPATH).tmp" "$(DESTDIR)$(ASTCONFPATH)" ; \
  591. rm -f "$(DESTDIR)$(ASTCONFPATH).tmp" ; \
  592. fi ; \
  593. $(INSTALL) -d "$(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX"
  594. build_tools/make_sample_voicemail "$(DESTDIR)/$(ASTDATADIR)" "$(DESTDIR)/$(ASTSPOOLDIR)"
  595. @for x in phoneprov/*; do \
  596. dst="$(DESTDIR)$(ASTDATADIR)/$$x" ; \
  597. if [ -f "$${dst}" ]; then \
  598. if [ "$(OVERWRITE)" = "y" ]; then \
  599. if cmp -s "$${dst}" "$$x" ; then \
  600. echo "Config file $$x is unchanged"; \
  601. continue; \
  602. fi ; \
  603. mv -f "$${dst}" "$${dst}.old" ; \
  604. else \
  605. echo "Skipping config file $$x"; \
  606. continue; \
  607. fi ;\
  608. fi ; \
  609. echo "Installing file $$x"; \
  610. $(INSTALL) -m 644 "$$x" "$${dst}" ;\
  611. done
  612. webvmail:
  613. @[ -d "$(DESTDIR)$(HTTP_DOCSDIR)/" ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 )
  614. @[ -d "$(DESTDIR)$(HTTP_CGIDIR)" ] || ( printf "cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit 1 )
  615. $(INSTALL) -m 4755 contrib/scripts/vmail.cgi "$(DESTDIR)$(HTTP_CGIDIR)/vmail.cgi"
  616. $(INSTALL) -d "$(DESTDIR)$(HTTP_DOCSDIR)/_asterisk"
  617. for x in images/*.gif; do \
  618. $(INSTALL) -m 644 $$x "$(DESTDIR)$(HTTP_DOCSDIR)/_asterisk/"; \
  619. done
  620. @echo " +--------- Asterisk Web Voicemail ----------+"
  621. @echo " + +"
  622. @echo " + Asterisk Web Voicemail is installed in +"
  623. @echo " + your cgi-bin directory: +"
  624. @echo " + $(DESTDIR)$(HTTP_CGIDIR)"
  625. @echo " + IT USES A SETUID ROOT PERL SCRIPT, SO +"
  626. @echo " + IF YOU DON'T LIKE THAT, UNINSTALL IT! +"
  627. @echo " + +"
  628. @echo " + Other static items have been stored in: +"
  629. @echo " + $(DESTDIR)$(HTTP_DOCSDIR)"
  630. @echo " + +"
  631. @echo " + If these paths do not match your httpd +"
  632. @echo " + installation, correct the definitions +"
  633. @echo " + in your Makefile of HTTP_CGIDIR and +"
  634. @echo " + HTTP_DOCSDIR +"
  635. @echo " + +"
  636. @echo " +-------------------------------------------+"
  637. progdocs:
  638. (cat contrib/asterisk-ng-doxygen; echo "HAVE_DOT=$(HAVEDOT)"; \
  639. echo "PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen -
  640. install-logrotate:
  641. if [ ! -d "$(DESTDIR)$(ASTETCDIR)/../logrotate.d" ]; then \
  642. $(INSTALL) -d "$(DESTDIR)$(ASTETCDIR)/../logrotate.d" ; \
  643. fi
  644. sed 's#__LOGDIR__#$(ASTLOGDIR)#g' < contrib/scripts/asterisk.logrotate | sed 's#__SBINDIR__#$(ASTSBINDIR)#g' > contrib/scripts/asterisk.logrotate.tmp
  645. $(INSTALL) -m 0644 contrib/scripts/asterisk.logrotate.tmp "$(DESTDIR)$(ASTETCDIR)/../logrotate.d/asterisk"
  646. rm -f contrib/scripts/asterisk.logrotate.tmp
  647. config:
  648. @if [ "${OSARCH}" = "linux-gnu" ]; then \
  649. if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \
  650. cat contrib/init.d/rc.redhat.asterisk | sed 's|__ASTERISK_ETC_DIR__|$(ASTETCDIR)|;s|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;' > contrib/init.d/rc.asterisk.tmp ; \
  651. $(INSTALL) -m 755 contrib/init.d/rc.asterisk.tmp "$(DESTDIR)/etc/rc.d/init.d/asterisk" ; \
  652. rm -f contrib/init.d/rc.asterisk.tmp ; \
  653. if [ ! -f "$(DESTDIR)/etc/sysconfig/asterisk" ] ; then \
  654. $(INSTALL) -m 644 contrib/init.d/etc_default_asterisk "$(DESTDIR)/etc/sysconfig/asterisk" ; \
  655. fi ; \
  656. if [ -z "$(DESTDIR)" ] ; then \
  657. /sbin/chkconfig --add asterisk ; \
  658. fi ; \
  659. elif [ -f /etc/debian_version ] ; then \
  660. cat contrib/init.d/rc.debian.asterisk | sed 's|__ASTERISK_ETC_DIR__|$(ASTETCDIR)|;s|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;' > contrib/init.d/rc.asterisk.tmp ; \
  661. $(INSTALL) -m 755 contrib/init.d/rc.asterisk.tmp "$(DESTDIR)/etc/init.d/asterisk" ; \
  662. rm -f contrib/init.d/rc.asterisk.tmp ; \
  663. if [ ! -f "$(DESTDIR)/etc/default/asterisk" ] ; then \
  664. $(INSTALL) -m 644 contrib/init.d/etc_default_asterisk "$(DESTDIR)/etc/default/asterisk" ; \
  665. fi ; \
  666. if [ -z "$(DESTDIR)" ] ; then \
  667. /usr/sbin/update-rc.d asterisk defaults 50 91 ; \
  668. fi ; \
  669. elif [ -f /etc/gentoo-release ] ; then \
  670. cat contrib/init.d/rc.gentoo.asterisk | sed 's|__ASTERISK_ETC_DIR__|$(ASTETCDIR)|;s|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;' > contrib/init.d/rc.asterisk.tmp ; \
  671. $(INSTALL) -m 755 contrib/init.d/rc.asterisk.tmp "$(DESTDIR)/etc/init.d/asterisk" ; \
  672. rm -f contrib/init.d/rc.asterisk.tmp ; \
  673. if [ -z "$(DESTDIR)" ] ; then \
  674. /sbin/rc-update add asterisk default ; \
  675. fi ; \
  676. elif [ -f /etc/mandrake-release -o -f /etc/mandriva-release ] ; then \
  677. cat contrib/init.d/rc.mandriva.asterisk | sed 's|__ASTERISK_ETC_DIR__|$(ASTETCDIR)|;s|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;' > contrib/init.d/rc.asterisk.tmp ; \
  678. $(INSTALL) -m 755 contrib/init.d/rc.asterisk.tmp "$(DESTDIR)/etc/rc.d/init.d/asterisk" ; \
  679. rm -f contrib/init.d/rc.asterisk.tmp ; \
  680. if [ ! -f /etc/sysconfig/asterisk ] ; then \
  681. $(INSTALL) -m 644 contrib/init.d/etc_default_asterisk "$(DESTDIR)/etc/sysconfig/asterisk" ; \
  682. fi ; \
  683. if [ -z "$(DESTDIR)" ] ; then \
  684. /sbin/chkconfig --add asterisk ; \
  685. fi ; \
  686. elif [ -f /etc/SuSE-release -o -f /etc/novell-release ] ; then \
  687. cat contrib/init.d/rc.suse.asterisk | sed 's|__ASTERISK_ETC_DIR__|$(ASTETCDIR)|;s|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;' > contrib/init.d/rc.asterisk.tmp ; \
  688. $(INSTALL) -m 755 contrib/init.d/rc.asterisk.tmp "$(DESTDIR)/etc/init.d/asterisk" ;\
  689. rm -f contrib/init.d/rc.asterisk.tmp ; \
  690. if [ ! -f /etc/sysconfig/asterisk ] ; then \
  691. $(INSTALL) -m 644 contrib/init.d/etc_default_asterisk "$(DESTDIR)/etc/sysconfig/asterisk" ; \
  692. fi ; \
  693. if [ -z "$(DESTDIR)" ] ; then \
  694. /sbin/chkconfig --add asterisk ; \
  695. fi ; \
  696. elif [ -f /etc/arch-release -o -f /etc/arch-release ] ; then \
  697. cat contrib/init.d/rc.archlinux.asterisk | sed 's|__ASTERISK_ETC_DIR__|$(ASTETCDIR)|;s|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;' > contrib/init.d/rc.asterisk.tmp ; \
  698. $(INSTALL) -m 755 contrib/init.d/rc.asterisk.tmp "$(DESTDIR)/etc/rc.d/asterisk" ; \
  699. rm -f contrib/init.d/rc.asterisk.tmp ; \
  700. elif [ -d "$(DESTDIR)/Library/LaunchDaemons" ]; then \
  701. if [ ! -f "$(DESTDIR)/Library/LaunchDaemons/org.asterisk.asterisk.plist" ]; then \
  702. sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;' < contrib/init.d/org.asterisk.asterisk.plist > asterisk.plist ; \
  703. $(INSTALL) -m 644 asterisk.plist "$(DESTDIR)/Library/LaunchDaemons/org.asterisk.asterisk.plist"; \
  704. rm -f asterisk.plist; \
  705. fi; \
  706. if [ ! -f "$(DESTDIR)/Library/LaunchDaemons/org.asterisk.muted.plist" ]; then \
  707. sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;' < contrib/init.d/org.asterisk.muted.plist > muted.plist ; \
  708. $(INSTALL) -m 644 muted.plist "$(DESTDIR)/Library/LaunchDaemons/org.asterisk.muted.plist"; \
  709. rm -f muted.plist; \
  710. fi; \
  711. elif [ -f /etc/slackware-version ]; then \
  712. echo "Slackware is not currently supported, although an init script does exist for it."; \
  713. else \
  714. echo "We could not install init scripts for your distribution." ; \
  715. fi \
  716. else \
  717. echo "We could not install init scripts for your operating system." ; \
  718. fi
  719. sounds:
  720. $(MAKE) -C sounds all
  721. # If the cleancount has been changed, force a make clean.
  722. # .cleancount is the global clean count, and .lastclean is the
  723. # last clean count we had
  724. cleantest:
  725. @cmp -s .cleancount .lastclean || $(MAKE) clean
  726. $(SUBDIRS_UNINSTALL):
  727. +@$(SUBMAKE) -C $(@:-uninstall=) uninstall
  728. _uninstall: $(SUBDIRS_UNINSTALL)
  729. rm -f "$(DESTDIR)$(MODULES_DIR)/"*
  730. rm -f "$(DESTDIR)$(ASTSBINDIR)/"*asterisk*
  731. rm -f "$(DESTDIR)$(ASTSBINDIR)/astgenkey"
  732. rm -f "$(DESTDIR)$(ASTSBINDIR)/autosupport"
  733. rm -rf "$(DESTDIR)$(ASTHEADERDIR)"
  734. rm -rf "$(DESTDIR)$(ASTDATADIR)/firmware"
  735. rm -f "$(DESTDIR)$(ASTMANDIR)/man8/asterisk.8"
  736. rm -f "$(DESTDIR)$(ASTMANDIR)/man8/astgenkey.8"
  737. rm -f "$(DESTDIR)$(ASTMANDIR)/man8/autosupport.8"
  738. rm -f "$(DESTDIR)$(ASTMANDIR)/man8/safe_asterisk.8"
  739. $(MAKE) -C sounds uninstall
  740. uninstall: _uninstall
  741. @echo " +--------- Asterisk Uninstall Complete -----+"
  742. @echo " + Asterisk binaries, sounds, man pages, +"
  743. @echo " + headers, modules, and firmware builds, +"
  744. @echo " + have all been uninstalled. +"
  745. @echo " + +"
  746. @echo " + To remove ALL traces of Asterisk, +"
  747. @echo " + including configuration, spool +"
  748. @echo " + directories, and logs, run the following +"
  749. @echo " + command: +"
  750. @echo " + +"
  751. @echo " + $(mK) uninstall-all +"
  752. @echo " +-------------------------------------------+"
  753. uninstall-all: _uninstall
  754. rm -rf "$(DESTDIR)$(ASTLIBDIR)"
  755. rm -rf "$(DESTDIR)$(ASTVARLIBDIR)"
  756. rm -rf "$(DESTDIR)$(ASTDATADIR)"
  757. rm -rf "$(DESTDIR)$(ASTSPOOLDIR)"
  758. rm -rf "$(DESTDIR)$(ASTETCDIR)"
  759. rm -rf "$(DESTDIR)$(ASTLOGDIR)"
  760. menuconfig: menuselect
  761. cmenuconfig: cmenuselect
  762. gmenuconfig: gmenuselect
  763. nmenuconfig: nmenuselect
  764. menuselect: menuselect/cmenuselect menuselect/nmenuselect menuselect/gmenuselect
  765. @if [ -x menuselect/nmenuselect ]; then \
  766. $(MAKE) nmenuselect; \
  767. elif [ -x menuselect/cmenuselect ]; then \
  768. $(MAKE) cmenuselect; \
  769. elif [ -x menuselect/gmenuselect ]; then \
  770. $(MAKE) gmenuselect; \
  771. else \
  772. echo "No menuselect user interface found. Install ncurses,"; \
  773. echo "newt or GTK libraries to build one and re-rerun"; \
  774. echo "'./configure' and 'make menuselect'."; \
  775. fi
  776. cmenuselect: menuselect/cmenuselect menuselect-tree menuselect.makeopts
  777. -@menuselect/cmenuselect menuselect.makeopts && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
  778. gmenuselect: menuselect/gmenuselect menuselect-tree menuselect.makeopts
  779. -@menuselect/gmenuselect menuselect.makeopts && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
  780. nmenuselect: menuselect/nmenuselect menuselect-tree menuselect.makeopts
  781. -@menuselect/nmenuselect menuselect.makeopts && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
  782. # options for make in menuselect/
  783. MAKE_MENUSELECT=CC="$(BUILD_CC)" CXX="" LD="" AR="" RANLIB="" CFLAGS="" $(MAKE) -C menuselect CONFIGURE_SILENT="--silent"
  784. menuselect/menuselect: menuselect/makeopts
  785. +$(MAKE_MENUSELECT) menuselect
  786. menuselect/cmenuselect: menuselect/makeopts
  787. +$(MAKE_MENUSELECT) cmenuselect
  788. menuselect/gmenuselect: menuselect/makeopts
  789. +$(MAKE_MENUSELECT) gmenuselect
  790. menuselect/nmenuselect: menuselect/makeopts
  791. +$(MAKE_MENUSELECT) nmenuselect
  792. menuselect/makeopts: makeopts
  793. +$(MAKE_MENUSELECT) makeopts
  794. menuselect-tree: $(foreach dir,$(filter-out main,$(MOD_SUBDIRS)),$(wildcard $(dir)/*.c) $(wildcard $(dir)/*.cc)) build_tools/cflags.xml build_tools/cflags-devmode.xml sounds/sounds.xml build_tools/embed_modules.xml utils/utils.xml agi/agi.xml configure makeopts
  795. @echo "Generating input for menuselect ..."
  796. @echo "<?xml version=\"1.0\"?>" > $@
  797. @echo >> $@
  798. @echo "<menu name=\"Asterisk Module and Build Option Selection\">" >> $@
  799. +@for dir in $(sort $(filter-out main,$(MOD_SUBDIRS))); do $(SILENTMAKE) -C $${dir} SUBDIR=$${dir} moduleinfo >> $@; done
  800. @cat build_tools/cflags.xml >> $@
  801. +@for dir in $(sort $(filter-out main,$(MOD_SUBDIRS))); do $(SILENTMAKE) -C $${dir} SUBDIR=$${dir} makeopts >> $@; done
  802. @if [ "${AST_DEVMODE}" = "yes" ]; then \
  803. cat build_tools/cflags-devmode.xml >> $@; \
  804. fi
  805. @cat utils/utils.xml >> $@
  806. @cat agi/agi.xml >> $@
  807. @cat build_tools/embed_modules.xml >> $@
  808. @cat sounds/sounds.xml >> $@
  809. @echo "</menu>" >> $@
  810. .PHONY: menuselect
  811. .PHONY: main
  812. .PHONY: sounds
  813. .PHONY: clean
  814. .PHONY: dist-clean
  815. .PHONY: distclean
  816. .PHONY: all
  817. .PHONY: prereqs
  818. .PHONY: cleantest
  819. .PHONY: uninstall
  820. .PHONY: _uninstall
  821. .PHONY: uninstall-all
  822. .PHONY: dont-optimize
  823. .PHONY: badshell
  824. .PHONY: installdirs
  825. .PHONY: validate-docs
  826. .PHONY: _clean
  827. .PHONY: $(SUBDIRS_INSTALL)
  828. .PHONY: $(SUBDIRS_DIST_CLEAN)
  829. .PHONY: $(SUBDIRS_CLEAN)
  830. .PHONY: $(SUBDIRS_UNINSTALL)
  831. .PHONY: $(SUBDIRS)
  832. .PHONY: $(MOD_SUBDIRS_EMBED_LDSCRIPT)
  833. .PHONY: $(MOD_SUBDIRS_EMBED_LDFLAGS)
  834. .PHONY: $(MOD_SUBDIRS_EMBED_LIBS)
  835. FORCE: