diff options
Diffstat (limited to 'Makefile.moddir_rules')
-rw-r--r-- | Makefile.moddir_rules | 62 |
1 files changed, 41 insertions, 21 deletions
diff --git a/Makefile.moddir_rules b/Makefile.moddir_rules index 20fcde38a..fea69a2e2 100644 --- a/Makefile.moddir_rules +++ b/Makefile.moddir_rules @@ -41,33 +41,19 @@ include $(ASTTOPDIR)/Makefile.rules # Use MODULE_EXCLUDE to specify additional modules to exclude. ifneq ($(MODULE_PREFIX),) - # Compute the lowercase and uppercase directory name. The former - # is used as a key in MENUSELECT_EMBED, the latter is part of - # the name of the MENUSELECT_* variable containing the exclude list - # generated by menuselect. - A:=$(notdir $(CURDIR)) - B:=$(shell echo $A | tr "[a-z]" "[A-Z]") - # MENUSELECT_$(L) contains the list of modules excluded by menuselect. - # MODULE_EXCLUDE contains the locally generated exclude list - L:=$(MENUSELECT_$(B)) $(MODULE_EXCLUDE) - # construct the list of C and CC modules from the content of the directory - C_MODS:= - CC_MODS:= - C_MODS+=$(foreach pre,$(MODULE_PREFIX),$(filter-out $(L),$(patsubst %.c,%,$(wildcard $(pre)*.c)))) - CC_MODS+=$(foreach pre,$(MODULE_PREFIX),$(filter-out $(L),$(patsubst %.cc,%,$(wildcard $(pre)*.cc)))) + ALL_C_MODS:=$(patsubst %.c,%,$(wildcard $(MODULE_PREFIX)_*.c)) + ALL_CC_MODS:=$(patsubst %.cc,%,$(wildcard $(MODULE_PREFIX)_*.cc)) + + C_MODS:=$(filter-out $(MENUSELECT_$(MENUSELECT_CATEGORY)),$(ALL_C_MODS)) + CC_MODS:=$(filter-out $(MENUSELECT_$(MENUSELECT_CATEGORY)),$(ALL_CC_MODS)) # and store in the list of embedded or loadable modules - ifneq ($(findstring $(A),$(MENUSELECT_EMBED)),) + ifneq ($(findstring $(MENUSELECT_CATEGORY),$(MENUSELECT_EMBED)),) EMBEDDED_MODS:=$(C_MODS) $(CC_MODS) else LOADABLE_MODS:=$(C_MODS) $(CC_MODS) endif endif -# debugging -# x:=$(shell echo 'in $(B)' >&2) -# x:=$(shell echo 'filtered out $(L)' >&2) -# x:=$(shell echo 'C_MODS= $(C_MODS)' >&2) -# x:=$(shell sleep 2) # Both C++ and C++ sources need their module name in AST_MODULE # We also pass whatever _INCLUDE list is generated by menuselect @@ -92,7 +78,7 @@ $(addsuffix .so,$(filter $(LOADABLE_MODS),$(CC_MODS))): %.so: %.oo modules.link: $(addsuffix .eo,$(filter $(EMBEDDED_MODS),$(C_MODS))) -.PHONY: clean uninstall _all +.PHONY: clean uninstall _all moduleinfo makeopts ifneq ($(LOADABLE_MODS),) _all: $(LOADABLE_MODS:%=%.so) @@ -137,6 +123,40 @@ install:: all uninstall:: +dist-clean:: + rm -f .*.moduleinfo .moduleinfo + rm -f .*.makeopts .makeopts + +.%.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 $< >> $@ + 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 $< >> $@ + echo "</member>" >> $@ + +.moduleinfo:: $(addsuffix .moduleinfo,$(addprefix .,$(ALL_C_MODS) $(ALL_CC_MODS))) + @echo "<category name=\"MENUSELECT_$(MENUSELECT_CATEGORY)\" displayname=\"$(MENUSELECT_DESCRIPTION)\" remove_on_change=\"$(SUBDIR)/modules.link\">" > $@ + @cat $^ >> $@ + @echo "</category>" >> $@ + +moduleinfo: .moduleinfo + @cat $< + +.%.makeopts: %.c + @$(AWK) -f $(ASTTOPDIR)/build_tools/get_makeopts $< > $@ + +.%.makeopts: %.cc + @$(AWK) -f $(ASTTOPDIR)/build_tools/get_makeopts $< > $@ + +.makeopts:: $(addsuffix .makeopts,$(addprefix .,$(ALL_C_MODS) $(ALL_CC_MODS))) + @cat $^ > $@ + +makeopts: .makeopts + @cat $< + ifneq ($(wildcard .*.d),) include .*.d endif |