diff options
author | Steven Knight <knight@baldmt.com> | 2005-01-10 13:45:00 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2005-01-10 13:45:00 (GMT) |
commit | 519037f42eb7c90c5fb1f7d2e2b41ccee5fdba86 (patch) | |
tree | 44bc33674ae55485c128e0a59a050cbda7a52973 /src/engine/SCons | |
parent | 69e3c442cdfb846cbcba7702d500e237b66be71e (diff) | |
download | SCons-519037f42eb7c90c5fb1f7d2e2b41ccee5fdba86.zip SCons-519037f42eb7c90c5fb1f7d2e2b41ccee5fdba86.tar.gz SCons-519037f42eb7c90c5fb1f7d2e2b41ccee5fdba86.tar.bz2 |
Eliminate Executor's creation and use of a build_dict and a subst_dict, which were creating a separate OverrideEnvironment for every target and foiling the Memoizer's attempts at speeding up things.
Diffstat (limited to 'src/engine/SCons')
23 files changed, 125 insertions, 93 deletions
diff --git a/src/engine/SCons/Defaults.py b/src/engine/SCons/Defaults.py index 644dadf..26e2236 100644 --- a/src/engine/SCons/Defaults.py +++ b/src/engine/SCons/Defaults.py @@ -43,6 +43,7 @@ import stat import string import time import types +import sys import SCons.Action import SCons.Builder @@ -161,17 +162,6 @@ ActionFactory = SCons.Action.ActionFactory Chmod = ActionFactory(os.chmod, lambda dest, mode: 'Chmod("%s", 0%o)' % (dest, mode)) -def Copy(dest, src): - def _copy_func(target, source, env, dest=dest, src=src): - dest = str(env.arg2nodes(dest, env.fs.Entry)[0]) - src = str(env.arg2nodes(src, env.fs.Entry)[0]) - shutil.copytree(src, dest, 1) - def _copy_str(target, source, env, dest=dest, src=src): - dest = str(env.arg2nodes(dest, env.fs.Entry)[0]) - src = str(env.arg2nodes(src, env.fs.Entry)[0]) - return 'Copy("%s", "%s")' % (dest, src) - return SCons.Action.Action(_copy_func, strfunction=_copy_str) - def copy_func(dest, src): if os.path.isfile(src): return shutil.copy(src, dest) @@ -221,7 +211,7 @@ def copyFunc(dest, source, env): os.chmod(dest, stat.S_IMODE(st[stat.ST_MODE]) | stat.S_IWRITE) return 0 -def _concat(prefix, list, suffix, env, f=lambda x: x): +def _concat(prefix, list, suffix, env, f=lambda x: x, target=None): """Creates a new list from 'list' by first interpolating each element in the list using the 'env' dictionary and then calling f on the list, and finally concatenating 'prefix' and 'suffix' onto @@ -234,7 +224,7 @@ def _concat(prefix, list, suffix, env, f=lambda x: x): if SCons.Util.is_List(list): list = SCons.Util.flatten(list) - list = f(env.subst_path(list)) + list = f(env.subst_path(list, target=target)) result = [] @@ -341,24 +331,57 @@ class NullCmdGenerator: def __call__(self, target, source, env, for_signature=None): return self.cmd +class Variable_Method_Caller: + """A class for finding a construction variable on the stack and + calling one of its methods. + + We use this to support "construction variables" in our string + eval()s that actually stand in for methods--specifically, use + of "RDirs" in call to _concat that should actually execute the + "TARGET.RDirs" method. (We used to support this by creating a little + "build dictionary" that mapped RDirs to the method, but this got in + the way of Memoizing construction environments, because we had to + create new environment objects to hold the variables.) + """ + def __init__(self, variable, method): + self.variable = variable + self.method = method + def __call__(self, *args, **kw): + try: 1/0 + except ZeroDivisionError: frame = sys.exc_info()[2].tb_frame + variable = None + while frame: + try: + variable = frame.f_locals[self.variable] + except KeyError: + pass + frame = frame.f_back + if variable is None: + return None + method = getattr(variable, self.method) + return apply(method, args, kw) + ConstructionEnvironment = { - 'BUILDERS' : {}, - 'SCANNERS' : [], - 'CPPSUFFIXES': CSuffixes, - 'DSUFFIXES' : DSuffixes, - 'IDLSUFFIXES': IDLSuffixes, - 'PDFPREFIX' : '', - 'PDFSUFFIX' : '.pdf', - 'PSPREFIX' : '', - 'PSSUFFIX' : '.ps', - 'ENV' : {}, - 'INSTALL' : copyFunc, - '_concat' : _concat, - '_defines' : _defines, - '_stripixes' : _stripixes, - '_LIBFLAGS' : '${_concat(LIBLINKPREFIX, LIBS, LIBLINKSUFFIX, __env__)}', - '_LIBDIRFLAGS' : '$( ${_concat(LIBDIRPREFIX, LIBPATH, LIBDIRSUFFIX, __env__, RDirs)} $)', - '_CPPINCFLAGS' : '$( ${_concat(INCPREFIX, CPPPATH, INCSUFFIX, __env__, RDirs)} $)', - '_CPPDEFFLAGS' : '${_defines(CPPDEFPREFIX, CPPDEFINES, CPPDEFSUFFIX, __env__)}', - 'TEMPFILE' : NullCmdGenerator - } + 'BUILDERS' : {}, + 'SCANNERS' : [], + 'CPPSUFFIXES' : CSuffixes, + 'DSUFFIXES' : DSuffixes, + 'IDLSUFFIXES' : IDLSuffixes, + 'PDFPREFIX' : '', + 'PDFSUFFIX' : '.pdf', + 'PSPREFIX' : '', + 'PSSUFFIX' : '.ps', + 'ENV' : {}, + 'INSTALL' : copyFunc, + '_concat' : _concat, + '_defines' : _defines, + '_stripixes' : _stripixes, + '_LIBFLAGS' : '${_concat(LIBLINKPREFIX, LIBS, LIBLINKSUFFIX, __env__)}', + '_LIBDIRFLAGS' : '$( ${_concat(LIBDIRPREFIX, LIBPATH, LIBDIRSUFFIX, __env__, RDirs, TARGET)} $)', + '_CPPINCFLAGS' : '$( ${_concat(INCPREFIX, CPPPATH, INCSUFFIX, __env__, RDirs, TARGET)} $)', + '_CPPDEFFLAGS' : '${_defines(CPPDEFPREFIX, CPPDEFINES, CPPDEFSUFFIX, __env__)}', + 'TEMPFILE' : NullCmdGenerator, + 'Dir' : Variable_Method_Caller('TARGET', 'Dir'), + 'File' : Variable_Method_Caller('TARGET', 'File'), + 'RDirs' : Variable_Method_Caller('TARGET', 'RDirs'), +} diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index fbc8454..c2d2e92 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -372,7 +372,7 @@ class SubstitutionEnvironment: lvars['__env__'] = self return SCons.Util.scons_subst_list(string, self, raw, target, source, gvars, lvars, conv) - def subst_path(self, path): + def subst_path(self, path, target=None): """Substitute a path list, turning EntryProxies into Nodes and leaving Nodes (and other objects) as-is.""" @@ -397,7 +397,7 @@ class SubstitutionEnvironment: r = [] for p in path: if SCons.Util.is_String(p): - p = self.subst(p, conv=s) + p = self.subst(p, target=target, conv=s) if SCons.Util.is_List(p): if len(p) == 1: p = p[0] diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py index ad5a9b2..44dc814 100644 --- a/src/engine/SCons/EnvironmentTests.py +++ b/src/engine/SCons/EnvironmentTests.py @@ -484,6 +484,14 @@ class SubstitutionTestCase(unittest.TestCase): def get(self): return self.val + '-proxy' + class MyNode: + def __init__(self, val): + self.val = val + def get_subst_proxy(self): + return self + def __str__(self): + return self.val + class MyObj: pass @@ -495,6 +503,12 @@ class SubstitutionTestCase(unittest.TestCase): r = env.subst_path(['$FOO', 'xxx', '$BAR']) assert r == ['foo', 'xxx', 'bar'], r + r = env.subst_path(['$FOO', '$TARGET', '$BAR']) + assert r == ['foo', '', 'bar'], r + + r = env.subst_path(['$FOO', '$TARGET', '$BAR'], target=MyNode('yyy')) + assert map(str, r) == ['foo', 'yyy', 'bar'], r + n = MyObj() r = env.subst_path(['$PROXY', MyProxy('my2'), n]) diff --git a/src/engine/SCons/Executor.py b/src/engine/SCons/Executor.py index 2a19171..7bc847a 100644 --- a/src/engine/SCons/Executor.py +++ b/src/engine/SCons/Executor.py @@ -70,27 +70,11 @@ class Executor: overrides = {} for odict in self.overridelist: overrides.update(odict) - try: - generate_build_dict = self.targets[0].generate_build_dict - except (AttributeError, IndexError): - pass - else: - overrides.update(generate_build_dict()) import SCons.Defaults env = self.env or SCons.Defaults.DefaultEnvironment() build_env = env.Override(overrides) - # Update the overrides with the $TARGET/$SOURCE variables for - # this target+source pair, so that evaluations of arbitrary - # Python functions have them in the __env__ environment - # they're passed. Note that the underlying substitution - # functions also override these with their own $TARGET/$SOURCE - # expansions, which is *usually* duplicated effort, but covers - # a corner case where an Action is called directly from within - # a function action with different target and source lists. - build_env._update(SCons.Util.subst_dict(self.targets, self.sources)) - return build_env def do_nothing(self, target, errfunc, kw): diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index 1f2b0a8..50e3818 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -1397,13 +1397,6 @@ class File(Base): return self.fs.Rsearchall(pathlist, clazz=Dir, must_exist=0, cwd=self.cwd) - def generate_build_dict(self): - """Return an appropriate dictionary of values for building - this File.""" - return {'Dir' : self.Dir, - 'File' : self.File, - 'RDirs' : self.RDirs} - def _morph(self): """Turn a file system node into a File object. __cache_reset__""" self.scanner_paths = {} @@ -1480,10 +1473,10 @@ class File(Base): try: path = self.scanner_paths[scanner] except KeyError: - path = scanner.path(env, self.cwd) + path = scanner.path(env, self.cwd, target) self.scanner_paths[scanner] = path except KeyError: - path = scanner.path(env, target.cwd) + path = scanner.path(env, target.cwd, target) target.scanner_paths[scanner] = path return scanner(self, env, path) diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py index e71093f..e65c10b 100644 --- a/src/engine/SCons/Node/FSTests.py +++ b/src/engine/SCons/Node/FSTests.py @@ -54,7 +54,7 @@ class Scanner: scanner_count = scanner_count + 1 self.hash = scanner_count self.node = node - def path(self, env, target): + def path(self, env, dir, target=None): return () def __call__(self, node, env, path): return [self.node] diff --git a/src/engine/SCons/Node/NodeTests.py b/src/engine/SCons/Node/NodeTests.py index ee0e82b..3e5a9f0 100644 --- a/src/engine/SCons/Node/NodeTests.py +++ b/src/engine/SCons/Node/NodeTests.py @@ -1128,12 +1128,6 @@ class NodeTestCase(unittest.TestCase): s = n.get_suffix() assert s == '', s - def test_generate_build_dict(self): - """Test the base Node generate_build_dict() method""" - n = SCons.Node.Node() - dict = n.generate_build_dict() - assert dict == {}, dict - def test_postprocess(self): """Test calling the base Node postprocess() method""" n = SCons.Node.Node() diff --git a/src/engine/SCons/Node/__init__.py b/src/engine/SCons/Node/__init__.py index 7b443ab..7ffec0e 100644 --- a/src/engine/SCons/Node/__init__.py +++ b/src/engine/SCons/Node/__init__.py @@ -143,11 +143,6 @@ class Node: def get_suffix(self): return '' - def generate_build_dict(self): - """Return an appropriate dictionary of values for building - this Node.""" - return {} - def get_build_env(self): """Fetch the appropriate Environment to build this node. __cacheable__""" diff --git a/src/engine/SCons/Scanner/CTests.py b/src/engine/SCons/Scanner/CTests.py index 5296f93..e3caa5f 100644 --- a/src/engine/SCons/Scanner/CTests.py +++ b/src/engine/SCons/Scanner/CTests.py @@ -188,7 +188,7 @@ class DummyEnvironment(UserDict.UserDict): return [self.data[strSubst[1:]]] return [[strSubst]] - def subst_path(self, path): + def subst_path(self, path, target=None): if type(path) != type([]): path = [path] return map(self.subst, path) diff --git a/src/engine/SCons/Scanner/FortranTests.py b/src/engine/SCons/Scanner/FortranTests.py index ebf7b56..75264ac 100644 --- a/src/engine/SCons/Scanner/FortranTests.py +++ b/src/engine/SCons/Scanner/FortranTests.py @@ -236,7 +236,7 @@ class DummyEnvironment: return self[arg[1:]] return arg - def subst_path(self, path): + def subst_path(self, path, target=None): if type(path) != type([]): path = [path] return map(self.subst, path) diff --git a/src/engine/SCons/Scanner/IDLTests.py b/src/engine/SCons/Scanner/IDLTests.py index f8683b0..31a40ea 100644 --- a/src/engine/SCons/Scanner/IDLTests.py +++ b/src/engine/SCons/Scanner/IDLTests.py @@ -201,7 +201,7 @@ class DummyEnvironment: def subst(self, arg): return arg - def subst_path(self, path): + def subst_path(self, path, target=None): if type(path) != type([]): path = [path] return map(self.subst, path) diff --git a/src/engine/SCons/Scanner/ProgTests.py b/src/engine/SCons/Scanner/ProgTests.py index 7ab88f9..7e33866 100644 --- a/src/engine/SCons/Scanner/ProgTests.py +++ b/src/engine/SCons/Scanner/ProgTests.py @@ -78,7 +78,7 @@ class DummyEnvironment: return '' return s - def subst_path(self, path): + def subst_path(self, path, target=None): if type(path) != type([]): path = [path] return map(self.subst, path) diff --git a/src/engine/SCons/Scanner/ScannerTests.py b/src/engine/SCons/Scanner/ScannerTests.py index e418c17..493a330 100644 --- a/src/engine/SCons/Scanner/ScannerTests.py +++ b/src/engine/SCons/Scanner/ScannerTests.py @@ -42,7 +42,7 @@ class DummyEnvironment(UserDict.UserDict): if strSubst[0] == '$': return [self.data[strSubst[1:]]] return [[strSubst]] - def subst_path(self, path): + def subst_path(self, path, target=None): if type(path) != type([]): path = [path] return map(self.subst, path) diff --git a/src/engine/SCons/Scanner/__init__.py b/src/engine/SCons/Scanner/__init__.py index 1968a9e..1322fff 100644 --- a/src/engine/SCons/Scanner/__init__.py +++ b/src/engine/SCons/Scanner/__init__.py @@ -71,14 +71,15 @@ class FindPathDirs: def __init__(self, variable, fs): self.variable = variable self.fs = fs - def __call__(self, env, dir, argument=None): + def __call__(self, env, dir, target=None, argument=None): "__cacheable__" try: path = env[self.variable] except KeyError: return () - path_tuple = tuple(self.fs.Rsearchall(env.subst_path(path), + path = env.subst_path(path, target=target) + path_tuple = tuple(self.fs.Rsearchall(path, must_exist = 0, #kwq! clazz = SCons.Node.FS.Dir, cwd = dir)) @@ -188,14 +189,14 @@ class Base: self.scan_check = scan_check self.recursive = recursive - def path(self, env, dir = None): + def path(self, env, dir=None, target=None): "__cacheable__" if not self.path_function: return () if not self.argument is _null: - return self.path_function(env, dir, self.argument) + return self.path_function(env, dir, target, self.argument) else: - return self.path_function(env, dir) + return self.path_function(env, dir, target) def __call__(self, node, env, path = ()): """ diff --git a/src/engine/SCons/Script/SConscript.py b/src/engine/SCons/Script/SConscript.py index e30a979..2e8c916 100644 --- a/src/engine/SCons/Script/SConscript.py +++ b/src/engine/SCons/Script/SConscript.py @@ -522,11 +522,15 @@ class DefaultEnvironmentCall: thereby prevent expansion of construction variables (since from the user's point of view this was called as a global function, with no associated construction environment).""" - def __init__(self, method_name): + def __init__(self, method_name, subst=0): self.method_name = method_name + if subst: + self.factory = SCons.Defaults.DefaultEnvironment + else: + self.factory = get_DefaultEnvironmentProxy def __call__(self, *args, **kw): - proxy = get_DefaultEnvironmentProxy() - method = getattr(proxy, self.method_name) + env = self.factory() + method = getattr(env, self.method_name) return apply(method, args, kw) diff --git a/src/engine/SCons/Script/__init__.py b/src/engine/SCons/Script/__init__.py index d6d4912..d94fee2 100644 --- a/src/engine/SCons/Script/__init__.py +++ b/src/engine/SCons/Script/__init__.py @@ -191,7 +191,7 @@ GlobalDefaultEnvironmentFunctions = [ 'BuildDir', 'CacheDir', 'Clean', - 'Command', + #The Command() method is handled separately, below. 'Depends', 'Dir', 'Execute', @@ -245,3 +245,21 @@ GlobalDefaultBuilders = [ for name in GlobalDefaultEnvironmentFunctions + GlobalDefaultBuilders: exec "%s = _SConscript.DefaultEnvironmentCall(%s)" % (name, repr(name)) + +# The global Command() function must be handled differently than the +# global functions for other construction environment methods because +# we want people to be able to use Actions that must expand $TARGET +# and $SOURCE later, when (and if) the Action is invoked to build +# the target(s). We do this with the subst=1 argument, which creates +# a DefaultEnvironmentCall instance that wraps up a normal default +# construction environment that performs variable substitution, not a +# proxy that doesn't. +# +# There's a flaw here, though, because any other $-variables on a command +# line will *also* be expanded, each to a null string, but that should +# only be a problem in the unusual case where someone was passing a '$' +# on a command line and *expected* the $ to get through to the shell +# because they were calling Command() and not env.Command()... This is +# unlikely enough that we're going to leave this as is and cross that +# bridge if someone actually comes to it. +Command = _SConscript.DefaultEnvironmentCall('Command', subst=1) diff --git a/src/engine/SCons/Tool/dmd.py b/src/engine/SCons/Tool/dmd.py index 914129c..13f58a1 100644 --- a/src/engine/SCons/Tool/dmd.py +++ b/src/engine/SCons/Tool/dmd.py @@ -95,7 +95,7 @@ def generate(env): env['DC'] = 'dmd' env['DCOM'] = '$DC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -c -of$TARGET $SOURCES' - env['_DINCFLAGS'] = '$( ${_concat(DINCPREFIX, DPATH, DINCSUFFIX, __env__, RDirs)} $)' + env['_DINCFLAGS'] = '$( ${_concat(DINCPREFIX, DPATH, DINCSUFFIX, __env__, RDirs, TARGET)} $)' env['_DVERFLAGS'] = '$( ${_concat(DVERPREFIX, DVERSIONS, DVERSUFFIX, __env__)} $)' env['_DDEBUGFLAGS'] = '$( ${_concat(DDEBUGPREFIX, DDEBUG, DDEBUGSUFFIX, __env__)} $)' env['_DFLAGS'] = '$( ${_concat(DFLAGPREFIX, DFLAGS, DFLAGSUFFIX, __env__)} $)' @@ -132,7 +132,7 @@ def generate(env): env['DLIB'] = 'lib' env['DLIBCOM'] = '$DLIB $_DLIBFLAGS -c $TARGET $SOURCES $_DLINKLIBFLAGS' - env['_DLINKLIBFLAGS'] = '$( ${_concat(DLIBLINKPREFIX, LIBS, DLIBLINKSUFFIX, __env__, RDirs)} $)' + env['_DLINKLIBFLAGS'] = '$( ${_concat(DLIBLINKPREFIX, LIBS, DLIBLINKSUFFIX, __env__, RDirs, TARGET)} $)' env['_DLIBFLAGS'] = '$( ${_concat(DLIBFLAGPREFIX, DLIBFLAGS, DLIBFLAGSUFFIX, __env__)} $)' env['DLINKFLAGS'] = [] env['DLIBLINKPREFIX'] = '' diff --git a/src/engine/SCons/Tool/f77.py b/src/engine/SCons/Tool/f77.py index 87c8c9a..5650e97 100644 --- a/src/engine/SCons/Tool/f77.py +++ b/src/engine/SCons/Tool/f77.py @@ -111,7 +111,7 @@ def add_to_env(env): env['_SHF77COMSTRG'] = ShF77CommandStrGenerator env['_SHF77PPCOMSTRG'] = ShF77PPCommandStrGenerator - env['_F77INCFLAGS'] = '$( ${_concat(INCPREFIX, F77PATH, INCSUFFIX, __env__, RDirs)} $)' + env['_F77INCFLAGS'] = '$( ${_concat(INCPREFIX, F77PATH, INCSUFFIX, __env__, RDirs, TARGET)} $)' env['_F77COMD'] = '$_F77G $_F77FLAGSG $_F77INCFLAGS -c -o $TARGET $SOURCES' env['_F77PPCOMD'] = '$_F77G $_F77FLAGSG $CPPFLAGS $_CPPDEFFLAGS $_F77INCFLAGS -c -o $TARGET $SOURCES' diff --git a/src/engine/SCons/Tool/f90.py b/src/engine/SCons/Tool/f90.py index 272f40e..9c3b0a3 100644 --- a/src/engine/SCons/Tool/f90.py +++ b/src/engine/SCons/Tool/f90.py @@ -111,7 +111,7 @@ def add_to_env(env): env['_SHF90PPCOMG'] = ShF90PPCommandGenerator env['_SHF90PPCOMSTRG'] = ShF90PPCommandStrGenerator - env['_F90INCFLAGS'] = '$( ${_concat(INCPREFIX, F90PATH, INCSUFFIX, __env__, RDirs)} $)' + env['_F90INCFLAGS'] = '$( ${_concat(INCPREFIX, F90PATH, INCSUFFIX, __env__, RDirs, TARGET)} $)' env['_F90COMD'] = '$_F90G $_F90FLAGSG $_F90INCFLAGS $_FORTRANMODFLAG -c -o $TARGET $SOURCES' env['_F90PPCOMD'] = '$_F90G $_F90FLAGSG $CPPFLAGS $_CPPDEFFLAGS $_F90INCFLAGS $_FORTRANMODFLAG -c -o $TARGET $SOURCES' env['_SHF90COMD'] = '$_SHF90G $_SHF90FLAGSG $_F90INCFLAGS $_FORTRANMODFLAG -c -o $TARGET $SOURCES' diff --git a/src/engine/SCons/Tool/f95.py b/src/engine/SCons/Tool/f95.py index 7121011..2d5a0b5 100644 --- a/src/engine/SCons/Tool/f95.py +++ b/src/engine/SCons/Tool/f95.py @@ -110,7 +110,7 @@ def add_to_env(env): env['_SHF95PPCOMG'] = ShF95PPCommandGenerator env['_SHF95PPCOMSTRG'] = ShF95PPCommandStrGenerator - env['_F95INCFLAGS'] = '$( ${_concat(INCPREFIX, F95PATH, INCSUFFIX, __env__, RDirs)} $)' + env['_F95INCFLAGS'] = '$( ${_concat(INCPREFIX, F95PATH, INCSUFFIX, __env__, RDirs, TARGET)} $)' env['_F95COMD'] = '$_F95G $_F95FLAGSG $_F95INCFLAGS $_FORTRANMODFLAG -c -o $TARGET $SOURCES' env['_F95PPCOMD'] = '$_F95G $_F95FLAGSG $CPPFLAGS $_CPPDEFFLAGS $_F95INCFLAGS $_FORTRANMODFLAG -c -o $TARGET $SOURCES' diff --git a/src/engine/SCons/Tool/fortran.py b/src/engine/SCons/Tool/fortran.py index 7f6a88b..770a45e 100644 --- a/src/engine/SCons/Tool/fortran.py +++ b/src/engine/SCons/Tool/fortran.py @@ -137,7 +137,7 @@ def add_to_env(env): env['_SHFORTRANPPCOMG'] = ShFortranPPCommandGenerator env['_SHFORTRANPPCOMSTRG'] = ShFortranPPCommandStrGenerator - env['_FORTRANINCFLAGS'] = '$( ${_concat(INCPREFIX, FORTRANPATH, INCSUFFIX, __env__, RDirs)} $)' + env['_FORTRANINCFLAGS'] = '$( ${_concat(INCPREFIX, FORTRANPATH, INCSUFFIX, __env__, RDirs, TARGET)} $)' env['FORTRANMODPREFIX'] = '' # like $LIBPREFIX env['FORTRANMODSUFFIX'] = '.mod' # like $LIBSUFFIX diff --git a/src/engine/SCons/Tool/mingw.py b/src/engine/SCons/Tool/mingw.py index 99a5574..f1bc91a 100644 --- a/src/engine/SCons/Tool/mingw.py +++ b/src/engine/SCons/Tool/mingw.py @@ -139,7 +139,7 @@ def generate(env): env['RC'] = 'windres' env['RCFLAGS'] = SCons.Util.CLVar('') - env['RCINCFLAGS'] = '$( ${_concat(RCINCPREFIX, CPPPATH, RCINCSUFFIX, __env__, RDirs)} $)' + env['RCINCFLAGS'] = '$( ${_concat(RCINCPREFIX, CPPPATH, RCINCSUFFIX, __env__, RDirs, TARGET)} $)' env['RCINCPREFIX'] = '--include-dir ' env['RCINCSUFFIX'] = '' env['RCCOM'] = '$RC $RCINCFLAGS $RCFLAGS -i $SOURCE -o $TARGET' diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py index 361b18c..2ca487f 100644 --- a/src/engine/SCons/Util.py +++ b/src/engine/SCons/Util.py @@ -490,6 +490,9 @@ def subst_dict(target, source): tnl = NLWrapper(target, lambda x: x.get_subst_proxy()) dict['TARGETS'] = Targets_or_Sources(tnl) dict['TARGET'] = Target_or_Source(tnl) + else: + dict['TARGETS'] = None + dict['TARGET'] = None if source: def get_src_subst_proxy(node): @@ -503,6 +506,9 @@ def subst_dict(target, source): snl = NLWrapper(source, get_src_subst_proxy) dict['SOURCES'] = Targets_or_Sources(snl) dict['SOURCE'] = Target_or_Source(snl) + else: + dict['SOURCES'] = None + dict['SOURCE'] = None return dict |