modmake.rules.in 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. @SET_MAKE@
  2. switch_builddir=@switch_builddir@
  3. switch_srcdir=@switch_srcdir@
  4. build=@build@
  5. host=@host@
  6. target=$(host)
  7. prefix=@prefix@
  8. exec_prefix=@exec_prefix@
  9. libdir=@libdir@
  10. libexecdir=@libexecdir@
  11. includedir=@includedir@
  12. modulesdir=@modulesdir@
  13. runtimedir=@runtimedir@
  14. logfiledir=@logfiledir@
  15. sysconfdir=@sysconfdir@
  16. localstatedir=@localstatedir@
  17. grammardir=@grammardir@
  18. CC=@CC@
  19. CXX=@CXX@
  20. AWK=@AWK@
  21. SHELL=@SHELL@
  22. INSTALL=@INSTALL@
  23. GETLIB=@GETLIB@
  24. LIBTOOL=@LIBTOOL@
  25. AR=@AR@
  26. LTINSTALL=$(LIBTOOL) --quiet --mode=install $(INSTALL)
  27. LTUNINSTALL=$(LIBTOOL) --mode=uninstall rm -f
  28. CCLD = $(CC)
  29. CXXLD = $(CXX)
  30. OPENSSL_LIBS=@openssl_LIBS@
  31. OPENSSL_CFLAGS=@openssl_CFLAGS@
  32. LIBS=$(switch_builddir)/libfreeswitch.la
  33. DEFS=@DEFS@
  34. DYLD_LIBRARY_PATH=@libdir@:$DYLD_LIBRARY_PATH
  35. LD_LIBRARY_PATH=@libdir@:$LD_LIBRARY_PATH
  36. OSARCH=`uname -s`
  37. LIBTOOL_LIB_EXTEN = @LIBTOOL_LIB_EXTEN@
  38. SOLINK = @SOLINK@
  39. CFLAGS=@CFLAGS@
  40. CXXFLAGS=@CXXFLAGS@
  41. LDFLAGS=@SWITCH_AM_LDFLAGS@ @LDFLAGS@ $(OUR_LDFLAGS)
  42. ALL_CFLAGS = $(LOCAL_CFLAGS) $(MOD_CFLAGS) @SWITCH_AM_CFLAGS@ @CFLAGS@ @SWITCH_ANSI_CFLAGS@ -D_GNU_SOURCE $(OUR_CFLAGS)
  43. ALL_CXXFLAGS = $(LOCAL_CFLAGS) $(MOD_CFLAGS) @SWITCH_AM_CXXFLAGS@ @CXXFLAGS@ -D_GNU_SOURCE $(OUR_CFLAGS)
  44. DEFAULT_VARS:= CFLAGS="$(CFLAGS)" CPPFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" CC="$(CC)" CXX="$(CXX)"
  45. DEFAULT_ARGS:= --build=$(build) --host=$(host) --target=$(target) \
  46. --prefix="$(prefix)" --exec_prefix="$(exec_prefix)" --libdir="$(libdir)" \
  47. --disable-shared --with-pic
  48. COMPILE = $(CC) $(ALL_CFLAGS) $(DEFS)
  49. LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(COMPILE)
  50. LINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(ALL_CFLAGS) $(LDFLAGS) -shared -module -avoid-version -rpath $(modulesdir) -o $@
  51. CXXCOMPILE = $(CXX) $(ALL_CXXFLAGS) $(DEFS)
  52. LTCXXCOMPILE = $(LIBTOOL) --mode=compile --tag=CXX $(CXXCOMPILE)
  53. CXXLINK = $(LIBTOOL) --mode=link --tag=CXX $(CXXLD) $(ALL_CXXFLAGS) $(LDFLAGS) -shared -module -avoid-version -rpath $(modulesdir) -o $@
  54. CSOURCEFILE=$(MODNAME).c
  55. CXXSOURCEFILE=$(MODNAME).cpp
  56. TOUCH_TARGET=@TOUCH_TARGET@
  57. #MAKE_OPTS = `if test -z "$(VERBOSE)" ; then $(MAKE) --help | grep silent | grep "\-s" 2>&1 >/dev/null && echo -s;fi`
  58. MAKE_OPTS = `test -n "$(VERBOSE)" || echo -s`
  59. RECURSE_MODNAME=`pwd | sed -e 's|^.*/||'`
  60. RECURSE_SOURCEFILE=`if test -f "$$modname.cpp" -o -f "$(MODDIR)/$$modname.cpp"; then echo "$$modname.cpp"; else echo "$$modname.c"; fi`
  61. RECURSE_OUR_CFLAGS=` $(LOCAL_INSERT_CFLAGS) `
  62. RECURSE_OUR_LDFLAGS=` $(LOCAL_INSERT_LDFLAGS) `
  63. RECURSE_MODDIR=`if test -z $(MODDIR); then pwd | sed -e 's|$(switch_builddir)|$(switch_srcdir)|'; else echo $(MODDIR); fi`
  64. RECURSE_MAKE=+modname="$(RECURSE_MODNAME)" ; \
  65. sourcefile="$(RECURSE_SOURCEFILE)" ; \
  66. osarch=`uname -s` ; \
  67. ourcflags="$(RECURSE_OUR_CFLAGS)" ; \
  68. ourldflags="$(RECURSE_OUR_LDFLAGS)" ; \
  69. insertobjs="`$(LOCAL_INSERT_OBJS)`" ; \
  70. moddir="$(RECURSE_MODDIR)" ; \
  71. $(MAKE) $(MAKE_OPTS) MODNAME="$$modname" SOURCEFILE="$$sourcefile" MODDIR="$$moddir" \
  72. OUR_CFLAGS="$$ourcflags" OUR_LDFLAGS="$$ourldflags" OUR_OBJS="$$insertobjs"
  73. all: Makefile
  74. @$(RECURSE_MAKE) all-modules || exit 1
  75. depend: Makefile
  76. @$(RECURSE_MAKE) depend-modules || exit 1
  77. clean: Makefile
  78. @$(RECURSE_MAKE) clean-modules || exit 1
  79. install: Makefile
  80. @$(RECURSE_MAKE) install-modules || exit 1
  81. uninstall: Makefile
  82. @$(RECURSE_MAKE) uninstall-modules || exit 1
  83. distclean: Makefile
  84. @$(RECURSE_MAKE) distclean-modules || exit 1
  85. extraclean: Makefile
  86. @$(RECURSE_MAKE) extraclean-modules || exit 1
  87. all-modules: local_depend $(MODNAME).$(LIBTOOL_LIB_EXTEN) local_all Makefile
  88. depend-modules: local_depend
  89. clean-modules: local_clean mod_clean
  90. install-modules: all-modules depend_install local_install mod_install
  91. uninstall-modules: local_uninstall mod_uninstall
  92. distclean-modules: clean-modules local_distclean
  93. extraclean-modules: distclean local_extraclean
  94. print_tests:
  95. Makefile:
  96. @if test ! -f $@; then \
  97. if ! pwd | grep $(switch_builddir)/src/mod ; then rulesdir=$(switch_builddir) ; else rulesdir=../../../.. ; fi ; \
  98. echo BASE=$$rulesdir > Makefile ; \
  99. echo 'include $$(BASE)/build/modmake.rules' >> Makefile ; \
  100. fi ;
  101. LINK_OUTPUT_REDIR=> .libs/$(MODNAME).log || error="yes" ; \
  102. if test -n "$(VERBOSE)" -o "$$error" = "yes"; then \
  103. cat .libs/$(MODNAME).log ; \
  104. fi ;\
  105. if test "$$error" = "yes"; then \
  106. exit 1 ;\
  107. fi
  108. $(MODNAME).$(LIBTOOL_LIB_EXTEN): $(LIBS) $(LOCAL_LIBADD) $(LOCAL_OBJS) $(OUR_OBJS) $(MODDIR)/$(SOURCEFILE) $(MODNAME).lo
  109. @echo Creating $@...
  110. @test -d .libs || mkdir .libs
  111. @error="";\
  112. if test -f "$(CSOURCEFILE)" -o -f "$(MODDIR)/$(CSOURCEFILE)"; then \
  113. $(LINK) $(SOLINK) $(MODNAME).lo $(LIBS) $(LOCAL_LDFLAGS) $(LOCAL_OBJS) $(OUR_OBJS) $(LOCAL_LIBADD) $(LOCAL_LDFLAGS_POST) $(LINK_OUTPUT_REDIR) ;\
  114. else \
  115. $(CXXLINK) $(SOLINK) $(MODNAME).lo $(LIBS) $(LOCAL_LDFLAGS) $(LOCAL_OBJS) $(OUR_OBJS) $(LOCAL_LIBADD) $(LOCAL_LDFLAGS_POST) $(LINK_OUTPUT_REDIR) ;\
  116. fi;
  117. mod_clean:
  118. @rm -fr *.$(LIBTOOL_LIB_EXTEN) *.o *.lo *~ .libs $(LOCAL_OBJS)
  119. mod_install: $(DESTDIR)$(modulesdir)/$(MODNAME).$(LIBTOOL_LIB_EXTEN)
  120. $(DESTDIR)$(modulesdir)/$(MODNAME).$(LIBTOOL_LIB_EXTEN):$(MODNAME).$(LIBTOOL_LIB_EXTEN)
  121. @echo installing $<
  122. @$(LTINSTALL) $(MODNAME).$(LIBTOOL_LIB_EXTEN) $(DESTDIR)$(modulesdir) >/dev/null
  123. mod_uninstall:
  124. @$(LTUNINSTALL) $(DESTDIR)$(modulesdir)/$(MODNAME).$(LIBTOOL_LIB_EXTEN)
  125. # define these in your makefile if you wish
  126. local_all local_depend local_clean depend_install local_install local_distclean local_extraclean local_uninstall:
  127. #
  128. # Implicit rules for creating outputs from input files
  129. #
  130. .SUFFIXES:
  131. .SUFFIXES: .c .lo .o .cpp
  132. .c.o:
  133. @echo Compiling $<...
  134. @if test ! -z $(VERBOSE) ; then echo $(COMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; fi
  135. @$(COMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< || exit 1
  136. .c.lo:
  137. @echo Compiling $<...
  138. @if test ! -z $(VERBOSE) ; then echo $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; fi
  139. @$(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< || exit 1
  140. .cpp.o:
  141. @echo Compiling $<...
  142. @if test ! -z $(VERBOSE) ; then echo $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; fi
  143. @$(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< || exit 1
  144. .cpp.lo:
  145. @echo Compiling $<...
  146. @if test ! -z $(VERBOSE) ; then echo $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; fi
  147. @$(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< || exit 1
  148. $(MODNAME).o: $(MODDIR)/$(SOURCEFILE) \
  149. $(switch_srcdir)/src/include/switch.h \
  150. $(switch_builddir)/src/include/switch_am_config.h \
  151. $(switch_srcdir)/src/include/switch_types.h $(switch_srcdir)/src/include/switch_apr.h \
  152. $(switch_srcdir)/src/include/switch_core_db.h $(switch_srcdir)/src/include/switch_regex.h \
  153. $(switch_srcdir)/src/include/switch_core.h $(switch_srcdir)/src/include/switch_loadable_module.h \
  154. $(switch_srcdir)/src/include/switch_console.h $(switch_srcdir)/src/include/switch_utils.h \
  155. $(switch_srcdir)/src/include/switch_caller.h $(switch_srcdir)/src/include/switch_config.h \
  156. $(switch_srcdir)/src/include/switch_frame.h $(switch_srcdir)/src/include/switch_module_interfaces.h \
  157. $(switch_srcdir)/src/include/switch_channel.h $(switch_srcdir)/src/include/switch_buffer.h \
  158. $(switch_srcdir)/src/include/switch_event.h $(switch_srcdir)/src/include/switch_resample.h \
  159. $(switch_srcdir)/src/include/switch_ivr.h $(switch_srcdir)/src/include/switch_rtp.h \
  160. $(switch_srcdir)/src/include/switch_stun.h $(switch_srcdir)/src/include/switch_log.h \
  161. $(switch_srcdir)/src/include/switch_xml.h $(switch_srcdir)/src/include/switch_spandsp.h
  162. @echo Compiling $<...
  163. if test -f "$(CSOURCEFILE)" -o -f "$(MODDIR)/$(CSOURCEFILE)"; then \
  164. if test ! -z $(VERBOSE) ; then echo $(COMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; fi ;\
  165. $(COMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; \
  166. else \
  167. if test ! -z $(VERBOSE) ; then echo $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; fi ;\
  168. $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; \
  169. fi;
  170. $(MODNAME).lo: $(MODDIR)/$(SOURCEFILE) \
  171. $(switch_srcdir)/src/include/switch.h \
  172. $(switch_builddir)/src/include/switch_am_config.h \
  173. $(switch_srcdir)/src/include/switch_types.h $(switch_srcdir)/src/include/switch_apr.h \
  174. $(switch_srcdir)/src/include/switch_core_db.h $(switch_srcdir)/src/include/switch_regex.h \
  175. $(switch_srcdir)/src/include/switch_core.h $(switch_srcdir)/src/include/switch_loadable_module.h \
  176. $(switch_srcdir)/src/include/switch_console.h $(switch_srcdir)/src/include/switch_utils.h \
  177. $(switch_srcdir)/src/include/switch_caller.h $(switch_srcdir)/src/include/switch_config.h \
  178. $(switch_srcdir)/src/include/switch_frame.h $(switch_srcdir)/src/include/switch_module_interfaces.h \
  179. $(switch_srcdir)/src/include/switch_channel.h $(switch_srcdir)/src/include/switch_buffer.h \
  180. $(switch_srcdir)/src/include/switch_event.h $(switch_srcdir)/src/include/switch_resample.h \
  181. $(switch_srcdir)/src/include/switch_ivr.h $(switch_srcdir)/src/include/switch_rtp.h \
  182. $(switch_srcdir)/src/include/switch_stun.h $(switch_srcdir)/src/include/switch_log.h \
  183. $(switch_srcdir)/src/include/switch_xml.h $(switch_srcdir)/src/include/switch_spandsp.h
  184. @echo Compiling $<...
  185. if test -f "$(CSOURCEFILE)" -o -f "$(MODDIR)/$(CSOURCEFILE)"; then \
  186. if test ! -z $(VERBOSE) ; then echo $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; fi ;\
  187. $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; \
  188. else \
  189. if test ! -z $(VERBOSE) ; then echo $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; fi ;\
  190. $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; \
  191. fi;
  192. $(switch_srcdir)/src/include/switch.h:
  193. $(switch_builddir)/src/include/switch_am_config.h: $(switch_srcdir)/src/include/switch_am_config.h.in
  194. $(switch_srcdir)/src/include/switch_types.h:
  195. $(switch_srcdir)/src/include/switch_apr.h:
  196. $(switch_srcdir)/src/include/switch_core_db.h:
  197. $(switch_srcdir)/src/include/switch_regex.h:
  198. $(switch_srcdir)/src/include/switch_core.h:
  199. $(switch_srcdir)/src/include/switch_loadable_module.h:
  200. $(switch_srcdir)/src/include/switch_console.h:
  201. $(switch_srcdir)/src/include/switch_utils.h:
  202. $(switch_srcdir)/src/include/switch_caller.h:
  203. $(switch_srcdir)/src/include/switch_config.h:
  204. $(switch_srcdir)/src/include/switch_frame.h:
  205. $(switch_srcdir)/src/include/switch_module_interfaces.h:
  206. $(switch_srcdir)/src/include/switch_channel.h:
  207. $(switch_srcdir)/src/include/switch_buffer.h:
  208. $(switch_srcdir)/src/include/switch_event.h:
  209. $(switch_srcdir)/src/include/switch_resample.h:
  210. $(switch_srcdir)/src/include/switch_ivr.h:
  211. $(switch_srcdir)/src/include/switch_rtp.h:
  212. $(switch_srcdir)/src/include/switch_spandsp.h:
  213. $(switch_srcdir)/src/include/switch_stun.h:
  214. $(switch_srcdir)/src/include/switch_log.h:
  215. $(switch_srcdir)/src/include/switch_xml.h:
  216. .PHONY: all clean depend install distclean extraclean \
  217. all-modules clean-modules depend-modules install-modules distclean-modules extraclean-modules \
  218. local_all local_clean local_depend local_install local_distclean local_extraclean \
  219. mod_clean mod_install mod_uninstall depend_install print_tests