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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Apr 9 18:25:10 CDT 2008


Author: kpfleming
Date: Wed Apr  9 18:25:10 2008
New Revision: 114009

URL: http://svn.digium.com/view/asterisk?view=rev&rev=114009
Log:
commit some more work... a few more things work as desired... progress is good :-)

Added:
    team/kpfleming/multimodule-build/astbuild/get_makeopts
      - copied unchanged from r113925, team/kpfleming/multimodule-build/build_tools/get_makeopts
    team/kpfleming/multimodule-build/astbuild/get_moduleinfo
      - copied unchanged from r113925, team/kpfleming/multimodule-build/build_tools/get_moduleinfo
Modified:
    team/kpfleming/multimodule-build/astbuild/Makefile.core
    team/kpfleming/multimodule-build/res/   (props changed)

Modified: team/kpfleming/multimodule-build/astbuild/Makefile.core
URL: http://svn.digium.com/view/asterisk/team/kpfleming/multimodule-build/astbuild/Makefile.core?view=diff&rev=114009&r1=114008&r2=114009
==============================================================================
--- team/kpfleming/multimodule-build/astbuild/Makefile.core (original)
+++ team/kpfleming/multimodule-build/astbuild/Makefile.core Wed Apr  9 18:25:10 2008
@@ -1,8 +1,25 @@
-all:
-
-dist-clean::
-	rm -f .*.moduleinfo .moduleinfo
-	rm -f .*.makeopts .makeopts
+# the ASTBUILD variable must be set before executing this Makefile;
+# the variable must contain the path to the 'astbuild' toolkit directory
+
+# all temporary files generated by the build system are stored
+# in a subdirectory of the working directory; set a variable
+# to hold that directory's name
+astbuild_dir = .astbuild
+
+all:: $(astbuild_dir)
+
+clean::
+	rm -f *.o *.oo
+	rm -f *.so *.a
+	rm -f built-in.o built-in.oo
+
+dist-clean:: clean
+	@rm -rf $(astbuild_dir)
+
+distclean: dist-clean
+
+$(astbuild_dir):
+	@mkdir $@
 
 # XXX: this will now be a full path
 SUBDIR:=$(shell pwd)
@@ -18,10 +35,6 @@
 mods-y :=
 
 include Makefile.astbuild
-
-$(warning mods-n = $(mods-n))
-$(warning mods-m = $(mods-m))
-$(warning mods-y = $(mods-y))
 
 # lists of module names (all modules, using virtual names for modules that have them)
 all-mods-c :=
@@ -34,6 +47,7 @@
 mods-cc-y = $(single-mods-cc-y) $(multi-mods-cc-y)
 
 # lists of module names (multi-component modules)
+multi-mods = $(multi-mods-m) $(multi-mods-y)
 multi-mods-m = $(multi-mods-c-m) $(multi-mods-cc-m)
 multi-mods-y = $(multi-mods-c-y) $(multi-mods-cc-y)
 multi-mods-c-m :=
@@ -42,6 +56,7 @@
 multi-mods-cc-y :=
 
 # lists of module names (single-component modules)
+single-mods = $(single-mods-m) $(single-mods-y)
 single-mods-m = $(single-mods-c-m) $(single-mods-cc-m)
 single-mods-y = $(single-mods-c-y) $(single-mods-cc-y)
 single-mods-c-m :=
@@ -58,34 +73,31 @@
 objs-cc-y = $(single-objs-cc-y) $(multi-objs-cc-y)
 
 # lists of object names (objects in multi-component modules)
+multi-objs = $(multi-objs-m) $(multi-objs-y)
 multi-objs-m = $(multi-objs-c-m) $(multi-objs-cc-m)
 multi-objs-y = $(multi-objs-c-y) $(multi-objs-cc-y)
+multi-objs-c = $(multi-objs-c-m) $(multi-objs-c-y)
+multi-objs-cc = $(multi-objs-cc-m) $(multi-objs-cc-y)
 multi-objs-c-m :=
 multi-objs-c-y :=
 multi-objs-cc-m :=
 multi-objs-cc-y :=
 
 # lists of object names (objects in single-component modules)
+single-objs = $(single-objs-m) $(single-objs-y)
 single-objs-m = $(single-objs-c-m) $(single-objs-cc-m)
 single-objs-y = $(single-objs-c-y) $(single-objs-cc-y)
+single-objs-c = $(single-objs-c-m) $(single-objs-c-y)
+single-objs-cc = $(single-objs-cc-m) $(single-objs-cc-y)
 single-objs-c-m :=
 single-objs-c-y :=
 single-objs-cc-m :=
 single-objs-cc-y :=
 
-# steps
-# - split contents of all-mods into all-mods-(c,cc)
-# - find matching C sources that are not already a component and add to all-mods-c
-# - find matching CC sources that are not already a component and add to all-mods-cc
-# - repopulate all-mods with complete lists
-
 # find all multi-component C modules in all-mods and move them to all-mods-c
 all-mods-c := $(strip $(foreach mod,$(all-mods),$(if $(filter %.o,$($(mod))),$(mod))))
 # find all multi-component CC modules in all-mods and move them to all-mods-cc
 all-mods-cc := $(strip $(foreach mod,$(all-mods),$(if $(filter %.oo,$($(mod))),$(mod))))
-
-$(warning all-mods-c = $(all-mods-c))
-$(warning all-mods-cc = $(all-mods-cc))
 
 # find all available C modules that aren't already known
 ifneq ($(MODULE_PREFIX),)
@@ -107,31 +119,40 @@
   found-mods-cc := $(filter-out $(foreach mod,$(all-mods-cc),$(patsubst %.oo,%,$($(mod)))),$(found-mods-cc))
 endif
 
-$(warning found-mods-c = $(found-mods-c))
-$(warning found-mods-cc = $(found-mods-cc))
-
+# now rebuild the list of *all* modules to include the ones we found
 all-mods-c := $(sort $(all-mods-c) $(found-mods-c))
 all-mods-cc := $(sort $(all-mods-cc) $(found-mods-cc))
 
-$(warning all-mods-c = $(all-mods-c))
-$(warning all-mods-cc = $(all-mods-cc))
-
 all-mods := $(sort $(all-mods-c) $(all-mods-cc))
 
+# compute the list of modules that will be built as loadable
+#  (the subdirectory makefile will only ever specify the ones
+#   not to build at all, or to build as built-in)
 mods-m += $(filter-out $(mods-y) $(mods-n),$(all-mods))
 
-$(warning mods-y = $(mods-y))
-$(warning mods-m = $(mods-m))
-
+# generate the lists of multi-component modules to be built
 multi-mods-c-m := $(filter-out $(mods-y) $(mods-n),$(foreach mod,$(all-mods-c),$(if $($(mod)),$(mod))))
 multi-mods-c-y := $(filter-out $(mods-m) $(mods-n),$(foreach mod,$(all-mods-c),$(if $($(mod)),$(mod))))
 multi-mods-cc-m := $(filter-out $(mods-y) $(mods-n),$(foreach mod,$(all-mods-cc),$(if $($(mod)),$(mod))))
 multi-mods-cc-y := $(filter-out $(mods-m) $(mods-n),$(foreach mod,$(all-mods-cc),$(if $($(mod)),$(mod))))
 
-$(warning multi-mods-c-m = $(multi-mods-c-m))
-$(warning multi-mods-c-y = $(multi-mods-c-y))
-$(warning multi-mods-cc-m = $(multi-mods-cc-m))
-$(warning multi-mods-cc-y = $(multi-mods-cc-y))
+# generate the lists of single component modules to be built
+single-mods-c-m := $(filter-out $(mods-y) $(mods-n),$(foreach mod,$(all-mods-c),$(if $($(mod)),,$(mod))))
+single-mods-c-y := $(filter-out $(mods-m) $(mods-n),$(foreach mod,$(all-mods-c),$(if $($(mod)),,$(mod))))
+single-mods-cc-m := $(filter-out $(mods-y) $(mods-n),$(foreach mod,$(all-mods-cc),$(if $($(mod)),,$(mod))))
+single-mods-cc-y := $(filter-out $(mods-m) $(mods-n),$(foreach mod,$(all-mods-cc),$(if $($(mod)),,$(mod))))
+
+# generate the lists of multi-component module object files
+multi-objs-c-m := $(sort $(foreach mod,$(multi-mods-c-m),$($(mod))))
+multi-objs-c-y := $(sort $(foreach mod,$(multi-mods-c-y),$($(mod))))
+multi-objs-cc-m := $(sort $(foreach mod,$(multi-mods-cc-m),$($(mod))))
+multi-objs-cc-y := $(sort $(foreach mod,$(multi-mods-cc-y),$($(mod))))
+
+# generate the lists of single component module object files
+single-objs-c-m := $(single-mods-c-m:%=%.o)
+single-objs-c-y := $(single-mods-c-y:%=%.o)
+single-objs-cc-m := $(single-mods-cc-m:%=%.oo)
+single-objs-cc-y := $(single-mods-cc-y:%=%.oo)
 
 # function: module-base
 #
@@ -145,38 +166,50 @@
 # function: modname-multi
 #
 # get the module name that a component will be linked into
-modname-multi = $(sort $(foreach m,$(multi-used),\
-		$(if $(filter $(subst $(obj)/,,$*.o), $($(m:.o=-objs)) $($(m:.o=-y))),$(m:.o=))))
-
-$(warning module-base for res_config_odbc = $(call module-base,res_config_odbc))
-$(warning module-base for res_ael_foo = $(call module-base,res_ael_foo))
-
-.%.moduleinfo: %.c
-	@echo "<member name=\"$*\" displayname=\"$(shell $(GREP) -e AST_MODULE_INFO $< | head -n 1 | cut -d '"' -f 2)\" remove_on_change=\"$(SUBDIR)/$*.o $(SUBDIR)/$*.so\">" > $@
-	@$(AWK) -f $(ASTTOPDIR)/build_tools/get_moduleinfo $< >> $@
+modname-multi = $(sort $(foreach mod,$(multi-mods), $(if $(filter $*$(1), $($(mod))),$(mod))))
+
+# set a variable called 'modname' for every file that gets built, containing
+# the module name that the file being built is associated with, or will be
+# linked into
+#
+# first, for single component modules (the easy ones):
+$(single-objs-c): modname = $*
+$(single-objs-cc): modname = $*
+$(patsubst %.o,$(astbuild_dir)/%.moduleinfo,$(single-objs-c)): modname = $*
+$(patsubst %.oo,$(astbuild_dir)/%.moduleinfo,$(single-objs-cc)): modname = $*
+
+# second, for multi-component modules:
+$(multi-objs-c): modname = $(call modname-multi,.o)
+$(multi-objs-cc): modname = $(call modname-multi,.oo)
+$(patsubst %.o,$(astbuild_dir)/%.moduleinfo,$(multi-objs-c)): modname = $(call modname-multi,.o)
+$(patsubst %.oo,$(astbuild_dir)/%.moduleinfo,$(multi-objs-cc)): modname = $(call modname-multi,.oo)
+
+$(astbuild_dir)/%.moduleinfo: %.c
+	@echo "<member name=\"$(modname)\" displayname=\"$(shell $(GREP) -e AST_MODULE_INFO $< | head -n 1 | cut -d '"' -f 2)\">" > $@
+	@$(AWK) -f $(ASTBUILD)/get_moduleinfo $< >> $@
 	@echo "</member>" >> $@
 
-.%.moduleinfo: %.cc
-	@echo "<member name=\"$*\" displayname=\"$(shell $(GREP) -e AST_MODULE_INFO $< | head -n 1 | cut -d '"' -f 2)\" remove_on_change=\"$(SUBDIR)/$*.oo $(SUBDIR)/$*.so\">" > $@
-	@$(AWK) -f $(ASTTOPDIR)/build_tools/get_moduleinfo $< >> $@
+$(astbuild_dir)/%.moduleinfo: %.cc
+	@echo "<member name=\"$(modname)\" displayname=\"$(shell $(GREP) -e AST_MODULE_INFO $< | head -n 1 | cut -d '"' -f 2)\">" > $@
+	@$(AWK) -f $(ASTBUILD)/get_moduleinfo $< >> $@
 	@echo "</member>" >> $@
 
-.moduleinfo:: $(addsuffix .moduleinfo,$(addprefix .,$(foreach mod,$(all-mods),$(call module-base,$(mod)))))
-	@echo "<category name=\"MENUSELECT_$(MENUSELECT_CATEGORY)\" displayname=\"$(MENUSELECT_DESCRIPTION)\" remove_on_change=\"$(SUBDIR)/modules.link\">" > $@
-	@cat $^ >> $@
+$(astbuild_dir)/moduleinfo: $(astbuild_dir) $(addsuffix .moduleinfo,$(addprefix $(astbuild_dir)/,$(foreach mod,$(all-mods),$(call module-base,$(mod)))))
+	@echo "<category name=\"MENUSELECT_$(MENUSELECT_CATEGORY)\" displayname=\"$(MENUSELECT_DESCRIPTION)\" >" > $@
+	@cat $(filter-out $(astbuild_dir),$^) >> $@
 	@echo "</category>" >> $@
 
-moduleinfo: .moduleinfo
+moduleinfo: $(astbuild_dir)/moduleinfo
 	@cat $<
 
-.%.makeopts: %.c
-	@$(AWK) -f $(ASTTOPDIR)/build_tools/get_makeopts $< > $@
-
-.%.makeopts: %.cc
-	@$(AWK) -f $(ASTTOPDIR)/build_tools/get_makeopts $< > $@
-
-.makeopts:: $(addsuffix .makeopts,$(addprefix .,$(foreach mod,$(all-mods),$(call module-base,$(mod)))))
-	@cat $^ > $@
-
-makeopts: .makeopts
+$(astbuild_dir)/%.makeopts: %.c
+	@$(AWK) -f $(ASTBUILD)/get_makeopts $< > $@
+
+$(astbuild_dir)/%.makeopts: %.cc
+	@$(AWK) -f $(ASTBUILD)/get_makeopts $< > $@
+
+$(astbuild_dir)/makeopts: $(astbuild_dir) $(addsuffix .makeopts,$(addprefix $(astbuild_dir)/,$(foreach mod,$(all-mods),$(call module-base,$(mod)))))
+	@cat $(filter-out $(astbuild_dir),$^) > $@
+
+makeopts: $(astbuild_dir)/makeopts
 	@cat $<

Propchange: team/kpfleming/multimodule-build/res/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Apr  9 18:25:10 2008
@@ -1,10 +1,6 @@
 *.a
 *.d
-*.eo
-*.eoo
 *.i
-*.makeopts
-*.moduleinfo
 *.s
 *.so
-modules.link
+.astbuild




More information about the asterisk-commits mailing list