From 28c23ab147a128f8a73156f65ca66b04359a4ab4 Mon Sep 17 00:00:00 2001 From: Corey Smith Date: Tue, 26 Jan 2016 20:22:56 -0500 Subject: [PATCH] FS-8776 #resolve Support GNU make parallel builds * Explicitly define dependency tree for several modules * Enable parallel builds for libtiff and libspandsp * Verify module is enabled before attempting build. Allows the virtual targets to be used for ordering without forcing a build dependency. --- src/mod/Makefile.am | 59 +++++++++++--------- src/mod/applications/mod_spandsp/Makefile.am | 4 +- src/mod/endpoints/mod_gsmopen/Makefile.am | 4 +- src/mod/endpoints/mod_skypopen/Makefile.am | 4 +- 4 files changed, 39 insertions(+), 32 deletions(-) diff --git a/src/mod/Makefile.am b/src/mod/Makefile.am index f2c8dbeee5..36ed523311 100644 --- a/src/mod/Makefile.am +++ b/src/mod/Makefile.am @@ -5,37 +5,44 @@ clean: $(OUR_CLEAN_MODULES) $(OUR_DISABLED_CLEAN_MODULES) install: $(OUR_INSTALL_MODULES) uninstall: $(OUR_UNINSTALL_MODULES) $(OUR_DISABLED_UNINSTALL_MODULES) +mod_skypopen-all: mod_gsmopen-all +mod_gsmopen-all: mod_spandsp-all +mod_unimrcp-all: mod_sofia-all + $(OUR_MODULES) $(OUR_CLEAN_MODULES) $(OUR_INSTALL_MODULES) $(OUR_UNINSTALL_MODULES) $(OUR_DISABLED_MODULES) $(OUR_DISABLED_CLEAN_MODULES) $(OUR_DISABLED_INSTALL_MODULES) $(OUR_DISABLED_UNINSTALL_MODULES): @set fnord $$MAKEFLAGS; amf=$$2; \ target=`echo $@ | 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`; \ - if test -z "$$confmoddir" ; then \ - moddir=$@ ; \ - buildmoddir=$(switch_builddir)/src/mod/$@ ;\ - else \ - if test -d "$(switch_srcdir)/src/mod/$$confmoddir" ; then \ - moddir="$(switch_srcdir)/src/mod/$$confmoddir" ; \ - buildmoddir="$(switch_builddir)/src/mod/$$confmoddir" ; \ - else \ - moddir="$$confmoddir" ; \ - buildmoddir="$(switch_builddir)/src/mod/$$confmoddir" ; \ + enabled=`echo $(CONF_MODULES) | grep -w $$modname`; \ + if ! test -z "$$enabled"; then \ + confmoddir=`cat $(switch_builddir)/modules.conf | sed -e 's| ||' | grep $$modname$$ | sed -e 's|#||' | head -n 1`; \ + if test -z "$$confmoddir" ; then \ + moddir=$@ ; \ + buildmoddir=$(switch_builddir)/src/mod/$@ ;\ + else \ + if test -d "$(switch_srcdir)/src/mod/$$confmoddir" ; then \ + moddir="$(switch_srcdir)/src/mod/$$confmoddir" ; \ + buildmoddir="$(switch_builddir)/src/mod/$$confmoddir" ; \ + else \ + moddir="$$confmoddir" ; \ + buildmoddir="$(switch_builddir)/src/mod/$$confmoddir" ; \ + fi ; \ fi ; \ - fi ; \ - if test -z "$$target" ; then target="all" ; fi ; \ - if ! test -f $$moddir/$$modname.c && ! test -f $$moddir/$$modname.cpp && test $$modname != "mod_com_g729" ; \ - then echo ; echo "WARNING $$modname is not a valid FreeSWITCH module dir, skipping it..." ; else \ - echo ;\ - echo making $$target $$modname ;\ - test -d "$$buildmoddir" || mkdir -p $$buildmoddir ; \ - (if test -f "$$moddir/Makefile" ; then \ - test -f "$$buildmoddir/Makefile" || cp $$moddir/Makefile $$buildmoddir/Makefile ; \ - cd $$buildmoddir && MODDIR=$$moddir MODNAME=$$modname BASE=$(switch_builddir) $(MAKE) $(AM_MAKEFLAGS) $$target; \ - else\ - cd $$buildmoddir && MODDIR=$$moddir MODNAME=$$modname BASE=$(switch_builddir) $(MAKE) $(AM_MAKEFLAGS) -f $(switch_builddir)/build/modmake.rules $$target ;\ - fi;) || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - fi; \ - test -z "$$fail" ; + if test -z "$$target" ; then target="all" ; fi ; \ + if ! test -f $$moddir/$$modname.c && ! test -f $$moddir/$$modname.cpp && test $$modname != "mod_com_g729" ; \ + then echo ; echo "WARNING $$modname is not a valid FreeSWITCH module dir, skipping it..." ; else \ + echo ;\ + echo making $$target $$modname ;\ + test -d "$$buildmoddir" || mkdir -p $$buildmoddir ; \ + (if test -f "$$moddir/Makefile" ; then \ + test -f "$$buildmoddir/Makefile" || cp $$moddir/Makefile $$buildmoddir/Makefile ; \ + cd $$buildmoddir && MODDIR=$$moddir MODNAME=$$modname BASE=$(switch_builddir) $(MAKE) $(AM_MAKEFLAGS) $$target; \ + else\ + cd $$buildmoddir && MODDIR=$$moddir MODNAME=$$modname BASE=$(switch_builddir) $(MAKE) $(AM_MAKEFLAGS) -f $(switch_builddir)/build/modmake.rules $$target ;\ + fi;) || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + fi; \ + test -z "$$fail" ; \ + fi; mod_com_g729-activate: cd $(switch_builddir)/src/mod/codecs/mod_com_g729 && $(MAKE) $(AM_MAKEFLAGS) activate diff --git a/src/mod/applications/mod_spandsp/Makefile.am b/src/mod/applications/mod_spandsp/Makefile.am index aa1b65718a..ae6ab7590e 100644 --- a/src/mod/applications/mod_spandsp/Makefile.am +++ b/src/mod/applications/mod_spandsp/Makefile.am @@ -16,9 +16,9 @@ mod_spandsp_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(SPANDSP_LA) $(TI mod_spandsp_la_LDFLAGS = -avoid-version -module -no-undefined -shared $(SPANDSP_LA): $(TIFF_LA) $(SPANDSP_DIR) $(SPANDSP_DIR)/.update - cd $(SPANDSP_BUILDDIR) && $(MAKE) -j1 CPPFLAGS="$(CPPFLAGS) -I$(TIFF_BUILDDIR)/libtiff -I$(TIFF_DIR)/libtiff" CFLAGS="$(CFLAGS)" + cd $(SPANDSP_BUILDDIR) && $(MAKE) CPPFLAGS="$(CPPFLAGS) -I$(TIFF_BUILDDIR)/libtiff -I$(TIFF_DIR)/libtiff" CFLAGS="$(CFLAGS)" $(TOUCH_TARGET) $(TIFF_LA): $(TIFF_DIR) $(TIFF_DIR)/.update - cd $(TIFF_BUILDDIR) && $(MAKE) -j1 + cd $(TIFF_BUILDDIR) && $(MAKE) $(TOUCH_TARGET) diff --git a/src/mod/endpoints/mod_gsmopen/Makefile.am b/src/mod/endpoints/mod_gsmopen/Makefile.am index c8ea26614d..ce31c910aa 100644 --- a/src/mod/endpoints/mod_gsmopen/Makefile.am +++ b/src/mod/endpoints/mod_gsmopen/Makefile.am @@ -19,9 +19,9 @@ mod_gsmopen_la_LDFLAGS = -avoid-version -module -no-undefined -lctb-0.16 -lgsmm BUILT_SOURCES = $(TIFF_LA) $(SPANDSP_LA) $(SPANDSP_LA): $(TIFF_LA) $(SPANDSP_DIR) $(SPANDSP_DIR)/.update - cd $(SPANDSP_BUILDDIR) && $(MAKE) -j1 CPPFLAGS="$(CPPFLAGS) -I$(TIFF_BUILDDIR)/libtiff -I$(TIFF_DIR)/libtiff" CFLAGS="$(CFLAGS)" + cd $(SPANDSP_BUILDDIR) && $(MAKE) CPPFLAGS="$(CPPFLAGS) -I$(TIFF_BUILDDIR)/libtiff -I$(TIFF_DIR)/libtiff" CFLAGS="$(CFLAGS)" $(TOUCH_TARGET) $(TIFF_LA): $(TIFF_DIR) $(TIFF_DIR)/.update - cd $(TIFF_BUILDDIR) && $(MAKE) -j1 + cd $(TIFF_BUILDDIR) && $(MAKE) $(TOUCH_TARGET) diff --git a/src/mod/endpoints/mod_skypopen/Makefile.am b/src/mod/endpoints/mod_skypopen/Makefile.am index 8f6cfdfe31..b5d1b91e4b 100644 --- a/src/mod/endpoints/mod_skypopen/Makefile.am +++ b/src/mod/endpoints/mod_skypopen/Makefile.am @@ -19,9 +19,9 @@ mod_skypopen_la_LDFLAGS = -avoid-version -module -no-undefined -shared -lX11 BUILT_SOURCES = $(TIFF_LA) $(SPANDSP_LA) $(SPANDSP_LA): $(TIFF_LA) $(SPANDSP_DIR) $(SPANDSP_DIR)/.update - cd $(SPANDSP_BUILDDIR) && $(MAKE) -j1 CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS) -I$(TIFF_BUILDDIR)/libtiff -I$(TIFF_DIR)/libtiff" + cd $(SPANDSP_BUILDDIR) && $(MAKE) CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS) -I$(TIFF_BUILDDIR)/libtiff -I$(TIFF_DIR)/libtiff" $(TOUCH_TARGET) $(TIFF_LA): $(TIFF_DIR) $(TIFF_DIR)/.update - cd $(TIFF_BUILDDIR) && $(MAKE) -j1 + cd $(TIFF_BUILDDIR) && $(MAKE) $(TOUCH_TARGET)