summaryrefslogtreecommitdiff
path: root/Makefile.moddir_rules
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2007-12-17 07:25:35 +0000
committerKevin P. Fleming <kpfleming@digium.com>2007-12-17 07:25:35 +0000
commit100ef27af920de05dec41cdf281c3a9b8172d68f (patch)
treedfc78c051a3faabab03ba235d18d6e5ec1204ec6 /Makefile.moddir_rules
parentf483cf28bbde151d07a1e14dd885b5c63e137a33 (diff)
Merged revisions 93180 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r93180 | kpfleming | 2007-12-16 22:44:51 -0800 (Sun, 16 Dec 2007) | 23 lines In http://lists.digium.com/pipermail/asterisk-dev/2007-December/031145.html, rizzo brought up some issues related to the way that the metadata required for menuselect and the rest of the build system is extracted from the source files. Since I had a few hours to kill on an airplane today, I decided to improve this situation... so now the system caches the extracted metadata and uses it to build the menuselect 'tree' as much as it can. The result of this is that when a single source file is changed, only the metadata for that file needs to be extracted again, and the rest is used from the cache files. I also reduced the number of forked processes required to do the metadata extraction; it was actually possible to do most of what we needed in the Makefiles themselves without using any shell scripts at all! On my laptop, these changes resulted in an 80% decrease in the time required for the 'menuselect.makeopts' automatic check to occur after editing a single source file. While doing this work I also cleaned up a few minor things in the Makefiles, adding a check for 'awk' to the configure script and changed all remaining places we use 'grep' or 'awk' to use the ones found by the configure script, and changed the 'prep_tarball' script to build the menuselect metadata so that tarballs of Asterisk will include it and won't require the user to wait while it is extracted after unpacking. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@93184 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'Makefile.moddir_rules')
-rw-r--r--Makefile.moddir_rules62
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