Makefile 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. #
  2. # Asterisk -- An open source telephony toolkit.
  3. #
  4. # Various utilities
  5. #
  6. # Copyright (C) 1999-2006, Digium
  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. ASTTOPDIR?=..
  14. -include $(ASTTOPDIR)/menuselect.makeopts
  15. .PHONY: clean all uninstall
  16. # to get check_expr, add it to the ALL_UTILS list -- this is a somewhat old checking
  17. # program that wants an ael file for input, and will check each $[] expr for
  18. # possible (old) problems, like spacing around operators, which dates back to
  19. # the 1.2 days. The neat part is that it will actually evaluate the expressions.
  20. # Users could use this to quickly check expressions in their .ael file.
  21. # to get check_expr2, add it to the ALL_UTILS list -- this is a program that will
  22. # read in a file containing expressions (as if they were in $[ ]), one per line.
  23. # It will, of course signal any syntax errors. Devs (like murf) should use this whenever
  24. # changes are made to ast_expr2.y or ast_expr2.fl (or the corresponding .c files),
  25. # as a regression test. Others (mere mortals?) need not bother, but they are
  26. # more than welcome to play! The regression test itself is in expr2.testinput.
  27. ALL_UTILS:=$(MENUSELECT_UTILS)
  28. UTILS:=$(ALL_UTILS)
  29. LIBS += $(BKTR_LIB) # astobj2 with devmode uses backtrace
  30. _ASTCFLAGS+=-DSTANDALONE
  31. include $(ASTTOPDIR)/Makefile.rules
  32. ifeq ($(OSARCH),SunOS)
  33. LIBS+=-lsocket -lnsl
  34. UTILS:=$(filter-out muted,$(UTILS))
  35. endif
  36. ifeq ($(OSARCH),OpenBSD)
  37. UTILS:=$(filter-out muted,$(UTILS))
  38. endif
  39. ifeq ($(OSARCH),cygwin)
  40. UTILS:=$(filter-out muted,$(UTILS))
  41. endif
  42. ifeq ($(OSARCH),mingw32)
  43. UTILS:=
  44. endif
  45. ifneq ($(findstring darwin,$(OSARCH)),)
  46. AUDIO_LIBS=-framework CoreAudio
  47. endif
  48. ifeq ($(POPT_LIB),)
  49. UTILS:=$(filter-out smsq,$(UTILS))
  50. endif
  51. ifeq ($(NEWT_LIB),)
  52. UTILS:=$(filter-out astman,$(UTILS))
  53. endif
  54. ifneq ($(filter pbx_ael,$(MENUSELECT_PBX)),)
  55. UTILS:=$(filter-out aelparse,$(UTILS))
  56. UTILS:=$(filter-out conf2ael,$(UTILS))
  57. endif
  58. all: $(UTILS)
  59. install:
  60. for x in $(UTILS); do \
  61. if [ "$$x" != "none" ]; then \
  62. $(INSTALL) -m 755 $$x "$(DESTDIR)$(ASTSBINDIR)/$$x"; \
  63. fi; \
  64. done
  65. uninstall:
  66. for x in $(ALL_UTILS); do rm -f "$(DESTDIR)$(ASTSBINDIR)/$$x"; done
  67. clean:
  68. rm -f *.o $(ALL_UTILS) check_expr
  69. rm -f .*.d
  70. rm -f *.s *.i
  71. rm -f md5.c strcompat.c ast_expr2.c ast_expr2.h ast_expr2f.c pbx_ael.c pval.c hashtab.c lock.c
  72. rm -f aelparse.c aelbison.c conf2ael
  73. rm -f threadstorage.c
  74. rm -f utils.c strings.c poll.c version.c sha1.c astobj2.c refcounter
  75. rm -f db1-ast/.*.d
  76. @$(MAKE) -C db1-ast clean
  77. md5.c: $(ASTTOPDIR)/main/md5.c
  78. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  79. $(CMD_PREFIX) cp "$<" "$@"
  80. astman: astman.o md5.o
  81. astman: LIBS+=$(NEWT_LIB)
  82. astman.o: _ASTCFLAGS+=-DNO_MALLOC_DEBUG
  83. stereorize: stereorize.o frame.o
  84. stereorize: LIBS+=-lm
  85. hashtab.c: $(ASTTOPDIR)/main/hashtab.c
  86. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  87. $(CMD_PREFIX) cp "$<" "$@"
  88. lock.c: $(ASTTOPDIR)/main/lock.c
  89. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  90. $(CMD_PREFIX) cp "$<" "$@"
  91. strcompat.c: $(ASTTOPDIR)/main/strcompat.c
  92. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  93. $(CMD_PREFIX) cp "$<" "$@"
  94. pval.c: $(ASTTOPDIR)/res/ael/pval.c
  95. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  96. $(CMD_PREFIX) cp "$<" "$@"
  97. ast_expr2.c: $(ASTTOPDIR)/main/ast_expr2.c
  98. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  99. $(CMD_PREFIX) cp "$<" "$@"
  100. ast_expr2.h: $(ASTTOPDIR)/main/ast_expr2.h
  101. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  102. $(CMD_PREFIX) cp "$<" "$@"
  103. ast_expr2f.c: $(ASTTOPDIR)/main/ast_expr2f.c
  104. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  105. $(CMD_PREFIX) cp "$<" "$@"
  106. ast_expr2f.o: _ASTCFLAGS+=-I$(ASTTOPDIR)/main -Wno-unused
  107. check_expr: check_expr.o ast_expr2.o ast_expr2f.o strcompat.o threadstorage.o clicompat.o
  108. aelbison.c: $(ASTTOPDIR)/res/ael/ael.tab.c
  109. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  110. $(CMD_PREFIX) cp "$<" "$@"
  111. aelbison.o: _ASTCFLAGS+=-I$(ASTTOPDIR)/res/ael -DYYENABLE_NLS=0
  112. ifneq ($(AST_CLANG_BLOCKS),)
  113. _ASTCFLAGS+=-Wno-parentheses-equality
  114. endif
  115. pbx_ael.c: $(ASTTOPDIR)/pbx/pbx_ael.c
  116. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  117. $(CMD_PREFIX) cp "$<" "$@"
  118. $(ECHO_PREFIX) echo " [SED] $@"
  119. $(CMD_PREFIX) sed 's/ast_debug([[:digit:]][[:digit:]]*/ast_log(LOG_DEBUG/' "$@" > "$@.new"
  120. $(CMD_PREFIX) mv "$@.new" "$@"
  121. aelparse.c: $(ASTTOPDIR)/res/ael/ael_lex.c
  122. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  123. $(CMD_PREFIX) cp "$<" "$@"
  124. $(ECHO_PREFIX) echo " [SED] $@"
  125. $(CMD_PREFIX) sed 's/ast_debug([[:digit:]][[:digit:]]*/ast_log(LOG_DEBUG/' "$@" > "$@.new"
  126. $(CMD_PREFIX) mv "$@.new" "$@"
  127. aelparse.o: _ASTCFLAGS+=-I$(ASTTOPDIR)/res -Wno-unused
  128. aelparse: LIBS+=-lm
  129. aelparse: aelparse.o aelbison.o pbx_ael.o hashtab.o lock.o ael_main.o ast_expr2f.o ast_expr2.o strcompat.o pval.o extconf.o
  130. threadstorage.c: $(ASTTOPDIR)/main/threadstorage.c
  131. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  132. $(CMD_PREFIX) cp "$<" "$@"
  133. extconf.o: extconf.c
  134. conf2ael: conf2ael.o ast_expr2f.o ast_expr2.o hashtab.o lock.o aelbison.o aelparse.o pbx_ael.o pval.o extconf.o strcompat.o
  135. check_expr2: $(ASTTOPDIR)/main/ast_expr2f.c $(ASTTOPDIR)/main/ast_expr2.c $(ASTTOPDIR)/main/ast_expr2.h
  136. $(ECHO_PREFIX) echo " [CC] ast_expr2f.c -> ast_expr2fz.o"
  137. $(CC) -g -c -I$(ASTTOPDIR)/include -DSTANDALONE $(ASTTOPDIR)/main/ast_expr2f.c -o ast_expr2fz.o
  138. $(ECHO_PREFIX) echo " [CC] ast_expr2.c -> ast_expr2z.o"
  139. $(CC) -g -c -I$(ASTTOPDIR)/include -DSTANDALONE2 $(ASTTOPDIR)/main/ast_expr2.c -o ast_expr2z.o
  140. $(ECHO_PREFIX) echo " [LD] ast_expr2fz.o ast_expr2z.o -> check_expr2"
  141. $(CC) -g -o check_expr2 ast_expr2fz.o ast_expr2z.o -lm
  142. $(ECHO_PREFIX) echo " [RM] ast_expr2fz.o ast_expr2z.o"
  143. rm ast_expr2z.o ast_expr2fz.o
  144. ./check_expr2 expr2.testinput
  145. smsq: smsq.o strcompat.o
  146. smsq: LIBS+=$(POPT_LIB)
  147. streamplayer: streamplayer.o
  148. muted: muted.o
  149. muted: LIBS+=$(AUDIO_LIBS)
  150. muted: _ASTCFLAGS:=$(filter-out -Werror,$(_ASTCFLAGS))
  151. CHECK_SUBDIR: # do nothing, just make sure that we recurse in the subdir/
  152. db1-ast/libdb1.a: CHECK_SUBDIR
  153. _ASTCFLAGS="$(_ASTCFLAGS) -Wno-strict-aliasing" ASTCFLAGS="$(ASTCFLAGS)" $(MAKE) -C db1-ast libdb1.a
  154. astdb2sqlite3: LIBS+=$(SQLITE3_LIB)
  155. astdb2sqlite3: _ASTCFLAGS+=$(SQLITE3_INCLUDE)
  156. astdb2sqlite3: db1-ast/libdb1.a
  157. astdb2bdb: LIBS+=$(SQLITE3_LIB)
  158. astdb2bdb: _ASTCFLAGS+=$(SQLITE3_INCLUDE)
  159. astdb2bdb: db1-ast/libdb1.a
  160. ifneq ($(wildcard .*.d),)
  161. include .*.d
  162. endif