Makefile 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165
  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 libraries
  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 ASTCACHEDIR
  48. export ASTETCDIR # Path for config files
  49. export ASTVARRUNDIR
  50. export ASTSPOOLDIR
  51. export ASTVARLIBDIR
  52. export ASTDATADIR
  53. export ASTDBDIR
  54. export ASTLOGDIR
  55. export ASTLIBDIR
  56. export ASTMODDIR
  57. export ASTMANDIR
  58. export ASTHEADERDIR
  59. export ASTSBINDIR
  60. export AGI_DIR
  61. export ASTCONFPATH
  62. export ASTKEYDIR
  63. export OSARCH # Operating system
  64. export NOISY_BUILD # Used in Makefile.rules
  65. export MENUSELECT_CFLAGS # Options selected in menuselect.
  66. export AST_DEVMODE # Set to "yes" for additional compiler
  67. # and runtime checks
  68. export AST_DEVMODE_STRICT # Enables shadow warnings (-Wshadow)
  69. export _SOLINK # linker flags for all shared objects
  70. export SOLINK # linker flags for loadable modules
  71. export DYLINK # linker flags for shared libraries
  72. #--- paths to various commands
  73. # The makeopts include below tries to set these if they're found during
  74. # configure.
  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. export TAR
  92. export PATCH
  93. export SED
  94. export NM
  95. export FIND
  96. export BASENAME
  97. export DIRNAME
  98. export XMLLINT
  99. export XMLSTARLET
  100. # makeopts is required unless the goal is just {dist{-}}clean
  101. ifeq ($(MAKECMDGOALS),clean)
  102. else ifeq ($(MAKECMDGOALS),distclean)
  103. else ifeq ($(MAKECMDGOALS),dist-clean)
  104. else
  105. include makeopts
  106. endif
  107. # start the primary CFLAGS and LDFLAGS with any that were provided
  108. # to the configure script
  109. _ASTCFLAGS:=$(CONFIG_CFLAGS) $(CONFIG_SIGNED_CHAR)
  110. _ASTLDFLAGS:=$(CONFIG_LDFLAGS)
  111. # Some build systems, such as the one in openwrt, like to pass custom target
  112. # CFLAGS and LDFLAGS in the COPTS and LDOPTS variables; these should also
  113. # go before any build-system computed flags, since they are defaults, not
  114. # overrides
  115. _ASTCFLAGS+=$(COPTS)
  116. _ASTLDFLAGS+=$(LDOPTS)
  117. # libxml2 cflags
  118. _ASTCFLAGS+=$(LIBXML2_INCLUDE)
  119. # BIND_8_COMPAT
  120. _ASTCFLAGS+=$(BIND8_CFLAGS)
  121. #Uncomment this to see all build commands instead of 'quiet' output
  122. #NOISY_BUILD=yes
  123. empty:=
  124. space:=$(empty) $(empty)
  125. ASTTOPDIR:=$(subst $(space),\$(space),$(CURDIR))
  126. # Overwrite config files on "make samples" or other config installation targets
  127. OVERWRITE=y
  128. # Include debug and macro symbols in the executables (-g) and profiling info (-pg)
  129. DEBUG=-g3
  130. # Asterisk.conf is located in ASTETCDIR or by using the -C flag
  131. # when starting Asterisk
  132. ASTCONFPATH=$(ASTETCDIR)/asterisk.conf
  133. AGI_DIR=$(ASTDATADIR)/agi-bin
  134. # If you use Apache, you may determine by a grep 'DocumentRoot' of your httpd.conf file
  135. HTTP_DOCSDIR=/var/www/html
  136. # Determine by a grep 'ScriptAlias' of your Apache httpd.conf file
  137. HTTP_CGIDIR=/var/www/cgi-bin
  138. # If your platform's linker expects a prefix on symbols generated from compiling C
  139. # source files, set LINKER_SYMBOL_PREFIX to that value. On some systems, exported symbols
  140. # from C source files are prefixed with '_', for example. If this value is not set
  141. # properly, the linker scripts that live in the '*.exports' files in various places
  142. # in this tree will unintentionally suppress symbols that should be visible
  143. # in the final binary objects.
  144. LINKER_SYMBOL_PREFIX=
  145. # Uncomment this to use the older DSP routines
  146. #_ASTCFLAGS+=-DOLD_DSP_ROUTINES
  147. # Default install directory for DAHDI hooks.
  148. DAHDI_UDEV_HOOK_DIR = /usr/share/dahdi/span_config.d
  149. # If the file .asterisk.makeopts is present in your home directory, you can
  150. # include all of your favorite menuselect options so that every time you download
  151. # a new version of Asterisk, you don't have to run menuselect to set them.
  152. # The file /etc/asterisk.makeopts will also be included but can be overridden
  153. # by the file in your home directory.
  154. ifeq ($(wildcard menuselect.makeopts),)
  155. USER_MAKEOPTS=$(wildcard ~/.asterisk.makeopts)
  156. GLOBAL_MAKEOPTS=$(wildcard /etc/asterisk.makeopts)
  157. else
  158. USER_MAKEOPTS=
  159. GLOBAL_MAKEOPTS=
  160. endif
  161. MOD_SUBDIR_CFLAGS="-I$(ASTTOPDIR)/include"
  162. OTHER_SUBDIR_CFLAGS="-I$(ASTTOPDIR)/include"
  163. # Create OPTIONS variable, but probably we can assign directly to ASTCFLAGS
  164. OPTIONS=
  165. ifeq ($(findstring -save-temps,$(_ASTCFLAGS) $(ASTCFLAGS)),)
  166. ifeq ($(findstring -pipe,$(_ASTCFLAGS) $(ASTCFLAGS)),)
  167. _ASTCFLAGS+=-pipe
  168. endif
  169. endif
  170. ifeq ($(findstring -Wall,$(_ASTCFLAGS) $(ASTCFLAGS)),)
  171. _ASTCFLAGS+=-Wall
  172. endif
  173. _ASTCFLAGS+=-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(AST_NESTED_FUNCTIONS) $(AST_CLANG_BLOCKS) $(DEBUG)
  174. ADDL_TARGETS=
  175. ifeq ($(AST_DEVMODE),yes)
  176. _ASTCFLAGS+=-Werror
  177. _ASTCFLAGS+=-Wunused
  178. _ASTCFLAGS+=$(AST_DECLARATION_AFTER_STATEMENT)
  179. _ASTCFLAGS+=$(AST_TRAMPOLINES)
  180. _ASTCFLAGS+=-Wundef
  181. _ASTCFLAGS+=-Wmissing-format-attribute
  182. _ASTCFLAGS+=-Wformat=2
  183. ifeq ($(AST_DEVMODE_STRICT),yes)
  184. _ASTCFLAGS+=-Wshadow
  185. endif
  186. ifneq ($(DISABLE_XMLDOC),yes)
  187. ADDL_TARGETS+=validate-docs
  188. endif
  189. endif
  190. ifeq ($(OSARCH),NetBSD)
  191. _ASTCFLAGS+=-isystem /usr/pkg/include
  192. else ifneq ($(findstring BSD,$(OSARCH)),)
  193. _ASTCFLAGS+=-isystem /usr/local/include
  194. endif
  195. ifeq ($(OSARCH),FreeBSD)
  196. # -V is understood by BSD Make, not by GNU make.
  197. BSDVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk)
  198. _ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
  199. endif
  200. ifeq ($(OSARCH),NetBSD)
  201. _ASTCFLAGS+=-pthread -D__LIBPTHREAD_SOURCE__ -I/usr/pkg/include
  202. endif
  203. ifeq ($(OSARCH),OpenBSD)
  204. _ASTCFLAGS+=-pthread -ftrampolines
  205. endif
  206. ifeq ($(OSARCH),linux-uclibc)
  207. AST_LIBS+=-lpthread -ldl
  208. endif
  209. ifeq ($(OSARCH),SunOS)
  210. _ASTCFLAGS+=-Wcast-align -DSOLARIS -I../include/solaris-compat -I/opt/ssl/include -I/usr/local/ssl/include -D_XPG4_2 -D__EXTENSIONS__
  211. endif
  212. ifeq ($(GREP),)
  213. else ifeq ($(GREP),:)
  214. else
  215. ASTERISKVERSION:=$(shell GREP=$(GREP) AWK=$(AWK) GIT=$(GIT) build_tools/make_version .)
  216. endif
  217. ifneq ($(AWK),)
  218. ifneq ($(wildcard .version),)
  219. ASTERISKVERSIONNUM:=$(shell $(SED) -e 's/^certified\///' -e 's/-cert/./' .version | $(AWK) -F. '{printf "%01d%02d%02d", $$1, $$2, $$3}')
  220. endif
  221. endif
  222. ifneq ($(wildcard .svn),)
  223. ASTERISKVERSIONNUM:=999999
  224. endif
  225. ifneq ($(DISABLE_XMLDOC),yes)
  226. CORE_XMLDOC=doc/core-en_US.xml
  227. FULL_XMLDOC=doc/full-en_US.xml
  228. else
  229. CORE_XMLDOC=
  230. FULL_XMLDOC=
  231. endif
  232. _ASTCFLAGS+=$(OPTIONS)
  233. MOD_SUBDIRS:=third-party channels pbx apps codecs formats cdr cel bridges funcs tests main res addons $(LOCAL_MOD_SUBDIRS)
  234. OTHER_SUBDIRS:=utils agi contrib
  235. SUBDIRS:=$(OTHER_SUBDIRS) $(MOD_SUBDIRS)
  236. SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)
  237. SUBDIRS_CLEAN:=$(SUBDIRS:%=%-clean)
  238. SUBDIRS_DIST_CLEAN:=$(SUBDIRS:%=%-dist-clean)
  239. SUBDIRS_UNINSTALL:=$(SUBDIRS:%=%-uninstall)
  240. MOD_SUBDIRS_MENUSELECT_TREE:=$(MOD_SUBDIRS:%=%-menuselect-tree)
  241. ifneq ($(findstring darwin,$(OSARCH)),)
  242. _ASTCFLAGS+=-D__Darwin__ -mmacosx-version-min=10.6
  243. _SOLINK=-mmacosx-version-min=10.6 -Wl,-undefined,dynamic_lookup
  244. _SOLINK+=/usr/lib/bundle1.o
  245. SOLINK=-bundle $(_SOLINK)
  246. DYLINK=-Wl,-dylib $(_SOLINK)
  247. _ASTLDFLAGS+=-L/usr/local/lib
  248. else
  249. # These are used for all but Darwin
  250. SOLINK=-shared
  251. DYLINK=$(SOLINK)
  252. ifeq ($(OSARCH),NetBSD)
  253. _ASTLDFLAGS+=-L/usr/pkg/lib
  254. else ifneq ($(findstring BSD,$(OSARCH)),)
  255. _ASTLDFLAGS+=-L/usr/local/lib
  256. endif
  257. endif
  258. # Include rpath settings
  259. _ASTLDFLAGS+=$(AST_RPATH)
  260. ifeq ($(OSARCH),SunOS)
  261. SOLINK=-shared -fpic -L/usr/local/ssl/lib -lrt
  262. DYLINK=$(SOLINK)
  263. endif
  264. ifeq ($(OSARCH),OpenBSD)
  265. SOLINK=-shared -fpic
  266. DYLINK=$(SOLINK)
  267. endif
  268. # comment to print directories during submakes
  269. #PRINT_DIR=yes
  270. ifneq ($(INSIDE_EMACS),)
  271. PRINT_DIR=yes
  272. endif
  273. SILENTMAKE:=$(MAKE) --quiet --no-print-directory
  274. ifneq ($(PRINT_DIR)$(NOISY_BUILD),)
  275. SUBMAKE:=$(MAKE)
  276. else
  277. SUBMAKE:=$(MAKE) --quiet --no-print-directory
  278. endif
  279. mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
  280. mkfile_dir := $(dir $(mkfile_path))
  281. # $(MAKE) is printed in several places, and we want it to be a
  282. # fixed size string. Define a variable whose name has also the
  283. # same size, so we can easily align text.
  284. ifeq ($(MAKE), gmake)
  285. mK="gmake"
  286. else
  287. mK=" make"
  288. endif
  289. all: _all
  290. @echo " +--------- Asterisk Build Complete ---------+"
  291. @echo " + Asterisk has successfully been built, and +"
  292. @echo " + can be installed by running: +"
  293. @echo " + +"
  294. @echo " + $(mK) install +"
  295. @echo " +-------------------------------------------+"
  296. full: _full
  297. @echo " +--------- Asterisk Build Complete ---------+"
  298. @echo " + Asterisk has successfully been built, and +"
  299. @echo " + can be installed by running: +"
  300. @echo " + +"
  301. @echo " + $(mK) install +"
  302. @echo " +-------------------------------------------+"
  303. _all: makeopts $(SUBDIRS) $(CORE_XMLDOC) $(ADDL_TARGETS)
  304. _full: makeopts $(SUBDIRS) $(FULL_XMLDOC) $(ADDL_TARGETS)
  305. makeopts: configure
  306. @echo "****"
  307. @echo "**** The configure script must be executed before running '$(MAKE)'."
  308. @echo "**** Please run \"./configure\"."
  309. @echo "****"
  310. @exit 1
  311. menuselect.makeopts: menuselect/menuselect menuselect-tree makeopts build_tools/menuselect-deps $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS)
  312. ifeq ($(filter %.menuselect,$(MAKECMDGOALS)),)
  313. menuselect/menuselect --check-deps $@
  314. menuselect/menuselect --check-deps $@ $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS)
  315. endif
  316. $(MOD_SUBDIRS_MENUSELECT_TREE):
  317. +@$(SUBMAKE) -C $(@:-menuselect-tree=) SUBDIR=$(@:-menuselect-tree=) moduleinfo
  318. +@$(SUBMAKE) -C $(@:-menuselect-tree=) SUBDIR=$(@:-menuselect-tree=) makeopts
  319. $(SUBDIRS): makeopts .lastclean main/version.c include/asterisk/build.h defaults.h
  320. ifeq ($(findstring $(OSARCH), mingw32 cygwin ),)
  321. main: third-party
  322. else
  323. # Windows: we need to build main (i.e. the asterisk dll) first,
  324. # followed by res, followed by the other directories, because
  325. # dll symbols must be resolved during linking and not at runtime.
  326. D1:= $(filter-out main,$(MOD_SUBDIRS))
  327. D1:= $(filter-out res,$(D1))
  328. $(D1): res
  329. res: main
  330. endif
  331. $(MOD_SUBDIRS): makeopts
  332. +@_ASTCFLAGS="$(MOD_SUBDIR_CFLAGS) $(_ASTCFLAGS)" ASTCFLAGS="$(ASTCFLAGS)" _ASTLDFLAGS="$(_ASTLDFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" $(SUBMAKE) --no-builtin-rules -C $@ SUBDIR=$@ all
  333. $(OTHER_SUBDIRS): makeopts
  334. +@_ASTCFLAGS="$(OTHER_SUBDIR_CFLAGS) $(_ASTCFLAGS)" ASTCFLAGS="$(ASTCFLAGS)" _ASTLDFLAGS="$(_ASTLDFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" $(SUBMAKE) --no-builtin-rules -C $@ SUBDIR=$@ all
  335. defaults.h: makeopts .lastclean build_tools/make_defaults_h
  336. @build_tools/make_defaults_h > $@.tmp
  337. @cmp -s $@.tmp $@ || mv $@.tmp $@
  338. @rm -f $@.tmp
  339. main/version.c: FORCE include/asterisk/buildopts.h menuselect.makeopts .lastclean
  340. @build_tools/make_version_c > $@.tmp
  341. @cmp -s $@.tmp $@ || mv $@.tmp $@
  342. @rm -f $@.tmp
  343. include/asterisk/buildopts.h: menuselect.makeopts .lastclean
  344. @build_tools/make_buildopts_h > $@.tmp
  345. @cmp -s $@.tmp $@ || mv $@.tmp $@
  346. @rm -f $@.tmp
  347. # build.h must depend on .lastclean, or parallel make may wipe it out after it's
  348. # been created.
  349. include/asterisk/build.h: .lastclean
  350. @build_tools/make_build_h > $@
  351. $(SUBDIRS_CLEAN):
  352. +@$(SUBMAKE) -C $(@:-clean=) clean
  353. $(SUBDIRS_DIST_CLEAN):
  354. +@$(SUBMAKE) -C $(@:-dist-clean=) dist-clean
  355. clean: $(SUBDIRS_CLEAN) _clean
  356. _clean:
  357. rm -f defaults.h
  358. rm -f include/asterisk/build.h
  359. rm -f main/version.c
  360. rm -f doc/core-en_US.xml
  361. rm -f doc/full-en_US.xml
  362. rm -f doc/rest-api/*.wiki
  363. rm -f doxygen.log
  364. rm -rf latex
  365. rm -f rest-api-templates/*.pyc
  366. @$(MAKE) -C menuselect clean
  367. cp -f .cleancount .lastclean
  368. dist-clean: distclean
  369. distclean: $(SUBDIRS_DIST_CLEAN) _clean
  370. @$(MAKE) -C menuselect dist-clean
  371. @$(MAKE) -C sounds dist-clean
  372. rm -f menuselect.makeopts makeopts menuselect-tree menuselect.makedeps
  373. rm -f config.log config.status config.cache
  374. rm -rf autom4te.cache
  375. rm -f include/asterisk/autoconfig.h
  376. rm -f include/asterisk/buildopts.h
  377. rm -rf doc/api
  378. rm -f doc/Doxyfile
  379. rm -f build_tools/menuselect-deps
  380. datafiles: _all $(CORE_XMLDOC)
  381. CFLAGS="$(_ASTCFLAGS) $(ASTCFLAGS)" build_tools/mkpkgconfig "$(DESTDIR)$(libdir)/pkgconfig";
  382. # # Recursively install contents of the static-http directory, in case
  383. # # extra content is provided there. See contrib/scripts/get_swagger_ui.sh
  384. find static-http | while read x; do \
  385. if test -d $$x; then \
  386. $(INSTALL) -m 755 -d "$(DESTDIR)$(ASTDATADIR)/$$x"; \
  387. else \
  388. $(INSTALL) -m 644 $$x "$(DESTDIR)$(ASTDATADIR)/$$x" ; \
  389. fi \
  390. done
  391. ifneq ($(DISABLE_XMLDOC),yes)
  392. $(INSTALL) -m 644 doc/core-en_US.xml "$(DESTDIR)$(ASTDATADIR)/static-http";
  393. $(INSTALL) -m 644 doc/appdocsxml.xslt "$(DESTDIR)$(ASTDATADIR)/static-http";
  394. endif
  395. if [ -d doc/tex/asterisk ] ; then \
  396. $(INSTALL) -d "$(DESTDIR)$(ASTDATADIR)/static-http/docs" ; \
  397. for n in doc/tex/asterisk/* ; do \
  398. $(INSTALL) -m 644 $$n "$(DESTDIR)$(ASTDATADIR)/static-http/docs" ; \
  399. done \
  400. fi
  401. for x in images/*.jpg; do \
  402. $(INSTALL) -m 644 $$x "$(DESTDIR)$(ASTDATADIR)/images" ; \
  403. done
  404. $(MAKE) -C sounds install
  405. find rest-api -name "*.json" | while read x; do \
  406. $(INSTALL) -m 644 $$x "$(DESTDIR)$(ASTDATADIR)/rest-api" ; \
  407. done
  408. DOC_MOD_SUBDIRS := $(filter-out third-party,$(MOD_SUBDIRS))
  409. XML_core_en_US := $(shell build_tools/make_xml_documentation --command=print_dependencies --source-tree=. --mod-subdirs="$(DOC_MOD_SUBDIRS)")
  410. # core-en_US.xml is the normal documentation created with asterisk builds.
  411. doc/core-en_US.xml: makeopts .lastclean $(XML_core_en_US)
  412. @build_tools/make_xml_documentation --command=create_xml --source-tree=. --mod-subdirs="$(DOC_MOD_SUBDIRS)" \
  413. --with-moduleinfo --output-file=$@
  414. # The full-en_US.xml target is only called by the wiki documentation generation process
  415. # and does special post-processing in preparation for uploading to the wiki.
  416. # It creates full-en_US.xml but then re-creates core-en_US.xml as well.
  417. doc/full-en_US.xml: makeopts .lastclean $(XML_core_en_US)
  418. ifeq ($(PYTHON),:)
  419. @echo "--------------------------------------------------------------------------"
  420. @echo "--- Please install python to build full documentation ---"
  421. @echo "--------------------------------------------------------------------------"
  422. else
  423. @build_tools/make_xml_documentation --command=create_xml --source-tree=. --mod-subdirs="$(DOC_MOD_SUBDIRS)" \
  424. --for-wiki --output-file=$@ --core-output-file=./doc/core-en_US.xml
  425. endif
  426. validate-docs: doc/core-en_US.xml
  427. ifeq ($(XMLSTARLET)$(XMLLINT),::)
  428. @echo "--------------------------------------------------------------------------"
  429. @echo "--- Please install xmllint or xmlstarlet to validate the documentation ---"
  430. @echo "--------------------------------------------------------------------------"
  431. else
  432. ifneq ($(XMLLINT),:)
  433. $(XMLLINT) --dtdvalid doc/appdocsxml.dtd --noout $<
  434. else
  435. $(XMLSTARLET) val -d doc/appdocsxml.dtd $<
  436. endif
  437. endif
  438. update:
  439. @if [ -d .svn ]; then \
  440. echo "Updating from Subversion..." ; \
  441. fromrev="`svn info | $(AWK) '/Revision: / {print $$2}'`"; \
  442. svn update | tee update.out; \
  443. torev="`svn info | $(AWK) '/Revision: / {print $$2}'`"; \
  444. echo "`date` Updated from revision $${fromrev} to $${torev}." >> update.log; \
  445. rm -f .version; \
  446. if [ `grep -c ^C update.out` -gt 0 ]; then \
  447. echo ; echo "The following files have conflicts:" ; \
  448. grep ^C update.out | cut -b4- ; \
  449. fi ; \
  450. rm -f update.out; \
  451. else \
  452. echo "Not under version control"; \
  453. fi
  454. NEWHEADERS=$(notdir $(wildcard include/asterisk/*.h))
  455. OLDHEADERS=$(filter-out $(NEWHEADERS) $(notdir $(DESTDIR)$(ASTHEADERDIR)),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h)))
  456. INSTALLDIRS="$(ASTLIBDIR)" "$(ASTMODDIR)" "$(ASTSBINDIR)" "$(ASTCACHEDIR)" "$(ASTETCDIR)" "$(ASTVARRUNDIR)" \
  457. "$(ASTSPOOLDIR)" "$(ASTSPOOLDIR)/dictate" "$(ASTSPOOLDIR)/meetme" \
  458. "$(ASTSPOOLDIR)/monitor" "$(ASTSPOOLDIR)/system" "$(ASTSPOOLDIR)/tmp" \
  459. "$(ASTSPOOLDIR)/voicemail" "$(ASTSPOOLDIR)/recording" \
  460. "$(ASTLOGDIR)" "$(ASTLOGDIR)/cdr-csv" "$(ASTLOGDIR)/cdr-custom" \
  461. "$(ASTLOGDIR)/cel-custom" "$(ASTDATADIR)" "$(ASTDATADIR)/documentation" \
  462. "$(ASTDATADIR)/documentation/thirdparty" "$(ASTDATADIR)/firmware" \
  463. "$(ASTDATADIR)/firmware/iax" "$(ASTDATADIR)/images" "$(ASTDATADIR)/keys" \
  464. "$(ASTDATADIR)/phoneprov" "$(ASTDATADIR)/rest-api" "$(ASTDATADIR)/static-http" \
  465. "$(ASTDATADIR)/sounds" "$(ASTDATADIR)/moh" "$(ASTMANDIR)/man8" "$(AGI_DIR)" "$(ASTDBDIR)" \
  466. "$(ASTDATADIR)/third-party" "${ASTDATADIR}/keys/stir_shaken" "${ASTDATADIR}/keys/stir_shaken/cache"
  467. installdirs:
  468. @for i in $(INSTALLDIRS); do \
  469. if [ ! -z "$${i}" -a ! -d "$(DESTDIR)$${i}" ]; then \
  470. $(INSTALL) -d "$(DESTDIR)$${i}"; \
  471. fi; \
  472. done
  473. main-bininstall:
  474. +@DESTDIR="$(DESTDIR)" ASTSBINDIR="$(ASTSBINDIR)" ASTLIBDIR="$(ASTLIBDIR)" $(SUBMAKE) -C main bininstall
  475. bininstall: _all installdirs $(SUBDIRS_INSTALL) main-bininstall
  476. $(INSTALL) -m 755 contrib/scripts/astversion "$(DESTDIR)$(ASTSBINDIR)/"
  477. $(INSTALL) -m 755 contrib/scripts/astgenkey "$(DESTDIR)$(ASTSBINDIR)/"
  478. $(INSTALL) -m 755 contrib/scripts/autosupport "$(DESTDIR)$(ASTSBINDIR)/"
  479. ifneq ($(HAVE_SBIN_LAUNCHD),1)
  480. ./build_tools/install_subst contrib/scripts/safe_asterisk "$(DESTDIR)$(ASTSBINDIR)/safe_asterisk";
  481. endif
  482. ifneq ($(DISABLE_XMLDOC),yes)
  483. $(INSTALL) -m 644 doc/core-*.xml "$(DESTDIR)$(ASTDATADIR)/documentation"
  484. $(INSTALL) -m 644 doc/appdocsxml.xslt "$(DESTDIR)$(ASTDATADIR)/documentation"
  485. $(INSTALL) -m 644 doc/appdocsxml.dtd "$(DESTDIR)$(ASTDATADIR)/documentation"
  486. endif
  487. $(INSTALL) -m 644 doc/asterisk.8 "$(DESTDIR)$(ASTMANDIR)/man8"
  488. $(INSTALL) -m 644 doc/astdb*.8 "$(DESTDIR)$(ASTMANDIR)/man8"
  489. $(INSTALL) -m 644 contrib/scripts/astgenkey.8 "$(DESTDIR)$(ASTMANDIR)/man8"
  490. $(INSTALL) -m 644 contrib/scripts/autosupport.8 "$(DESTDIR)$(ASTMANDIR)/man8"
  491. $(INSTALL) -m 644 contrib/scripts/safe_asterisk.8 "$(DESTDIR)$(ASTMANDIR)/man8"
  492. if [ -f contrib/firmware/iax/iaxy.bin ] ; then \
  493. $(INSTALL) -m 644 contrib/firmware/iax/iaxy.bin "$(DESTDIR)$(ASTDATADIR)/firmware/iax/iaxy.bin"; \
  494. fi
  495. ifeq ($(HAVE_DAHDI),1)
  496. $(INSTALL) -d $(DESTDIR)/$(DAHDI_UDEV_HOOK_DIR)
  497. $(INSTALL) -m 644 contrib/scripts/dahdi_span_config_hook $(DESTDIR)$(DAHDI_UDEV_HOOK_DIR)/40-asterisk
  498. endif
  499. $(SUBDIRS_INSTALL):
  500. +@DESTDIR="$(DESTDIR)" ASTSBINDIR="$(ASTSBINDIR)" ASTDATADIR="$(ASTDATADIR)" $(SUBMAKE) -C $(@:-install=) install
  501. NEWMODS:=$(foreach d,$(MOD_SUBDIRS),$(notdir $(wildcard $(d)/*.so)))
  502. OLDMODS=$(filter-out $(NEWMODS) $(notdir $(DESTDIR)$(ASTMODDIR)),$(notdir $(wildcard $(DESTDIR)$(ASTMODDIR)/*.so)))
  503. ifneq ($(BASH),:)
  504. FILMODS=$(filter-out $(shell ./build_tools/list_valid_installed_externals),$(OLDMODS))
  505. else
  506. FILMODS=$(OLDMODS)
  507. endif
  508. BADMODS=$(strip $(FILMODS))
  509. oldmodcheck:
  510. @if [ -n "$(BADMODS)" ]; then \
  511. echo " WARNING WARNING WARNING" ;\
  512. echo "" ;\
  513. echo " Your Asterisk modules directory, located at" ;\
  514. echo " $(DESTDIR)$(ASTMODDIR)" ;\
  515. echo " contains modules that were not installed by this " ;\
  516. echo " version of Asterisk. Please ensure that these" ;\
  517. echo " modules are compatible with this version before" ;\
  518. echo " attempting to run Asterisk." ;\
  519. echo "" ;\
  520. for f in $(BADMODS); do \
  521. echo " $$f" ;\
  522. done ;\
  523. echo "" ;\
  524. echo " WARNING WARNING WARNING" ;\
  525. fi
  526. ld-cache-update:
  527. ifeq ($(LDCONFIG),)
  528. else ifeq ($(LDCONFIG),:)
  529. else
  530. ifeq ($(DESTDIR),) # DESTDIR means binary archive creation; ldconfig should be run on postinst
  531. @if [ $$(id -u) -eq 0 ] ; then \
  532. $(LDCONFIG) "$(ASTLIBDIR)/" ; \
  533. else \
  534. echo " WARNING WARNING WARNING" ;\
  535. echo "" ;\
  536. echo " You cannot rebuild the system linker cache unless you are root. " ;\
  537. echo " You MUST do one of the following..." ;\
  538. echo " * Re-run 'make install' as root. " ;\
  539. echo " * Run 'ldconfig $(ASTLIBDIR)' as root. " ;\
  540. echo " * Run asterisk with 'LD_LIBRARY_PATH=$(ASTLIBDIR) asterisk' " ;\
  541. echo "" ;\
  542. echo " WARNING WARNING WARNING" ;\
  543. fi
  544. endif
  545. endif
  546. export _oldlibdir =
  547. export _oldmoddir =
  548. ifeq ($(findstring 64,$(HOST_CPU)),64)
  549. # Strip any trailing '/' so the dir and notdir functions work correctly
  550. _current_libdir = $(patsubst %/,%,$(DESTDIR)$(ASTLIBDIR))
  551. # Only process if the paths end in lib64 or lib.
  552. # If we're installing to lib64, check lib for orphans.
  553. # If we're installing to lib, check lib64 for orphans.
  554. # Otherwise, leave _oldlibdir empty.
  555. ifeq ($(notdir $(_current_libdir)),lib64)
  556. _oldlibdir = $(dir $(_current_libdir))lib
  557. else ifeq ($(notdir $(_current_libdir)),lib)
  558. _oldlibdir = $(dir $(_current_libdir))lib64
  559. endif
  560. # Strip any trailing '/' so the dir and notdir functions work correctly
  561. _current_moddir = $(patsubst %/,%,$(DESTDIR)$(ASTMODDIR))
  562. # Only process if the paths contain /lib64/ or /lib/.
  563. # If we're installing to lib64, check lib for orphans.
  564. # If we're installing to lib, check lib64 for orphans.
  565. # Otherwise, leave _oldmoddir empty.
  566. ifeq ($(findstring /lib64/,$(_current_moddir)),/lib64/)
  567. _oldmoddir = $(subst /lib64/,/lib/,$(_current_moddir))
  568. else ifeq ($(findstring /lib/,$(_current_moddir)),/lib/)
  569. _oldmoddir = $(subst /lib/,/lib64/,$(_current_moddir))
  570. endif
  571. endif
  572. check-old-libdir:
  573. @test -n "$(_oldlibdir)" -a -d "$(_oldlibdir)" || exit 0 ;\
  574. oldfiles=`find "$(_oldlibdir)" -name libasterisk* -print -quit -o \( -path *asterisk/modules/* -a -name *.so \) -print -quit 2>/dev/null` ;\
  575. if [ "x$$oldfiles" != "x" ] ; then \
  576. echo " WARNING WARNING WARNING" ;\
  577. echo "" ;\
  578. echo " Installation is to: " ;\
  579. echo " $(DESTDIR)$(ASTLIBDIR)" ;\
  580. echo " but there are asterisk shared libraries in: " ;\
  581. echo " $(_oldlibdir)" ;\
  582. echo " or" ;\
  583. echo " $(_oldlibdir)/asterisk/modules" ;\
  584. echo "" ;\
  585. echo " It is unlikely that asterisk will start." ;\
  586. echo "" ;\
  587. echo " You should do one of the following..." ;\
  588. echo " * Run 'make uninstall' to remove the incorrect libraries" ;\
  589. echo " then run 'make install' again." ;\
  590. echo " * Manually remove the libraries from" ;\
  591. echo " $(_oldlibdir)" ;\
  592. echo " and run 'ldconfig' to rebuild the linker cache." ;\
  593. echo "" ;\
  594. echo " WARNING WARNING WARNING" ;\
  595. fi
  596. badshell:
  597. ifneq ($(filter ~%,$(DESTDIR)),)
  598. @echo "Your shell doesn't do ~ expansion when expected (specifically, when doing \"make install DESTDIR=~/path\")."
  599. @echo "Try replacing ~ with \$$HOME, as in \"make install DESTDIR=\$$HOME/path\"."
  600. @exit 1
  601. endif
  602. versioncheck:
  603. ifeq ($(ASTERISKVERSION),UNKNOWN__git_check_fail)
  604. @echo "Asterisk Version is unknown due to a git error. If you are running make"
  605. @echo "as a different user than the project owner, this can be resolved by"
  606. @echo "running the following command as the user currently executing make: "$$USER
  607. @echo "git config --global --add safe.directory "$(mkfile_dir:/=)
  608. @exit 1
  609. endif
  610. install: badshell versioncheck bininstall datafiles
  611. @if [ -x /usr/sbin/asterisk-post-install ]; then \
  612. /usr/sbin/asterisk-post-install "$(DESTDIR)" . ; \
  613. fi
  614. @echo " +---- Asterisk Installation Complete -------+"
  615. @echo " + +"
  616. @echo " + YOU MUST READ THE SECURITY DOCUMENT +"
  617. @echo " + +"
  618. @echo " + Asterisk has successfully been installed. +"
  619. @echo " + If you would like to install the sample +"
  620. @echo " + configuration files (overwriting any +"
  621. @echo " + existing config files), run: +"
  622. @echo " + +"
  623. @echo " + For generic reference documentation: +"
  624. @echo " + $(mK) samples +"
  625. @echo " + +"
  626. @echo " + For a sample basic PBX: +"
  627. @echo " + $(mK) basic-pbx +"
  628. @echo " + +"
  629. @echo " + +"
  630. @echo " +----------------- or ---------------------+"
  631. @echo " + +"
  632. @echo " + You can go ahead and install the asterisk +"
  633. @echo " + program documentation now or later run: +"
  634. @echo " + +"
  635. @echo " + $(mK) progdocs +"
  636. @echo " + +"
  637. @echo " + **Note** This requires that you have +"
  638. @echo " + doxygen installed on your local system +"
  639. @echo " +-------------------------------------------+"
  640. @$(MAKE) -s oldmodcheck
  641. @$(MAKE) -s ld-cache-update
  642. @$(MAKE) -s check-old-libdir
  643. isntall: install
  644. upgrade: bininstall
  645. # Install configuration files from the specified directory
  646. # Parameters:
  647. # (1) the configuration directory to install from
  648. # (2) the extension to strip off
  649. define INSTALL_CONFIGS
  650. @for x in $(1)/*$(2); do \
  651. dst="$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x $(2)`"; \
  652. if [ -f "$${dst}" ]; then \
  653. if [ "$(OVERWRITE)" = "y" ]; then \
  654. if cmp -s "$${dst}" "$$x" ; then \
  655. echo "Config file $$x is unchanged"; \
  656. continue; \
  657. fi ; \
  658. mv -f "$${dst}" "$${dst}.old" ; \
  659. else \
  660. echo "Skipping config file $$x"; \
  661. continue; \
  662. fi ;\
  663. fi ; \
  664. echo "Installing file $$x"; \
  665. $(INSTALL) -m 644 "$$x" "$${dst}" ;\
  666. done ; \
  667. if [ "$(OVERWRITE)" = "y" ]; then \
  668. echo "Updating asterisk.conf" ; \
  669. sed -e 's|^astcachedir.*$$|astcachedir => $(ASTCACHEDIR)|' \
  670. -e 's|^astetcdir.*$$|astetcdir => $(ASTETCDIR)|' \
  671. -e 's|^astmoddir.*$$|astmoddir => $(ASTMODDIR)|' \
  672. -e 's|^astvarlibdir.*$$|astvarlibdir => $(ASTVARLIBDIR)|' \
  673. -e 's|^astdbdir.*$$|astdbdir => $(ASTDBDIR)|' \
  674. -e 's|^astkeydir.*$$|astkeydir => $(ASTKEYDIR)|' \
  675. -e 's|^astdatadir.*$$|astdatadir => $(ASTDATADIR)|' \
  676. -e 's|^astagidir.*$$|astagidir => $(AGI_DIR)|' \
  677. -e 's|^astspooldir.*$$|astspooldir => $(ASTSPOOLDIR)|' \
  678. -e 's|^astrundir.*$$|astrundir => $(ASTVARRUNDIR)|' \
  679. -e 's|^astlogdir.*$$|astlogdir => $(ASTLOGDIR)|' \
  680. -e 's|^astsbindir.*$$|astsbindir => $(ASTSBINDIR)|' \
  681. "$(DESTDIR)$(ASTCONFPATH)" > "$(DESTDIR)$(ASTCONFPATH).tmp" ; \
  682. $(INSTALL) -m 644 "$(DESTDIR)$(ASTCONFPATH).tmp" "$(DESTDIR)$(ASTCONFPATH)" ; \
  683. rm -f "$(DESTDIR)$(ASTCONFPATH).tmp" ; \
  684. fi
  685. endef
  686. install-headers:
  687. # Will create all components of "$(DESTDIR)$(ASTHEADERDIR)/doxygen" including "$(DESTDIR)$(includedir)"
  688. $(INSTALL) -d "$(DESTDIR)$(ASTHEADERDIR)/doxygen"
  689. $(INSTALL) -m 644 include/asterisk.h "$(DESTDIR)$(includedir)"
  690. $(INSTALL) -m 644 include/asterisk/*.h "$(DESTDIR)$(ASTHEADERDIR)"
  691. $(INSTALL) -m 644 include/asterisk/doxygen/*.h "$(DESTDIR)$(ASTHEADERDIR)/doxygen"
  692. if [ -n "$(OLDHEADERS)" ]; then \
  693. for h in $(OLDHEADERS); do rm -f "$(DESTDIR)$(ASTHEADERDIR)/$$h"; done \
  694. fi
  695. install-configs:
  696. @if test -z "$(CONFIG_SRC)" -o ! -d "$(CONFIG_SRC)"; then \
  697. >&2 echo "CONFIG_SRC must be set to a directory."; \
  698. exit 1; \
  699. fi
  700. @echo "Installing config files from $(CONFIG_SRC)/*$(CONFIG_EXTEN)"
  701. $(call INSTALL_CONFIGS,$(CONFIG_SRC),$(CONFIG_EXTEN))
  702. # XXX why *.adsi is installed first ?
  703. adsi:
  704. @echo Installing adsi config files...
  705. $(INSTALL) -d "$(DESTDIR)$(ASTETCDIR)"
  706. @for x in configs/samples/*.adsi; do \
  707. dst="$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x`" ; \
  708. if [ -f "$${dst}" ] ; then \
  709. echo "Overwriting $$x" ; \
  710. else \
  711. echo "Installing $$x" ; \
  712. fi ; \
  713. $(INSTALL) -m 644 "$$x" "$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x`" ; \
  714. done
  715. samples: adsi
  716. @echo Installing other config files...
  717. $(call INSTALL_CONFIGS,configs/samples,.sample)
  718. $(INSTALL) -d "$(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX"
  719. build_tools/make_sample_voicemail "$(DESTDIR)/$(ASTDATADIR)" "$(DESTDIR)/$(ASTSPOOLDIR)"
  720. @for x in phoneprov/*; do \
  721. dst="$(DESTDIR)$(ASTDATADIR)/$$x" ; \
  722. if [ -f "$${dst}" ]; then \
  723. if [ "$(OVERWRITE)" = "y" ]; then \
  724. if cmp -s "$${dst}" "$$x" ; then \
  725. echo "Config file $$x is unchanged"; \
  726. continue; \
  727. fi ; \
  728. mv -f "$${dst}" "$${dst}.old" ; \
  729. else \
  730. echo "Skipping config file $$x"; \
  731. continue; \
  732. fi ;\
  733. fi ; \
  734. echo "Installing file $$x"; \
  735. $(INSTALL) -m 644 "$$x" "$${dst}" ;\
  736. done
  737. basic-pbx:
  738. @echo Installing basic-pbx config files...
  739. $(call INSTALL_CONFIGS,configs/basic-pbx)
  740. webvmail:
  741. @[ -d "$(DESTDIR)$(HTTP_DOCSDIR)/" ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 )
  742. @[ -d "$(DESTDIR)$(HTTP_CGIDIR)" ] || ( printf "cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit 1 )
  743. $(INSTALL) -m 4755 contrib/scripts/vmail.cgi "$(DESTDIR)$(HTTP_CGIDIR)/vmail.cgi"
  744. $(INSTALL) -d "$(DESTDIR)$(HTTP_DOCSDIR)/_asterisk"
  745. for x in images/*.gif; do \
  746. $(INSTALL) -m 644 $$x "$(DESTDIR)$(HTTP_DOCSDIR)/_asterisk/"; \
  747. done
  748. @echo " +--------- Asterisk Web Voicemail ----------+"
  749. @echo " + +"
  750. @echo " + Asterisk Web Voicemail is installed in +"
  751. @echo " + your cgi-bin directory: +"
  752. @echo " + $(DESTDIR)$(HTTP_CGIDIR)"
  753. @echo " + IT USES A SETUID ROOT PERL SCRIPT, SO +"
  754. @echo " + IF YOU DON'T LIKE THAT, UNINSTALL IT! +"
  755. @echo " + +"
  756. @echo " + Other static items have been stored in: +"
  757. @echo " + $(DESTDIR)$(HTTP_DOCSDIR)"
  758. @echo " + +"
  759. @echo " + If these paths do not match your httpd +"
  760. @echo " + installation, correct the definitions +"
  761. @echo " + in your Makefile of HTTP_CGIDIR and +"
  762. @echo " + HTTP_DOCSDIR +"
  763. @echo " + +"
  764. @echo " +-------------------------------------------+"
  765. progdocs:
  766. ifeq ($(DOXYGEN),:)
  767. @echo "Doxygen is not installed. Please install and re-run the configuration script."
  768. else
  769. @cp doc/Doxyfile.in doc/Doxyfile
  770. ifeq ($(DOT),:)
  771. @echo "DOT is not installed. Doxygen will not produce any diagrams. Please install and re-run the configuration script."
  772. else
  773. @echo "HAVE_DOT = YES" >> doc/Doxyfile
  774. endif
  775. ifneq ($(NOISY_BUILD),yes)
  776. @echo "EXTRACT_ALL = YES" >> doc/Doxyfile
  777. endif
  778. ifeq ($(AST_DEVMODE),yes)
  779. @echo "INTERNAL_DOCS = YES" >> doc/Doxyfile
  780. @echo "WARN_NO_PARAMDOC = YES" >> doc/Doxyfile
  781. endif
  782. ifeq ($(ASTERISKVERSION),UNKNOWN__and_probably_unsupported)
  783. @echo "Asterisk Version is unknown, not configuring Doxygen PROJECT_NUMBER."
  784. else ifeq ($(ASTERISKVERSION),UNKNOWN__git_check_fail)
  785. @echo "Asterisk Version is unknown due to a git error. If you are running make"
  786. @echo "as a different user than the project owner, this can be resolved by"
  787. @echo "running the following command as the user currently executing make: "$$USER
  788. @echo "git config --global --add safe.directory "$(mkfile_dir:/=)
  789. @echo "not configuring Doxygen PROJECT_NUMBER."
  790. else
  791. @echo "PROJECT_NUMBER = $(ASTERISKVERSION)" >> doc/Doxyfile
  792. endif
  793. @echo "Generating C-API documentation. This will take a while."
  794. @doxygen doc/Doxyfile
  795. @echo "Generation complete. Any warnings are in ./doxygen.log."
  796. endif
  797. install-logrotate:
  798. if [ ! -d "$(DESTDIR)$(ASTETCDIR)/../logrotate.d" ]; then \
  799. $(INSTALL) -d "$(DESTDIR)$(ASTETCDIR)/../logrotate.d" ; \
  800. fi
  801. sed 's#__LOGDIR__#$(ASTLOGDIR)#g' < contrib/scripts/asterisk.logrotate | sed 's#__SBINDIR__#$(ASTSBINDIR)#g' > contrib/scripts/asterisk.logrotate.tmp
  802. $(INSTALL) -m 0644 contrib/scripts/asterisk.logrotate.tmp "$(DESTDIR)$(ASTETCDIR)/../logrotate.d/asterisk"
  803. rm -f contrib/scripts/asterisk.logrotate.tmp
  804. config:
  805. @if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \
  806. ./build_tools/install_subst contrib/init.d/rc.redhat.asterisk "$(DESTDIR)/etc/rc.d/init.d/asterisk"; \
  807. if [ ! -f "$(DESTDIR)/etc/sysconfig/asterisk" ] ; then \
  808. $(INSTALL) -m 644 contrib/init.d/etc_default_asterisk "$(DESTDIR)/etc/sysconfig/asterisk" ; \
  809. fi ; \
  810. if [ -z "$(DESTDIR)" ] ; then \
  811. /sbin/chkconfig --add asterisk ; \
  812. fi ; \
  813. elif [ -f /etc/debian_version ] ; then \
  814. ./build_tools/install_subst contrib/init.d/rc.debian.asterisk "$(DESTDIR)/etc/init.d/asterisk"; \
  815. if [ ! -f "$(DESTDIR)/etc/default/asterisk" ] ; then \
  816. $(INSTALL) -m 644 contrib/init.d/etc_default_asterisk "$(DESTDIR)/etc/default/asterisk" ; \
  817. fi ; \
  818. if [ -z "$(DESTDIR)" ] ; then \
  819. /usr/sbin/update-rc.d asterisk defaults 50 91 ; \
  820. fi ; \
  821. elif [ -f /etc/gentoo-release ] ; then \
  822. ./build_tools/install_subst contrib/init.d/rc.gentoo.asterisk "$(DESTDIR)/etc/init.d/asterisk"; \
  823. if [ -z "$(DESTDIR)" ] ; then \
  824. /sbin/rc-update add asterisk default ; \
  825. fi ; \
  826. elif [ -f /etc/mandrake-release -o -f /etc/mandriva-release ] ; then \
  827. ./build_tools/install_subst contrib/init.d/rc.mandriva.asterisk "$(DESTDIR)/etc/rc.d/init.d/asterisk"; \
  828. if [ ! -f /etc/sysconfig/asterisk ] ; then \
  829. $(INSTALL) -m 644 contrib/init.d/etc_default_asterisk "$(DESTDIR)/etc/sysconfig/asterisk" ; \
  830. fi ; \
  831. if [ -z "$(DESTDIR)" ] ; then \
  832. /sbin/chkconfig --add asterisk ; \
  833. fi ; \
  834. elif [ -f /etc/SuSE-release -o -f /etc/novell-release ] ; then \
  835. ./build_tools/install_subst contrib/init.d/rc.suse.asterisk "$(DESTDIR)/etc/init.d/asterisk"; \
  836. if [ ! -f /etc/sysconfig/asterisk ] ; then \
  837. $(INSTALL) -m 644 contrib/init.d/etc_default_asterisk "$(DESTDIR)/etc/sysconfig/asterisk" ; \
  838. fi ; \
  839. if [ -z "$(DESTDIR)" ] ; then \
  840. /sbin/chkconfig --add asterisk ; \
  841. fi ; \
  842. elif [ -f /etc/os-release ] && [ "opensuse" = "$(shell . /etc/os-release 2>/dev/null && echo $$ID)" ] ; then \
  843. ./build_tools/install_subst contrib/init.d/rc.suse.asterisk "$(DESTDIR)/etc/init.d/asterisk"; \
  844. if [ ! -f /etc/sysconfig/asterisk ] ; then \
  845. $(INSTALL) -m 644 contrib/init.d/etc_default_asterisk "$(DESTDIR)/etc/sysconfig/asterisk" ; \
  846. fi ; \
  847. if [ -z "$(DESTDIR)" ] ; then \
  848. /sbin/chkconfig --add asterisk ; \
  849. fi ; \
  850. elif [ -f /etc/arch-release -o -f /etc/arch-release ] ; then \
  851. ./build_tools/install_subst contrib/init.d/rc.archlinux.asterisk "$(DESTDIR)/etc/init.d/asterisk"; \
  852. elif [ -f /etc/slackware-version ]; then \
  853. ./build_tools/install_subst contrib/init.d/rc.slackware.asterisk "$(DESTDIR)/etc/rc.d/rc.asterisk"; \
  854. elif [ -f /etc/os-release ] && [ "slackware" = "$(shell . /etc/os-release 2>/dev/null && echo $$ID)" ] ; then \
  855. ./build_tools/install_subst contrib/init.d/rc.slackware.asterisk "$(DESTDIR)/etc/rc.d/rc.asterisk"; \
  856. elif [ -d "$(DESTDIR)/Library/LaunchDaemons" ]; then \
  857. if [ ! -f "$(DESTDIR)/Library/LaunchDaemons/org.asterisk.asterisk.plist" ]; then \
  858. ./build_tools/install_subst contrib/init.d/org.asterisk.asterisk.plist "$(DESTDIR)/Library/LaunchDaemons/org.asterisk.asterisk.plist"; \
  859. fi; \
  860. if [ ! -f "$(DESTDIR)/Library/LaunchDaemons/org.asterisk.muted.plist" ]; then \
  861. ./build_tools/install_subst contrib/init.d/org.asterisk.muted.plist "$(DESTDIR)/Library/LaunchDaemons/org.asterisk.muted.plist"; \
  862. fi; \
  863. else \
  864. echo "We could not install init scripts for your distribution." ; \
  865. fi
  866. sounds:
  867. $(MAKE) -C sounds all
  868. # If the cleancount has been changed, force a make clean.
  869. # .cleancount is the global clean count, and .lastclean is the
  870. # last clean count we had
  871. .lastclean: .cleancount
  872. @$(MAKE) clean
  873. @[ -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")
  874. $(SUBDIRS_UNINSTALL):
  875. +@DESTDIR="$(DESTDIR)" ASTSBINDIR="$(ASTSBINDIR)" ASTDATADIR="$(ASTDATADIR)" $(SUBMAKE) -C $(@:-uninstall=) uninstall
  876. main-binuninstall:
  877. +@DESTDIR="$(DESTDIR)" ASTSBINDIR="$(ASTSBINDIR)" ASTLIBDIR="$(ASTLIBDIR)" $(SUBMAKE) -C main binuninstall
  878. uninstall-headers:
  879. rm -rf "$(DESTDIR)$(ASTHEADERDIR)"
  880. rm -f "$(DESTDIR)$(includedir)/asterisk.h"
  881. _uninstall: $(SUBDIRS_UNINSTALL) main-binuninstall
  882. rm -f "$(DESTDIR)$(ASTMODDIR)/"*
  883. test -n "$(_oldmoddir)" -a -d "$(_oldmoddir)" && rm -f "$(_oldmoddir)/"* || :
  884. rm -f "$(DESTDIR)$(ASTSBINDIR)/astgenkey"
  885. rm -f "$(DESTDIR)$(ASTSBINDIR)/autosupport"
  886. rm -rf "$(DESTDIR)$(ASTDATADIR)/firmware"
  887. rm -f "$(DESTDIR)$(ASTMANDIR)/man8/asterisk.8"
  888. rm -f "$(DESTDIR)$(ASTMANDIR)/man8/astgenkey.8"
  889. rm -f "$(DESTDIR)$(ASTMANDIR)/man8/autosupport.8"
  890. rm -f "$(DESTDIR)$(ASTMANDIR)/man8/safe_asterisk.8"
  891. ifeq ($(HAVE_DAHDI),1)
  892. rm -f $(DESTDIR)$(DAHDI_UDEV_HOOK_DIR)/40-asterisk
  893. endif
  894. $(MAKE) -C sounds uninstall
  895. ifeq ($(LDCONFIG),)
  896. else ifeq ($(LDCONFIG),:)
  897. else
  898. $(LDCONFIG) "$(ASTLIBDIR)/" || :
  899. endif
  900. uninstall: _uninstall
  901. @echo " +--------- Asterisk Uninstall Complete -----+"
  902. @echo " + Asterisk binaries, sounds, man pages, +"
  903. @echo " + headers, modules, and firmware builds, +"
  904. @echo " + have all been uninstalled. +"
  905. @echo " + +"
  906. @echo " + To remove ALL traces of Asterisk, +"
  907. @echo " + including configuration, spool +"
  908. @echo " + directories, and logs, run the following +"
  909. @echo " + command: +"
  910. @echo " + +"
  911. @echo " + $(mK) uninstall-all +"
  912. @echo " +-------------------------------------------+"
  913. uninstall-all: _uninstall uninstall-headers
  914. rm -rf "$(DESTDIR)$(ASTMODDIR)"
  915. test -n "$(_oldmoddir)" -a -d "$(_oldmoddir)" && rm -rf "$(_oldmoddir)" || :
  916. rm -rf "$(DESTDIR)$(ASTVARLIBDIR)"
  917. rm -rf "$(DESTDIR)$(ASTDATADIR)"
  918. rm -rf "$(DESTDIR)$(ASTSPOOLDIR)"
  919. rm -rf "$(DESTDIR)$(ASTETCDIR)"
  920. rm -rf "$(DESTDIR)$(ASTLOGDIR)"
  921. rm -rf "$(DESTDIR)$(ASTCACHEDIR)"
  922. menuconfig: menuselect
  923. cmenuconfig: cmenuselect
  924. gmenuconfig: gmenuselect
  925. nmenuconfig: nmenuselect
  926. menuselect: menuselect/cmenuselect menuselect/nmenuselect menuselect/gmenuselect
  927. @if [ -x menuselect/nmenuselect ]; then \
  928. $(MAKE) nmenuselect; \
  929. elif [ -x menuselect/cmenuselect ]; then \
  930. $(MAKE) cmenuselect; \
  931. elif [ -x menuselect/gmenuselect ]; then \
  932. $(MAKE) gmenuselect; \
  933. else \
  934. echo "No menuselect user interface found. Install ncurses,"; \
  935. echo "newt or GTK libraries to build one and re-rerun"; \
  936. echo "'./configure' and 'make menuselect'."; \
  937. fi
  938. cmenuselect: menuselect/cmenuselect menuselect-tree menuselect.makeopts
  939. -@menuselect/cmenuselect menuselect.makeopts && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
  940. gmenuselect: menuselect/gmenuselect menuselect-tree menuselect.makeopts
  941. -@menuselect/gmenuselect menuselect.makeopts && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
  942. nmenuselect: menuselect/nmenuselect menuselect-tree menuselect.makeopts
  943. -@menuselect/nmenuselect menuselect.makeopts && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
  944. # options for make in menuselect/
  945. MAKE_MENUSELECT=CC="$(BUILD_CC)" CXX="$(CXX)" LD="" AR="" RANLIB="" \
  946. CFLAGS="$(BUILD_CFLAGS)" LDFLAGS="$(BUILD_LDFLAGS)" \
  947. $(MAKE) -C menuselect CONFIGURE_SILENT="--silent"
  948. menuselect/menuselect: menuselect/makeopts .lastclean
  949. +$(MAKE_MENUSELECT) menuselect
  950. menuselect/cmenuselect: menuselect/makeopts .lastclean
  951. +$(MAKE_MENUSELECT) cmenuselect
  952. menuselect/gmenuselect: menuselect/makeopts .lastclean
  953. +$(MAKE_MENUSELECT) gmenuselect
  954. menuselect/nmenuselect: menuselect/makeopts .lastclean
  955. +$(MAKE_MENUSELECT) nmenuselect
  956. menuselect/makeopts: makeopts .lastclean
  957. +$(MAKE_MENUSELECT) makeopts
  958. menuselect-tree: $(foreach dir,$(filter-out main,$(MOD_SUBDIRS)),$(wildcard $(dir)/*.c) $(wildcard $(dir)/*.cc) $(wildcard $(dir)/*.xml)) build_tools/cflags.xml build_tools/cflags-devmode.xml sounds/sounds.xml utils/utils.xml agi/agi.xml configure makeopts
  959. @echo "Generating input for menuselect ..."
  960. @echo "<?xml version=\"1.0\"?>" > $@
  961. @echo >> $@
  962. @echo "<menu name=\"Asterisk Module and Build Option Selection\">" >> $@
  963. +@for dir in $(sort $(filter-out main,$(MOD_SUBDIRS))); do $(SILENTMAKE) -C $${dir} SUBDIR=$${dir} moduleinfo >> $@; done
  964. @cat build_tools/cflags.xml >> $@
  965. +@for dir in $(sort $(filter-out main,$(MOD_SUBDIRS))); do $(SILENTMAKE) -C $${dir} SUBDIR=$${dir} makeopts >> $@; done
  966. @if [ "${AST_DEVMODE}" = "yes" ]; then \
  967. cat build_tools/cflags-devmode.xml >> $@; \
  968. fi
  969. @cat utils/utils.xml >> $@
  970. @cat agi/agi.xml >> $@
  971. @cat sounds/sounds.xml >> $@
  972. @echo "</menu>" >> $@
  973. # We don't want to require Python or Pystache for every build, so this is its
  974. # own target.
  975. ari-stubs:
  976. ifeq ($(PYTHON),:)
  977. @echo "--------------------------------------------------------------------------"
  978. @echo "--- Please install python to build ARI stubs ---"
  979. @echo "--------------------------------------------------------------------------"
  980. @false
  981. else
  982. @$(INSTALL) -d doc/rest-api
  983. $(PYTHON) rest-api-templates/make_ari_stubs.py \
  984. --resources rest-api/resources.json --source-dir $(ASTTOPDIR) \
  985. --dest-dir $(ASTTOPDIR)/doc/rest-api --docs-prefix ../
  986. endif
  987. check-alembic: makeopts
  988. @find contrib/ast-db-manage/ -name '*.pyc' -delete
  989. @ALEMBIC=$(ALEMBIC) build_tools/make_check_alembic config cdr voicemail >&2
  990. .PHONY: install-configs
  991. .PHONY: install-headers
  992. .PHONY: menuselect
  993. .PHONY: main
  994. .PHONY: sounds
  995. .PHONY: clean
  996. .PHONY: dist-clean
  997. .PHONY: distclean
  998. .PHONY: all
  999. .PHONY: _all
  1000. .PHONY: full
  1001. .PHONY: _full
  1002. .PHONY: uninstall
  1003. .PHONY: _uninstall
  1004. .PHONY: uninstall-all
  1005. .PHONY: uninstall-headers
  1006. .PHONY: badshell
  1007. .PHONY: installdirs
  1008. .PHONY: progdocs
  1009. .PHONY: validate-docs
  1010. .PHONY: _clean
  1011. .PHONY: ari-stubs
  1012. .PHONY: basic-pbx
  1013. .PHONY: check-alembic
  1014. .PHONY: ld-cache-update
  1015. .PHONY: check-old-libdir
  1016. .PHONY: $(SUBDIRS_INSTALL)
  1017. .PHONY: $(SUBDIRS_DIST_CLEAN)
  1018. .PHONY: $(SUBDIRS_CLEAN)
  1019. .PHONY: $(SUBDIRS_UNINSTALL)
  1020. .PHONY: $(SUBDIRS)
  1021. FORCE:
  1022. # This only stops targets within the root Makefile from building in parallel.
  1023. .NOTPARALLEL: