Makefile 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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. endif
  35. ifeq ($(OSARCH),mingw32)
  36. UTILS:=
  37. endif
  38. ifneq ($(findstring darwin,$(OSARCH)),)
  39. AUDIO_LIBS=-framework CoreAudio
  40. endif
  41. ifeq ($(POPT_LIB),)
  42. UTILS:=$(filter-out smsq,$(UTILS))
  43. endif
  44. ifeq ($(NEWT_LIB),)
  45. UTILS:=$(filter-out astman,$(UTILS))
  46. endif
  47. ifneq ($(filter pbx_ael,$(MENUSELECT_PBX)),)
  48. UTILS:=$(filter-out aelparse,$(UTILS))
  49. endif
  50. all: $(UTILS)
  51. install:
  52. for x in $(UTILS); do \
  53. if [ "$$x" != "none" ]; then \
  54. $(INSTALL) -m 755 $$x "$(DESTDIR)$(ASTSBINDIR)/$$x"; \
  55. fi; \
  56. done
  57. uninstall:
  58. for x in $(ALL_UTILS); do rm -f "$(DESTDIR)$(ASTSBINDIR)/$$x"; done
  59. clean:
  60. rm -f *.o $(ALL_UTILS) check_expr
  61. rm -f .*.d
  62. rm -f *.s *.i
  63. rm -f astmm.c md5.c strcompat.c ast_expr2.c ast_expr2.h ast_expr2f.c pbx_ael.c pval.c hashtab.c lock.c
  64. rm -f aelparse.c aelbison.c
  65. rm -f threadstorage.c
  66. rm -f utils.c strings.c poll.c version.c sha1.c astobj2.c refcounter
  67. rm -f db1-ast/.*.d
  68. @$(MAKE) -C db1-ast clean
  69. md5.c: $(ASTTOPDIR)/main/md5.c
  70. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  71. $(CMD_PREFIX) cp "$<" "$@"
  72. astman: astman.o md5.o
  73. astman: LIBS+=$(NEWT_LIB)
  74. stereorize: stereorize.o frame.o
  75. stereorize: LIBS+=-lm
  76. astmm.c: $(ASTTOPDIR)/main/astmm.c
  77. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  78. $(CMD_PREFIX) cp "$<" "$@"
  79. hashtab.c: $(ASTTOPDIR)/main/hashtab.c
  80. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  81. $(CMD_PREFIX) cp "$<" "$@"
  82. lock.c: $(ASTTOPDIR)/main/lock.c
  83. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  84. $(CMD_PREFIX) cp "$<" "$@"
  85. strcompat.c: $(ASTTOPDIR)/main/strcompat.c
  86. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  87. $(CMD_PREFIX) cp "$<" "$@"
  88. pval.c: $(ASTTOPDIR)/res/ael/pval.c
  89. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  90. $(CMD_PREFIX) cp "$<" "$@"
  91. ast_expr2.c: $(ASTTOPDIR)/main/ast_expr2.c
  92. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  93. $(CMD_PREFIX) cp "$<" "$@"
  94. ast_expr2.h: $(ASTTOPDIR)/main/ast_expr2.h
  95. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  96. $(CMD_PREFIX) cp "$<" "$@"
  97. ast_expr2f.c: $(ASTTOPDIR)/main/ast_expr2f.c
  98. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  99. $(CMD_PREFIX) cp "$<" "$@"
  100. ast_expr2f.o: _ASTCFLAGS+=-I$(ASTTOPDIR)/main -Wno-unused
  101. check_expr: check_expr.o ast_expr2.o ast_expr2f.o strcompat.o threadstorage.o clicompat.o astmm.o
  102. aelbison.c: $(ASTTOPDIR)/res/ael/ael.tab.c
  103. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  104. $(CMD_PREFIX) cp "$<" "$@"
  105. aelbison.o: _ASTCFLAGS+=-I$(ASTTOPDIR)/res/ael -DYYENABLE_NLS=0
  106. pbx_ael.c: $(ASTTOPDIR)/pbx/pbx_ael.c
  107. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  108. $(CMD_PREFIX) cp "$<" "$@"
  109. $(ECHO_PREFIX) echo " [SED] $@"
  110. $(CMD_PREFIX) sed 's/ast_debug([[:digit:]][[:digit:]]*/ast_log(LOG_DEBUG/' "$@" > "$@.new"
  111. $(CMD_PREFIX) mv "$@.new" "$@"
  112. pbx_ael.o: _ASTCFLAGS+=-DAST_MODULE_SELF_SYM=__internal_pbx_ael_self
  113. aelparse.c: $(ASTTOPDIR)/res/ael/ael_lex.c
  114. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  115. $(CMD_PREFIX) cp "$<" "$@"
  116. $(ECHO_PREFIX) echo " [SED] $@"
  117. $(CMD_PREFIX) sed 's/ast_debug([[:digit:]][[:digit:]]*/ast_log(LOG_DEBUG/' "$@" > "$@.new"
  118. $(CMD_PREFIX) mv "$@.new" "$@"
  119. aelparse.o: _ASTCFLAGS+=-I$(ASTTOPDIR)/res -Wno-unused $(AST_NO_FORMAT_TRUNCATION)
  120. aelparse: LIBS+=-lm $(AST_CLANG_BLOCKS_LIBS)
  121. 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 astmm.o
  122. threadstorage.c: $(ASTTOPDIR)/main/threadstorage.c
  123. $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
  124. $(CMD_PREFIX) cp "$<" "$@"
  125. extconf.o: _ASTCFLAGS+=$(call get_menuselect_cflags,DETECT_DEADLOCKS)
  126. extconf.o: extconf.c
  127. check_expr2: $(ASTTOPDIR)/main/ast_expr2f.c $(ASTTOPDIR)/main/ast_expr2.c $(ASTTOPDIR)/main/ast_expr2.h astmm.o
  128. $(ECHO_PREFIX) echo " [CC] ast_expr2f.c -> ast_expr2fz.o"
  129. $(CC) -g -c -I$(ASTTOPDIR)/include $(_ASTCFLAGS) -DYY_NO_INPUT $(ASTTOPDIR)/main/ast_expr2f.c -o ast_expr2fz.o
  130. $(ECHO_PREFIX) echo " [CC] ast_expr2.c -> ast_expr2z.o"
  131. $(CC) -g -c -I$(ASTTOPDIR)/include $(_ASTCFLAGS) -DSTANDALONE2 $(ASTTOPDIR)/main/ast_expr2.c -o ast_expr2z.o
  132. $(ECHO_PREFIX) echo " [LD] ast_expr2fz.o ast_expr2z.o -> check_expr2"
  133. $(CC) -g -o check_expr2 ast_expr2fz.o ast_expr2z.o astmm.o -lm $(_ASTLDFLAGS)
  134. $(ECHO_PREFIX) echo " [RM] ast_expr2fz.o ast_expr2z.o"
  135. rm ast_expr2z.o ast_expr2fz.o
  136. ifneq ($(CROSS_COMPILING),1)
  137. ./check_expr2 expr2.testinput
  138. endif
  139. smsq: smsq.o strcompat.o
  140. smsq: LIBS+=$(POPT_LIB)
  141. streamplayer: streamplayer.o
  142. CHECK_SUBDIR: # do nothing, just make sure that we recurse in the subdir/
  143. db1-ast/libdb1.a: CHECK_SUBDIR
  144. _ASTCFLAGS="$(_ASTCFLAGS) -Wno-strict-aliasing" ASTCFLAGS="$(ASTCFLAGS)" $(MAKE) -C db1-ast libdb1.a
  145. astdb2sqlite3: LIBS+=$(SQLITE3_LIB)
  146. astdb2sqlite3: _ASTCFLAGS+=$(SQLITE3_INCLUDE)
  147. astdb2sqlite3: db1-ast/libdb1.a
  148. astdb2bdb: LIBS+=$(SQLITE3_LIB)
  149. astdb2bdb: _ASTCFLAGS+=$(SQLITE3_INCLUDE)
  150. astdb2bdb: db1-ast/libdb1.a
  151. conf_bridge_binaural_hrir_importer: LIBS+=$(SNDFILE_LIB)
  152. conf_bridge_binaural_hrir_importer.o: _ASTCFLAGS+=$(SNDFILE_INCLUDE)
  153. ifneq ($(wildcard .*.d),)
  154. include .*.d
  155. endif