Makefile 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014
  1. #
  2. # Asterisk -- An open source telephony toolkit.
  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. # The makeopts include below tries to set these if they're found during
  76. # configure.
  77. export CC
  78. export CXX
  79. export AR
  80. export RANLIB
  81. export HOST_CC
  82. export BUILD_CC
  83. export INSTALL
  84. export STRIP
  85. export DOWNLOAD
  86. export AWK
  87. export GREP
  88. export MD5
  89. export WGET_EXTRA_ARGS
  90. export LDCONFIG
  91. export LDCONFIG_FLAGS
  92. export PYTHON
  93. -include makeopts
  94. # start the primary CFLAGS and LDFLAGS with any that were provided
  95. # to the configure script
  96. _ASTCFLAGS:=$(CONFIG_CFLAGS) $(CONFIG_SIGNED_CHAR)
  97. _ASTLDFLAGS:=$(CONFIG_LDFLAGS)
  98. # Some build systems, such as the one in openwrt, like to pass custom target
  99. # CFLAGS and LDFLAGS in the COPTS and LDOPTS variables; these should also
  100. # go before any build-system computed flags, since they are defaults, not
  101. # overrides
  102. _ASTCFLAGS+=$(COPTS)
  103. _ASTLDFLAGS+=$(LDOPTS)
  104. # libxml2 cflags
  105. _ASTCFLAGS+=$(LIBXML2_INCLUDE)
  106. #Uncomment this to see all build commands instead of 'quiet' output
  107. #NOISY_BUILD=yes
  108. empty:=
  109. space:=$(empty) $(empty)
  110. ASTTOPDIR:=$(subst $(space),\$(space),$(CURDIR))
  111. # Overwite config files on "make samples"
  112. OVERWRITE=y
  113. # Include debug and macro symbols in the executables (-g) and profiling info (-pg)
  114. DEBUG=-g3
  115. # Asterisk.conf is located in ASTETCDIR or by using the -C flag
  116. # when starting Asterisk
  117. ASTCONFPATH=$(ASTETCDIR)/asterisk.conf
  118. AGI_DIR=$(ASTDATADIR)/agi-bin
  119. # If you use Apache, you may determine by a grep 'DocumentRoot' of your httpd.conf file
  120. HTTP_DOCSDIR=/var/www/html
  121. # Determine by a grep 'ScriptAlias' of your Apache httpd.conf file
  122. HTTP_CGIDIR=/var/www/cgi-bin
  123. # If your platform's linker expects a prefix on symbols generated from compiling C
  124. # source files, set LINKER_SYMBOL_PREFIX to that value. On some systems, exported symbols
  125. # from C source files are prefixed with '_', for example. If this value is not set
  126. # properly, the linker scripts that live in the '*.exports' files in various places
  127. # in this tree will unintentionally suppress symbols that should be visible
  128. # in the final binary objects.
  129. LINKER_SYMBOL_PREFIX=
  130. # Uncomment this to use the older DSP routines
  131. #_ASTCFLAGS+=-DOLD_DSP_ROUTINES
  132. # Default install directory for DAHDI hooks.
  133. DAHDI_UDEV_HOOK_DIR = /usr/share/dahdi/span_config.d
  134. # If the file .asterisk.makeopts is present in your home directory, you can
  135. # include all of your favorite menuselect options so that every time you download
  136. # a new version of Asterisk, you don't have to run menuselect to set them.
  137. # The file /etc/asterisk.makeopts will also be included but can be overridden
  138. # by the file in your home directory.
  139. GLOBAL_MAKEOPTS=$(wildcard /etc/asterisk.makeopts)
  140. USER_MAKEOPTS=$(wildcard ~/.asterisk.makeopts)
  141. MOD_SUBDIR_CFLAGS="-I$(ASTTOPDIR)/include"
  142. OTHER_SUBDIR_CFLAGS="-I$(ASTTOPDIR)/include"
  143. # Create OPTIONS variable, but probably we can assign directly to ASTCFLAGS
  144. OPTIONS=
  145. ifeq ($(OSARCH),linux-gnu)
  146. # flag to tell 'ldconfig' to only process specified directories
  147. LDCONFIG_FLAGS=-n
  148. endif
  149. ifeq ($(findstring -save-temps,$(_ASTCFLAGS) $(ASTCFLAGS)),)
  150. ifeq ($(findstring -pipe,$(_ASTCFLAGS) $(ASTCFLAGS)),)
  151. _ASTCFLAGS+=-pipe
  152. endif
  153. endif
  154. ifeq ($(findstring -Wall,$(_ASTCFLAGS) $(ASTCFLAGS)),)
  155. _ASTCFLAGS+=-Wall
  156. endif
  157. _ASTCFLAGS+=-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(AST_NESTED_FUNCTIONS) $(AST_CLANG_BLOCKS) $(DEBUG)
  158. ADDL_TARGETS=
  159. ifeq ($(AST_DEVMODE),yes)
  160. _ASTCFLAGS+=-Werror
  161. _ASTCFLAGS+=-Wunused
  162. _ASTCFLAGS+=$(AST_DECLARATION_AFTER_STATEMENT)
  163. _ASTCFLAGS+=$(AST_TRAMPOLINES)
  164. _ASTCFLAGS+=-Wundef
  165. _ASTCFLAGS+=-Wmissing-format-attribute
  166. _ASTCFLAGS+=-Wformat=2
  167. ifeq ($(AST_DEVMODE_STRICT),yes)
  168. _ASTCFLAGS+=-Wshadow
  169. endif
  170. ADDL_TARGETS+=validate-docs
  171. endif
  172. ifneq ($(findstring BSD,$(OSARCH)),)
  173. _ASTCFLAGS+=-isystem /usr/local/include
  174. endif
  175. ifeq ($(OSARCH),FreeBSD)
  176. # -V is understood by BSD Make, not by GNU make.
  177. BSDVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk)
  178. _ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
  179. # flag to tell 'ldconfig' to only process specified directories
  180. LDCONFIG_FLAGS=-m
  181. endif
  182. ifeq ($(OSARCH),NetBSD)
  183. _ASTCFLAGS+=-pthread -I/usr/pkg/include
  184. endif
  185. ifeq ($(OSARCH),OpenBSD)
  186. _ASTCFLAGS+=-pthread -ftrampolines
  187. endif
  188. ifeq ($(OSARCH),SunOS)
  189. _ASTCFLAGS+=-Wcast-align -DSOLARIS -I../include/solaris-compat -I/opt/ssl/include -I/usr/local/ssl/include -D_XPG4_2 -D__EXTENSIONS__
  190. endif
  191. ifneq ($(GREP),)
  192. ASTERISKVERSION:=$(shell GREP=$(GREP) AWK=$(AWK) GIT=$(GIT) build_tools/make_version .)
  193. endif
  194. ifneq ($(AWK),)
  195. ifneq ($(wildcard .version),)
  196. ASTERISKVERSIONNUM:=$(shell $(AWK) -F. '{printf "%01d%02d%02d", $$1, $$2, $$3}' .version)
  197. endif
  198. endif
  199. ifneq ($(wildcard .svn),)
  200. ASTERISKVERSIONNUM:=999999
  201. endif
  202. _ASTCFLAGS+=$(OPTIONS)
  203. MOD_SUBDIRS:=channels pbx apps codecs formats cdr cel bridges funcs tests main res addons $(LOCAL_MOD_SUBDIRS)
  204. OTHER_SUBDIRS:=utils agi contrib
  205. SUBDIRS:=$(OTHER_SUBDIRS) $(MOD_SUBDIRS)
  206. SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)
  207. SUBDIRS_CLEAN:=$(SUBDIRS:%=%-clean)
  208. SUBDIRS_DIST_CLEAN:=$(SUBDIRS:%=%-dist-clean)
  209. SUBDIRS_UNINSTALL:=$(SUBDIRS:%=%-uninstall)
  210. MOD_SUBDIRS_EMBED_LDSCRIPT:=$(MOD_SUBDIRS:%=%-embed-ldscript)
  211. MOD_SUBDIRS_EMBED_LDFLAGS:=$(MOD_SUBDIRS:%=%-embed-ldflags)
  212. MOD_SUBDIRS_EMBED_LIBS:=$(MOD_SUBDIRS:%=%-embed-libs)
  213. MOD_SUBDIRS_MENUSELECT_TREE:=$(MOD_SUBDIRS:%=%-menuselect-tree)
  214. ifneq ($(findstring darwin,$(OSARCH)),)
  215. _ASTCFLAGS+=-D__Darwin__ -mmacosx-version-min=10.6
  216. _SOLINK=-mmacosx-version-min=10.6 -Xlinker -undefined -Xlinker dynamic_lookup
  217. _SOLINK+=/usr/lib/bundle1.o
  218. SOLINK=-bundle $(_SOLINK)
  219. DYLINK=-Xlinker -dylib $(_SOLINK)
  220. _ASTLDFLAGS+=-L/usr/local/lib
  221. else
  222. # These are used for all but Darwin
  223. SOLINK=-shared
  224. DYLINK=$(SOLINK)
  225. ifneq ($(findstring BSD,$(OSARCH)),)
  226. _ASTLDFLAGS+=-L/usr/local/lib
  227. endif
  228. endif
  229. # Include rpath settings
  230. _ASTLDFLAGS+=$(AST_RPATH)
  231. ifeq ($(OSARCH),SunOS)
  232. SOLINK=-shared -fpic -L/usr/local/ssl/lib -lrt
  233. DYLINK=$(SOLINK)
  234. endif
  235. ifeq ($(OSARCH),OpenBSD)
  236. SOLINK=-shared -fpic
  237. DYLINK=$(SOLINK)
  238. endif
  239. # comment to print directories during submakes
  240. #PRINT_DIR=yes
  241. ifneq ($(INSIDE_EMACS),)
  242. PRINT_DIR=yes
  243. endif
  244. SILENTMAKE:=$(MAKE) --quiet --no-print-directory
  245. ifneq ($(PRINT_DIR)$(NOISY_BUILD),)
  246. SUBMAKE:=$(MAKE)
  247. else
  248. SUBMAKE:=$(MAKE) --quiet --no-print-directory
  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. rm -f doc/rest-api/*.wiki
  353. rm -f rest-api-templates/*.pyc
  354. @$(MAKE) -C menuselect clean
  355. cp -f .cleancount .lastclean
  356. dist-clean: distclean
  357. distclean: $(SUBDIRS_DIST_CLEAN) _clean
  358. @$(MAKE) -C menuselect dist-clean
  359. @$(MAKE) -C sounds dist-clean
  360. rm -f menuselect.makeopts makeopts menuselect-tree menuselect.makedeps
  361. rm -f makeopts.embed_rules
  362. rm -f config.log config.status config.cache
  363. rm -rf autom4te.cache
  364. rm -f include/asterisk/autoconfig.h
  365. rm -f include/asterisk/buildopts.h
  366. rm -rf doc/api
  367. rm -f build_tools/menuselect-deps
  368. datafiles: _all doc/core-en_US.xml
  369. CFLAGS="$(_ASTCFLAGS) $(ASTCFLAGS)" build_tools/mkpkgconfig "$(DESTDIR)$(libdir)/pkgconfig";
  370. # # Recursively install contents of the static-http directory, in case
  371. # # extra content is provided there. See contrib/scripts/get_swagger_ui.sh
  372. find static-http | while read x; do \
  373. if test -d $$x; then \
  374. $(INSTALL) -m 755 -d "$(DESTDIR)$(ASTDATADIR)/$$x"; \
  375. else \
  376. $(INSTALL) -m 644 $$x "$(DESTDIR)$(ASTDATADIR)/$$x" ; \
  377. fi \
  378. done
  379. $(INSTALL) -m 644 doc/core-en_US.xml "$(DESTDIR)$(ASTDATADIR)/static-http";
  380. $(INSTALL) -m 644 doc/appdocsxml.xslt "$(DESTDIR)$(ASTDATADIR)/static-http";
  381. if [ -d doc/tex/asterisk ] ; then \
  382. $(INSTALL) -d "$(DESTDIR)$(ASTDATADIR)/static-http/docs" ; \
  383. for n in doc/tex/asterisk/* ; do \
  384. $(INSTALL) -m 644 $$n "$(DESTDIR)$(ASTDATADIR)/static-http/docs" ; \
  385. done \
  386. fi
  387. for x in images/*.jpg; do \
  388. $(INSTALL) -m 644 $$x "$(DESTDIR)$(ASTDATADIR)/images" ; \
  389. done
  390. $(MAKE) -C sounds install
  391. find rest-api -name "*.json" | while read x; do \
  392. $(INSTALL) -m 644 $$x "$(DESTDIR)$(ASTDATADIR)/rest-api" ; \
  393. done
  394. ifneq ($(GREP),)
  395. XML_core_en_US = $(foreach dir,$(MOD_SUBDIRS),$(shell $(GREP) -l "language=\"en_US\"" $(dir)/*.c $(dir)/*.cc 2>/dev/null))
  396. endif
  397. doc/core-en_US.xml: makeopts .lastclean $(XML_core_en_US)
  398. @printf "Building Documentation For: "
  399. @echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > $@
  400. @echo "<!DOCTYPE docs SYSTEM \"appdocsxml.dtd\">" >> $@
  401. @echo "<?xml-stylesheet type=\"text/xsl\" href=\"appdocsxml.xslt\"?>" > $@
  402. @echo "<docs xmlns:xi=\"http://www.w3.org/2001/XInclude\">" >> $@
  403. @for x in $(MOD_SUBDIRS); do \
  404. printf "$$x " ; \
  405. for i in `find $$x -name '*.c'`; do \
  406. $(AWK) -f build_tools/get_documentation $$i >> $@ ; \
  407. done ; \
  408. done
  409. @echo
  410. @echo "</docs>" >> $@
  411. ifneq ($(GREP),)
  412. XML_full_en_US = $(foreach dir,$(MOD_SUBDIRS),$(shell $(GREP) -l "language=\"en_US\"" $(dir)/*.c $(dir)/*.cc 2>/dev/null))
  413. endif
  414. doc/full-en_US.xml: makeopts .lastclean $(XML_full_en_US)
  415. ifeq ($(PYTHON),:)
  416. @echo "--------------------------------------------------------------------------"
  417. @echo "--- Please install python to build full documentation ---"
  418. @echo "--------------------------------------------------------------------------"
  419. else
  420. @printf "Building Documentation For: "
  421. @echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > $@
  422. @echo "<!DOCTYPE docs SYSTEM \"appdocsxml.dtd\">" >> $@
  423. @echo "<?xml-stylesheet type=\"text/xsl\" href=\"appdocsxml.xslt\"?>" > $@
  424. @echo "<docs xmlns:xi=\"http://www.w3.org/2001/XInclude\">" >> $@
  425. @for x in $(MOD_SUBDIRS); do \
  426. printf "$$x " ; \
  427. for i in `find $$x -name '*.c'`; do \
  428. $(PYTHON) build_tools/get_documentation.py < $$i >> $@ ; \
  429. done ; \
  430. done
  431. @echo
  432. @echo "</docs>" >> $@
  433. @$(PYTHON) build_tools/post_process_documentation.py -i $@ -o "doc/core-en_US.xml"
  434. endif
  435. validate-docs: doc/core-en_US.xml
  436. ifeq ($(XMLSTARLET)$(XMLLINT),::)
  437. @echo "--------------------------------------------------------------------------"
  438. @echo "--- Please install xmllint or xmlstarlet to validate the documentation ---"
  439. @echo "--------------------------------------------------------------------------"
  440. else
  441. ifneq ($(XMLLINT),:)
  442. $(XMLLINT) --dtdvalid doc/appdocsxml.dtd --noout $<
  443. else
  444. $(XMLSTARLET) val -d doc/appdocsxml.dtd $<
  445. endif
  446. endif
  447. update:
  448. @if [ -d .svn ]; then \
  449. echo "Updating from Subversion..." ; \
  450. fromrev="`svn info | $(AWK) '/Revision: / {print $$2}'`"; \
  451. svn update | tee update.out; \
  452. torev="`svn info | $(AWK) '/Revision: / {print $$2}'`"; \
  453. echo "`date` Updated from revision $${fromrev} to $${torev}." >> update.log; \
  454. rm -f .version; \
  455. if [ `grep -c ^C update.out` -gt 0 ]; then \
  456. echo ; echo "The following files have conflicts:" ; \
  457. grep ^C update.out | cut -b4- ; \
  458. fi ; \
  459. rm -f update.out; \
  460. else \
  461. echo "Not under version control"; \
  462. fi
  463. NEWHEADERS=$(notdir $(wildcard include/asterisk/*.h))
  464. OLDHEADERS=$(filter-out $(NEWHEADERS) $(notdir $(DESTDIR)$(ASTHEADERDIR)),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h)))
  465. INSTALLDIRS="$(ASTLIBDIR)" "$(ASTMODDIR)" "$(ASTSBINDIR)" "$(ASTETCDIR)" "$(ASTVARRUNDIR)" \
  466. "$(ASTSPOOLDIR)" "$(ASTSPOOLDIR)/dictate" "$(ASTSPOOLDIR)/meetme" \
  467. "$(ASTSPOOLDIR)/monitor" "$(ASTSPOOLDIR)/system" "$(ASTSPOOLDIR)/tmp" \
  468. "$(ASTSPOOLDIR)/voicemail" "$(ASTSPOOLDIR)/recording" \
  469. "$(ASTHEADERDIR)" "$(ASTHEADERDIR)/doxygen" \
  470. "$(ASTLOGDIR)" "$(ASTLOGDIR)/cdr-csv" "$(ASTLOGDIR)/cdr-custom" \
  471. "$(ASTLOGDIR)/cel-custom" "$(ASTDATADIR)" "$(ASTDATADIR)/documentation" \
  472. "$(ASTDATADIR)/documentation/thirdparty" "$(ASTDATADIR)/firmware" \
  473. "$(ASTDATADIR)/firmware/iax" "$(ASTDATADIR)/images" "$(ASTDATADIR)/keys" \
  474. "$(ASTDATADIR)/phoneprov" "$(ASTDATADIR)/rest-api" "$(ASTDATADIR)/static-http" \
  475. "$(ASTDATADIR)/sounds" "$(ASTDATADIR)/moh" "$(ASTMANDIR)/man8" "$(AGI_DIR)" "$(ASTDBDIR)"
  476. installdirs:
  477. @for i in $(INSTALLDIRS); do \
  478. if [ ! -z "$${i}" -a ! -d "$(DESTDIR)$${i}" ]; then \
  479. $(INSTALL) -d "$(DESTDIR)$${i}"; \
  480. fi; \
  481. done
  482. main-bininstall:
  483. +@DESTDIR="$(DESTDIR)" ASTSBINDIR="$(ASTSBINDIR)" ASTLIBDIR="$(ASTLIBDIR)" $(SUBMAKE) -C main bininstall
  484. bininstall: _all installdirs $(SUBDIRS_INSTALL) main-bininstall
  485. $(INSTALL) -m 755 contrib/scripts/astgenkey "$(DESTDIR)$(ASTSBINDIR)/"
  486. $(INSTALL) -m 755 contrib/scripts/autosupport "$(DESTDIR)$(ASTSBINDIR)/"
  487. if [ ! -f /sbin/launchd ]; then \
  488. ./build_tools/install_subst contrib/scripts/safe_asterisk "$(DESTDIR)$(ASTSBINDIR)/safe_asterisk"; \
  489. fi
  490. $(INSTALL) -m 644 include/asterisk.h "$(DESTDIR)$(includedir)"
  491. $(INSTALL) -m 644 include/asterisk/*.h "$(DESTDIR)$(ASTHEADERDIR)"
  492. $(INSTALL) -m 644 include/asterisk/doxygen/*.h "$(DESTDIR)$(ASTHEADERDIR)/doxygen"
  493. if [ -n "$(OLDHEADERS)" ]; then \
  494. for h in $(OLDHEADERS); do rm -f "$(DESTDIR)$(ASTHEADERDIR)/$$h"; done \
  495. fi
  496. $(INSTALL) -m 644 doc/core-*.xml "$(DESTDIR)$(ASTDATADIR)/documentation"
  497. $(INSTALL) -m 644 doc/appdocsxml.xslt "$(DESTDIR)$(ASTDATADIR)/documentation"
  498. $(INSTALL) -m 644 doc/appdocsxml.dtd "$(DESTDIR)$(ASTDATADIR)/documentation"
  499. $(INSTALL) -m 644 doc/asterisk.8 "$(DESTDIR)$(ASTMANDIR)/man8"
  500. $(INSTALL) -m 644 doc/astdb*.8 "$(DESTDIR)$(ASTMANDIR)/man8"
  501. $(INSTALL) -m 644 contrib/scripts/astgenkey.8 "$(DESTDIR)$(ASTMANDIR)/man8"
  502. $(INSTALL) -m 644 contrib/scripts/autosupport.8 "$(DESTDIR)$(ASTMANDIR)/man8"
  503. $(INSTALL) -m 644 contrib/scripts/safe_asterisk.8 "$(DESTDIR)$(ASTMANDIR)/man8"
  504. if [ -f contrib/firmware/iax/iaxy.bin ] ; then \
  505. $(INSTALL) -m 644 contrib/firmware/iax/iaxy.bin "$(DESTDIR)$(ASTDATADIR)/firmware/iax/iaxy.bin"; \
  506. fi
  507. ifeq ($(HAVE_DAHDI),1)
  508. $(INSTALL) -d $(DESTDIR)/$(DAHDI_UDEV_HOOK_DIR)
  509. $(INSTALL) -m 644 contrib/scripts/dahdi_span_config_hook $(DESTDIR)$(DAHDI_UDEV_HOOK_DIR)/40-asterisk
  510. endif
  511. $(SUBDIRS_INSTALL):
  512. +@DESTDIR="$(DESTDIR)" ASTSBINDIR="$(ASTSBINDIR)" $(SUBMAKE) -C $(@:-install=) install
  513. NEWMODS:=$(foreach d,$(MOD_SUBDIRS),$(notdir $(wildcard $(d)/*.so)))
  514. OLDMODS=$(filter-out $(NEWMODS) $(notdir $(DESTDIR)$(ASTMODDIR)),$(notdir $(wildcard $(DESTDIR)$(ASTMODDIR)/*.so)))
  515. oldmodcheck:
  516. @if [ -n "$(OLDMODS)" ]; then \
  517. echo " WARNING WARNING WARNING" ;\
  518. echo "" ;\
  519. echo " Your Asterisk modules directory, located at" ;\
  520. echo " $(DESTDIR)$(ASTMODDIR)" ;\
  521. echo " contains modules that were not installed by this " ;\
  522. echo " version of Asterisk. Please ensure that these" ;\
  523. echo " modules are compatible with this version before" ;\
  524. echo " attempting to run Asterisk." ;\
  525. echo "" ;\
  526. for f in $(OLDMODS); do \
  527. echo " $$f" ;\
  528. done ;\
  529. echo "" ;\
  530. echo " WARNING WARNING WARNING" ;\
  531. fi
  532. badshell:
  533. ifneq ($(filter ~%,$(DESTDIR)),)
  534. @echo "Your shell doesn't do ~ expansion when expected (specifically, when doing \"make install DESTDIR=~/path\")."
  535. @echo "Try replacing ~ with \$$HOME, as in \"make install DESTDIR=\$$HOME/path\"."
  536. @exit 1
  537. endif
  538. install: badshell bininstall datafiles
  539. @if [ -x /usr/sbin/asterisk-post-install ]; then \
  540. /usr/sbin/asterisk-post-install "$(DESTDIR)" . ; \
  541. fi
  542. @echo " +---- Asterisk Installation Complete -------+"
  543. @echo " + +"
  544. @echo " + YOU MUST READ THE SECURITY DOCUMENT +"
  545. @echo " + +"
  546. @echo " + Asterisk has successfully been installed. +"
  547. @echo " + If you would like to install the sample +"
  548. @echo " + configuration files (overwriting any +"
  549. @echo " + existing config files), run: +"
  550. @echo " + +"
  551. @echo " + $(mK) samples +"
  552. @echo " + +"
  553. @echo " +----------------- or ---------------------+"
  554. @echo " + +"
  555. @echo " + You can go ahead and install the asterisk +"
  556. @echo " + program documentation now or later run: +"
  557. @echo " + +"
  558. @echo " + $(mK) progdocs +"
  559. @echo " + +"
  560. @echo " + **Note** This requires that you have +"
  561. @echo " + doxygen installed on your local system +"
  562. @echo " +-------------------------------------------+"
  563. @$(MAKE) -s oldmodcheck
  564. isntall: install
  565. upgrade: bininstall
  566. # XXX why *.adsi is installed first ?
  567. adsi:
  568. @echo Installing adsi config files...
  569. $(INSTALL) -d "$(DESTDIR)$(ASTETCDIR)"
  570. @for x in configs/samples/*.adsi; do \
  571. dst="$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x`" ; \
  572. if [ -f "$${dst}" ] ; then \
  573. echo "Overwriting $$x" ; \
  574. else \
  575. echo "Installing $$x" ; \
  576. fi ; \
  577. $(INSTALL) -m 644 "$$x" "$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x`" ; \
  578. done
  579. samples: adsi
  580. @echo Installing other config files...
  581. @for x in configs/samples/*.sample; do \
  582. dst="$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample`" ; \
  583. if [ -f "$${dst}" ]; then \
  584. if [ "$(OVERWRITE)" = "y" ]; then \
  585. if cmp -s "$${dst}" "$$x" ; then \
  586. echo "Config file $$x is unchanged"; \
  587. continue; \
  588. fi ; \
  589. mv -f "$${dst}" "$${dst}.old" ; \
  590. else \
  591. echo "Skipping config file $$x"; \
  592. continue; \
  593. fi ;\
  594. fi ; \
  595. echo "Installing file $$x"; \
  596. $(INSTALL) -m 644 "$$x" "$${dst}" ;\
  597. done
  598. if [ "$(OVERWRITE)" = "y" ]; then \
  599. echo "Updating asterisk.conf" ; \
  600. sed -e 's|^astetcdir.*$$|astetcdir => $(ASTETCDIR)|' \
  601. -e 's|^astmoddir.*$$|astmoddir => $(ASTMODDIR)|' \
  602. -e 's|^astvarlibdir.*$$|astvarlibdir => $(ASTVARLIBDIR)|' \
  603. -e 's|^astdbdir.*$$|astdbdir => $(ASTDBDIR)|' \
  604. -e 's|^astkeydir.*$$|astkeydir => $(ASTKEYDIR)|' \
  605. -e 's|^astdatadir.*$$|astdatadir => $(ASTDATADIR)|' \
  606. -e 's|^astagidir.*$$|astagidir => $(AGI_DIR)|' \
  607. -e 's|^astspooldir.*$$|astspooldir => $(ASTSPOOLDIR)|' \
  608. -e 's|^astrundir.*$$|astrundir => $(ASTVARRUNDIR)|' \
  609. -e 's|^astlogdir.*$$|astlogdir => $(ASTLOGDIR)|' \
  610. -e 's|^astsbindir.*$$|astsbindir => $(ASTSBINDIR)|' \
  611. "$(DESTDIR)$(ASTCONFPATH)" > "$(DESTDIR)$(ASTCONFPATH).tmp" ; \
  612. $(INSTALL) -m 644 "$(DESTDIR)$(ASTCONFPATH).tmp" "$(DESTDIR)$(ASTCONFPATH)" ; \
  613. rm -f "$(DESTDIR)$(ASTCONFPATH).tmp" ; \
  614. fi ; \
  615. $(INSTALL) -d "$(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX"
  616. build_tools/make_sample_voicemail "$(DESTDIR)/$(ASTDATADIR)" "$(DESTDIR)/$(ASTSPOOLDIR)"
  617. @for x in phoneprov/*; do \
  618. dst="$(DESTDIR)$(ASTDATADIR)/$$x" ; \
  619. if [ -f "$${dst}" ]; then \
  620. if [ "$(OVERWRITE)" = "y" ]; then \
  621. if cmp -s "$${dst}" "$$x" ; then \
  622. echo "Config file $$x is unchanged"; \
  623. continue; \
  624. fi ; \
  625. mv -f "$${dst}" "$${dst}.old" ; \
  626. else \
  627. echo "Skipping config file $$x"; \
  628. continue; \
  629. fi ;\
  630. fi ; \
  631. echo "Installing file $$x"; \
  632. $(INSTALL) -m 644 "$$x" "$${dst}" ;\
  633. done
  634. webvmail:
  635. @[ -d "$(DESTDIR)$(HTTP_DOCSDIR)/" ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 )
  636. @[ -d "$(DESTDIR)$(HTTP_CGIDIR)" ] || ( printf "cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit 1 )
  637. $(INSTALL) -m 4755 contrib/scripts/vmail.cgi "$(DESTDIR)$(HTTP_CGIDIR)/vmail.cgi"
  638. $(INSTALL) -d "$(DESTDIR)$(HTTP_DOCSDIR)/_asterisk"
  639. for x in images/*.gif; do \
  640. $(INSTALL) -m 644 $$x "$(DESTDIR)$(HTTP_DOCSDIR)/_asterisk/"; \
  641. done
  642. @echo " +--------- Asterisk Web Voicemail ----------+"
  643. @echo " + +"
  644. @echo " + Asterisk Web Voicemail is installed in +"
  645. @echo " + your cgi-bin directory: +"
  646. @echo " + $(DESTDIR)$(HTTP_CGIDIR)"
  647. @echo " + IT USES A SETUID ROOT PERL SCRIPT, SO +"
  648. @echo " + IF YOU DON'T LIKE THAT, UNINSTALL IT! +"
  649. @echo " + +"
  650. @echo " + Other static items have been stored in: +"
  651. @echo " + $(DESTDIR)$(HTTP_DOCSDIR)"
  652. @echo " + +"
  653. @echo " + If these paths do not match your httpd +"
  654. @echo " + installation, correct the definitions +"
  655. @echo " + in your Makefile of HTTP_CGIDIR and +"
  656. @echo " + HTTP_DOCSDIR +"
  657. @echo " + +"
  658. @echo " +-------------------------------------------+"
  659. progdocs:
  660. # Note, Makefile conditionals must not be tabbed out. Wasted hours with that.
  661. ifeq ($(DOXYGEN),:)
  662. @echo "Doxygen is not installed. Please install and re-run the configuration script."
  663. else
  664. ifeq ($(DOT),:)
  665. @echo "DOT is not installed. Doxygen will not produce any diagrams. Please install and re-run the configuration script."
  666. else
  667. # Enable DOT
  668. @echo "HAVE_DOT = YES" >> contrib/asterisk-ng-doxygen
  669. endif
  670. # Set Doxygen PROJECT_NUMBER variable
  671. ifneq ($(ASTERISKVERSION),UNKNOWN__and_probably_unsupported)
  672. @echo "PROJECT_NUMBER = $(ASTERISKVERSION)" >> contrib/asterisk-ng-doxygen
  673. else
  674. echo "Asterisk Version is unknown, not configuring Doxygen PROJECT_NUMBER."
  675. endif
  676. # Validate Doxygen Configuration
  677. @doxygen -u contrib/asterisk-ng-doxygen
  678. # Run Doxygen
  679. @doxygen contrib/asterisk-ng-doxygen
  680. # Remove configuration backup file
  681. @rm -f contrib/asterisk-ng-doxygen.bak
  682. endif
  683. install-logrotate:
  684. if [ ! -d "$(DESTDIR)$(ASTETCDIR)/../logrotate.d" ]; then \
  685. $(INSTALL) -d "$(DESTDIR)$(ASTETCDIR)/../logrotate.d" ; \
  686. fi
  687. sed 's#__LOGDIR__#$(ASTLOGDIR)#g' < contrib/scripts/asterisk.logrotate | sed 's#__SBINDIR__#$(ASTSBINDIR)#g' > contrib/scripts/asterisk.logrotate.tmp
  688. $(INSTALL) -m 0644 contrib/scripts/asterisk.logrotate.tmp "$(DESTDIR)$(ASTETCDIR)/../logrotate.d/asterisk"
  689. rm -f contrib/scripts/asterisk.logrotate.tmp
  690. config:
  691. @if [ "${OSARCH}" = "linux-gnu" -o "${OSARCH}" = "kfreebsd-gnu" ]; then \
  692. if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \
  693. ./build_tools/install_subst contrib/init.d/rc.redhat.asterisk "$(DESTDIR)/etc/rc.d/init.d/asterisk"; \
  694. if [ ! -f "$(DESTDIR)/etc/sysconfig/asterisk" ] ; then \
  695. $(INSTALL) -m 644 contrib/init.d/etc_default_asterisk "$(DESTDIR)/etc/sysconfig/asterisk" ; \
  696. fi ; \
  697. if [ -z "$(DESTDIR)" ] ; then \
  698. /sbin/chkconfig --add asterisk ; \
  699. fi ; \
  700. elif [ -f /etc/debian_version ] ; then \
  701. ./build_tools/install_subst contrib/init.d/rc.debian.asterisk "$(DESTDIR)/etc/init.d/asterisk"; \
  702. if [ ! -f "$(DESTDIR)/etc/default/asterisk" ] ; then \
  703. $(INSTALL) -m 644 contrib/init.d/etc_default_asterisk "$(DESTDIR)/etc/default/asterisk" ; \
  704. fi ; \
  705. if [ -z "$(DESTDIR)" ] ; then \
  706. /usr/sbin/update-rc.d asterisk defaults 50 91 ; \
  707. fi ; \
  708. elif [ -f /etc/gentoo-release ] ; then \
  709. ./build_tools/install_subst contrib/init.d/rc.gentoo.asterisk "$(DESTDIR)/etc/init.d/asterisk"; \
  710. if [ -z "$(DESTDIR)" ] ; then \
  711. /sbin/rc-update add asterisk default ; \
  712. fi ; \
  713. elif [ -f /etc/mandrake-release -o -f /etc/mandriva-release ] ; then \
  714. ./build_tools/install_subst contrib/init.d/rc.mandriva.asterisk "$(DESTDIR)/etc/rc.d/init.d/asterisk"; \
  715. if [ ! -f /etc/sysconfig/asterisk ] ; then \
  716. $(INSTALL) -m 644 contrib/init.d/etc_default_asterisk "$(DESTDIR)/etc/sysconfig/asterisk" ; \
  717. fi ; \
  718. if [ -z "$(DESTDIR)" ] ; then \
  719. /sbin/chkconfig --add asterisk ; \
  720. fi ; \
  721. elif [ -f /etc/SuSE-release -o -f /etc/novell-release ] ; then \
  722. ./build_tools/install_subst contrib/init.d/rc.suse.asterisk "$(DESTDIR)/etc/init.d/asterisk"; \
  723. if [ ! -f /etc/sysconfig/asterisk ] ; then \
  724. $(INSTALL) -m 644 contrib/init.d/etc_default_asterisk "$(DESTDIR)/etc/sysconfig/asterisk" ; \
  725. fi ; \
  726. if [ -z "$(DESTDIR)" ] ; then \
  727. /sbin/chkconfig --add asterisk ; \
  728. fi ; \
  729. elif [ -f /etc/arch-release -o -f /etc/arch-release ] ; then \
  730. ./build_tools/install_subst contrib/init.d/rc.archlinux.asterisk "$(DESTDIR)/etc/init.d/asterisk"; \
  731. elif [ -d "$(DESTDIR)/Library/LaunchDaemons" ]; then \
  732. if [ ! -f "$(DESTDIR)/Library/LaunchDaemons/org.asterisk.asterisk.plist" ]; then \
  733. ./build_tools/install_subst contrib/init.d/org.asterisk.asterisk.plist "$(DESTDIR)/Library/LaunchDaemons/org.asterisk.asterisk.plist"; \
  734. fi; \
  735. if [ ! -f "$(DESTDIR)/Library/LaunchDaemons/org.asterisk.muted.plist" ]; then \
  736. ./build_tools/install_subst contrib/init.d/org.asterisk.muted.plist "$(DESTDIR)/Library/LaunchDaemons/org.asterisk.muted.plist"; \
  737. fi; \
  738. elif [ -f /etc/slackware-version ]; then \
  739. echo "Slackware is not currently supported, although an init script does exist for it."; \
  740. else \
  741. echo "We could not install init scripts for your distribution." ; \
  742. fi \
  743. else \
  744. echo "We could not install init scripts for your operating system." ; \
  745. fi
  746. sounds:
  747. $(MAKE) -C sounds all
  748. # If the cleancount has been changed, force a make clean.
  749. # .cleancount is the global clean count, and .lastclean is the
  750. # last clean count we had
  751. .lastclean: .cleancount
  752. @$(MAKE) clean
  753. @[ -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")
  754. $(SUBDIRS_UNINSTALL):
  755. +@$(SUBMAKE) -C $(@:-uninstall=) uninstall
  756. main-binuninstall:
  757. +@DESTDIR="$(DESTDIR)" ASTSBINDIR="$(ASTSBINDIR)" ASTLIBDIR="$(ASTLIBDIR)" $(SUBMAKE) -C main binuninstall
  758. _uninstall: $(SUBDIRS_UNINSTALL) main-binuninstall
  759. rm -f "$(DESTDIR)$(ASTMODDIR)/"*
  760. rm -f "$(DESTDIR)$(ASTSBINDIR)/astgenkey"
  761. rm -f "$(DESTDIR)$(ASTSBINDIR)/autosupport"
  762. rm -rf "$(DESTDIR)$(ASTHEADERDIR)"
  763. rm -rf "$(DESTDIR)$(ASTDATADIR)/firmware"
  764. rm -f "$(DESTDIR)$(ASTMANDIR)/man8/asterisk.8"
  765. rm -f "$(DESTDIR)$(ASTMANDIR)/man8/astgenkey.8"
  766. rm -f "$(DESTDIR)$(ASTMANDIR)/man8/autosupport.8"
  767. rm -f "$(DESTDIR)$(ASTMANDIR)/man8/safe_asterisk.8"
  768. ifeq ($(HAVE_DAHDI),1)
  769. rm -f $(DESTDIR)$(DAHDI_UDEV_HOOK_DIR)/40-asterisk
  770. endif
  771. $(MAKE) -C sounds uninstall
  772. uninstall: _uninstall
  773. @echo " +--------- Asterisk Uninstall Complete -----+"
  774. @echo " + Asterisk binaries, sounds, man pages, +"
  775. @echo " + headers, modules, and firmware builds, +"
  776. @echo " + have all been uninstalled. +"
  777. @echo " + +"
  778. @echo " + To remove ALL traces of Asterisk, +"
  779. @echo " + including configuration, spool +"
  780. @echo " + directories, and logs, run the following +"
  781. @echo " + command: +"
  782. @echo " + +"
  783. @echo " + $(mK) uninstall-all +"
  784. @echo " +-------------------------------------------+"
  785. uninstall-all: _uninstall
  786. rm -rf "$(DESTDIR)$(ASTMODDIR)"
  787. rm -rf "$(DESTDIR)$(ASTVARLIBDIR)"
  788. rm -rf "$(DESTDIR)$(ASTDATADIR)"
  789. rm -rf "$(DESTDIR)$(ASTSPOOLDIR)"
  790. rm -rf "$(DESTDIR)$(ASTETCDIR)"
  791. rm -rf "$(DESTDIR)$(ASTLOGDIR)"
  792. menuconfig: menuselect
  793. cmenuconfig: cmenuselect
  794. gmenuconfig: gmenuselect
  795. nmenuconfig: nmenuselect
  796. menuselect: menuselect/cmenuselect menuselect/nmenuselect menuselect/gmenuselect
  797. @if [ -x menuselect/nmenuselect ]; then \
  798. $(MAKE) nmenuselect; \
  799. elif [ -x menuselect/cmenuselect ]; then \
  800. $(MAKE) cmenuselect; \
  801. elif [ -x menuselect/gmenuselect ]; then \
  802. $(MAKE) gmenuselect; \
  803. else \
  804. echo "No menuselect user interface found. Install ncurses,"; \
  805. echo "newt or GTK libraries to build one and re-rerun"; \
  806. echo "'./configure' and 'make menuselect'."; \
  807. fi
  808. cmenuselect: menuselect/cmenuselect menuselect-tree menuselect.makeopts
  809. -@menuselect/cmenuselect menuselect.makeopts && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
  810. gmenuselect: menuselect/gmenuselect menuselect-tree menuselect.makeopts
  811. -@menuselect/gmenuselect menuselect.makeopts && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
  812. nmenuselect: menuselect/nmenuselect menuselect-tree menuselect.makeopts
  813. -@menuselect/nmenuselect menuselect.makeopts && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
  814. # options for make in menuselect/
  815. MAKE_MENUSELECT=CC="$(CC)" CXX="$(CXX)" LD="" AR="" RANLIB="" \
  816. CFLAGS="$(BUILD_CFLAGS)" LDFLAGS="$(BUILD_LDFLAGS)" \
  817. $(MAKE) -C menuselect CONFIGURE_SILENT="--silent"
  818. menuselect/menuselect: menuselect/makeopts .lastclean
  819. +$(MAKE_MENUSELECT) menuselect
  820. menuselect/cmenuselect: menuselect/makeopts .lastclean
  821. +$(MAKE_MENUSELECT) cmenuselect
  822. menuselect/gmenuselect: menuselect/makeopts .lastclean
  823. +$(MAKE_MENUSELECT) gmenuselect
  824. menuselect/nmenuselect: menuselect/makeopts .lastclean
  825. +$(MAKE_MENUSELECT) nmenuselect
  826. menuselect/makeopts: makeopts .lastclean
  827. +$(MAKE_MENUSELECT) makeopts
  828. 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
  829. @echo "Generating input for menuselect ..."
  830. @echo "<?xml version=\"1.0\"?>" > $@
  831. @echo >> $@
  832. @echo "<menu name=\"Asterisk Module and Build Option Selection\">" >> $@
  833. +@for dir in $(sort $(filter-out main,$(MOD_SUBDIRS))); do $(SILENTMAKE) -C $${dir} SUBDIR=$${dir} moduleinfo >> $@; done
  834. @cat build_tools/cflags.xml >> $@
  835. +@for dir in $(sort $(filter-out main,$(MOD_SUBDIRS))); do $(SILENTMAKE) -C $${dir} SUBDIR=$${dir} makeopts >> $@; done
  836. @if [ "${AST_DEVMODE}" = "yes" ]; then \
  837. cat build_tools/cflags-devmode.xml >> $@; \
  838. fi
  839. @cat utils/utils.xml >> $@
  840. @cat agi/agi.xml >> $@
  841. @cat build_tools/embed_modules.xml >> $@
  842. @cat sounds/sounds.xml >> $@
  843. @echo "</menu>" >> $@
  844. # We don't want to require Python or Pystache for every build, so this is its
  845. # own target.
  846. ari-stubs:
  847. ifeq ($(PYTHON),:)
  848. @echo "--------------------------------------------------------------------------"
  849. @echo "--- Please install python to build ARI stubs ---"
  850. @echo "--------------------------------------------------------------------------"
  851. @false
  852. else
  853. $(PYTHON) rest-api-templates/make_ari_stubs.py \
  854. rest-api/resources.json .
  855. endif
  856. .PHONY: menuselect
  857. .PHONY: main
  858. .PHONY: sounds
  859. .PHONY: clean
  860. .PHONY: dist-clean
  861. .PHONY: distclean
  862. .PHONY: all
  863. .PHONY: _all
  864. .PHONY: full
  865. .PHONY: _full
  866. .PHONY: prereqs
  867. .PHONY: uninstall
  868. .PHONY: _uninstall
  869. .PHONY: uninstall-all
  870. .PHONY: dont-optimize
  871. .PHONY: badshell
  872. .PHONY: installdirs
  873. .PHONY: validate-docs
  874. .PHONY: _clean
  875. .PHONY: ari-stubs
  876. .PHONY: $(SUBDIRS_INSTALL)
  877. .PHONY: $(SUBDIRS_DIST_CLEAN)
  878. .PHONY: $(SUBDIRS_CLEAN)
  879. .PHONY: $(SUBDIRS_UNINSTALL)
  880. .PHONY: $(SUBDIRS)
  881. .PHONY: $(MOD_SUBDIRS_EMBED_LDSCRIPT)
  882. .PHONY: $(MOD_SUBDIRS_EMBED_LDFLAGS)
  883. .PHONY: $(MOD_SUBDIRS_EMBED_LIBS)
  884. FORCE: