[Freeswitch-svn] [commit] r4583 - in freeswitch/trunk: build src/mod

Freeswitch SVN mikej at freeswitch.org
Tue Mar 13 12:49:15 EDT 2007


Author: mikej
Date: Tue Mar 13 12:49:15 2007
New Revision: 4583

Modified:
   freeswitch/trunk/build/modmake.rules.in
   freeswitch/trunk/src/mod/Makefile.am
   freeswitch/trunk/src/mod/Makefile.in

Log:
allow you to export var MODULES that will override what is in modules.conf for that build.  work a little harder to try to make it so you can do make in a module directory.  More on that later

Modified: freeswitch/trunk/build/modmake.rules.in
==============================================================================
--- freeswitch/trunk/build/modmake.rules.in	(original)
+++ freeswitch/trunk/build/modmake.rules.in	Tue Mar 13 12:49:15 2007
@@ -49,7 +49,8 @@
 
 Makefile:
 	@if test ! -f $@; then \
-	  echo include $(switch_srcdir)/build/modmake.rules > Makefile ; \
+	  echo MODNAME=$(MODNAME) > Makefile ; \
+	  echo include $(switch_srcdir)/build/modmake.rules >> Makefile ; \
 	fi ;
 
 $(MODNAME).$(DYNAMIC_LIB_EXTEN): $(MODNAME).o $(LOCAL_OBJS) $(SOURCEFILE)

Modified: freeswitch/trunk/src/mod/Makefile.am
==============================================================================
--- freeswitch/trunk/src/mod/Makefile.am	(original)
+++ freeswitch/trunk/src/mod/Makefile.am	Tue Mar 13 12:49:15 2007
@@ -1,41 +1,42 @@
-MODULES = `grep -v "\#" $(switch_builddir)/modules.conf`
+CONF_MODULES=$(shell grep -v "\#" $(switch_builddir)/modules.conf)
+FOUND_MODULES=$(shell find . -type d -name mod_\*)
+OUR_MODULES=`if test -z $(MODULES) ; then echo $(CONF_MODULES) ; else echo $(MODULES) ; fi ;`
+OUR_CLEAN_MODULES=`if test -z $(MODULES) ; then echo $(CONF_MODULES) $(FOUND_MODULES) ; else echo $(MODULES) ; fi ;`
+MOD_NAME=`echo $$i | sed -e 's|^.*/||'`
+MOD_DIR=`if test -d $(switch_srcdir)/src/mod/$$i ; then echo $(switch_srcdir)/src/mod/$$i ; else echo $$i ; fi;`
+
 
 all: 
 	@if [ ! -f $(switch_builddir)/modules.conf ] ; then cp $(switch_builddir)/modules.conf.in $(switch_builddir)/modules.conf ; fi
 	@echo making modules
-	@for i in $(MODULES) ; do  \
+	@for i in $(OUR_MODULES) ; do  \
 	   echo making $$i ; \
-	   modname=`echo $$i | sed "s/^.*\///g"`; \
-	   if test -z $$modname ; then  modname=$$i ; fi; \
-	   if test -d $(switch_srcdir)/src/mod/$$i ; then moddir=$(switch_srcdir)/src/mod/$$i ; else moddir=$$i ; fi; \
+	   moddir=$(MOD_DIR); \
+	   echo $(MOD_NAME); \
 	   if test -f $$moddir/Makefile ; then \
-	      cd $$moddir && MODNAME=$$modname BASE=$(switch_builddir) $(MAKE) ; else  \
-	      cd $$moddir && MODNAME=$$modname BASE=$(switch_builddir) $(MAKE) -f $(switch_builddir)/build/modmake.rules ; \
+	      cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) ; else  \
+	      cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) -f $(switch_builddir)/build/modmake.rules ; \
 	   fi; \
 	 done
 
 clean:
-	@for i in `find . -type d -name mod_\*` ; do \
+	@for i in $(OUR_CLEAN_MODULES) ; do \
 	   echo making clean $$i ; \
-	   modname=`echo $$i | sed "s/^.*\///g"`; \
-	   if test -z $$modname ; then  modname=$$i ; fi; \
-	   if test -d $(switch_srcdir)/src/mod/$$i ; then moddir=$(switch_srcdir)/src/mod/$$i ; else moddir=$$i ; fi; \
+	   moddir=$(MOD_DIR); \
 	   if test -f $$moddir/Makefile ; then \
-	      cd $$moddir && MODNAME=$$modname BASE=$(switch_builddir) $(MAKE) clean ; else  \
-	      cd $$moddir && MODNAME=$$modname BASE=$(switch_builddir) $(MAKE) -f $(switch_builddir)/build/modmake.rules clean ; \
+	      cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) clean ; else  \
+	      cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) -f $(switch_builddir)/build/modmake.rules clean ; \
 	   fi; \
 	 done
 
 install:
 	@echo Installing Modules
-	@for i in $(MODULES) ; do \
+	@for i in $(OUR_MODULES) ; do \
 	   echo making install $$i ; \
-	   modname=`echo $$i | sed "s/^.*\///g"`; \
-	   if test -z $$modname ; then  modname=$$i ; fi; \
-	   if test -d $(switch_srcdir)/src/mod/$$i ; then moddir=$(switch_srcdir)/src/mod/$$i ; else moddir=$$i ; fi; \
+	   moddir=$(MOD_DIR); \
 	   if test -f $$moddir/Makefile ; then \
-	      cd $$moddir && MODNAME=$$modname BASE=$(switch_builddir) $(MAKE) install ; else  \
-	      cd $$moddir && MODNAME=$$modname BASE=$(switch_builddir) $(MAKE) -f $(switch_builddir)/build/modmake.rules clean ; \
+	      cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) install ; else  \
+	      cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) -f $(switch_builddir)/build/modmake.rules clean ; \
 	   fi; \
 	done
 	@echo done

Modified: freeswitch/trunk/src/mod/Makefile.in
==============================================================================
--- freeswitch/trunk/src/mod/Makefile.in	(original)
+++ freeswitch/trunk/src/mod/Makefile.in	Tue Mar 13 12:49:15 2007
@@ -182,7 +182,12 @@
 target_alias = @target_alias@
 uint64_t_fmt = @uint64_t_fmt@
 voidp_size = @voidp_size@
-MODULES = `grep -v "\#" $(switch_builddir)/modules.conf`
+CONF_MODULES = $(shell grep -v "\#" $(switch_builddir)/modules.conf)
+FOUND_MODULES = $(shell find . -type d -name mod_\*)
+OUR_MODULES = `if test -z $(MODULES) ; then echo $(CONF_MODULES) ; else echo $(MODULES) ; fi ;`
+OUR_CLEAN_MODULES = `if test -z $(MODULES) ; then echo $(CONF_MODULES) $(FOUND_MODULES) ; else echo $(MODULES) ; fi ;`
+MOD_NAME = `echo $$i | sed -e 's|^.*/||'`
+MOD_DIR = `if test -d $(switch_srcdir)/src/mod/$$i ; then echo $(switch_srcdir)/src/mod/$$i ; else echo $$i ; fi;`
 all: all-am
 
 .SUFFIXES:
@@ -344,39 +349,34 @@
 all: 
 	@if [ ! -f $(switch_builddir)/modules.conf ] ; then cp $(switch_builddir)/modules.conf.in $(switch_builddir)/modules.conf ; fi
 	@echo making modules
-	@for i in $(MODULES) ; do  \
+	@for i in $(OUR_MODULES) ; do  \
 	   echo making $$i ; \
-	   modname=`echo $$i | sed "s/^.*\///g"`; \
-	   if test -z $$modname ; then  modname=$$i ; fi; \
-	   if test -d $(switch_srcdir)/src/mod/$$i ; then moddir=$(switch_srcdir)/src/mod/$$i ; else moddir=$$i ; fi; \
+	   moddir=$(MOD_DIR); \
+	   echo $(MOD_NAME); \
 	   if test -f $$moddir/Makefile ; then \
-	      cd $$moddir && MODNAME=$$modname BASE=$(switch_builddir) $(MAKE) ; else  \
-	      cd $$moddir && MODNAME=$$modname BASE=$(switch_builddir) $(MAKE) -f $(switch_builddir)/build/modmake.rules ; \
+	      cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) ; else  \
+	      cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) -f $(switch_builddir)/build/modmake.rules ; \
 	   fi; \
 	 done
 
 clean:
-	@for i in `find . -type d -name mod_\*` ; do \
+	@for i in $(OUR_CLEAN_MODULES) ; do \
 	   echo making clean $$i ; \
-	   modname=`echo $$i | sed "s/^.*\///g"`; \
-	   if test -z $$modname ; then  modname=$$i ; fi; \
-	   if test -d $(switch_srcdir)/src/mod/$$i ; then moddir=$(switch_srcdir)/src/mod/$$i ; else moddir=$$i ; fi; \
+	   moddir=$(MOD_DIR); \
 	   if test -f $$moddir/Makefile ; then \
-	      cd $$moddir && MODNAME=$$modname BASE=$(switch_builddir) $(MAKE) clean ; else  \
-	      cd $$moddir && MODNAME=$$modname BASE=$(switch_builddir) $(MAKE) -f $(switch_builddir)/build/modmake.rules clean ; \
+	      cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) clean ; else  \
+	      cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) -f $(switch_builddir)/build/modmake.rules clean ; \
 	   fi; \
 	 done
 
 install:
 	@echo Installing Modules
-	@for i in $(MODULES) ; do \
+	@for i in $(OUR_MODULES) ; do \
 	   echo making install $$i ; \
-	   modname=`echo $$i | sed "s/^.*\///g"`; \
-	   if test -z $$modname ; then  modname=$$i ; fi; \
-	   if test -d $(switch_srcdir)/src/mod/$$i ; then moddir=$(switch_srcdir)/src/mod/$$i ; else moddir=$$i ; fi; \
+	   moddir=$(MOD_DIR); \
 	   if test -f $$moddir/Makefile ; then \
-	      cd $$moddir && MODNAME=$$modname BASE=$(switch_builddir) $(MAKE) install ; else  \
-	      cd $$moddir && MODNAME=$$modname BASE=$(switch_builddir) $(MAKE) -f $(switch_builddir)/build/modmake.rules clean ; \
+	      cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) install ; else  \
+	      cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) -f $(switch_builddir)/build/modmake.rules clean ; \
 	   fi; \
 	done
 	@echo done



More information about the Freeswitch-svn mailing list