aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile.moddir_rules
diff options
context:
space:
mode:
authorrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2007-12-10 03:50:38 +0000
committerrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2007-12-10 03:50:38 +0000
commitaa855407636dfbcb68119ac54a669ee083fd109b (patch)
tree954493fb03243d28b94bb410a7a10144d245bfe0 /Makefile.moddir_rules
parent8cc18059de1c6d1f4768528b316394bad8b3de4d (diff)
Put into Makefile.moddir_rules the common instructions used to
generate loadable and embedded module lists. Individual Makefiles now are a lot simpler, possibly as simple as this: -include $(ASTTOPDIR)/menuselect.makeopts $(ASTTOPDIR)/menuselect.makedeps MODULE_PREFIX=cdr_ all: _all include $(ASTTOPDIR)/Makefile.moddir_rules and also more flexible because in a single directory we can combine various types of modules (app_, cdr_, func_, ... ) by simply listing them in the MODULE_PREFIX variable. The individual Makefiles can also create list of modules to be excluded by listing them in the variablel MODULE_EXCLUDE (see an example in channels/Makefile). With this change it becomes trivial to integrate a directory with locally created/modified sources into the main build. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@92082 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'Makefile.moddir_rules')
-rw-r--r--Makefile.moddir_rules35
1 files changed, 35 insertions, 0 deletions
diff --git a/Makefile.moddir_rules b/Makefile.moddir_rules
index 8db597cb4..20fcde38a 100644
--- a/Makefile.moddir_rules
+++ b/Makefile.moddir_rules
@@ -34,6 +34,41 @@ endif
include $(ASTTOPDIR)/Makefile.rules
+# If MODULE_PREFIX is defined, use it to run the standard functions to set
+# C_MODS, CC_MODS, LOADABLE_MODS and EMBEDDED_MODS.
+# Each word of MODULE_PREFIX is a prefix for filenames that we consider
+# valid C or CC modules (eg. app_, func_ ...).
+# 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))))
+
+ # and store in the list of embedded or loadable modules
+ ifneq ($(findstring $(A),$(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
# (they are stored in file 'makeopts')