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

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4583 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2007-03-13 16:49:15 +00:00
parent 3bd2569177
commit d66d95fb29
3 changed files with 41 additions and 39 deletions

View File

@ -49,7 +49,8 @@ extraclean: distclean local_extraclean
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)

View File

@ -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

View File

@ -182,7 +182,12 @@ sysconfdir = @sysconfdir@
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 @@ uninstall-am: uninstall-info-am
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