Makefile 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. #
  2. # Asterisk -- A telephony toolkit for Linux.
  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 utils.c strings.c threadstorage.c sha1.c astobj2.c hashtest2 hashtest refcounter
  74. rm -f db1-ast/.*.d
  75. @$(MAKE) -C db1-ast clean
  76. md5.c: $(ASTTOPDIR)/main/md5.c
  77. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  78. $(CMD_PREFIX) cp "$<" "$@"
  79. astman: astman.o md5.o
  80. astman: LIBS+=$(NEWT_LIB)
  81. astman.o: _ASTCFLAGS+=-DNO_MALLOC_DEBUG
  82. stereorize: stereorize.o frame.o
  83. stereorize: LIBS+=-lm
  84. hashtab.c: $(ASTTOPDIR)/main/hashtab.c
  85. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  86. $(CMD_PREFIX) cp "$<" "$@"
  87. lock.c: $(ASTTOPDIR)/main/lock.c
  88. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  89. $(CMD_PREFIX) cp "$<" "$@"
  90. strcompat.c: $(ASTTOPDIR)/main/strcompat.c
  91. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  92. $(CMD_PREFIX) cp "$<" "$@"
  93. pval.c: $(ASTTOPDIR)/res/ael/pval.c
  94. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  95. $(CMD_PREFIX) cp "$<" "$@"
  96. ast_expr2.c: $(ASTTOPDIR)/main/ast_expr2.c
  97. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  98. $(CMD_PREFIX) cp "$<" "$@"
  99. ast_expr2.h: $(ASTTOPDIR)/main/ast_expr2.h
  100. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  101. $(CMD_PREFIX) cp "$<" "$@"
  102. ast_expr2f.c: $(ASTTOPDIR)/main/ast_expr2f.c
  103. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  104. $(CMD_PREFIX) cp "$<" "$@"
  105. ast_expr2f.o: _ASTCFLAGS+=-I$(ASTTOPDIR)/main -Wno-unused
  106. check_expr: check_expr.o ast_expr2.o ast_expr2f.o strcompat.o threadstorage.o clicompat.o
  107. aelbison.c: $(ASTTOPDIR)/res/ael/ael.tab.c
  108. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  109. $(CMD_PREFIX) cp "$<" "$@"
  110. aelbison.o: _ASTCFLAGS+=-I$(ASTTOPDIR)/res/ael -DYYENABLE_NLS=0
  111. pbx_ael.c: $(ASTTOPDIR)/pbx/pbx_ael.c
  112. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  113. $(CMD_PREFIX) cp "$<" "$@"
  114. aelparse.c: $(ASTTOPDIR)/res/ael/ael_lex.c
  115. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  116. $(CMD_PREFIX) cp "$<" "$@"
  117. aelparse.o: _ASTCFLAGS+=-I$(ASTTOPDIR)/res -Wno-unused
  118. aelparse: LIBS+=-lm
  119. 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
  120. astobj2.c: $(ASTTOPDIR)/main/astobj2.c
  121. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  122. $(CMD_PREFIX) cp "$<" "$@"
  123. utils.c: $(ASTTOPDIR)/main/utils.c
  124. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  125. $(CMD_PREFIX) cp "$<" "$@"
  126. poll.c: $(ASTTOPDIR)/main/poll.c
  127. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  128. $(CMD_PREFIX) cp "$<" "$@"
  129. strings.c: $(ASTTOPDIR)/main/strings.c
  130. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  131. $(CMD_PREFIX) cp "$<" "$@"
  132. sha1.c: $(ASTTOPDIR)/main/sha1.c
  133. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  134. $(CMD_PREFIX) cp "$<" "$@"
  135. threadstorage.c: $(ASTTOPDIR)/main/threadstorage.c
  136. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  137. $(CMD_PREFIX) cp "$<" "$@"
  138. hashtest2.o: _ASTCFLAGS+=-O0
  139. hashtest2: hashtest2.o md5.o lock.o utils.o strings.o astobj2.o sha1.o strcompat.o threadstorage.o clicompat.o poll.o
  140. hashtest: hashtest.o md5.o hashtab.o lock.o utils.o strings.o sha1.o strcompat.o threadstorage.o clicompat.o poll.o
  141. hashtest.o: _ASTCFLAGS+=-O0
  142. refcounter: refcounter.o md5.o hashtab.o lock.o utils.o strings.o sha1.o strcompat.o threadstorage.o clicompat.o poll.o
  143. refcounter.o: _ASTCFLAGS+=-O0
  144. extconf.o: extconf.c
  145. 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
  146. check_expr2: $(ASTTOPDIR)/main/ast_expr2f.c $(ASTTOPDIR)/main/ast_expr2.c $(ASTTOPDIR)/main/ast_expr2.h
  147. $(ECHO_PREFIX) echo " [CC] ast_expr2f.c -> ast_expr2fz.o"
  148. $(CC) -g -c -I$(ASTTOPDIR)/include -DSTANDALONE $(ASTTOPDIR)/main/ast_expr2f.c -o ast_expr2fz.o
  149. $(ECHO_PREFIX) echo " [CC] ast_expr2.c -> ast_expr2z.o"
  150. $(CC) -g -c -I$(ASTTOPDIR)/include -DSTANDALONE2 $(ASTTOPDIR)/main/ast_expr2.c -o ast_expr2z.o
  151. $(ECHO_PREFIX) echo " [LD] ast_expr2fz.o ast_expr2z.o -> check_expr2"
  152. $(CC) -g -o check_expr2 ast_expr2fz.o ast_expr2z.o -lm
  153. $(ECHO_PREFIX) echo " [RM] ast_expr2fz.o ast_expr2z.o"
  154. rm ast_expr2z.o ast_expr2fz.o
  155. ./check_expr2 expr2.testinput
  156. smsq: smsq.o strcompat.o
  157. smsq: LIBS+=$(POPT_LIB)
  158. streamplayer: streamplayer.o
  159. muted: muted.o
  160. muted: LIBS+=$(AUDIO_LIBS)
  161. muted: _ASTCFLAGS:=$(filter-out -Werror,$(_ASTCFLAGS))
  162. CHECK_SUBDIR: # do nothing, just make sure that we recurse in the subdir/
  163. db1-ast/libdb1.a: CHECK_SUBDIR
  164. _ASTCFLAGS="$(_ASTCFLAGS) -Wno-strict-aliasing" ASTCFLAGS="$(ASTCFLAGS)" $(MAKE) -C db1-ast libdb1.a
  165. astdb2sqlite3: LIBS+=$(SQLITE3_LIB)
  166. astdb2sqlite3: _ASTCFLAGS+=$(SQLITE3_INCLUDE)
  167. astdb2sqlite3: db1-ast/libdb1.a
  168. ifneq ($(wildcard .*.d),)
  169. include .*.d
  170. endif