[asterisk-commits] kpfleming: branch kpfleming/multimodule-build r114015 - /team/kpfleming/multi...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Apr 9 19:00:14 CDT 2008
Author: kpfleming
Date: Wed Apr 9 19:00:13 2008
New Revision: 114015
URL: http://svn.digium.com/view/asterisk?view=rev&rev=114015
Log:
yay! generation of moduleinfo and makeopts now works properly
Modified:
team/kpfleming/multimodule-build/astbuild/Makefile.core
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=114015&r1=114014&r2=114015
==============================================================================
--- team/kpfleming/multimodule-build/astbuild/Makefile.core (original)
+++ team/kpfleming/multimodule-build/astbuild/Makefile.core Wed Apr 9 19:00:13 2008
@@ -39,6 +39,12 @@
# lists of module names (all modules, using virtual names for modules that have them)
all-mods-c :=
all-mods-cc :=
+all-multi-mods = $(all-multi-mods-c) $(all-multi-mods-cc)
+all-single-mods = $(all-single-mods-c) $(all-single-mods-cc)
+all-multi-mods-c :=
+all-multi-mods-cc :=
+all-single-mods-c :=
+all-single-mods-cc :=
# lists of module names (modules to build)
mods-c-m = $(single-mods-c-m) $(multi-mods-c-m)
@@ -125,22 +131,28 @@
all-mods := $(sort $(all-mods-c) $(all-mods-cc))
+# generate lists of all known modules, separated by source type and build type
+all-multi-mods-c := $(sort $(foreach mod,$(all-mods-c),$(if $($(mod)),$(mod))))
+all-multi-mods-cc := $(sort $(foreach mod,$(all-mods-cc),$(if $($(mod)),$(mod))))
+all-single-mods-c := $(filter-out $(all-multi-mods-c),$(all-mods-c))
+all-single-mods-cc := $(filter-out $(all-multi-mods-cc),$(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))
# 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))))
+multi-mods-c-m := $(filter-out $(mods-y) $(mods-n),$(all-multi-mods-c))
+multi-mods-c-y := $(filter-out $(mods-m) $(mods-n),$(all-multi-mods-c))
+multi-mods-cc-m := $(filter-out $(mods-y) $(mods-n),$(all-multi-mods-cc))
+multi-mods-cc-y := $(filter-out $(mods-m) $(mods-n),$(all-multi-mods-cc))
# 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))))
+single-mods-c-m := $(filter-out $(mods-y) $(mods-n),$(all-single-mods-c))
+single-mods-c-y := $(filter-out $(mods-m) $(mods-n),$(all-single-mods-c))
+single-mods-cc-m := $(filter-out $(mods-y) $(mods-n),$(all-single-mods-cc))
+single-mods-cc-y := $(filter-out $(mods-m) $(mods-n),$(all-single-mods-cc))
# generate the lists of multi-component module object files
multi-objs-c-m := $(sort $(foreach mod,$(multi-mods-c-m),$($(mod))))
@@ -163,26 +175,34 @@
#
module-base = $(if $($(1)),$(basename $(firstword $($(1)))),$(1))
+# function: module-bases
+#
+# get the base files for a list of modules
+#
+module-bases = $(sort $(foreach mod,$(1),$(call module-base,$(mod))))
+
# function: modname-multi
#
# get the module name that a component will be linked into
-modname-multi = $(sort $(foreach mod,$(multi-mods), $(if $(filter $*$(1), $($(mod))),$(mod))))
+modname-multi = $(sort $(foreach mod,$(all-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
+# linked into; some of these lists are built for the entire list of all
+# known modules, and others are built only for the modules that will be
+# built
#
# 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 = $*
+$(patsubst %,$(astbuild_dir)/%.moduleinfo,$(all-single-mods-c)): modname = $*
+$(patsubst %,$(astbuild_dir)/%.moduleinfo,$(all-single-mods-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)
+$(patsubst %,$(astbuild_dir)/%.moduleinfo,$(call module-bases,$(all-multi-mods-c))): modname = $(call modname-multi,.o)
+$(patsubst %,$(astbuild_dir)/%.moduleinfo,$(call module-bases,$(all-multi-mods-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)\">" > $@
@@ -194,7 +214,7 @@
@$(AWK) -f $(ASTBUILD)/get_moduleinfo $< >> $@
@echo "</member>" >> $@
-$(astbuild_dir)/moduleinfo: $(astbuild_dir) $(addsuffix .moduleinfo,$(addprefix $(astbuild_dir)/,$(foreach mod,$(all-mods),$(call module-base,$(mod)))))
+$(astbuild_dir)/moduleinfo: $(astbuild_dir) $(patsubst %,$(astbuild_dir)/%.moduleinfo,$(call module-bases,$(all-mods)))
@echo "<category name=\"MENUSELECT_$(MENUSELECT_CATEGORY)\" displayname=\"$(MENUSELECT_DESCRIPTION)\" >" > $@
@cat $(filter-out $(astbuild_dir),$^) >> $@
@echo "</category>" >> $@
@@ -208,7 +228,7 @@
$(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)))))
+$(astbuild_dir)/makeopts: $(astbuild_dir) $(patsubst %,$(astbuild_dir)/%.makeopts,$(call module-bases,$(all-mods)))
@cat $(filter-out $(astbuild_dir),$^) > $@
makeopts: $(astbuild_dir)/makeopts
More information about the asterisk-commits
mailing list