[asterisk-commits] kpfleming: branch kpfleming/multimodule-build r103505 - in /team/kpfleming/mu...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Feb 12 16:24:21 CST 2008


Author: kpfleming
Date: Tue Feb 12 16:24:20 2008
New Revision: 103505

URL: http://svn.digium.com/view/asterisk?view=rev&rev=103505
Log:
commit some (not yet working) code for making builds of modules that have multiple source files easier and more consistent

Added:
    team/kpfleming/multimodule-build/
      - copied from r103503, trunk/
    team/kpfleming/multimodule-build/channels/chan_misdn_core.c
      - copied unchanged from r102712, trunk/channels/chan_misdn.c
Removed:
    team/kpfleming/multimodule-build/channels/chan_misdn.c
Modified:
    team/kpfleming/multimodule-build/Makefile.moddir_rules
    team/kpfleming/multimodule-build/Makefile.rules
    team/kpfleming/multimodule-build/channels/Makefile

Modified: team/kpfleming/multimodule-build/Makefile.moddir_rules
URL: http://svn.digium.com/view/asterisk/team/kpfleming/multimodule-build/Makefile.moddir_rules?view=diff&rev=103505&r1=103503&r2=103505
==============================================================================
--- team/kpfleming/multimodule-build/Makefile.moddir_rules (original)
+++ team/kpfleming/multimodule-build/Makefile.moddir_rules Tue Feb 12 16:24:20 2008
@@ -35,36 +35,44 @@
 include $(ASTTOPDIR)/Makefile.rules
 
 # If MODULE_PREFIX is defined, use it to run the standard functions to set
-# C_MODS, CC_MODS, LOADABLE_MODS and EMBEDDED_MODS.
+# C_MODS, CC_MODS, LOADABLE_MODS and EMBEDDED_MODS. If MULTI_C_MODS or
+# MULTI_CC_MODS are set, those modules are excluded because they are
+# handled by the Makefile that includes this one.
 # Each word of MODULE_PREFIX is a prefix for filenames that we consider
 # valid C or CC modules (eg. app, func ...). Note that the underscore
 # is added here, and does not need to be in MODULE_PREFIX
 #
 # Use MODULE_EXCLUDE to specify additional modules to exclude.
 
+# Automatically add all components of MULTI_C_MODS and MULTI_CC_MODS
+# to MODULE_EXCLUDE
+
+MODULE_EXCLUDE+=$(foreach m,$(MULTI_C_MODS),$(patsubst %.o,%,$($(m).o)))
+MODULE_EXCLUDE+=$(foreach m,$(MULTI_CC_MODS),$(patsubst %.oo,%,$($(m).oo)))
+
 ifneq ($(MODULE_PREFIX),)
     ALL_C_MODS:=
-    ALL_C_MODS+=$(foreach p,$(MODULE_PREFIX),$(patsubst %.c,%,$(wildcard $(p)_*.c)))
+    ALL_C_MODS+=$(filter-out $(MODULE_EXCLUDE),$(foreach p,$(MODULE_PREFIX),$(patsubst %.c,%,$(wildcard $(p)_*.c))))
     ALL_CC_MODS:=
-    ALL_CC_MODS+=$(foreach p,$(MODULE_PREFIX),$(patsubst %.cc,%,$(wildcard $(p)_*.cc)))
+    ALL_CC_MODS+=$(filter-out $(MODULE_EXCLUDE),$(foreach p,$(MODULE_PREFIX),$(patsubst %.cc,%,$(wildcard $(p)_*.cc))))
  
-    C_MODS:=$(filter-out $(MENUSELECT_$(MENUSELECT_CATEGORY)),$(ALL_C_MODS))
-    CC_MODS:=$(filter-out $(MENUSELECT_$(MENUSELECT_CATEGORY)),$(ALL_CC_MODS))
+    C_MODS:=$(filter-out $(MENUSELECT_$(MENUSELECT_CATEGORY)) $(MULTI_C_MODS),$(ALL_C_MODS))
+    CC_MODS:=$(filter-out $(MENUSELECT_$(MENUSELECT_CATEGORY)) $(MULTI_CC_MODS),$(ALL_CC_MODS))
 
     # and store in the list of embedded or loadable modules
     ifneq ($(findstring $(MENUSELECT_CATEGORY),$(MENUSELECT_EMBED)),)
-	EMBEDDED_MODS:=$(C_MODS) $(CC_MODS)
+	EMBEDDED_MODS:=$(C_MODS) $(CC_MODS) $(MULTI_C_MODS) $(MULTI_CC_MODS)
     else
-	LOADABLE_MODS:=$(C_MODS) $(CC_MODS)
+	LOADABLE_MODS:=$(C_MODS) $(CC_MODS) $(MULTI_C_MODS) $(MULTI_CC_MODS)
     endif
 endif
 
-# Both C++ and C++ sources need their module name in AST_MODULE
+# Both C and C++ sources need their module name in AST_MODULE
 # We also pass whatever _INCLUDE list is generated by menuselect
 # (they are stored in file 'makeopts')
 
-$(addsuffix .oo,$(CC_MODS)) $(addsuffix .o,$(C_MODS)):	\
-	ASTCFLAGS+= -DAST_MODULE=\"$*\" $(MENUSELECT_OPTS_$*:%=-D%) $(foreach dep,$(MENUSELECT_DEPENDS_$*),$(value $(dep)_INCLUDE))
+$(C_MODS:%=%.o) $(MULTI_C_MODS:%=%.o) $(CC_MODS:%=%.oo) $(MULTI_CC_MODS:%=%.oo): \
+	ASTCFLAGS+=-DAST_MODULE=\"$*\" $(MENUSELECT_OPTS_$*:%=-D%) $(foreach dep,$(MENUSELECT_DEPENDS_$*),$($(dep)_INCLUDE))
 
 ifeq ($(findstring $(OSARCH), mingw32 cygwin ),)
    # don't define -fPIC on mingw32 and cygwin, it is the default
@@ -72,15 +80,16 @@
 endif
 
 # For loadable modules, pass _LIB and _LDFLAGS from menuselect.
-$(LOADABLE_MODS:%=%.so): LIBS+=$(foreach dep,$(MENUSELECT_DEPENDS_$*),$(value $(dep)_LIB))
-$(LOADABLE_MODS:%=%.so): ASTLDFLAGS+=$(foreach dep,$(MENUSELECT_DEPENDS_$*),$(value $(dep)_LDFLAGS))
+$(LOADABLE_MODS:%=%.so): LIBS+=$(foreach dep,$(MENUSELECT_DEPENDS_$*),$($(dep)_LIB))
+$(LOADABLE_MODS:%=%.so): ASTLDFLAGS+=$(foreach dep,$(MENUSELECT_DEPENDS_$*),$($(dep)_LDFLAGS))
 
 $(EMBEDDED_MODS:%=%.o): ASTCFLAGS+=-DEMBEDDED_MODULE=$*
 
-$(addsuffix .so,$(filter $(LOADABLE_MODS),$(C_MODS))): %.so: %.o
-$(addsuffix .so,$(filter $(LOADABLE_MODS),$(CC_MODS))): %.so: %.oo
+$(addsuffix .so,$(filter $(LOADABLE_MODS),$(C_MODS) $(MULTI_C_MODS))): %.so: %.o
+$(addsuffix .so,$(filter $(LOADABLE_MODS),$(CC_MODS) $(MULTI_CC_MODS))): %.so: %.oo
 
-modules.link: $(addsuffix .eo,$(filter $(EMBEDDED_MODS),$(C_MODS)))
+modules.link: $(addsuffix .eo,$(filter $(EMBEDDED_MODS),$(C_MODS) $(MULTI_C_MODS)))
+modules.link: $(addsuffix .eoo,$(filter $(EMBEDDED_MODS),$(CC_MODS) $(MULTI_CC_MODS)))
 
 .PHONY: clean uninstall _all moduleinfo makeopts
 
@@ -99,11 +108,11 @@
 __embed_ldscript:
 	@echo "../$(SUBDIR)/modules.link"
 __embed_ldflags:
-	@echo "$(foreach mod,$(filter $(EMBEDDED_MODS),$(C_MODS)),$(foreach dep,$(MENUSELECT_DEPENDS_$(mod)),$(dep)_LDFLAGS))"
-	@echo "$(foreach mod,$(filter $(EMBEDDED_MODS),$(CC_MODS)),$(foreach dep,$(MENUSELECT_DEPENDS_$(mod)),$(dep)_LDFLAGS))"
+	@echo "$(foreach mod,$(filter $(EMBEDDED_MODS),$(C_MODS) $(MULTI_C_MODS)),$(foreach dep,$(MENUSELECT_DEPENDS_$(mod)),$(dep)_LDFLAGS))"
+	@echo "$(foreach mod,$(filter $(EMBEDDED_MODS),$(CC_MODS) $(MULTI_C_MODS)),$(foreach dep,$(MENUSELECT_DEPENDS_$(mod)),$(dep)_LDFLAGS))"
 __embed_libs:
-	@echo "$(foreach mod,$(filter $(EMBEDDED_MODS),$(C_MODS)),$(foreach dep,$(MENUSELECT_DEPENDS_$(mod)),$(dep)_LIB))"
-	@echo "$(foreach mod,$(filter $(EMBEDDED_MODS),$(CC_MODS)),$(foreach dep,$(MENUSELECT_DEPENDS_$(mod)),$(dep)_LIB))"
+	@echo "$(foreach mod,$(filter $(EMBEDDED_MODS),$(C_MODS) $(MULTI_C_MODS)),$(foreach dep,$(MENUSELECT_DEPENDS_$(mod)),$(dep)_LIB))"
+	@echo "$(foreach mod,$(filter $(EMBEDDED_MODS),$(CC_MODS) $(MULTI_C_MODS)),$(foreach dep,$(MENUSELECT_DEPENDS_$(mod)),$(dep)_LIB))"
 else
 __embed_ldscript:
 __embed_ldflags:

Modified: team/kpfleming/multimodule-build/Makefile.rules
URL: http://svn.digium.com/view/asterisk/team/kpfleming/multimodule-build/Makefile.rules?view=diff&rev=103505&r1=103503&r2=103505
==============================================================================
--- team/kpfleming/multimodule-build/Makefile.rules (original)
+++ team/kpfleming/multimodule-build/Makefile.rules Tue Feb 12 16:24:20 2008
@@ -79,6 +79,14 @@
 	$(ECHO_PREFIX) echo "   [LDXX] $^ -> $@"
 	$(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o $@ $(PTHREAD_CFLAGS) $(ASTLDFLAGS) $(SOLINK) $^ $(PTHREAD_LIBS) $(LIBS)
 
+%.o: %.o
+	$(ECHO_PREFIX) echo "   [LD] $< -> $@"
+	$(CMD_PREFIX) $(LD) -r -o $@ $<
+
+%.oo: %.oo
+	$(ECHO_PREFIX) echo "   [LD] $< -> $@"
+	$(CMD_PREFIX) $(LD) -r -o $@ $<
+
 %.eo: %.o
 	$(ECHO_PREFIX) echo "   [EMBED] $< -> $@"
 	$(CMD_PREFIX) $(ASTTOPDIR)/build_tools/make_linker_eo_script $* > .$@.ld

Modified: team/kpfleming/multimodule-build/channels/Makefile
URL: http://svn.digium.com/view/asterisk/team/kpfleming/multimodule-build/channels/Makefile?view=diff&rev=103505&r1=103503&r2=103505
==============================================================================
--- team/kpfleming/multimodule-build/channels/Makefile (original)
+++ team/kpfleming/multimodule-build/channels/Makefile Tue Feb 12 16:24:20 2008
@@ -51,6 +51,14 @@
 
 all: _all
 
+MULTI_C_MODS:=chan_misdn
+MULTI_CC_MODS:=chan_bar
+
+chan_misdn.o:=chan_misdn_core.o misdn_config.o misdn/isdn_lib.o misdn/isdn_msg_parser.o
+chan_bar.oo:=chan_bar_1.oo bar_2.oo bar_3.oo
+
+chan_misdn.o: $(chan_misdn.o)
+
 include $(ASTTOPDIR)/Makefile.moddir_rules
 
 ifneq ($(findstring $(OSARCH), mingw32 cygwin ),)
@@ -92,14 +100,12 @@
 	$(CMD_PREFIX) $(CXX) $(PTHREAD_CFLAGS) $(ASTLDFLAGS) $(SOLINK) -o $@ $< h323/libchanh323.a $(CHANH323LIB) -L$(PWLIBDIR)/lib $(PTLIB) -L$(OPENH323DIR)/lib $(H323LIB) -L/usr/lib -lcrypto -lssl -lexpat
 endif
 
-chan_misdn.o: ASTCFLAGS+=-Imisdn
+chan_misdn_core.o: ASTCFLAGS+=-Imisdn
 
 misdn_config.o: ASTCFLAGS+=-Imisdn
 
 misdn/isdn_lib.o: ASTCFLAGS+=-Wno-strict-aliasing
 
-$(if $(filter chan_misdn,$(EMBEDDED_MODS)),modules.link,chan_misdn.so): misdn_config.o misdn/isdn_lib.o misdn/isdn_msg_parser.o
-
 chan_vpb.oo: ASTCFLAGS:=$(filter-out -Wdeclaration-after-statement,$(ASTCFLAGS))
 
 $(if $(filter chan_oss,$(EMBEDDED_MODS)),modules.link,chan_oss.so): console_video.o vgrabbers.o console_board.o




More information about the asterisk-commits mailing list