path: root/Makefile.moddir_rules
diff options
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2007-12-17 06:44:51 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2007-12-17 06:44:51 +0000
commit12db9f992343a130ed8436689a0d2b9daf47ebc6 (patch)
tree3c0af506fe3ada2a6e90a348490026520059d45f /Makefile.moddir_rules
parentf5f21806cd5684b9efbe562a86575bb9a314f527 (diff)
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: http://svn.digium.com/svn/asterisk/branches/1.4@93180 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'Makefile.moddir_rules')
1 files changed, 35 insertions, 1 deletions
diff --git a/Makefile.moddir_rules b/Makefile.moddir_rules
index a493e4733..f73bc83e9 100644
--- a/Makefile.moddir_rules
+++ b/Makefile.moddir_rules
@@ -42,7 +42,7 @@ $(addsuffix .so,$(filter $(LOADABLE_MODS),$(CC_MODS))): %.so: %.oo
modules.link: $(addsuffix .o,$(filter $(EMBEDDED_MODS),$(C_MODS)))
modules.link: $(addsuffix .oo,$(filter $(EMBEDDED_MODS),$(CC_MODS)))
-.PHONY: clean uninstall _all
+.PHONY: clean uninstall _all moduleinfo makeopts
ifneq ($(LOADABLE_MODS),)
_all: $(LOADABLE_MODS:%=%.so)
@@ -79,6 +79,40 @@ install:: all
+ 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