diff --git a/Makefile.am b/Makefile.am index c829af74aa..f543bdc388 100644 --- a/Makefile.am +++ b/Makefile.am @@ -14,6 +14,9 @@ if CRASHPROT AM_CFLAGS += -DCRASH_PROT endif +.DEFAULT: + @cd src/mod && $(MAKE) $(AM_MAKEFLAGS) $@ + libfreeswitch_la_SOURCES = \ src/switch_apr.c \ src/switch_buffer.c \ @@ -90,8 +93,6 @@ libs/libteletone/src/libteletone_detect.h\ libs/libteletone/src/libteletone_generate.h\ libs/libteletone/src/libteletone.h - - CORE_CFLAGS = `$(switch_srcdir)/libs/apr/apr-1-config --cflags --cppflags --includes` CORE_CFLAGS += `$(switch_srcdir)/libs/apr-util/apu-1-config --includes` CORE_CFLAGS += -I$(switch_srcdir)/libs/sqlite @@ -244,15 +245,10 @@ eclean: clean megaclean: eclean modclean rm -f `find ./libs -name \*.la` -@am__include@ @am__quote@./$(DEPDIR)/modules.targets@am__quote@ - modules.conf: if test -f $@; then touch $@; else cp build/modules.conf.in $@ ;fi -./$(DEPDIR)/modules.targets: modules.conf - mods=`cat modules.conf | sed -e 's|^.*/||'`; echo MODULE_TARGETS=\"$$mods\" > ./$(DEPDIR)/modules.targets - -$(MODULE_TARGETS): +$(OUR_MODULES): @set fnord $$MAKEFLAGS; amf=$$2; \ (cd src/mod && $(MAKE) $(AM_MAKEFLAGS) $@) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ diff --git a/configure.in b/configure.in index ec4d63d227..a870df2f6f 100644 --- a/configure.in +++ b/configure.in @@ -340,9 +340,20 @@ AM_CONDITIONAL(IS64BITLINUX, [test `uname -m` = x86_64]) #LIBS+=> core.log || error="yes";if test -n "$(VERBOSE)" -o "$$error" = "yes";then cat core.log;fi;if test "$$error" = "yes";then exit 1;fi LIBTOOL='`if test -z "$(VERBOSE)" ; then echo $(SHELL) $(switch_builddir)/quiet_libtool ;else echo $(switch_builddir)/libtool; fi;`' TOUCH_TARGET='if test -f "$@";then touch "$@";fi;' -AM_MAKEFLAGS='`test -n "$(VERBOSE)" || echo -s`' +CONF_MODULES='\`grep -v "\#" $(switch_builddir)/modules.conf | sed -e "s|^.*/||" \`' +OUR_MODS='`if test -z "$(MODULES)" ; then tmp_mods="$(CONF_MODULES)"; else tmp_mods="$(MODULES)" ; fi ; mods=\`for i in $$tmp_mods ; do echo $$i-all ; done \`; echo $$mods `' +OUR_CLEAN_MODS='`if test -z "$(MODULES)" ; then tmp_mods="$(CONF_MODULES)"; else tmp_mods="$(MODULES)" ; fi ; mods=\`for i in $$tmp_mods ; do echo $$i-clean ; done \`; echo $$mods `' +OUR_INSTALL_MODS='`if test -z "$(MODULES)" ; then tmp_mods="$(CONF_MODULES)"; else tmp_mods="$(MODULES)" ; fi ; mods=\`for i in $$tmp_mods ; do echo $$i-install ; done\`; echo $$mods `' +OUR_UNINSTALL_MODS='`if test -z "$(MODULES)" ; then tmp_mods="$(CONF_MODULES)"; else tmp_mods="$(MODULES)" ; fi ; mods=\`for i in $$tmp_mods ; do echo $$i-uninstall ; done\`; echo $$mods `' +AM_MAKEFLAGS='"OUR_MODULES=$(OUR_MODS)" "OUR_CLEAN_MODULES=$(OUR_CLEAN_MODS)" "OUR_INSTALL_MODULES=$(OUR_INSTALL_MODS)" "OUR_UNINSTALL_MODULES=$(OUR_UNINSTALL_MODS)" `test -n "$(VERBOSE)" || echo -s`' +#AM_MAKEFLAGS='`test -n "$(VERBOSE)" || echo -s`' AC_SUBST(LIBTOOL) AC_SUBST(TOUCH_TARGET) +AC_SUBST(CONF_MODULES) +AC_SUBST(OUR_MODS) +AC_SUBST(OUR_CLEAN_MODS) +AC_SUBST(OUR_INSTALL_MODS) +AC_SUBST(OUR_UNINSTALL_MODS) AC_SUBST(AM_MAKEFLAGS) # Run configure in all the subdirs diff --git a/src/mod/Makefile.am b/src/mod/Makefile.am index 43a72e155b..3b84932a80 100644 --- a/src/mod/Makefile.am +++ b/src/mod/Makefile.am @@ -1,90 +1,28 @@ -CONF_MODULES=if test ! -f $(switch_builddir)/modules.conf ; then cp $(switch_builddir)/build/modules.conf.in $(switch_builddir)/modules.conf ; fi ; conf_modules=`grep -v "\#" $(switch_builddir)/modules.conf` ; -FOUND_MODULES=found_modules=`find . -type d -name mod_\* | sed -e 's|^\./||'` ; -OUR_MODULES=if test -z "$(MODULES)" ; then our_modules=$$conf_modules ; else our_modules="$(MODULES)" ; fi ; -OUR_CLEAN_MODULES=if test -z "$(MODULES)" ; then tmp_clean_modules=`echo $$conf_modules $$found_modules`; \ - our_clean_modules=`for i in $$tmp_clean_modules ; do echo $$i ; done | sort | uniq` ; \ - else our_clean_modules="$(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: $(OUR_MODULES) +clean: $(OUR_CLEAN_MODULES) +install: $(OUR_INSTALL_MODULES) +uninstall: $(OUR_UNINSTALL_MODULES) -all: - @$(CONF_MODULES) \ - $(OUR_MODULES) \ - echo ;\ - echo making modules ; \ - for i in $$our_modules ; do \ - echo ;\ - echo making $$i ; \ - moddir=$(MOD_DIR); \ - if test -f $$moddir/Makefile ; then \ - cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) $(AM_MAKEFLAGS) || exit 1; else \ - cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) $(AM_MAKEFLAGS) -f $(switch_builddir)/build/modmake.rules || exit 1; \ - fi; \ - done - @echo - @echo done making modules - -clean: - @$(CONF_MODULES) \ - $(FOUND_MODULES) \ - $(OUR_CLEAN_MODULES) \ - echo ;\ - echo making clean modules ; \ - for i in $$our_clean_modules ; do \ - echo ;\ - echo making clean $$i ; \ - moddir=$(MOD_DIR); \ - if test -f $$moddir/Makefile ; then \ - cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) $(AM_MAKEFLAGS) clean || exit 1; else \ - cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) $(AM_MAKEFLAGS) -f $(switch_builddir)/build/modmake.rules clean || exit 1; \ - fi; \ - done - @echo - @echo done making clean modules - -install: - @$(CONF_MODULES) \ - $(OUR_MODULES) \ - echo ;\ - echo Installing Modules ; \ - for i in $$our_modules ; do \ - echo ;\ - echo making install $$i ; \ - moddir=$(MOD_DIR); \ - if test -f $$moddir/Makefile ; then \ - cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) $(AM_MAKEFLAGS) install || exit 1; else \ - cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) $(AM_MAKEFLAGS) -f $(switch_builddir)/build/modmake.rules install || exit 1; \ - fi; \ - done - @echo - @echo done Installing Modules - -uninstall: - @$(CONF_MODULES) \ - $(OUR_MODULES) \ - echo ;\ - echo Uninstalling Modules ; \ - for i in $$our_modules ; do \ - echo ;\ - echo making uninstall $$i ; \ - moddir=$(MOD_DIR); \ - if test -f $$moddir/Makefile ; then \ - cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) $(AM_MAKEFLAGS) uninstall || exit 1; else \ - cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) $(AM_MAKEFLAGS) -f $(switch_builddir)/build/modmake.rules uninstall || exit 1; \ - fi; \ - done - @echo - @echo done Uninstalling Modules - - -@am__include@ @am__quote@$(switch_builddir)/$(DEPDIR)/modules.targets@am__quote@ - -$(MODULE_TARGETS): +$(OUR_MODULES) $(OUR_CLEAN_MODULES) $(OUR_INSTALL_MODULES) $(OUR_UNINSTALL_MODULES): @set fnord $$MAKEFLAGS; amf=$$2; \ - moddir=`grep $@ $(switch_builddir)/modules.conf | sed -e 's|#||'` ; \ + target=`echo $@ | sed -e 's|^.*-||'`; \ + modname=`echo $@ | sed -e 's|-.*||'`; \ + confmoddir=`cat $(switch_builddir)/modules.conf | grep $$modname | sed -e 's|#||' `; \ + if test -z "$$confmoddir" ; then moddir=$@ ; else \ + if test -d "$(switch_srcdir)/src/mod/$$confmoddir" ; then \ + moddir="$(switch_srcdir)/src/mod/$$confmoddir" ; else \ + moddir="$$confmoddir" ; \ + fi ; \ + fi ; \ + if test -z "$$target" ; then target="all" ; fi ; \ + echo ;\ + echo making $$target $$modname ;\ (if test -f $$moddir/Makefile ; then \ - cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) $(AM_MAKEFLAGS); else\ - cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) $(AM_MAKEFLAGS) -f $(switch_builddir)/build/modmake.rules;\ + cd $$moddir && MODNAME=$$modname BASE=$(switch_builddir) $(MAKE) $(AM_MAKEFLAGS) $$target; else\ + cd $$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; \ test -z "$$fail" + +.DEFAULT: + @if test -z "`echo $@ | grep all`"; then $(MAKE) $(AM_MAKEFLAGS) $@-all ; else echo Unknown target `echo $@ | sed -e 's|-all||'`; exit 1; fi