Makefile 34 KB

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