提交 1481d37f authored 作者: Michael Jerris's avatar Michael Jerris

move module make to it's own makefile

remove need for modmake.sh (its use is now fully adressed within src/mod/Makefile.am)
remove need for generic_mod.mk (it uses the generated build/modmake.rules now instead)
add support for building out of tree modules as part of the freeswitch build simply by adding the full path to the module dir to your modules.conf
remove the need for special tragets to build.
make will now do a make through the core AND all the modules.
make install will now install the core and all the modules.
most or all of the old targets are still there, plus the new target "core" that will do more or less what make used to do.
make should now be able to be done without write permissions to the prefix directory (make install of course will still need them) whith the exception of modules that use buildlib.sh to download and install thier dependencies.  This will be fixed in a future revision.
checkversion.sh no longer will clean the modules on a change.  The need for this should be gone with the correct include paths to have the src directory included first.
Some steps in this commit to move us closer to being able to build with non gnu make (gmake).  Still some more work to do in this regard as well.
buildlib.sh no longer exports CFLAGS, just passes them to the confiure.
Move a little closer to supporting install directories in the "automake way" where all the dirs will be acutally determined in configure, and follow the standard install targets in Makefile.am
no longer build the modules twice on make install

Additional fixes still on the way for proper dependency tracking for the module builds, so they don't build every time.

any input on how to reach some of the goals stated above of supporting non gnu make, and more properly handling the install directories is appretiated.  Drop me an e-mail if you are intersted in helping.

Mike




git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4577 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 996b330d
EXTRA_DIST =
SUBDIRS =
AUTOMAKE_OPTS = gnu foreign
SUBDIRS = . src/mod
AUTOMAKE_OPTS = foreign
NAME=freeswitch
PREFIX=$(prefix)
......@@ -98,6 +98,20 @@ freeswitch_SOURCES = src/switch.c\
freeswitch_CFLAGS = $(AM_CFLAGS)
freeswitch_LDADD = ${MOD_LINK}
install-data-local:
@echo Installing $(NAME)
@for x in conf mod db log log/xml_cdr bin scripts htdocs grammar ; do \
$(mkinstalldirs) $(DESTDIR)$(prefix)/$$x ; \
done
@if [ ! -f $(DESTDIR)$(PREFIX)/conf/freeswitch.xml ] ; then \
$(INSTALL) conf/*.xml $(DESTDIR)$(PREFIX)/conf ; \
fi
@if [ -f .libs/$(NAME) ] ; then \
$(INSTALL) .libs/$(NAME) $(DESTDIR)$(PREFIX)/bin/$(NAME) ; \
else \
$(INSTALL) ./$(NAME) $(DESTDIR)$(PREFIX)/bin/$(NAME) ;\
fi
version: Makefile src/include/switch_version.h
MAKE=$(MAKE) ./build/checkversion.sh
......@@ -138,82 +152,24 @@ deps: version sqlite apr apr-util pcre srtp resample teletone
core: deps libfreeswitch.la
modules: libfreeswitch.la
@if [ ! -f $(PWD)/modules.conf ] ; then cp $(PWD)/modules.conf.in $(PWD)/modules.conf ; fi
@echo making modules
@rm -f build/freeswitch.env
@./build/addenv.sh build/freeswitch.env MAKE "$(MAKE)"
@./build/addenv.sh build/freeswitch.env DYLD_LIBRARY_PATH "$(PREFIX)/lib:$DYLD_LIBRARY_PATH"
@./build/addenv.sh build/freeswitch.env LD_LIBRARY_PATH "$(PREFIX)/lib:$LD_LIBRARY_PATH"
@./build/addenv.sh build/freeswitch.env PREFIX "$(PREFIX)"
@./build/addenv.sh build/freeswitch.env BASE "$(switch_srcdir)"
@./build/addenv.sh build/freeswitch.env OSARCH "$(OSARCH)"
@./build/addenv.sh build/freeswitch.env DYNAMIC_LIB_EXTEN "$(DYNAMIC_LIB_EXTEN)"
@./build/addenv.sh build/freeswitch.env SOLINK "$(SOLINK)"
@./build/addenv.sh build/freeswitch.env LDFLAGS "$(AM_LDFLAGS) $(MOD_LINK)"
@./build/addenv.sh build/freeswitch.env CFLAGS "$(AM_CFLAGS)"
@./build/addenv.sh build/freeswitch.env CC "$(CC)"
@./build/addenv.sh build/freeswitch.env CFGARGS "$(AM_CFGARGS)"
@./build/addenv.sh build/freeswitch.env LINK "$(LINK)"
@./build/addenv.sh build/freeswitch.env LTCOMPILE "$(LTCOMPILE)"
@./build/addenv.sh build/freeswitch.env LIBTOOL "$(LIBTOOL)"
@./build/addenv.sh build/freeswitch.env LTINSTALL "$(LTINSTALL)"
@cd src/mod && for i in `cat ../../modules.conf | grep -v \#` ; do echo making $$i ; $(PWD)/build/modmake.sh $(MAKE) $(PWD) $$i || exit 1; done
@rm -f build/freeswitch.env
modclean:
@rm -f build/freeswitch.env
@./build/addenv.sh build/freeswitch.env MAKE "$(MAKE)"
@./build/addenv.sh build/freeswitch.env CC "$(CC)"
@./build/addenv.sh build/freeswitch.env DYNAMIC_LIB_EXTEN "$(DYNAMIC_LIB_EXTEN)"
@cd src/mod && for i in `find . -type d -name mod_\*` ; do echo making clean $$i ; $(PWD)/build/modmake.sh $(MAKE) $(PWD) $$i clean || exit 1; done
@rm -f build/freeswitch.env
everything: install
everything: install install_mod
installall: install
installall: install install_mod
sure: clean modwipe uninstall installall
sure: clean modclean modwipe uninstall installall
wayclean: clean
wayclean: clean modclean
modules: libfreeswitch.la
$(MAKE) -C src/mod
install_mod: libfreeswitch.la
$(MAKE) -C src/mod install
modclean:
$(MAKE) -C src/mod clean
modwipe:
rm -f $(PREFIX)/mod/*.${DYNAMIC_LIB_EXTEN}
install_mod: modules
@echo Installing $(NAME)
@for x in conf mod db log log/xml_cdr bin scripts htdocs grammar ; do \
$(mkinstalldirs) $(DESTDIR)$(prefix)/$$x ; \
done
@if [ ! -f $(DESTDIR)$(PREFIX)/conf/freeswitch.xml ] ; then \
$(INSTALL) conf/*.xml $(DESTDIR)$(PREFIX)/conf ; \
fi
@if [ -f .libs/$(NAME) ] ; then \
$(INSTALL) .libs/$(NAME) $(DESTDIR)$(PREFIX)/bin/$(NAME) ; \
else \
$(INSTALL) ./$(NAME) $(DESTDIR)$(PREFIX)/bin/$(NAME) ;\
fi
@echo Installing Modules
@rm -f build/freeswitch.env
@./build/addenv.sh build/freeswitch.env PREFIX "$(PREFIX)"
@./build/addenv.sh build/freeswitch.env MAKE "$(MAKE)"
@./build/addenv.sh build/freeswitch.env DYLD_LIBRARY_PATH "$(PREFIX)/lib:$DYLD_LIBRARY_PATH"
@./build/addenv.sh build/freeswitch.env LD_LIBRARY_PATH "$(PREFIX)/lib:$LD_LIBRARY_PATH"
@./build/addenv.sh build/freeswitch.env DYNAMIC_LIB_EXTEN "$(DYNAMIC_LIB_EXTEN)"
@./build/addenv.sh build/freeswitch.env BASE "$(switch_srcdir)"
@./build/addenv.sh build/freeswitch.env OSARCH "$(OSARCH)"
@./build/addenv.sh build/freeswitch.env SOLINK "$(SOLINK)"
@./build/addenv.sh build/freeswitch.env LDFLAGS "$(AM_LDFLAGS) $(MOD_LINK)"
@./build/addenv.sh build/freeswitch.env CFLAGS "$(AM_CFLAGS)"
@./build/addenv.sh build/freeswitch.env CC "$(CC)"
@./build/addenv.sh build/freeswitch.env LINK "$(LINK)"
@./build/addenv.sh build/freeswitch.env LTCOMPILE "$(LTCOMPILE)"
@./build/addenv.sh build/freeswitch.env LTINSTALL "$(LTINSTALL)"
@./build/addenv.sh build/freeswitch.env LIBTOOL "$(LIBTOOL)"
@cd src/mod && for i in `cat ../../modules.conf | grep -v \#` ; do echo making install $$i ; $(PWD)/build/modmake.sh $(MAKE) $(PWD) $$i install || exit 1; done
@rm -f build/freeswitch.env
@echo done
dox:
cd docs && doxygen $(PWD)/docs/Doxygen.conf
......
......@@ -257,6 +257,7 @@ localstatedir = @localstatedir@
long_value = @long_value@
mandir = @mandir@
mkdir_p = @mkdir_p@
moddir = @moddir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
......@@ -275,8 +276,8 @@ target_alias = @target_alias@
uint64_t_fmt = @uint64_t_fmt@
voidp_size = @voidp_size@
EXTRA_DIST =
SUBDIRS =
AUTOMAKE_OPTS = gnu foreign
SUBDIRS = . src/mod
AUTOMAKE_OPTS = foreign
NAME = freeswitch
PREFIX = $(prefix)
AM_CFLAGS = $(SWITCH_AM_CFLAGS) $(am__append_1)
......@@ -1011,7 +1012,7 @@ info: info-recursive
info-am:
install-data-am: install-library_includeHEADERS
install-data-am: install-data-local install-library_includeHEADERS
install-exec-am: install-binPROGRAMS install-libLTLIBRARIES
......@@ -1055,20 +1056,35 @@ uninstall-info: uninstall-info-recursive
distclean-recursive distclean-tags distcleancheck distdir \
distuninstallcheck dvi dvi-am html html-am info info-am \
install install-am install-binPROGRAMS install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-libLTLIBRARIES \
install-library_includeHEADERS install-man install-strip \
installcheck installcheck-am installdirs installdirs-am \
maintainer-clean maintainer-clean-generic \
maintainer-clean-recursive mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \
pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
install-data-am install-data-local install-exec \
install-exec-am install-info install-info-am \
install-libLTLIBRARIES install-library_includeHEADERS \
install-man install-strip installcheck installcheck-am \
installdirs installdirs-am maintainer-clean \
maintainer-clean-generic maintainer-clean-recursive \
mostlyclean mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \
tags tags-recursive uninstall uninstall-am \
uninstall-binPROGRAMS uninstall-info-am \
uninstall-libLTLIBRARIES uninstall-library_includeHEADERS
$(libfreeswitch_la_SOURCES): deps
install-data-local:
@echo Installing $(NAME)
@for x in conf mod db log log/xml_cdr bin scripts htdocs grammar ; do \
$(mkinstalldirs) $(DESTDIR)$(prefix)/$$x ; \
done
@if [ ! -f $(DESTDIR)$(PREFIX)/conf/freeswitch.xml ] ; then \
$(INSTALL) conf/*.xml $(DESTDIR)$(PREFIX)/conf ; \
fi
@if [ -f .libs/$(NAME) ] ; then \
$(INSTALL) .libs/$(NAME) $(DESTDIR)$(PREFIX)/bin/$(NAME) ; \
else \
$(INSTALL) ./$(NAME) $(DESTDIR)$(PREFIX)/bin/$(NAME) ;\
fi
version: Makefile src/include/switch_version.h
MAKE=$(MAKE) ./build/checkversion.sh
......@@ -1109,82 +1125,24 @@ deps: version sqlite apr apr-util pcre srtp resample teletone
core: deps libfreeswitch.la
modules: libfreeswitch.la
@if [ ! -f $(PWD)/modules.conf ] ; then cp $(PWD)/modules.conf.in $(PWD)/modules.conf ; fi
@echo making modules
@rm -f build/freeswitch.env
@./build/addenv.sh build/freeswitch.env MAKE "$(MAKE)"
@./build/addenv.sh build/freeswitch.env DYLD_LIBRARY_PATH "$(PREFIX)/lib:$DYLD_LIBRARY_PATH"
@./build/addenv.sh build/freeswitch.env LD_LIBRARY_PATH "$(PREFIX)/lib:$LD_LIBRARY_PATH"
@./build/addenv.sh build/freeswitch.env PREFIX "$(PREFIX)"
@./build/addenv.sh build/freeswitch.env BASE "$(switch_srcdir)"
@./build/addenv.sh build/freeswitch.env OSARCH "$(OSARCH)"
@./build/addenv.sh build/freeswitch.env DYNAMIC_LIB_EXTEN "$(DYNAMIC_LIB_EXTEN)"
@./build/addenv.sh build/freeswitch.env SOLINK "$(SOLINK)"
@./build/addenv.sh build/freeswitch.env LDFLAGS "$(AM_LDFLAGS) $(MOD_LINK)"
@./build/addenv.sh build/freeswitch.env CFLAGS "$(AM_CFLAGS)"
@./build/addenv.sh build/freeswitch.env CC "$(CC)"
@./build/addenv.sh build/freeswitch.env CFGARGS "$(AM_CFGARGS)"
@./build/addenv.sh build/freeswitch.env LINK "$(LINK)"
@./build/addenv.sh build/freeswitch.env LTCOMPILE "$(LTCOMPILE)"
@./build/addenv.sh build/freeswitch.env LIBTOOL "$(LIBTOOL)"
@./build/addenv.sh build/freeswitch.env LTINSTALL "$(LTINSTALL)"
@cd src/mod && for i in `cat ../../modules.conf | grep -v \#` ; do echo making $$i ; $(PWD)/build/modmake.sh $(MAKE) $(PWD) $$i || exit 1; done
@rm -f build/freeswitch.env
modclean:
@rm -f build/freeswitch.env
@./build/addenv.sh build/freeswitch.env MAKE "$(MAKE)"
@./build/addenv.sh build/freeswitch.env CC "$(CC)"
@./build/addenv.sh build/freeswitch.env DYNAMIC_LIB_EXTEN "$(DYNAMIC_LIB_EXTEN)"
@cd src/mod && for i in `find . -type d -name mod_\*` ; do echo making clean $$i ; $(PWD)/build/modmake.sh $(MAKE) $(PWD) $$i clean || exit 1; done
@rm -f build/freeswitch.env
everything: install
everything: install install_mod
installall: install
installall: install install_mod
sure: clean modwipe uninstall installall
sure: clean modclean modwipe uninstall installall
wayclean: clean
wayclean: clean modclean
modules: libfreeswitch.la
$(MAKE) -C src/mod
install_mod: libfreeswitch.la
$(MAKE) -C src/mod install
modclean:
$(MAKE) -C src/mod clean
modwipe:
rm -f $(PREFIX)/mod/*.${DYNAMIC_LIB_EXTEN}
install_mod: modules
@echo Installing $(NAME)
@for x in conf mod db log log/xml_cdr bin scripts htdocs grammar ; do \
$(mkinstalldirs) $(DESTDIR)$(prefix)/$$x ; \
done
@if [ ! -f $(DESTDIR)$(PREFIX)/conf/freeswitch.xml ] ; then \
$(INSTALL) conf/*.xml $(DESTDIR)$(PREFIX)/conf ; \
fi
@if [ -f .libs/$(NAME) ] ; then \
$(INSTALL) .libs/$(NAME) $(DESTDIR)$(PREFIX)/bin/$(NAME) ; \
else \
$(INSTALL) ./$(NAME) $(DESTDIR)$(PREFIX)/bin/$(NAME) ;\
fi
@echo Installing Modules
@rm -f build/freeswitch.env
@./build/addenv.sh build/freeswitch.env PREFIX "$(PREFIX)"
@./build/addenv.sh build/freeswitch.env MAKE "$(MAKE)"
@./build/addenv.sh build/freeswitch.env DYLD_LIBRARY_PATH "$(PREFIX)/lib:$DYLD_LIBRARY_PATH"
@./build/addenv.sh build/freeswitch.env LD_LIBRARY_PATH "$(PREFIX)/lib:$LD_LIBRARY_PATH"
@./build/addenv.sh build/freeswitch.env DYNAMIC_LIB_EXTEN "$(DYNAMIC_LIB_EXTEN)"
@./build/addenv.sh build/freeswitch.env BASE "$(switch_srcdir)"
@./build/addenv.sh build/freeswitch.env OSARCH "$(OSARCH)"
@./build/addenv.sh build/freeswitch.env SOLINK "$(SOLINK)"
@./build/addenv.sh build/freeswitch.env LDFLAGS "$(AM_LDFLAGS) $(MOD_LINK)"
@./build/addenv.sh build/freeswitch.env CFLAGS "$(AM_CFLAGS)"
@./build/addenv.sh build/freeswitch.env CC "$(CC)"
@./build/addenv.sh build/freeswitch.env LINK "$(LINK)"
@./build/addenv.sh build/freeswitch.env LTCOMPILE "$(LTCOMPILE)"
@./build/addenv.sh build/freeswitch.env LTINSTALL "$(LTINSTALL)"
@./build/addenv.sh build/freeswitch.env LIBTOOL "$(LIBTOOL)"
@cd src/mod && for i in `cat ../../modules.conf | grep -v \#` ; do echo making install $$i ; $(PWD)/build/modmake.sh $(MAKE) $(PWD) $$i install || exit 1; done
@rm -f build/freeswitch.env
@echo done
dox:
cd docs && doxygen $(PWD)/docs/Doxygen.conf
......
......@@ -9,10 +9,6 @@ if [ -f $root/.nodepends ] ; then
exit 0
fi
if [ -f $root/build/freeswitch.env ] ; then
. $root/build/freeswitch.env
fi
if [ -z "$MAKE" ] ; then
make=`which gmake 2>/dev/null`
if [ -z "$MAKE" ] ; then
......
......@@ -16,12 +16,4 @@ grep "@SVN_VERSION@" src/include/switch_version.h && force=1
if [ $oldversion != $version ] || [ $force = 1 ] ; then
cat src/include/switch_version.h.in | sed "s/@SVN_VERSION@/$version/g" > src/include/switch_version.h
echo $version > .version
if [ -z "$MAKE" ] ; then
make=`which gmake 2>/dev/null`
if [ -z "$MAKE" ] ; then
make=make
fi
fi
$MAKE modclean
fi
......@@ -43,7 +43,7 @@ CXXSOURCEFILE=$(CURDIR)/$(MODNAME).cpp
all: depend $(MODNAME).$(DYNAMIC_LIB_EXTEN) local_all
depend: local_depend
clean: local_clean mod_clean
install: depend_install local_install mod_install
install: all depend_install local_install mod_install
distclean: clean local_distclean
extraclean: distclean local_extraclean
......
#!/bin/sh
make=$1
shift
pwd=$1
shift
mod=$1
shift
end=`echo $mod | sed "s/^.*\///g"`
if [ -z "$end" ] ; then
end=$mod
fi
if [ -f $mod/Makefile ] ; then
MOD_CFLAGS="$MOD_CFLAGS" MODNAME=$end BASE=$pwd $make -C $mod $@
else
MOD_CFLAGS="$MOD_CFLAGS" MODNAME=$end BASE=$pwd $make -f $pwd/generic_mod.mk -C $mod $@
fi
差异被折叠。
......@@ -20,6 +20,9 @@ switch_builddir=`pwd`
AC_SUBST(switch_srcdir)
AC_SUBST(switch_builddir)
moddir=$prefix/mod
AC_SUBST(moddir)
#Set default language
AC_LANG_C
# Checks for programs.
......@@ -277,6 +280,7 @@ AC_ARG_ENABLE(crash-protection,
AM_CONDITIONAL([CRASHPROT],[test "x$enable_crash_prot" != "xno"])
AC_CONFIG_FILES([Makefile
src/mod/Makefile
src/include/switch_am_config.h
build/modmake.rules])
......
# define these targets in your makefile if you wish
# local_all local_depend local_clean depend_install local_install local_distclean local_extraclean:
# and define these variables to impact your build
LOCAL_CFLAGS=
LOCAL_LDFLAGS=
LOCAL_OBJS=
include $(BASE)/build/modmake.rules
MODULES = `grep -v "\#" $(switch_builddir)/modules.conf`
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 \
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; \
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 ; \
fi; \
done
clean:
@for i in `find . -type d -name mod_\*` ; 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; \
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 ; \
fi; \
done
install:
@echo Installing Modules
@for i in $(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; \
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 ; \
fi; \
done
@echo done
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论