forked from Mirrors/freeswitch
an attempt at working --srcdir builds for the modules. (FSBUILD-211)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15704 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
7f22554792
commit
d9a103bd5b
|
@ -20,7 +20,7 @@ LIBCURL_DEPS=@LIBCURL_DEPS@
|
||||||
LIBCURL=@LIBCURL@
|
LIBCURL=@LIBCURL@
|
||||||
LIBCURL_CPPFLAGS=@LIBCURL_CPPFLAGS@
|
LIBCURL_CPPFLAGS=@LIBCURL_CPPFLAGS@
|
||||||
CURL_DIR=$(switch_srcdir)/libs/curl
|
CURL_DIR=$(switch_srcdir)/libs/curl
|
||||||
CURLLA=$(CURL_DIR)/lib/libcurl.la
|
CURLLA=$(switch_builddir)/libs/curl/lib/libcurl.la
|
||||||
|
|
||||||
OPENSSL_LIBS=@openssl_LIBS@
|
OPENSSL_LIBS=@openssl_LIBS@
|
||||||
OPENSSL_CFLAGS=@openssl_CFLAGS@
|
OPENSSL_CFLAGS=@openssl_CFLAGS@
|
||||||
|
@ -50,14 +50,14 @@ CXXCOMPILE = $(CXX) $(ALL_CXXFLAGS) $(DEFS)
|
||||||
LTCXXCOMPILE = $(LIBTOOL) --mode=compile --tag=CXX $(CXXCOMPILE)
|
LTCXXCOMPILE = $(LIBTOOL) --mode=compile --tag=CXX $(CXXCOMPILE)
|
||||||
CXXLINK = $(LIBTOOL) --mode=link --tag=CXX $(CXXLD) $(ALL_CXXFLAGS) $(LDFLAGS) -shared -module -avoid-version -rpath $(MODINSTDIR) -o $@
|
CXXLINK = $(LIBTOOL) --mode=link --tag=CXX $(CXXLD) $(ALL_CXXFLAGS) $(LDFLAGS) -shared -module -avoid-version -rpath $(MODINSTDIR) -o $@
|
||||||
|
|
||||||
CSOURCEFILE=$(MODNAME).c
|
CSOURCEFILE=$(MODDIR)/$(MODNAME).c
|
||||||
CXXSOURCEFILE=$(MODNAME).cpp
|
CXXSOURCEFILE=$(MODDIR)/$(MODNAME).cpp
|
||||||
TOUCH_TARGET=@TOUCH_TARGET@
|
TOUCH_TARGET=@TOUCH_TARGET@
|
||||||
|
|
||||||
#MAKE_OPTS = `if test -z "$(VERBOSE)" ; then $(MAKE) --help | grep silent | grep "\-s" 2>&1 >/dev/null && echo -s;fi`
|
#MAKE_OPTS = `if test -z "$(VERBOSE)" ; then $(MAKE) --help | grep silent | grep "\-s" 2>&1 >/dev/null && echo -s;fi`
|
||||||
MAKE_OPTS = `test -n "$(VERBOSE)" || echo -s`
|
MAKE_OPTS = `test -n "$(VERBOSE)" || echo -s`
|
||||||
RECURSE_MODNAME=`pwd | sed -e 's|^.*/||'`
|
RECURSE_MODNAME=`pwd | sed -e 's|^.*/||'`
|
||||||
RECURSE_SOURCEFILE=`if test -f $$modname.cpp; then echo $$modname.cpp; else echo $$modname.c; fi`
|
RECURSE_SOURCEFILE=`if test -f "$(MODDIR)/$$modname.cpp"; then echo "$(MODDIR)/$$modname.cpp"; else echo "$(MODDIR)/$$modname.c"; fi`
|
||||||
RECURSE_OUR_DEPS=`test -z "$(WANT_CURL)" || if test ! -z "$(LIBCURL_DEPS)"; then echo $(CURLLA); fi `
|
RECURSE_OUR_DEPS=`test -z "$(WANT_CURL)" || if test ! -z "$(LIBCURL_DEPS)"; then echo $(CURLLA); fi `
|
||||||
RECURSE_OUR_CFLAGS=`test -z "$(WANT_CURL)" || echo $(LIBCURL_CPPFLAGS) ; $(LOCAL_INSERT_CFLAGS) `
|
RECURSE_OUR_CFLAGS=`test -z "$(WANT_CURL)" || echo $(LIBCURL_CPPFLAGS) ; $(LOCAL_INSERT_CFLAGS) `
|
||||||
RECURSE_OUR_LDFLAGS=`test -z "$(WANT_CURL)" || echo $(LIBCURL) ; $(LOCAL_INSERT_LDFLAGS) `
|
RECURSE_OUR_LDFLAGS=`test -z "$(WANT_CURL)" || echo $(LIBCURL) ; $(LOCAL_INSERT_LDFLAGS) `
|
||||||
|
@ -68,7 +68,7 @@ RECURSE_MAKE=+modname="$(RECURSE_MODNAME)" ; \
|
||||||
ourcflags="$(RECURSE_OUR_CFLAGS)" ; \
|
ourcflags="$(RECURSE_OUR_CFLAGS)" ; \
|
||||||
ourldflags="$(RECURSE_OUR_LDFLAGS)" ; \
|
ourldflags="$(RECURSE_OUR_LDFLAGS)" ; \
|
||||||
insertobjs="`$(LOCAL_INSERT_OBJS)`" ; \
|
insertobjs="`$(LOCAL_INSERT_OBJS)`" ; \
|
||||||
$(MAKE) $(MAKE_OPTS) MODNAME="$$modname" SOURCEFILE="$$sourcefile" \
|
$(MAKE) $(MAKE_OPTS) MODNAME="$$modname" SOURCEFILE="$$sourcefile" MODDIR="$(MODDIR)" \
|
||||||
OUR_DEPS="$$ourdefs" OUR_CFLAGS="$$ourcflags" OUR_LDFLAGS="$$ourldflags" OUR_OBJS="$$insertobjs"
|
OUR_DEPS="$$ourdefs" OUR_CFLAGS="$$ourcflags" OUR_LDFLAGS="$$ourldflags" OUR_OBJS="$$insertobjs"
|
||||||
|
|
||||||
all: Makefile
|
all: Makefile
|
||||||
|
@ -96,7 +96,7 @@ extraclean-modules: distclean local_extraclean
|
||||||
|
|
||||||
Makefile:
|
Makefile:
|
||||||
@if test ! -f $@; then \
|
@if test ! -f $@; then \
|
||||||
if ! pwd | grep $(switch_srcdir)/src/mod ; then rulesdir=$(switch_srcdir) ; else rulesdir=../../../.. ; fi ; \
|
if ! pwd | grep $(switch_builddir)/src/mod ; then rulesdir=$(switch_builddir) ; else rulesdir=../../../.. ; fi ; \
|
||||||
echo BASE=$$rulesdir > Makefile ; \
|
echo BASE=$$rulesdir > Makefile ; \
|
||||||
echo 'include $$(BASE)/build/modmake.rules' >> Makefile ; \
|
echo 'include $$(BASE)/build/modmake.rules' >> Makefile ; \
|
||||||
fi ;
|
fi ;
|
||||||
|
|
|
@ -8,10 +8,16 @@ $(OUR_MODULES) $(OUR_CLEAN_MODULES) $(OUR_INSTALL_MODULES) $(OUR_UNINSTALL_MODUL
|
||||||
target=`echo $@ | sed -e 's|^.*-||'`; \
|
target=`echo $@ | sed -e 's|^.*-||'`; \
|
||||||
modname=`echo $@ | sed -e 's|-.*||' | sed -e 's|^.*/||'`; \
|
modname=`echo $@ | sed -e 's|-.*||' | sed -e 's|^.*/||'`; \
|
||||||
confmoddir=`cat $(switch_builddir)/modules.conf | sed -e 's| ||' | grep $$modname$$ | sed -e 's|#||' | head -n 1`; \
|
confmoddir=`cat $(switch_builddir)/modules.conf | sed -e 's| ||' | grep $$modname$$ | sed -e 's|#||' | head -n 1`; \
|
||||||
if test -z "$$confmoddir" ; then moddir=$@ ; else \
|
if test -z "$$confmoddir" ; then \
|
||||||
|
moddir=$@ ; \
|
||||||
|
buildmoddir=$(switch_builddir)/src/mod/$@ ;\
|
||||||
|
else \
|
||||||
if test -d "$(switch_srcdir)/src/mod/$$confmoddir" ; then \
|
if test -d "$(switch_srcdir)/src/mod/$$confmoddir" ; then \
|
||||||
moddir="$(switch_srcdir)/src/mod/$$confmoddir" ; else \
|
moddir="$(switch_srcdir)/src/mod/$$confmoddir" ; \
|
||||||
|
buildmoddir="$(switch_builddir)/src/mod/$$confmoddir" ; \
|
||||||
|
else \
|
||||||
moddir="$$confmoddir" ; \
|
moddir="$$confmoddir" ; \
|
||||||
|
buildmoddir="$(switch_builddir)/src/mod/$$confmoddir" ; \
|
||||||
fi ; \
|
fi ; \
|
||||||
fi ; \
|
fi ; \
|
||||||
if test -z "$$target" ; then target="all" ; fi ; \
|
if test -z "$$target" ; then target="all" ; fi ; \
|
||||||
|
@ -20,8 +26,10 @@ $(OUR_MODULES) $(OUR_CLEAN_MODULES) $(OUR_INSTALL_MODULES) $(OUR_UNINSTALL_MODUL
|
||||||
echo ;\
|
echo ;\
|
||||||
echo making $$target $$modname ;\
|
echo making $$target $$modname ;\
|
||||||
(if test -f "$$moddir/Makefile" ; then \
|
(if test -f "$$moddir/Makefile" ; then \
|
||||||
cd $$moddir && MODNAME=$$modname BASE=$(switch_builddir) $(MAKE) $(AM_MAKEFLAGS) $$target; else\
|
test -f "$$buildmoddir/Makefile" || cp $$moddir/Makefile $$buildmoddir/Makefile ; \
|
||||||
cd $$moddir && MODNAME=$$modname BASE=$(switch_builddir) $(MAKE) $(AM_MAKEFLAGS) -f $(switch_builddir)/build/modmake.rules $$target ;\
|
cd $$buildmoddir && MODDIR=$$moddir MODNAME=$$modname BASE=$(switch_srcdir) $(MAKE) $(AM_MAKEFLAGS) $$target; \
|
||||||
|
else\
|
||||||
|
cd $$buildmoddir && MODDIR=$$moddir MODNAME=$$modname BASE=$(switch_srcdir) $(MAKE) $(AM_MAKEFLAGS) -f $(switch_builddir)/build/modmake.rules $$target ;\
|
||||||
fi;) || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
fi;) || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||||
fi; \
|
fi; \
|
||||||
test -z "$$fail" ;
|
test -z "$$fail" ;
|
||||||
|
|
Loading…
Reference in New Issue