Makefile 37 KB

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