Makefile 36 KB

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