From e68cb455ec0859459f26654d4ec6b6862bf5855f Mon Sep 17 00:00:00 2001 From: stevenknight Date: Mon, 10 Jan 2005 13:45:00 +0000 Subject: [PATCH] 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. git-svn-id: http://scons.tigris.org/svn/scons/trunk@1212 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- src/engine/SCons/Defaults.py | 89 +++++++++++++++--------- src/engine/SCons/Environment.py | 4 +- src/engine/SCons/EnvironmentTests.py | 14 ++++ src/engine/SCons/Executor.py | 16 ----- src/engine/SCons/Node/FS.py | 11 +-- src/engine/SCons/Node/FSTests.py | 2 +- src/engine/SCons/Node/NodeTests.py | 6 -- src/engine/SCons/Node/__init__.py | 5 -- src/engine/SCons/Scanner/CTests.py | 2 +- src/engine/SCons/Scanner/FortranTests.py | 2 +- src/engine/SCons/Scanner/IDLTests.py | 2 +- src/engine/SCons/Scanner/ProgTests.py | 2 +- src/engine/SCons/Scanner/ScannerTests.py | 2 +- src/engine/SCons/Scanner/__init__.py | 11 +-- src/engine/SCons/Script/SConscript.py | 10 ++- src/engine/SCons/Script/__init__.py | 20 +++++- src/engine/SCons/Tool/dmd.py | 4 +- src/engine/SCons/Tool/f77.py | 2 +- src/engine/SCons/Tool/f90.py | 2 +- src/engine/SCons/Tool/f95.py | 2 +- src/engine/SCons/Tool/fortran.py | 2 +- src/engine/SCons/Tool/mingw.py | 2 +- src/engine/SCons/Util.py | 6 ++ 23 files changed, 125 insertions(+), 93 deletions(-) diff --git a/src/engine/SCons/Defaults.py b/src/engine/SCons/Defaults.py index 644dadff..26e22361 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 fbc84541..c2d2e92c 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 ad5a9b2b..44dc8143 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 2a191712..7bc847aa 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 1f2b0a86..50e3818d 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 e71093f6..e65c10b6 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 ee0e82b9..3e5a9f09 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 7b443abc..7ffec0e8 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 5296f93c..e3caa5f5 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 ebf7b566..75264ac2 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 f8683b0c..31a40eac 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 7ab88f94..7e33866a 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 e418c177..493a330b 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 1968a9e3..1322fffa 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 e30a9795..2e8c9165 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 d6d49122..d94fee2c 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 914129c6..13f58a10 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 87c8c9ae..5650e97b 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 272f40e1..9c3b0a3c 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 7121011d..2d5a0b5e 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 7f6a88b2..770a45eb 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 99a5574c..f1bc91ac 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 361b18c9..2ca487f2 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 -- 2.26.2