2
0

modmake.rules.in 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  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. Makefile:
  95. @if test ! -f $@; then \
  96. if ! pwd | grep $(switch_builddir)/src/mod ; then rulesdir=$(switch_builddir) ; else rulesdir=../../../.. ; fi ; \
  97. echo BASE=$$rulesdir > Makefile ; \
  98. echo 'include $$(BASE)/build/modmake.rules' >> Makefile ; \
  99. fi ;
  100. LINK_OUTPUT_REDIR=> .libs/$(MODNAME).log || error="yes" ; \
  101. if test -n "$(VERBOSE)" -o "$$error" = "yes"; then \
  102. cat .libs/$(MODNAME).log ; \
  103. fi ;\
  104. if test "$$error" = "yes"; then \
  105. exit 1 ;\
  106. fi
  107. $(MODNAME).$(LIBTOOL_LIB_EXTEN): $(LIBS) $(LOCAL_LIBADD) $(LOCAL_OBJS) $(OUR_OBJS) $(MODDIR)/$(SOURCEFILE) $(MODNAME).lo
  108. @echo Creating $@...
  109. @test -d .libs || mkdir .libs
  110. @error="";\
  111. if test -f "$(CSOURCEFILE)" -o -f "$(MODDIR)/$(CSOURCEFILE)"; then \
  112. $(LINK) $(SOLINK) $(MODNAME).lo $(LIBS) $(LOCAL_LDFLAGS) $(LOCAL_OBJS) $(OUR_OBJS) $(LOCAL_LIBADD) $(LOCAL_LDFLAGS_POST) $(LINK_OUTPUT_REDIR) ;\
  113. else \
  114. $(CXXLINK) $(SOLINK) $(MODNAME).lo $(LIBS) $(LOCAL_LDFLAGS) $(LOCAL_OBJS) $(OUR_OBJS) $(LOCAL_LIBADD) $(LOCAL_LDFLAGS_POST) $(LINK_OUTPUT_REDIR) ;\
  115. fi;
  116. mod_clean:
  117. @rm -fr *.$(LIBTOOL_LIB_EXTEN) *.o *.lo *~ .libs $(LOCAL_OBJS)
  118. mod_install: $(DESTDIR)$(modulesdir)/$(MODNAME).$(LIBTOOL_LIB_EXTEN)
  119. $(DESTDIR)$(modulesdir)/$(MODNAME).$(LIBTOOL_LIB_EXTEN):$(MODNAME).$(LIBTOOL_LIB_EXTEN)
  120. @echo installing $<
  121. @$(LTINSTALL) $(MODNAME).$(LIBTOOL_LIB_EXTEN) $(DESTDIR)$(modulesdir) >/dev/null
  122. mod_uninstall:
  123. @$(LTUNINSTALL) $(DESTDIR)$(modulesdir)/$(MODNAME).$(LIBTOOL_LIB_EXTEN)
  124. # define these in your makefile if you wish
  125. local_all local_depend local_clean depend_install local_install local_distclean local_extraclean local_uninstall:
  126. #
  127. # Implicit rules for creating outputs from input files
  128. #
  129. .SUFFIXES:
  130. .SUFFIXES: .c .lo .o .cpp
  131. .c.o:
  132. @echo Compiling $<...
  133. @if test ! -z $(VERBOSE) ; then echo $(COMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; fi
  134. @$(COMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< || exit 1
  135. .c.lo:
  136. @echo Compiling $<...
  137. @if test ! -z $(VERBOSE) ; then echo $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; fi
  138. @$(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< || exit 1
  139. .cpp.o:
  140. @echo Compiling $<...
  141. @if test ! -z $(VERBOSE) ; then echo $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; fi
  142. @$(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< || exit 1
  143. .cpp.lo:
  144. @echo Compiling $<...
  145. @if test ! -z $(VERBOSE) ; then echo $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; fi
  146. @$(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< || exit 1
  147. $(MODNAME).o: $(MODDIR)/$(SOURCEFILE) \
  148. $(switch_srcdir)/src/include/switch.h \
  149. $(switch_builddir)/src/include/switch_am_config.h \
  150. $(switch_srcdir)/src/include/switch_types.h $(switch_srcdir)/src/include/switch_apr.h \
  151. $(switch_srcdir)/src/include/switch_core_db.h $(switch_srcdir)/src/include/switch_regex.h \
  152. $(switch_srcdir)/src/include/switch_core.h $(switch_srcdir)/src/include/switch_loadable_module.h \
  153. $(switch_srcdir)/src/include/switch_console.h $(switch_srcdir)/src/include/switch_utils.h \
  154. $(switch_srcdir)/src/include/switch_caller.h $(switch_srcdir)/src/include/switch_config.h \
  155. $(switch_srcdir)/src/include/switch_frame.h $(switch_srcdir)/src/include/switch_module_interfaces.h \
  156. $(switch_srcdir)/src/include/switch_channel.h $(switch_srcdir)/src/include/switch_buffer.h \
  157. $(switch_srcdir)/src/include/switch_event.h $(switch_srcdir)/src/include/switch_resample.h \
  158. $(switch_srcdir)/src/include/switch_ivr.h $(switch_srcdir)/src/include/switch_rtp.h \
  159. $(switch_srcdir)/src/include/switch_stun.h $(switch_srcdir)/src/include/switch_log.h \
  160. $(switch_srcdir)/src/include/switch_xml.h
  161. @echo Compiling $<...
  162. if test -f "$(CSOURCEFILE)" -o -f "$(MODDIR)/$(CSOURCEFILE)"; then \
  163. if test ! -z $(VERBOSE) ; then echo $(COMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; fi ;\
  164. $(COMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; \
  165. else \
  166. if test ! -z $(VERBOSE) ; then echo $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; fi ;\
  167. $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; \
  168. fi;
  169. $(MODNAME).lo: $(MODDIR)/$(SOURCEFILE) \
  170. $(switch_srcdir)/src/include/switch.h \
  171. $(switch_builddir)/src/include/switch_am_config.h \
  172. $(switch_srcdir)/src/include/switch_types.h $(switch_srcdir)/src/include/switch_apr.h \
  173. $(switch_srcdir)/src/include/switch_core_db.h $(switch_srcdir)/src/include/switch_regex.h \
  174. $(switch_srcdir)/src/include/switch_core.h $(switch_srcdir)/src/include/switch_loadable_module.h \
  175. $(switch_srcdir)/src/include/switch_console.h $(switch_srcdir)/src/include/switch_utils.h \
  176. $(switch_srcdir)/src/include/switch_caller.h $(switch_srcdir)/src/include/switch_config.h \
  177. $(switch_srcdir)/src/include/switch_frame.h $(switch_srcdir)/src/include/switch_module_interfaces.h \
  178. $(switch_srcdir)/src/include/switch_channel.h $(switch_srcdir)/src/include/switch_buffer.h \
  179. $(switch_srcdir)/src/include/switch_event.h $(switch_srcdir)/src/include/switch_resample.h \
  180. $(switch_srcdir)/src/include/switch_ivr.h $(switch_srcdir)/src/include/switch_rtp.h \
  181. $(switch_srcdir)/src/include/switch_stun.h $(switch_srcdir)/src/include/switch_log.h \
  182. $(switch_srcdir)/src/include/switch_xml.h
  183. @echo Compiling $<...
  184. if test -f "$(CSOURCEFILE)" -o -f "$(MODDIR)/$(CSOURCEFILE)"; then \
  185. if test ! -z $(VERBOSE) ; then echo $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; fi ;\
  186. $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; \
  187. else \
  188. if test ! -z $(VERBOSE) ; then echo $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; fi ;\
  189. $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; \
  190. fi;
  191. $(switch_srcdir)/src/include/switch.h:
  192. $(switch_builddir)/src/include/switch_am_config.h: $(switch_srcdir)/src/include/switch_am_config.h.in
  193. $(switch_srcdir)/src/include/switch_types.h:
  194. $(switch_srcdir)/src/include/switch_apr.h:
  195. $(switch_srcdir)/src/include/switch_core_db.h:
  196. $(switch_srcdir)/src/include/switch_regex.h:
  197. $(switch_srcdir)/src/include/switch_core.h:
  198. $(switch_srcdir)/src/include/switch_loadable_module.h:
  199. $(switch_srcdir)/src/include/switch_console.h:
  200. $(switch_srcdir)/src/include/switch_utils.h:
  201. $(switch_srcdir)/src/include/switch_caller.h:
  202. $(switch_srcdir)/src/include/switch_config.h:
  203. $(switch_srcdir)/src/include/switch_frame.h:
  204. $(switch_srcdir)/src/include/switch_module_interfaces.h:
  205. $(switch_srcdir)/src/include/switch_channel.h:
  206. $(switch_srcdir)/src/include/switch_buffer.h:
  207. $(switch_srcdir)/src/include/switch_event.h:
  208. $(switch_srcdir)/src/include/switch_resample.h:
  209. $(switch_srcdir)/src/include/switch_ivr.h:
  210. $(switch_srcdir)/src/include/switch_rtp.h:
  211. $(switch_srcdir)/src/include/switch_stun.h:
  212. $(switch_srcdir)/src/include/switch_log.h:
  213. $(switch_srcdir)/src/include/switch_xml.h:
  214. .PHONY: all clean depend install distclean extraclean \
  215. all-modules clean-modules depend-modules install-modules distclean-modules extraclean-modules \
  216. local_all local_clean local_depend local_install local_distclean local_extraclean \
  217. mod_clean mod_install mod_uninstall depend_install