From 239cdb53f4e994c8fd4afe1233e69b93ad632230 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 24 Mar 2010 16:23:10 -0600 Subject: build: support variable expansion in source= arguments to build rules This makes it much easier to follow the s3 approach to lists of source files in the top level wscript Pair-Programmed-With: Kai Blin --- buildtools/wafsamba/wafsamba.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'buildtools/wafsamba/wafsamba.py') diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py index 9e7c39581b..ad104a2e89 100644 --- a/buildtools/wafsamba/wafsamba.py +++ b/buildtools/wafsamba/wafsamba.py @@ -66,6 +66,7 @@ def SAMBA_LIBRARY(bld, libname, source, group='main', depends_on='', local_include=True, + vars=None, install_path=None, install=True, enabled=True): @@ -74,6 +75,8 @@ def SAMBA_LIBRARY(bld, libname, source, SET_TARGET_TYPE(bld, libname, 'DISABLED') return + source = bld.EXPAND_VARIABLES(source, vars=vars) + # remember empty libraries, so we can strip the dependencies if (source == '') or (source == []): SET_TARGET_TYPE(bld, libname, 'EMPTY') @@ -193,6 +196,7 @@ def SAMBA_BINARY(bld, binname, source, local_include=True, subsystem_name=None, needs_python=False, + vars=None, install=True, install_path=None): @@ -207,6 +211,8 @@ def SAMBA_BINARY(bld, binname, source, obj_target = binname + '.objlist' + source = bld.EXPAND_VARIABLES(source, vars=vars) + # first create a target for building the object files for this binary # by separating in this way, we avoid recompiling the C files # separately for the install binary and the build binary @@ -299,6 +305,7 @@ def SAMBA_MODULE(bld, modname, source, cflags='', internal_module=True, local_include=True, + vars=None, enabled=True): # we add the init function regardless of whether the module @@ -322,6 +329,8 @@ def SAMBA_MODULE(bld, modname, source, SET_TARGET_TYPE(bld, modname, 'DISABLED') return + source = bld.EXPAND_VARIABLES(source, vars=vars) + # remember empty modules, so we can strip the dependencies if (source == '') or (source == []): SET_TARGET_TYPE(bld, modname, 'EMPTY') @@ -371,6 +380,7 @@ def SAMBA_SUBSYSTEM(bld, modname, source, local_include_first=True, subsystem_name=None, enabled=True, + vars=None, needs_python=False): if not enabled: @@ -385,6 +395,8 @@ def SAMBA_SUBSYSTEM(bld, modname, source, if not SET_TARGET_TYPE(bld, modname, 'SUBSYSTEM'): return + source = bld.EXPAND_VARIABLES(source, vars=vars) + deps += ' ' + public_deps bld.SET_BUILD_GROUP(group) @@ -421,7 +433,8 @@ Build.BuildContext.SAMBA_SUBSYSTEM = SAMBA_SUBSYSTEM def SAMBA_GENERATOR(bld, name, rule, source, target, - group='build_source', enabled=True): + group='build_source', enabled=True, + vars=None): '''A generic source generator target''' if not SET_TARGET_TYPE(bld, name, 'GENERATOR'): @@ -433,7 +446,7 @@ def SAMBA_GENERATOR(bld, name, rule, source, target, bld.SET_BUILD_GROUP(group) bld( rule=rule, - source=source, + source=bld.EXPAND_VARIABLES(source, vars=vars), target=target, shell=True, on_results=True, -- cgit