[asterisk-commits] rizzo: trunk r92082 - in /trunk: ./ apps/ cdr/ channels/ codecs/ formats/ fun...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Dec 9 21:50:39 CST 2007


Author: rizzo
Date: Sun Dec  9 21:50:38 2007
New Revision: 92082

URL: http://svn.digium.com/view/asterisk?view=rev&rev=92082
Log:
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.



Modified:
    trunk/Makefile.moddir_rules
    trunk/apps/Makefile
    trunk/cdr/Makefile
    trunk/channels/Makefile
    trunk/codecs/Makefile
    trunk/formats/Makefile
    trunk/funcs/Makefile
    trunk/pbx/Makefile
    trunk/res/Makefile

Modified: trunk/Makefile.moddir_rules
URL: http://svn.digium.com/view/asterisk/trunk/Makefile.moddir_rules?view=diff&rev=92082&r1=92081&r2=92082
==============================================================================
--- trunk/Makefile.moddir_rules (original)
+++ trunk/Makefile.moddir_rules Sun Dec  9 21:50:38 2007
@@ -33,6 +33,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

Modified: trunk/apps/Makefile
URL: http://svn.digium.com/view/asterisk/trunk/apps/Makefile?view=diff&rev=92082&r1=92081&r2=92082
==============================================================================
--- trunk/apps/Makefile (original)
+++ trunk/apps/Makefile Sun Dec  9 21:50:38 2007
@@ -11,16 +11,10 @@
 
 -include $(ASTTOPDIR)/menuselect.makeopts $(ASTTOPDIR)/menuselect.makedeps
 
-C_MODS:=$(filter-out $(MENUSELECT_APPS),$(patsubst %.c,%,$(wildcard app_*.c)))
-CC_MODS:=$(filter-out $(MENUSELECT_APPS),$(patsubst %.cc,%,$(wildcard app_*.cc)))
+#interesting files in this directory start with app_
+MODULE_PREFIX=app_
 
-LOADABLE_MODS:=$(C_MODS) $(CC_MODS)
-
-ifneq ($(findstring apps,$(MENUSELECT_EMBED)),)
-  EMBEDDED_MODS:=$(LOADABLE_MODS)
-  LOADABLE_MODS:=
-endif
-
+# create extra MENUSELECT_DEPENDS entries.
 MENUSELECT_OPTS_app_directory:=$(MENUSELECT_OPTS_app_voicemail)
 ifneq ($(findstring ODBC_STORAGE,$(MENUSELECT_OPTS_app_voicemail)),)
   MENUSELECT_DEPENDS_app_voicemail+=$(MENUSELECT_DEPENDS_ODBC_STORAGE)

Modified: trunk/cdr/Makefile
URL: http://svn.digium.com/view/asterisk/trunk/cdr/Makefile?view=diff&rev=92082&r1=92081&r2=92082
==============================================================================
--- trunk/cdr/Makefile (original)
+++ trunk/cdr/Makefile Sun Dec  9 21:50:38 2007
@@ -11,15 +11,7 @@
 
 -include $(ASTTOPDIR)/menuselect.makeopts $(ASTTOPDIR)/menuselect.makedeps
 
-C_MODS:=$(filter-out $(MENUSELECT_CDR),$(patsubst %.c,%,$(wildcard cdr_*.c)))
-CC_MODS:=$(filter-out $(MENUSELECT_CDR),$(patsubst %.cc,%,$(wildcard cdr_*.cc)))
-
-LOADABLE_MODS:=$(C_MODS) $(CC_MODS)
-
-ifneq ($(findstring cdr,$(MENUSELECT_EMBED)),)
-  EMBEDDED_MODS:=$(LOADABLE_MODS)
-  LOADABLE_MODS:=
-endif
+MODULE_PREFIX=cdr_
 
 all: _all
 

Modified: trunk/channels/Makefile
URL: http://svn.digium.com/view/asterisk/trunk/channels/Makefile?view=diff&rev=92082&r1=92081&r2=92082
==============================================================================
--- trunk/channels/Makefile (original)
+++ trunk/channels/Makefile Sun Dec  9 21:50:38 2007
@@ -11,8 +11,7 @@
 
 -include $(ASTTOPDIR)/menuselect.makeopts $(ASTTOPDIR)/menuselect.makedeps
 
-C_MODS:=$(filter-out $(MENUSELECT_CHANNELS),$(patsubst %.c,%,$(wildcard chan_*.c)))
-CC_MODS:=$(filter-out $(MENUSELECT_CHANNELS),$(patsubst %.cc,%,$(wildcard chan_*.cc)))
+MODULE_PREFIX=chan_
 
 ifeq ($(OSARCH),OpenBSD)
   PTLIB=-lpt_OpenBSD_x86_r
@@ -36,13 +35,13 @@
   H323LIB=-lh323_NetBSD_x86_r
 endif
 
+MODULE_EXCLUDE:=
 ifneq ($(findstring $(OSARCH), mingw32 cygwin ),)
-  C_MODS:=$(filter-out chan_oss,$(C_MODS))
-  C_MODS:=$(filter-out chan_unistim,$(C_MODS))
+  MODULE_EXCLUDE+= chan_oss chan_unistim
 endif
 
 ifeq ($(wildcard h323/libchanh323.a),)
-  CC_MODS:=$(filter-out chan_h323,$(CC_MODS))
+  MODULE_EXCLUDE += chan_h323
 endif
 
 ifndef OPENH323DIR
@@ -51,13 +50,6 @@
 
 ifndef PWLIBDIR
   PWLIBDIR=$(HOME)/pwlib
-endif
-
-LOADABLE_MODS:=$(C_MODS) $(CC_MODS)
-
-ifneq ($(findstring channels,$(MENUSELECT_EMBED)),)
-  EMBEDDED_MODS:=$(LOADABLE_MODS)
-  LOADABLE_MODS:=
 endif
 
 all: _all

Modified: trunk/codecs/Makefile
URL: http://svn.digium.com/view/asterisk/trunk/codecs/Makefile?view=diff&rev=92082&r1=92081&r2=92082
==============================================================================
--- trunk/codecs/Makefile (original)
+++ trunk/codecs/Makefile Sun Dec  9 21:50:38 2007
@@ -13,15 +13,7 @@
 
 -include $(ASTTOPDIR)/menuselect.makeopts $(ASTTOPDIR)/menuselect.makedeps
 
-C_MODS:=$(filter-out $(MENUSELECT_CODECS),$(patsubst %.c,%,$(wildcard codec_*.c)))
-CC_MODS:=$(filter-out $(MENUSELECT_CODECS),$(patsubst %.cc,%,$(wildcard codec_*.cc)))
-
-LOADABLE_MODS:=$(C_MODS) $(CC_MODS)
-
-ifneq ($(findstring codecs,$(MENUSELECT_EMBED)),)
-  EMBEDDED_MODS:=$(LOADABLE_MODS)
-  LOADABLE_MODS:=
-endif
+MODULE_PREFIX=codec_
 
 LIBILBC:=ilbc/libilbc.a
 LIBLPC10:=lpc10/liblpc10.a

Modified: trunk/formats/Makefile
URL: http://svn.digium.com/view/asterisk/trunk/formats/Makefile?view=diff&rev=92082&r1=92081&r2=92082
==============================================================================
--- trunk/formats/Makefile (original)
+++ trunk/formats/Makefile Sun Dec  9 21:50:38 2007
@@ -11,15 +11,7 @@
 
 -include $(ASTTOPDIR)/menuselect.makeopts $(ASTTOPDIR)/menuselect.makedeps
 
-C_MODS:=$(filter-out $(MENUSELECT_FORMATS),$(patsubst %.c,%,$(wildcard format_*.c)))
-CC_MODS:=$(filter-out $(MENUSELECT_FORMATS),$(patsubst %.cc,%,$(wildcard format_*.cc)))
-
-LOADABLE_MODS:=$(C_MODS) $(CC_MODS)
-
-ifneq ($(findstring formats,$(MENUSELECT_EMBED)),)
-  EMBEDDED_MODS:=$(LOADABLE_MODS)
-  LOADABLE_MODS:=
-endif
+MODULE_PREFIX=format_
 
 all: _all
 

Modified: trunk/funcs/Makefile
URL: http://svn.digium.com/view/asterisk/trunk/funcs/Makefile?view=diff&rev=92082&r1=92081&r2=92082
==============================================================================
--- trunk/funcs/Makefile (original)
+++ trunk/funcs/Makefile Sun Dec  9 21:50:38 2007
@@ -11,15 +11,7 @@
 
 -include $(ASTTOPDIR)/menuselect.makeopts $(ASTTOPDIR)/menuselect.makedeps
 
-C_MODS:=$(filter-out $(MENUSELECT_FUNCS),$(patsubst %.c,%,$(wildcard func_*.c)))
-CC_MODS:=$(filter-out $(MENUSELECT_FUNCS),$(patsubst %.cc,%,$(wildcard func_*.cc)))
-
-LOADABLE_MODS:=$(C_MODS) $(CC_MODS)
-
-ifneq ($(findstring funcs,$(MENUSELECT_EMBED)),)
-  EMBEDDED_MODS:=$(LOADABLE_MODS)
-  LOADABLE_MODS:=
-endif
+MODULE_PREFIX=func_
 
 all: _all
 

Modified: trunk/pbx/Makefile
URL: http://svn.digium.com/view/asterisk/trunk/pbx/Makefile?view=diff&rev=92082&r1=92081&r2=92082
==============================================================================
--- trunk/pbx/Makefile (original)
+++ trunk/pbx/Makefile Sun Dec  9 21:50:38 2007
@@ -11,15 +11,7 @@
 
 -include $(ASTTOPDIR)/menuselect.makeopts $(ASTTOPDIR)/menuselect.makedeps
 
-C_MODS:=$(filter-out $(MENUSELECT_PBX),$(patsubst %.c,%,$(wildcard pbx_*.c)))
-CC_MODS:=$(filter-out $(MENUSELECT_PBX),$(patsubst %.cc,%,$(wildcard pbx_*.cc)))
-
-LOADABLE_MODS:=$(C_MODS) $(CC_MODS)
-
-ifneq ($(findstring pbx,$(MENUSELECT_EMBED)),)
-  EMBEDDED_MODS:=$(LOADABLE_MODS)
-  LOADABLE_MODS:=
-endif
+MODULE_PREFIX=pbx_
 
 all: _all
 

Modified: trunk/res/Makefile
URL: http://svn.digium.com/view/asterisk/trunk/res/Makefile?view=diff&rev=92082&r1=92081&r2=92082
==============================================================================
--- trunk/res/Makefile (original)
+++ trunk/res/Makefile Sun Dec  9 21:50:38 2007
@@ -11,15 +11,7 @@
 
 -include $(ASTTOPDIR)/menuselect.makeopts $(ASTTOPDIR)/menuselect.makedeps
 
-C_MODS:=$(filter-out $(MENUSELECT_RES),$(patsubst %.c,%,$(wildcard res_*.c)))
-CC_MODS:=$(filter-out $(MENUSELECT_RES),$(patsubst %.cc,%,$(wildcard res_*.cc)))
-
-LOADABLE_MODS:=$(C_MODS) $(CC_MODS)
-
-ifneq ($(findstring res,$(MENUSELECT_EMBED)),)
-  EMBEDDED_MODS:=$(LOADABLE_MODS)
-  LOADABLE_MODS:=
-endif
+MODULE_PREFIX=res_
 
 all: _all
 




More information about the asterisk-commits mailing list