diff options
author | Steven Knight <knight@baldmt.com> | 2004-02-26 05:56:51 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2004-02-26 05:56:51 (GMT) |
commit | dfa9ded59f8641221328e2da7a06698a1b367ef1 (patch) | |
tree | cc4a700d072dff78736d245d7c664be7ad2d32f0 /src/engine | |
parent | b0656def14f9b2f7feff88301420c1dee99ac670 (diff) | |
download | SCons-dfa9ded59f8641221328e2da7a06698a1b367ef1.zip SCons-dfa9ded59f8641221328e2da7a06698a1b367ef1.tar.gz SCons-dfa9ded59f8641221328e2da7a06698a1b367ef1.tar.bz2 |
Initialize *FLAGS variables with objects that can add flags either as strings or lists.
Diffstat (limited to 'src/engine')
59 files changed, 340 insertions, 127 deletions
diff --git a/src/engine/SCons/Tool/386asm.py b/src/engine/SCons/Tool/386asm.py index 7a18a40..bb8b780 100644 --- a/src/engine/SCons/Tool/386asm.py +++ b/src/engine/SCons/Tool/386asm.py @@ -34,15 +34,17 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import as from SCons.Tool.PharLapCommon import addPharLapPaths +import SCons.Util + +import as def generate(env): """Add Builders and construction variables for ar to an Environment.""" as.generate(env) env['AS'] = '386asm' - env['ASFLAGS'] = '' + env['ASFLAGS'] = SCons.Util.CLVar('') env['ASCOM'] = '$AS $ASFLAGS $SOURCES -o $TARGET' env['ASPPCOM'] = '$CC $ASFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS $SOURCES -o $TARGET' diff --git a/src/engine/SCons/Tool/BitKeeper.py b/src/engine/SCons/Tool/BitKeeper.py index 3208b67..2983c14 100644 --- a/src/engine/SCons/Tool/BitKeeper.py +++ b/src/engine/SCons/Tool/BitKeeper.py @@ -37,6 +37,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os.path import SCons.Builder +import SCons.Util def generate(env): """Add a Builder factory function and construction variables for @@ -50,7 +51,7 @@ def generate(env): env['BITKEEPER'] = 'bk' env['BITKEEPERGET'] = '$BITKEEPER get' - env['BITKEEPERGETFLAGS'] = '' + env['BITKEEPERGETFLAGS'] = SCons.Util.CLVar('') env['BITKEEPERCOM'] = '$BITKEEPERGET $BITKEEPERGETFLAGS $TARGET' def exists(env): diff --git a/src/engine/SCons/Tool/CVS.py b/src/engine/SCons/Tool/CVS.py index 6d5b046..20bbb6a 100644 --- a/src/engine/SCons/Tool/CVS.py +++ b/src/engine/SCons/Tool/CVS.py @@ -36,6 +36,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os.path import SCons.Builder +import SCons.Util def generate(env): """Add a Builder factory function and construction variables for @@ -57,8 +58,8 @@ def generate(env): setattr(env, 'CVS', CVSFactory) env['CVS'] = 'cvs' - env['CVSFLAGS'] = '-d $CVSREPOSITORY' - env['CVSCOFLAGS'] = '' + env['CVSFLAGS'] = SCons.Util.CLVar('-d $CVSREPOSITORY') + env['CVSCOFLAGS'] = SCons.Util.CLVar('') env['CVSCOM'] = '$CVS $CVSFLAGS co $CVSCOFLAGS ${TARGET.posix}' def exists(env): diff --git a/src/engine/SCons/Tool/Perforce.py b/src/engine/SCons/Tool/Perforce.py index 3526952..3813d99 100644 --- a/src/engine/SCons/Tool/Perforce.py +++ b/src/engine/SCons/Tool/Perforce.py @@ -36,8 +36,8 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os import SCons.Builder -import SCons.Util import SCons.Node.FS +import SCons.Util # This function should maybe be moved to SCons.Util? from SCons.Tool.PharLapCommon import addPathIfNotExists @@ -58,7 +58,7 @@ def generate(env): setattr(env, 'Perforce', PerforceFactory) env['P4'] = 'p4' - env['P4FLAGS'] = '' + env['P4FLAGS'] = SCons.Util.CLVar('') env['P4COM'] = '$P4 $P4FLAGS sync $TARGET' try: environ = env['ENV'] diff --git a/src/engine/SCons/Tool/RCS.py b/src/engine/SCons/Tool/RCS.py index 3b9547c..a8f9168 100644 --- a/src/engine/SCons/Tool/RCS.py +++ b/src/engine/SCons/Tool/RCS.py @@ -34,6 +34,7 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import SCons.Builder +import SCons.Util def generate(env): """Add a Builder factory function and construction variables for @@ -47,7 +48,7 @@ def generate(env): env['RCS'] = 'rcs' env['RCS_CO'] = 'co' - env['RCS_COFLAGS'] = '' + env['RCS_COFLAGS'] = SCons.Util.CLVar('') env['RCS_COCOM'] = '$RCS_CO $RCS_COFLAGS $TARGET' def exists(env): diff --git a/src/engine/SCons/Tool/SCCS.py b/src/engine/SCons/Tool/SCCS.py index b75d676..8230241 100644 --- a/src/engine/SCons/Tool/SCCS.py +++ b/src/engine/SCons/Tool/SCCS.py @@ -34,6 +34,7 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import SCons.Builder +import SCons.Util def generate(env): """Add a Builder factory function and construction variables for @@ -46,8 +47,8 @@ def generate(env): setattr(env, 'SCCS', SCCSFactory) env['SCCS'] = 'sccs' - env['SCCSFLAGS'] = '' - env['SCCSGETFLAGS'] = '' + env['SCCSFLAGS'] = SCons.Util.CLVar('') + env['SCCSGETFLAGS'] = SCons.Util.CLVar('') env['SCCSCOM'] = '$SCCS $SCCSFLAGS get $SCCSGETFLAGS $TARGET' def exists(env): diff --git a/src/engine/SCons/Tool/Subversion.py b/src/engine/SCons/Tool/Subversion.py index 92839bc..85e032b 100644 --- a/src/engine/SCons/Tool/Subversion.py +++ b/src/engine/SCons/Tool/Subversion.py @@ -36,6 +36,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os.path import SCons.Builder +import SCons.Util def generate(env): """Add a Builder factory function and construction variables for @@ -54,7 +55,7 @@ def generate(env): setattr(env, 'Subversion', SubversionFactory) env['SVN'] = 'svn' - env['SVNFLAGS'] = '' + env['SVNFLAGS'] = SCons.Util.CLVar('') env['SVNCOM'] = '$SVN $SVNFLAGS cat $SVNREPOSITORY/$SVNMODULE$TARGET > $TARGET' def exists(env): diff --git a/src/engine/SCons/Tool/ToolTests.py b/src/engine/SCons/Tool/ToolTests.py index cd809df..5ddac19 100644 --- a/src/engine/SCons/Tool/ToolTests.py +++ b/src/engine/SCons/Tool/ToolTests.py @@ -52,7 +52,7 @@ class ToolTestCase(unittest.TestCase): t = SCons.Tool.Tool('g++') t(env) assert (env['CXX'] == 'c++' or env['CXX'] == 'g++'), env['CXX'] - assert env['CXXFLAGS'] == '$CCFLAGS', env['CXXFLAGS'] + assert env['CXXFLAGS'] == ['$CCFLAGS'], env['CXXFLAGS'] assert env['INCPREFIX'] == '-I', env['INCPREFIX'] assert env['TOOLS'] == ['g++'], env['TOOLS'] diff --git a/src/engine/SCons/Tool/aixlink.py b/src/engine/SCons/Tool/aixlink.py index d987016..2deb1f1 100644 --- a/src/engine/SCons/Tool/aixlink.py +++ b/src/engine/SCons/Tool/aixlink.py @@ -35,6 +35,8 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os import os.path +import SCons.Util + import aixcc import link @@ -55,8 +57,8 @@ def generate(env): link.generate(env) env['SMARTLINKFLAGS'] = smart_linkflags - env['LINKFLAGS'] = '$SMARTLINKFLAGS' - env['SHLINKFLAGS'] = '$LINKFLAGS -qmkshrobj -qsuppress=1501-218' + env['LINKFLAGS'] = SCons.Util.CLVar('$SMARTLINKFLAGS') + env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -qmkshrobj -qsuppress=1501-218') env['SHLIBSUFFIX'] = '.a' def exists(env): diff --git a/src/engine/SCons/Tool/ar.py b/src/engine/SCons/Tool/ar.py index 653836f..0522adc 100644 --- a/src/engine/SCons/Tool/ar.py +++ b/src/engine/SCons/Tool/ar.py @@ -35,6 +35,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import SCons.Defaults import SCons.Tool +import SCons.Util def generate(env): """Add Builders and construction variables for ar to an Environment.""" @@ -46,9 +47,9 @@ def generate(env): arcom = arcom + '\n$RANLIB $RANLIBFLAGS $TARGET' env['AR'] = 'ar' - env['ARFLAGS'] = 'r' + env['ARFLAGS'] = SCons.Util.CLVar('r') env['RANLIB'] = ranlib - env['RANLIBFLAGS'] = '' + env['RANLIBFLAGS'] = SCons.Util.CLVar('') env['ARCOM'] = arcom def exists(env): diff --git a/src/engine/SCons/Tool/as.py b/src/engine/SCons/Tool/as.py index 14a2d43..3d630e3 100644 --- a/src/engine/SCons/Tool/as.py +++ b/src/engine/SCons/Tool/as.py @@ -59,7 +59,7 @@ def generate(env): static_obj.add_action(suffix, SCons.Defaults.ASPPAction) env['AS'] = env.Detect(assemblers) or 'as' - env['ASFLAGS'] = '' + env['ASFLAGS'] = SCons.Util.CLVar('') env['ASCOM'] = '$AS $ASFLAGS -o $TARGET $SOURCES' env['ASPPCOM'] = '$CC $ASFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES' diff --git a/src/engine/SCons/Tool/bcc32.py b/src/engine/SCons/Tool/bcc32.py index 6f63525..6d3acca 100644 --- a/src/engine/SCons/Tool/bcc32.py +++ b/src/engine/SCons/Tool/bcc32.py @@ -59,10 +59,10 @@ def generate(env): static_obj.add_action(suffix, SCons.Defaults.CAction) shared_obj.add_action(suffix, SCons.Defaults.ShCAction) env['CC'] = 'bcc32' - env['CCFLAGS'] = '' + env['CCFLAGS'] = SCons.Util.CLVar('') env['CCCOM'] = '$CC -q $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES' env['SHCC'] = '$CC' - env['SHCCFLAGS'] = '$CCFLAGS' + env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS') env['SHCCCOM'] = '$SHCC -WD $SHCCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES' env['CPPDEFPREFIX'] = '-D' env['CPPDEFSUFFIX'] = '' diff --git a/src/engine/SCons/Tool/c++.py b/src/engine/SCons/Tool/c++.py index 2ed7d44..8e0adfa 100644 --- a/src/engine/SCons/Tool/c++.py +++ b/src/engine/SCons/Tool/c++.py @@ -67,10 +67,10 @@ def generate(env): shared_obj.add_action(suffix, SCons.Defaults.ShCXXAction) env['CXX'] = 'c++' - env['CXXFLAGS'] = '$CCFLAGS' + env['CXXFLAGS'] = SCons.Util.CLVar('$CCFLAGS') env['CXXCOM'] = '$CXX $CXXFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES' env['SHCXX'] = '$CXX' - env['SHCXXFLAGS'] = '$CXXFLAGS' + env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS') env['SHCXXCOM'] = '$SHCXX $SHCXXFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES' env['CPPDEFPREFIX'] = '-D' diff --git a/src/engine/SCons/Tool/cc.py b/src/engine/SCons/Tool/cc.py index 18b62d2..f096065 100644 --- a/src/engine/SCons/Tool/cc.py +++ b/src/engine/SCons/Tool/cc.py @@ -53,10 +53,10 @@ def generate(env): shared_obj.add_action(suffix, SCons.Defaults.ShCAction) env['CC'] = 'cc' - env['CCFLAGS'] = '' + env['CCFLAGS'] = SCons.Util.CLVar('') env['CCCOM'] = '$CC $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES' env['SHCC'] = '$CC' - env['SHCCFLAGS'] = '$CCFLAGS' + env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS') env['SHCCCOM'] = '$SHCC $SHCCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES' env['CPPDEFPREFIX'] = '-D' diff --git a/src/engine/SCons/Tool/dvipdf.py b/src/engine/SCons/Tool/dvipdf.py index b4da3c7..8c51ac0 100644 --- a/src/engine/SCons/Tool/dvipdf.py +++ b/src/engine/SCons/Tool/dvipdf.py @@ -34,6 +34,7 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import SCons.Defaults +import SCons.Util def generate(env): """Add Builders and construction variables for dvipdf to an Environment.""" @@ -45,11 +46,11 @@ def generate(env): bld.add_action('.dvi', '$PDFCOM') env['DVIPDF'] = 'dvipdf' - env['DVIPDFFLAGS'] = '' + env['DVIPDFFLAGS'] = SCons.Util.CLVar('') env['DVIPDFCOM'] = '$DVIPDF $DVIPDFFLAGS $SOURCES $TARGET' # Deprecated synonym. - env['PDFCOM'] = '$DVIPDFCOM' + env['PDFCOM'] = ['$DVIPDFCOM'] def exists(env): return env.Detect('dvipdf') diff --git a/src/engine/SCons/Tool/dvips.py b/src/engine/SCons/Tool/dvips.py index f197b9b..d70d78d 100644 --- a/src/engine/SCons/Tool/dvips.py +++ b/src/engine/SCons/Tool/dvips.py @@ -35,6 +35,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import SCons.Action import SCons.Defaults +import SCons.Util PostScript = SCons.Builder.Builder(action = '$PSCOM', prefix = '$PSPREFIX', @@ -47,7 +48,7 @@ def generate(env): env['BUILDERS']['PostScript'] = PostScript env['DVIPS'] = 'dvips' - env['DVIPSFLAGS'] = '' + env['DVIPSFLAGS'] = SCons.Util.CLVar('') env['PSCOM'] = '$DVIPS $DVIPSFLAGS -o $TARGET $SOURCES' def exists(env): diff --git a/src/engine/SCons/Tool/f77.py b/src/engine/SCons/Tool/f77.py index 4267096..83941f1 100644 --- a/src/engine/SCons/Tool/f77.py +++ b/src/engine/SCons/Tool/f77.py @@ -61,11 +61,11 @@ def generate(env): shared_obj.add_action(suffix, SCons.Defaults.ShF77PPAction) env['F77'] = env.Detect(compilers) or 'f77' - env['F77FLAGS'] = '' + env['F77FLAGS'] = SCons.Util.CLVar('') env['F77COM'] = '$F77 $F77FLAGS $_F77INCFLAGS -c -o $TARGET $SOURCES' env['F77PPCOM'] = '$F77 $F77FLAGS $CPPFLAGS $_CPPDEFFLAGS $_F77INCFLAGS -c -o $TARGET $SOURCES' env['SHF77'] = '$F77' - env['SHF77FLAGS'] = '$F77FLAGS' + env['SHF77FLAGS'] = SCons.Util.CLVar('$F77FLAGS') env['SHF77COM'] = '$SHF77 $SHF77FLAGS $_F77INCFLAGS -c -o $TARGET $SOURCES' env['SHF77PPCOM'] = '$SHF77 $SHF77FLAGS $CPPFLAGS $_CPPDEFFLAGS $_F77INCFLAGS -c -o $TARGET $SOURCES' diff --git a/src/engine/SCons/Tool/g++.py b/src/engine/SCons/Tool/g++.py index d641a6c..0576b90 100644 --- a/src/engine/SCons/Tool/g++.py +++ b/src/engine/SCons/Tool/g++.py @@ -34,7 +34,6 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os.path -import string import re import SCons.Defaults @@ -55,27 +54,27 @@ def generate(env): # platform specific settings if env['PLATFORM'] == 'cygwin': - env['SHCXXFLAGS'] = '$CXXFLAGS' + env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS') elif env['PLATFORM'] == 'aix': # Original line from Christian Engel added -DPIC: - #env['SHCXXFLAGS'] = '$CXXFLAGS -DPIC -mminimal-toc' - env['SHCXXFLAGS'] = '$CXXFLAGS -mminimal-toc' + #env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS -DPIC -mminimal-toc') + env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS -mminimal-toc') env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1 env['SHOBJSUFFIX'] = '$OBJSUFFIX' elif env['PLATFORM'] == 'hpux': # Original line from Christian Engel added -DPIC: - #env['SHCXXFLAGS'] = '$CXXFLAGS -fPIC -DPIC' - env['SHCXXFLAGS'] = '$CXXFLAGS -fPIC' + #env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS -fPIC -DPIC') + env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS -fPIC') env['SHOBJSUFFIX'] = '.pic.o' elif env['PLATFORM'] == 'sunos': # Original line from Christian Engel added -DPIC: - #env['SHCXXFLAGS'] = '$CXXFLAGS -fPIC -DPIC' - env['SHCXXFLAGS'] = '$CXXFLAGS -fPIC' + #env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS -fPIC -DPIC') + env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS -fPIC') env['SHOBJSUFFIX'] = '.pic.o' else: # Original line from Christian Engel added -DPIC: - #env['SHCXXFLAGS'] = '$CXXFLAGS -fPIC -DPIC' - env['SHCXXFLAGS'] = '$CXXFLAGS -fPIC' + #env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS -fPIC -DPIC') + env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS -fPIC') # determine compiler version if env['CXX']: line = os.popen(env['CXX'] + ' --version').readline() diff --git a/src/engine/SCons/Tool/gcc.py b/src/engine/SCons/Tool/gcc.py index acbe440..761082e 100644 --- a/src/engine/SCons/Tool/gcc.py +++ b/src/engine/SCons/Tool/gcc.py @@ -33,6 +33,8 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" +import SCons.Util + import cc compilers = ['gcc', 'cc'] @@ -43,9 +45,9 @@ def generate(env): env['CC'] = env.Detect(compilers) or 'gcc' if env['PLATFORM'] == 'cygwin': - env['SHCCFLAGS'] = '$CCFLAGS' + env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS') else: - env['SHCCFLAGS'] = ['$CCFLAGS', '-fPIC'] + env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS -fPIC') def exists(env): return env.Detect(compilers) diff --git a/src/engine/SCons/Tool/gnulink.py b/src/engine/SCons/Tool/gnulink.py index 3c3bba1..0e75304 100644 --- a/src/engine/SCons/Tool/gnulink.py +++ b/src/engine/SCons/Tool/gnulink.py @@ -33,6 +33,8 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" +import SCons.Util + import link linkers = ['g++', 'gcc'] @@ -42,7 +44,7 @@ def generate(env): link.generate(env) if env['PLATFORM'] == 'hpux': - env['SHLINKFLAGS'] = '$LINKFLAGS -shared -fPIC' + env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -shared -fPIC') def exists(env): return env.Detect(linkers) diff --git a/src/engine/SCons/Tool/gs.py b/src/engine/SCons/Tool/gs.py index 79d50e4..2666189 100644 --- a/src/engine/SCons/Tool/gs.py +++ b/src/engine/SCons/Tool/gs.py @@ -35,6 +35,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import SCons.Defaults import SCons.Platform +import SCons.Util # Ghostscript goes by different names on different platforms... platform = SCons.Platform.platform_default() @@ -58,7 +59,7 @@ def generate(env): bld.add_action('.ps', '$GSCOM') env['GS'] = gs - env['GSFLAGS'] = '-dNOPAUSE -dBATCH -sDEVICE=pdfwrite' + env['GSFLAGS'] = SCons.Util.CLVar('-dNOPAUSE -dBATCH -sDEVICE=pdfwrite') env['GSCOM'] = '$GS $GSFLAGS -sOutputFile=$TARGET $SOURCES' diff --git a/src/engine/SCons/Tool/hpc++.py b/src/engine/SCons/Tool/hpc++.py index 4ed1ba0..a1b3e97 100644 --- a/src/engine/SCons/Tool/hpc++.py +++ b/src/engine/SCons/Tool/hpc++.py @@ -36,6 +36,8 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os.path import string +import SCons.Util + cplusplus = __import__('c++', globals(), locals(), []) acc = None @@ -66,9 +68,9 @@ def generate(env): env['CXXVERSION'] = string.split(line)[-1] if env['PLATFORM'] == 'cygwin': - env['SHCXXFLAGS'] = '$CXXFLAGS' + env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS') else: - env['SHCXXFLAGS'] = '$CXXFLAGS +Z' + env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS +Z') def exists(env): return acc diff --git a/src/engine/SCons/Tool/hplink.py b/src/engine/SCons/Tool/hplink.py index 2c7b55c..f3d03c9 100644 --- a/src/engine/SCons/Tool/hplink.py +++ b/src/engine/SCons/Tool/hplink.py @@ -35,6 +35,8 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os import os.path +import SCons.Util + import link ccLinker = None @@ -59,8 +61,8 @@ def generate(env): """ link.generate(env) - env['LINKFLAGS'] = '-Wl,+s -Wl,+vnocompatwarnings' - env['SHLINKFLAGS'] = '$LINKFLAGS -b' + env['LINKFLAGS'] = SCons.Util.CLVar('-Wl,+s -Wl,+vnocompatwarnings') + env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -b') env['SHLIBSUFFIX'] = '.sl' def exists(env): diff --git a/src/engine/SCons/Tool/icc.py b/src/engine/SCons/Tool/icc.py index 20bf17c..4a553a0 100644 --- a/src/engine/SCons/Tool/icc.py +++ b/src/engine/SCons/Tool/icc.py @@ -33,6 +33,8 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" +import SCons.Util + import cc def generate(env): diff --git a/src/engine/SCons/Tool/ifl.py b/src/engine/SCons/Tool/ifl.py index 1b0cd33..04c9d39 100644 --- a/src/engine/SCons/Tool/ifl.py +++ b/src/engine/SCons/Tool/ifl.py @@ -33,6 +33,8 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" +import SCons.Util + import f77 def generate(env): @@ -40,11 +42,11 @@ def generate(env): f77.generate(env) env['F77'] = 'ifl' - env['F77FLAGS'] = '' + env['F77FLAGS'] = SCons.Util.CLVar('') env['F77COM'] = '$F77 $F77FLAGS $_F77INCFLAGS /c $SOURCES /Fo$TARGET' env['F77PPCOM'] = '$F77 $F77FLAGS $CPPFLAGS $_CPPDEFFLAGS $_F77INCFLAGS /c $SOURCES /Fo$TARGET' env['SHF77'] = '$F77' - env['SHF77FLAGS'] = '$F77FLAGS' + env['SHF77FLAGS'] = SCons.Util.CLVar('$F77FLAGS') env['SHF77COM'] = '$SHF77 $SHF77FLAGS $_F77INCFLAGS /c $SOURCES /Fo$TARGET' env['SHF77PPCOM'] = '$SHF77 $SHF77FLAGS $CPPFLAGS $_CPPDEFFLAGS $_F77INCFLAGS /c $SOURCES /Fo$TARGET' diff --git a/src/engine/SCons/Tool/ilink.py b/src/engine/SCons/Tool/ilink.py index 739dd17..180e57a 100644 --- a/src/engine/SCons/Tool/ilink.py +++ b/src/engine/SCons/Tool/ilink.py @@ -35,13 +35,14 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import SCons.Defaults import SCons.Tool +import SCons.Util def generate(env): """Add Builders and construction variables for ilink to an Environment.""" SCons.Tool.createProgBuilder(env) env['LINK'] = 'ilink' - env['LINKFLAGS'] = '' + env['LINKFLAGS'] = SCons.Util.CLVar('') env['LINKCOM'] = '$LINK $LINKFLAGS /O:$TARGET $SOURCES $( $_LIBDIRFLAGS $) $_LIBFLAGS' env['LIBDIRPREFIX']='/LIBPATH:' env['LIBDIRSUFFIX']='' diff --git a/src/engine/SCons/Tool/ilink32.py b/src/engine/SCons/Tool/ilink32.py index 35d1a66..a667b75 100644 --- a/src/engine/SCons/Tool/ilink32.py +++ b/src/engine/SCons/Tool/ilink32.py @@ -31,6 +31,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import SCons.Tool import SCons.Tool.bcc32 +import SCons.Util def generate(env): """Add Builders and construction variables for ilink to an @@ -38,7 +39,7 @@ def generate(env): SCons.Tool.createProgBuilder(env) env['LINK'] = '$CC' - env['LINKFLAGS'] = '' + env['LINKFLAGS'] = SCons.Util.CLVar('') env['LINKCOM'] = '$LINK -q $LINKFLAGS $SOURCES $LIBS' env['LIBDIRPREFIX']='' env['LIBDIRSUFFIX']='' diff --git a/src/engine/SCons/Tool/jar.py b/src/engine/SCons/Tool/jar.py index 5fcb205..7934ed2 100644 --- a/src/engine/SCons/Tool/jar.py +++ b/src/engine/SCons/Tool/jar.py @@ -37,6 +37,7 @@ import glob import os.path import SCons.Builder +import SCons.Util def jarSources(target, source, env, for_signature): """Only include sources that are not a manifest file.""" @@ -63,13 +64,14 @@ def jarManifest(target, source, env, for_signature): def jarFlags(target, source, env, for_signature): """If we have a manifest, make sure that the 'm' flag is specified.""" + jarflags = env.subst('$JARFLAGS') for src in source: contents = src.get_contents() if contents[:16] == "Manifest-Version": - if not 'm' in env['JARFLAGS']: - return env['JARFLAGS'] + 'm' + if not 'm' in jarflags: + return jarflags + 'm' break - return env['JARFLAGS'] + return jarflags def jarChdir(target, source, env, for_signature): """If we have an Environment variable by the name @@ -91,7 +93,7 @@ def generate(env): env['BUILDERS']['Jar'] = JarBuilder env['JAR'] = 'jar' - env['JARFLAGS'] = 'cf' + env['JARFLAGS'] = SCons.Util.CLVar('cf') env['_JARFLAGS'] = jarFlags env['_JARMANIFEST'] = jarManifest env['_JARSOURCES'] = jarSources diff --git a/src/engine/SCons/Tool/javac.py b/src/engine/SCons/Tool/javac.py index 3d4df10..b56a118 100644 --- a/src/engine/SCons/Tool/javac.py +++ b/src/engine/SCons/Tool/javac.py @@ -41,6 +41,7 @@ import string import SCons.Builder from SCons.Node.FS import _my_normcase from SCons.Tool.JavaCommon import parse_java_file +import SCons.Util def classname(path): """Turn a string (path name) into a Java class name.""" @@ -100,7 +101,7 @@ def generate(env): env['BUILDERS']['Java'] = JavaBuilder env['JAVAC'] = 'javac' - env['JAVACFLAGS'] = '' + env['JAVACFLAGS'] = SCons.Util.CLVar('') env['JAVACCOM'] = '$JAVAC $JAVACFLAGS -d ${TARGET.attributes.java_classdir} -sourcepath ${SOURCE.dir.rdir()} $SOURCES' env['JAVACLASSSUFFIX'] = '.class' env['JAVASUFFIX'] = '.java' diff --git a/src/engine/SCons/Tool/javah.py b/src/engine/SCons/Tool/javah.py index fe8c82d..c35f909 100644 --- a/src/engine/SCons/Tool/javah.py +++ b/src/engine/SCons/Tool/javah.py @@ -40,6 +40,7 @@ import string import SCons.Builder import SCons.Node.FS import SCons.Tool.javac +import SCons.Util def emit_java_headers(target, source, env): """Create and return lists of Java stub header files that will @@ -118,7 +119,7 @@ def generate(env): env['_JAVAHOUTFLAG'] = JavaHOutFlagGenerator env['JAVAH'] = 'javah' - env['JAVAHFLAGS'] = '' + env['JAVAHFLAGS'] = SCons.Util.CLVar('') env['JAVAHCOM'] = '$JAVAH $JAVAHFLAGS $_JAVAHOUTFLAG -classpath ${SOURCE.attributes.java_classdir} ${SOURCES.attributes.java_classname}' env['JAVACLASSSUFFIX'] = '.class' diff --git a/src/engine/SCons/Tool/latex.py b/src/engine/SCons/Tool/latex.py index d9b912c..7bbec6f 100644 --- a/src/engine/SCons/Tool/latex.py +++ b/src/engine/SCons/Tool/latex.py @@ -35,6 +35,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import SCons.Action import SCons.Defaults +import SCons.Util LaTeXAction = SCons.Action.Action('$LATEXCOM') @@ -51,7 +52,7 @@ def generate(env): bld.add_action('.latex', LaTeXAction) env['LATEX'] = 'latex' - env['LATEXFLAGS'] = '' + env['LATEXFLAGS'] = SCons.Util.CLVar('') env['LATEXCOM'] = '$LATEX $LATEXFLAGS $SOURCES' def exists(env): diff --git a/src/engine/SCons/Tool/lex.py b/src/engine/SCons/Tool/lex.py index 9ef2167..004d0da 100644 --- a/src/engine/SCons/Tool/lex.py +++ b/src/engine/SCons/Tool/lex.py @@ -35,6 +35,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import SCons.Defaults import SCons.Tool +import SCons.Util def generate(env): """Add Builders and construction variables for lex to an Environment.""" @@ -44,7 +45,7 @@ def generate(env): cxx_file.add_action('.ll', '$LEXCOM') env['LEX'] = env.Detect('flex') or 'lex' - env['LEXFLAGS'] = '' + env['LEXFLAGS'] = SCons.Util.CLVar('') env['LEXCOM'] = '$LEX $LEXFLAGS -t $SOURCES > $TARGET' def exists(env): diff --git a/src/engine/SCons/Tool/link.py b/src/engine/SCons/Tool/link.py index da672c1..cc0d4f4 100644 --- a/src/engine/SCons/Tool/link.py +++ b/src/engine/SCons/Tool/link.py @@ -50,12 +50,12 @@ def generate(env): SCons.Tool.createProgBuilder(env) env['SHLINK'] = '$LINK' - env['SHLINKFLAGS'] = '$LINKFLAGS -shared' + env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -shared') env['SHLINKCOM'] = '$SHLINK $SHLINKFLAGS -o $TARGET $SOURCES $_LIBDIRFLAGS $_LIBFLAGS' env['SHLIBEMITTER']= None env['SMARTLINK'] = smart_link env['LINK'] = "$SMARTLINK" - env['LINKFLAGS'] = '' + env['LINKFLAGS'] = SCons.Util.CLVar('') env['LINKCOM'] = '$LINK $LINKFLAGS -o $TARGET $SOURCES $_LIBDIRFLAGS $_LIBFLAGS' env['LIBDIRPREFIX']='-L' env['LIBDIRSUFFIX']='' diff --git a/src/engine/SCons/Tool/linkloc.py b/src/engine/SCons/Tool/linkloc.py index 313a16b..a5b2bdd 100644 --- a/src/engine/SCons/Tool/linkloc.py +++ b/src/engine/SCons/Tool/linkloc.py @@ -35,7 +35,6 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os.path -import string import re import SCons.Action @@ -84,11 +83,11 @@ def generate(env): env['SUBST_CMD_FILE'] = LinklocGenerator env['SHLINK'] = '$LINK' - env['SHLINKFLAGS'] = '$LINKFLAGS' + env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS') env['SHLINKCOM'] = '${SUBST_CMD_FILE("$SHLINK $SHLINKFLAGS $( $_LIBDIRFLAGS $) $_LIBFLAGS -dll $TARGET $SOURCES")}' env['SHLIBEMITTER']= None env['LINK'] = "linkloc" - env['LINKFLAGS'] = '' + env['LINKFLAGS'] = SCons.Util.CLVar('') env['LINKCOM'] = '${SUBST_CMD_FILE("$LINK $LINKFLAGS $( $_LIBDIRFLAGS $) $_LIBFLAGS -exe $TARGET $SOURCES")}' env['LIBDIRPREFIX']='-libpath ' env['LIBDIRSUFFIX']='' diff --git a/src/engine/SCons/Tool/m4.py b/src/engine/SCons/Tool/m4.py index 0c83c66..3fd2d66 100644 --- a/src/engine/SCons/Tool/m4.py +++ b/src/engine/SCons/Tool/m4.py @@ -34,6 +34,7 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import SCons.Builder +import SCons.Util def generate(env): """Add Builders and construction variables for m4 to an Environment.""" @@ -47,7 +48,7 @@ def generate(env): # The src_suffix setup is like so: file.c.m4 -> file.c, # file.cpp.m4 -> file.cpp etc. env['M4'] = 'm4' - env['M4FLAGS'] = '-E' + env['M4FLAGS'] = SCons.Util.CLVar('-E') env['M4COM'] = 'cd ${SOURCE.rsrcdir} && $M4 $M4FLAGS < ${SOURCE.file} > ${TARGET.abspath}' def exists(env): diff --git a/src/engine/SCons/Tool/masm.py b/src/engine/SCons/Tool/masm.py index 92f4c35..1bb9f95 100644 --- a/src/engine/SCons/Tool/masm.py +++ b/src/engine/SCons/Tool/masm.py @@ -37,6 +37,7 @@ import os.path import SCons.Defaults import SCons.Tool +import SCons.Util ASSuffixes = ['.s', '.asm', '.ASM'] ASPPSuffixes = ['.spp', '.SPP'] @@ -58,7 +59,7 @@ def generate(env): shared_obj.add_action(suffix, SCons.Defaults.ASPPAction) env['AS'] = 'ml' - env['ASFLAGS'] = '/nologo' + env['ASFLAGS'] = SCons.Util.CLVar('/nologo') env['ASCOM'] = '$AS $ASFLAGS /c /Fo$TARGET $SOURCES' env['ASPPCOM'] = '$CC $ASFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c /Fo$TARGET $SOURCES' env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1 diff --git a/src/engine/SCons/Tool/midl.py b/src/engine/SCons/Tool/midl.py index fe424fc..2efabcc 100644 --- a/src/engine/SCons/Tool/midl.py +++ b/src/engine/SCons/Tool/midl.py @@ -64,8 +64,8 @@ def generate(env): """Add Builders and construction variables for midl to an Environment.""" env['MIDL'] = 'MIDL.EXE' - env['MIDLFLAGS'] = '/nologo' - env['MIDLCOM'] = "$MIDL $MIDLFLAGS /tlb ${TARGETS[0]} /h ${TARGETS[1]} /iid ${TARGETS[2]} /proxy ${TARGETS[3]} /dlldata ${TARGETS[4]} $SOURCE 2> NUL" + env['MIDLFLAGS'] = SCons.Util.CLVar('/nologo') + env['MIDLCOM'] = '$MIDL $MIDLFLAGS /tlb ${TARGETS[0]} /h ${TARGETS[1]} /iid ${TARGETS[2]} /proxy ${TARGETS[3]} /dlldata ${TARGETS[4]} $SOURCE 2> NUL' env['BUILDERS']['TypeLibrary'] = midl_builder def exists(env): diff --git a/src/engine/SCons/Tool/mingw.py b/src/engine/SCons/Tool/mingw.py index bc3693d..ac4d969 100644 --- a/src/engine/SCons/Tool/mingw.py +++ b/src/engine/SCons/Tool/mingw.py @@ -33,11 +33,12 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import os.path import os +import os.path +import string + import SCons.Tool import SCons.Util -import string # This is what we search for to find mingw: key_program = 'mingw32-gcc' @@ -47,7 +48,7 @@ def find(env): return env.WhereIs(key_program) or SCons.Util.WhereIs(key_program) def shlib_generator(target, source, env, for_signature): - cmd = ['$SHLINK', '$SHLINKFLAGS'] + cmd = SCons.Util.CLVar('$SHLINK', '$SHLINKFLAGS') dll = env.FindIxes(target, 'SHLIBPREFIX', 'SHLIBSUFFIX') if dll: cmd.extend(['-o', dll]) @@ -117,10 +118,10 @@ def generate(env): #... but a few things differ: env['CC'] = 'gcc' - env['SHCCFLAGS'] = '$CCFLAGS' + env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS') env['CXX'] = 'g++' - env['SHCXXFLAGS'] = '$CXXFLAGS' - env['SHLINKFLAGS'] = '$LINKFLAGS -shared' + env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS') + env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -shared') env['SHLINKCOM'] = shlib_action env['SHLIBEMITTER']= shlib_emitter env['LINK'] = 'g++' @@ -131,8 +132,8 @@ def generate(env): env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1 env['RC'] = 'windres' - env['RCFLAGS'] = '' - env['RCINCFLAGS'] = '$( ${_concat(RCINCPREFIX, CPPPATH, RCINCSUFFIX, __env__, RDirs)} $)' + env['RCFLAGS'] = SCons.Util.CLVar('') + env['RCINCFLAGS'] = SCons.Util.CLVar('$( ${_concat(RCINCPREFIX, CPPPATH, RCINCSUFFIX, __env__, RDirs)} $)') env['RCINCPREFIX'] = '--include-dir ' env['RCINCSUFFIX'] = '' env['RCCOM'] = '$RC $RCINCFLAGS $RCFLAGS -i $SOURCE -o $TARGET' diff --git a/src/engine/SCons/Tool/mslib.py b/src/engine/SCons/Tool/mslib.py index 646cbde..1075c56 100644 --- a/src/engine/SCons/Tool/mslib.py +++ b/src/engine/SCons/Tool/mslib.py @@ -37,6 +37,7 @@ import SCons.Defaults import SCons.Tool import SCons.Tool.msvs import SCons.Tool.msvc +import SCons.Util def generate(env): """Add Builders and construction variables for lib to an Environment.""" @@ -57,7 +58,7 @@ def generate(env): pass env['AR'] = 'lib' - env['ARFLAGS'] = '/nologo' + env['ARFLAGS'] = SCons.Util.CLVar('/nologo') env['ARCOM'] = "${TEMPFILE('$AR $ARFLAGS /OUT:$TARGET $SOURCES')}" def exists(env): diff --git a/src/engine/SCons/Tool/mslink.py b/src/engine/SCons/Tool/mslink.py index 282fb22..fd53757 100644 --- a/src/engine/SCons/Tool/mslink.py +++ b/src/engine/SCons/Tool/mslink.py @@ -34,16 +34,15 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os.path -import string import SCons.Action import SCons.Defaults import SCons.Errors -import SCons.Util +import SCons.Platform.win32 import SCons.Tool -import SCons.Tool.msvs import SCons.Tool.msvc -import SCons.Platform.win32 +import SCons.Tool.msvs +import SCons.Util def pdbGenerator(env, target, source, for_signature): if target and env.has_key('PDB') and env['PDB']: @@ -137,13 +136,13 @@ def generate(env): SCons.Tool.createProgBuilder(env) env['SHLINK'] = '$LINK' - env['SHLINKFLAGS'] = '$LINKFLAGS /dll' + env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS /dll') env['_SHLINK_TARGETS'] = win32ShlinkTargets env['_SHLINK_SOURCES'] = win32ShlinkSources env['SHLINKCOM'] = compositeLinkAction env['SHLIBEMITTER']= win32LibEmitter env['LINK'] = 'link' - env['LINKFLAGS'] = '/nologo' + env['LINKFLAGS'] = SCons.Util.CLVar('/nologo') env['_PDB'] = pdbGenerator env['LINKCOM'] = '${TEMPFILE("$LINK $LINKFLAGS /OUT:$TARGET $( $_LIBDIRFLAGS $) $_LIBFLAGS $_PDB $SOURCES")}' env['PROGEMITTER'] = prog_emitter diff --git a/src/engine/SCons/Tool/msvc.py b/src/engine/SCons/Tool/msvc.py index 40f8b40..e2c0b65 100644 --- a/src/engine/SCons/Tool/msvc.py +++ b/src/engine/SCons/Tool/msvc.py @@ -34,18 +34,18 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os.path +import re import string import types -import re import SCons.Action -import SCons.Tool -import SCons.Errors -import SCons.Warnings import SCons.Builder -import SCons.Util +import SCons.Errors import SCons.Platform.win32 +import SCons.Tool import SCons.Tool.msvs +import SCons.Util +import SCons.Warnings CSuffixes = ['.c', '.C'] CXXSuffixes = ['.cc', '.cpp', '.cxx', '.c++', '.C++'] @@ -395,20 +395,20 @@ def generate(env): static_obj.add_action(suffix, SCons.Defaults.CXXAction) shared_obj.add_action(suffix, SCons.Defaults.ShCXXAction) - env['CCPDBFLAGS'] = '${(PDB and "/Zi /Fd%s"%File(PDB)) or ""}' - env['CCPCHFLAGS'] = '${(PCH and "/Yu%s /Fp%s"%(PCHSTOP or "",File(PCH))) or ""}' + env['CCPDBFLAGS'] = SCons.Util.CLVar(['${(PDB and "/Zi /Fd%s"%File(PDB)) or ""}']) + env['CCPCHFLAGS'] = SCons.Util.CLVar(['${(PCH and "/Yu%s /Fp%s"%(PCHSTOP or "",File(PCH))) or ""}']) env['CCCOMFLAGS'] = '$CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c $SOURCES /Fo$TARGET $CCPCHFLAGS $CCPDBFLAGS' env['CC'] = 'cl' - env['CCFLAGS'] = '/nologo' - env['CCCOM'] = '$CC $CCFLAGS $CCCOMFLAGS' + env['CCFLAGS'] = SCons.Util.CLVar('/nologo') + env['CCCOM'] = '$CC $CCFLAGS $CCCOMFLAGS' env['SHCC'] = '$CC' - env['SHCCFLAGS'] = '$CCFLAGS' + env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS') env['SHCCCOM'] = '$SHCC $SHCCFLAGS $CCCOMFLAGS' env['CXX'] = '$CC' - env['CXXFLAGS'] = ['$CCFLAGS', '$(', '/TP', '$)'] + env['CXXFLAGS'] = SCons.Util.CLVar('$CCFLAGS $( /TP $)') env['CXXCOM'] = '$CXX $CXXFLAGS $CCCOMFLAGS' env['SHCXX'] = '$CXX' - env['SHCXXFLAGS'] = '$CXXFLAGS' + env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS') env['SHCXXCOM'] = '$SHCXX $SHCXXFLAGS $CCCOMFLAGS' env['CPPDEFPREFIX'] = '/D' env['CPPDEFSUFFIX'] = '' @@ -419,7 +419,7 @@ def generate(env): env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1 env['RC'] = 'rc' - env['RCFLAGS'] = '' + env['RCFLAGS'] = SCons.Util.CLVar('') env['RCCOM'] = '$RC $_CPPDEFFLAGS $_CPPINCFLAGS $RCFLAGS /fo$TARGET $SOURCES' CScan = env.get_scanner('.c') if CScan: diff --git a/src/engine/SCons/Tool/nasm.py b/src/engine/SCons/Tool/nasm.py index 6a2fc36..84075ba 100644 --- a/src/engine/SCons/Tool/nasm.py +++ b/src/engine/SCons/Tool/nasm.py @@ -37,6 +37,7 @@ import os.path import SCons.Defaults import SCons.Tool +import SCons.Util ASSuffixes = ['.s', '.asm', '.ASM'] ASPPSuffixes = ['.spp', '.SPP'] @@ -56,7 +57,7 @@ def generate(env): static_obj.add_action(suffix, SCons.Defaults.ASPPAction) env['AS'] = 'nasm' - env['ASFLAGS'] = '' + env['ASFLAGS'] = SCons.Util.CLVar('') env['ASCOM'] = '$AS $ASFLAGS -o $TARGET $SOURCES' env['ASPPCOM'] = '$CC $ASFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES' diff --git a/src/engine/SCons/Tool/pdflatex.py b/src/engine/SCons/Tool/pdflatex.py index 1ae606e..b1a559a 100644 --- a/src/engine/SCons/Tool/pdflatex.py +++ b/src/engine/SCons/Tool/pdflatex.py @@ -35,6 +35,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import SCons.Action import SCons.Defaults +import SCons.Util PDFLaTeXAction = SCons.Action.Action('$PDFLATEXCOM') @@ -50,7 +51,7 @@ def generate(env): bld.add_action('.latex', PDFLaTeXAction) env['PDFLATEX'] = 'pdflatex' - env['PDFLATEXFLAGS'] = '' + env['PDFLATEXFLAGS'] = SCons.Util.CLVar('') env['PDFLATEXCOM'] = '$PDFLATEX $PDFLATEXFLAGS $SOURCES $TARGET' def exists(env): diff --git a/src/engine/SCons/Tool/pdftex.py b/src/engine/SCons/Tool/pdftex.py index 14b3d95..3d2add0 100644 --- a/src/engine/SCons/Tool/pdftex.py +++ b/src/engine/SCons/Tool/pdftex.py @@ -34,6 +34,7 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import SCons.Defaults +import SCons.Util def generate(env): """Add Builders and construction variables for pdftex to an Environment.""" @@ -46,7 +47,7 @@ def generate(env): bld.add_action('.tex', '$PDFTEXCOM') env['PDFTEX'] = 'pdftex' - env['PDFTEXFLAGS'] = '' + env['PDFTEXFLAGS'] = SCons.Util.CLVar('') env['PDFTEXCOM'] = '$PDFTEX $PDFTEXFLAGS $SOURCES $TARGET' def exists(env): diff --git a/src/engine/SCons/Tool/qt.py b/src/engine/SCons/Tool/qt.py index 9969e02..693f77e 100644 --- a/src/engine/SCons/Tool/qt.py +++ b/src/engine/SCons/Tool/qt.py @@ -34,9 +34,9 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import sys import os.path import re +import sys import SCons.Defaults import SCons.Tool @@ -154,10 +154,10 @@ def generate(env): # Some QT specific flags. I don't expect someone wants to # manipulate those ... - env['QT_UICIMPLFLAGS'] = '' - env['QT_UICDECLFLAGS'] = '' - env['QT_MOCFROMHFLAGS'] = '' - env['QT_MOCFROMCXXFLAGS'] = '-i' + env['QT_UICIMPLFLAGS'] = SCons.Util.CLVar('') + env['QT_UICDECLFLAGS'] = SCons.Util.CLVar('') + env['QT_MOCFROMHFLAGS'] = SCons.Util.CLVar('') + env['QT_MOCFROMCXXFLAGS'] = SCons.Util.CLVar('-i') # Suffixes for the headers / sources to generate env['QT_HSUFFIX'] = '.h' diff --git a/src/engine/SCons/Tool/rmic.py b/src/engine/SCons/Tool/rmic.py index 79cc316..565dc9e 100644 --- a/src/engine/SCons/Tool/rmic.py +++ b/src/engine/SCons/Tool/rmic.py @@ -39,6 +39,7 @@ import string import SCons.Builder import SCons.Node.FS +import SCons.Util def emit_rmic_classes(target, source, env): """Create and return lists of Java RMI stub and skeleton @@ -101,7 +102,7 @@ def generate(env): env['BUILDERS']['RMIC'] = RMICBuilder env['RMIC'] = 'rmic' - env['RMICFLAGS'] = '' + env['RMICFLAGS'] = SCons.Util.CLVar('') env['RMICCOM'] = '$RMIC $RMICFLAGS -d ${TARGET.attributes.java_lookupdir} -classpath ${SOURCE.attributes.java_classdir} ${SOURCES.attributes.java_classname}' env['JAVACLASSSUFFIX'] = '.class' diff --git a/src/engine/SCons/Tool/sgiar.py b/src/engine/SCons/Tool/sgiar.py index 079ec8c..1409d03 100644 --- a/src/engine/SCons/Tool/sgiar.py +++ b/src/engine/SCons/Tool/sgiar.py @@ -37,6 +37,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import SCons.Defaults import SCons.Tool +import SCons.Util def generate(env): """Add Builders and construction variables for ar to an Environment.""" @@ -44,15 +45,15 @@ def generate(env): if env.Detect('CC'): env['AR'] = 'CC' - env['ARFLAGS'] = '-ar' + env['ARFLAGS'] = SCons.Util.CLVar('-ar') env['ARCOM'] = '$AR $ARFLAGS -o $TARGET $SOURCES' else: env['AR'] = 'ar' - env['ARFLAGS'] = 'r' + env['ARFLAGS'] = SCons.Util.CLVar('r') env['ARCOM'] = '$AR $ARFLAGS $TARGET $SOURCES' env['SHLINK'] = '$LINK' - env['SHLINKFLAGS'] = '$LINKFLAGS -shared' + env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -shared') env['SHLINKCOM'] = '$SHLINK $SHLINKFLAGS -o $TARGET $SOURCES $_LIBDIRFLAGS $_LIBFLAGS' def exists(env): diff --git a/src/engine/SCons/Tool/sgic++.py b/src/engine/SCons/Tool/sgic++.py index a8c9186..9081044 100644 --- a/src/engine/SCons/Tool/sgic++.py +++ b/src/engine/SCons/Tool/sgic++.py @@ -7,10 +7,35 @@ It will usually be imported through the generic SCons.Tool.Tool() selection method. """ -__revision__ = "" + +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os.path -import string + +import SCons.Util cplusplus = __import__('c++', globals(), locals(), []) @@ -20,7 +45,7 @@ def generate(env): cplusplus.generate(env) env['CXX'] = 'CC' - env['CXXFLAGS'] = ['$CCFLAGS', '-LANG:std'] + env['CXXFLAGS'] = SCons.Util.CLVar('$CCFLAGS -LANG:std') env['SHCXX'] = 'CC' env['SHOBJSUFFIX'] = '.o' env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1 diff --git a/src/engine/SCons/Tool/sgilink.py b/src/engine/SCons/Tool/sgilink.py index 5643c08..80cfcf4 100644 --- a/src/engine/SCons/Tool/sgilink.py +++ b/src/engine/SCons/Tool/sgilink.py @@ -33,6 +33,8 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" +import SCons.Util + import link linkers = ['CC', 'cc'] @@ -42,7 +44,7 @@ def generate(env): link.generate(env) env['LINK'] = env.Detect(linkers) or 'cc' - env['SHLINKFLAGS'] = '$LINKFLAGS -shared' + env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -shared') def exists(env): return env.Detect(linkers) diff --git a/src/engine/SCons/Tool/sunar.py b/src/engine/SCons/Tool/sunar.py index 5d44b60..36a6984 100644 --- a/src/engine/SCons/Tool/sunar.py +++ b/src/engine/SCons/Tool/sunar.py @@ -36,6 +36,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import SCons.Defaults import SCons.Tool +import SCons.Util def generate(env): """Add Builders and construction variables for ar to an Environment.""" @@ -43,15 +44,15 @@ def generate(env): if env.Detect('CC'): env['AR'] = 'CC' - env['ARFLAGS'] = '-xar' + env['ARFLAGS'] = SCons.Util.CLVar('-xar') env['ARCOM'] = '$AR $ARFLAGS -o $TARGET $SOURCES' else: env['AR'] = 'ar' - env['ARFLAGS'] = 'r' + env['ARFLAGS'] = SCons.Util.CLVar('r') env['ARCOM'] = '$AR $ARFLAGS $TARGET $SOURCES' env['SHLINK'] = '$LINK' - env['SHLINKFLAGS'] = '$LINKFLAGS -G' + env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -G') env['SHLINKCOM'] = '$SHLINK $SHLINKFLAGS -o $TARGET $SOURCES $_LIBDIRFLAGS $_LIBFLAGS' def exists(env): diff --git a/src/engine/SCons/Tool/sunlink.py b/src/engine/SCons/Tool/sunlink.py index 53dd410..88624ca 100644 --- a/src/engine/SCons/Tool/sunlink.py +++ b/src/engine/SCons/Tool/sunlink.py @@ -35,6 +35,8 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os import os.path +import SCons.Util + import link ccLinker = None @@ -56,7 +58,7 @@ def generate(env): """Add Builders and construction variables for Forte to an Environment.""" link.generate(env) - env['SHLINKFLAGS'] = '$LINKFLAGS -G' + env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -G') def exists(env): return ccLinker diff --git a/src/engine/SCons/Tool/swig.py b/src/engine/SCons/Tool/swig.py index 9dcfad4..b58fadc 100644 --- a/src/engine/SCons/Tool/swig.py +++ b/src/engine/SCons/Tool/swig.py @@ -34,13 +34,13 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os.path -import string import SCons.Defaults import SCons.Tool +import SCons.Util def swigSuffixEmitter(env, source): - if '-c++' in string.split(env.subst("$SWIGFLAGS")): + if '-c++' in SCons.Util.CLVar(env.subst("$SWIGFLAGS")): return '$SWIGCXXFILESUFFIX' else: return '$SWIGCFILESUFFIX' @@ -56,7 +56,7 @@ def generate(env): cxx_file.add_action('.i', '$SWIGCOM') env['SWIG'] = 'swig' - env['SWIGFLAGS'] = '' + env['SWIGFLAGS'] = SCons.Util.CLVar('') env['SWIGCFILESUFFIX'] = '_wrap$CFILESUFFIX' env['SWIGCXXFILESUFFIX'] = '_wrap$CXXFILESUFFIX' env['SWIGCOM'] = '$SWIG $SWIGFLAGS -o $TARGET $SOURCES' diff --git a/src/engine/SCons/Tool/tar.py b/src/engine/SCons/Tool/tar.py index 011f48b..83fb7d3 100644 --- a/src/engine/SCons/Tool/tar.py +++ b/src/engine/SCons/Tool/tar.py @@ -54,7 +54,7 @@ def generate(env): env['BUILDERS']['Tar'] = bld env['TAR'] = env.Detect(tars) or 'gtar' - env['TARFLAGS'] = '-c' + env['TARFLAGS'] = SCons.Util.CLVar('-c') env['TARCOM'] = '$TAR $TARFLAGS -f $TARGET $SOURCES' env['TARSUFFIX'] = '.tar' diff --git a/src/engine/SCons/Tool/tex.py b/src/engine/SCons/Tool/tex.py index c06efbf..b9257ea 100644 --- a/src/engine/SCons/Tool/tex.py +++ b/src/engine/SCons/Tool/tex.py @@ -101,16 +101,16 @@ def generate(env): bld.add_action('.tex', TeXLaTeXAction) env['TEX'] = 'tex' - env['TEXFLAGS'] = '' + env['TEXFLAGS'] = SCons.Util.CLVar('') env['TEXCOM'] = '$TEX $TEXFLAGS $SOURCES' # Duplicate from latex.py. If latex.py goes away, then this is still OK. env['LATEX'] = 'latex' - env['LATEXFLAGS'] = '' + env['LATEXFLAGS'] = SCons.Util.CLVar('') env['LATEXCOM'] = '$LATEX $LATEXFLAGS $SOURCES' env['BIBTEX'] = 'bibtex' - env['BIBTEXFLAGS'] = '' + env['BIBTEXFLAGS'] = SCons.Util.CLVar('') env['BIBTEXCOM'] = '$BIBTEX $BIBTEXFLAGS $SOURCES' diff --git a/src/engine/SCons/Tool/tlib.py b/src/engine/SCons/Tool/tlib.py index 6ce1bf4..4a70c14 100644 --- a/src/engine/SCons/Tool/tlib.py +++ b/src/engine/SCons/Tool/tlib.py @@ -31,13 +31,14 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import SCons.Tool import SCons.Tool.bcc32 +import SCons.Util def generate(env): SCons.Tool.bcc32.findIt('tlib', env) """Add Builders and construction variables for ar to an Environment.""" SCons.Tool.createStaticLibBuilder(env) env['AR'] = 'tlib' - env['ARFLAGS'] = '' + env['ARFLAGS'] = SCons.Util.CLVar('') env['ARCOM'] = '$AR $TARGET $ARFLAGS /a $SOURCES' def exists(env): diff --git a/src/engine/SCons/Tool/yacc.py b/src/engine/SCons/Tool/yacc.py index c0274ce..cf54b78 100644 --- a/src/engine/SCons/Tool/yacc.py +++ b/src/engine/SCons/Tool/yacc.py @@ -34,7 +34,6 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os.path -import string import SCons.Tool import SCons.Util @@ -43,7 +42,7 @@ def _yaccEmitter(target, source, env, ysuf, hsuf): # If -d is specified on the command line, yacc will emit a .h # or .hpp file as well as a .c or .cpp file, depending on whether # the input file is a .y or .yy, respectively. - if len(source) and '-d' in string.split(env.subst("$YACCFLAGS")): + if len(source) and '-d' in SCons.Util.CLVar(env.subst("$YACCFLAGS")): base, ext = os.path.splitext(SCons.Util.to_String(source[0])) if ext == ysuf: base, ext = os.path.splitext(SCons.Util.to_String(target[0])) @@ -66,7 +65,7 @@ def generate(env): cxx_file.add_emitter('.yy', yyEmitter) env['YACC'] = env.Detect('bison') or 'yacc' - env['YACCFLAGS'] = '' + env['YACCFLAGS'] = SCons.Util.CLVar('') env['YACCCOM'] = '$YACC $YACCFLAGS -o $TARGET $SOURCES' def exists(env): diff --git a/src/engine/SCons/Tool/zip.py b/src/engine/SCons/Tool/zip.py index 18f0caa..c81a4f3 100644 --- a/src/engine/SCons/Tool/zip.py +++ b/src/engine/SCons/Tool/zip.py @@ -83,7 +83,7 @@ def generate(env): env['BUILDERS']['Zip'] = bld env['ZIP'] = 'zip' - env['ZIPFLAGS'] = '' + env['ZIPFLAGS'] = SCons.Util.CLVar('') env['ZIPCOM'] = zipAction env['ZIPCOMPRESSION'] = zipcompression env['ZIPSUFFIX'] = '.zip' diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py index 4ca25b2..2fb4e93 100644 --- a/src/engine/SCons/Util.py +++ b/src/engine/SCons/Util.py @@ -1202,6 +1202,33 @@ else: display = DisplayEngine() +def Split(arg): + if is_List(arg): + return arg + elif is_String(arg): + return string.split(arg) + else: + return [arg] + +class CLVar(UserList.UserList): + """A class for command-line construction variables. + + This is a list that uses Split() to split an initial string along + white-space arguments, and similarly to split any strings that get + added. This allows us to Do the Right Thing with Append() and + Prepend() (as well as straight Python foo = env['VAR'] + 'arg1 + arg2') regardless of whether a user adds a list or a string to a + command-line construction variable. + """ + def __init__(self, seq = []): + UserList.UserList.__init__(self, Split(seq)) + def __coerce__(self, other): + if is_String(other): + other = Split(other) + return (self, other) + def __str__(self): + return string.join(self.data) + class Selector(UserDict.UserDict): """A callable dictionary that maps file suffixes to dictionary values.""" diff --git a/src/engine/SCons/UtilTests.py b/src/engine/SCons/UtilTests.py index d981abc..8591119 100644 --- a/src/engine/SCons/UtilTests.py +++ b/src/engine/SCons/UtilTests.py @@ -1305,6 +1305,123 @@ class UtilTestCase(unittest.TestCase): assert nl[0:2].child.bar == [ 't1child', 't2child' ], \ nl[0:2].child.bar + def test_CLVar(self): + """Test the command-line construction variable class""" + f = SCons.Util.CLVar('a b') + + r = f + 'c d' + assert isinstance(r, SCons.Util.CLVar), type(r) + assert r.data == ['a', 'b', 'c', 'd'], r.data + assert str(r) == 'a b c d', str(r) + + r = f + ' c d' + assert isinstance(r, SCons.Util.CLVar), type(r) + assert r.data == ['a', 'b', 'c', 'd'], r.data + assert str(r) == 'a b c d', str(r) + + r = f + ['c d'] + assert isinstance(r, SCons.Util.CLVar), type(r) + assert r.data == ['a', 'b', 'c d'], r.data + assert str(r) == 'a b c d', str(r) + + r = f + [' c d'] + assert isinstance(r, SCons.Util.CLVar), type(r) + assert r.data == ['a', 'b', ' c d'], r.data + assert str(r) == 'a b c d', str(r) + + r = f + ['c', 'd'] + assert isinstance(r, SCons.Util.CLVar), type(r) + assert r.data == ['a', 'b', 'c', 'd'], r.data + assert str(r) == 'a b c d', str(r) + + r = f + [' c', 'd'] + assert isinstance(r, SCons.Util.CLVar), type(r) + assert r.data == ['a', 'b', ' c', 'd'], r.data + assert str(r) == 'a b c d', str(r) + + f = SCons.Util.CLVar(['a b']) + + r = f + 'c d' + assert isinstance(r, SCons.Util.CLVar), type(r) + assert r.data == ['a b', 'c', 'd'], r.data + assert str(r) == 'a b c d', str(r) + + r = f + ' c d' + assert isinstance(r, SCons.Util.CLVar), type(r) + assert r.data == ['a b', 'c', 'd'], r.data + assert str(r) == 'a b c d', str(r) + + r = f + ['c d'] + assert isinstance(r, SCons.Util.CLVar), type(r) + assert r.data == ['a b', 'c d'], r.data + assert str(r) == 'a b c d', str(r) + + r = f + [' c d'] + assert isinstance(r, SCons.Util.CLVar), type(r) + assert r.data == ['a b', ' c d'], r.data + assert str(r) == 'a b c d', str(r) + + r = f + ['c', 'd'] + assert isinstance(r, SCons.Util.CLVar), type(r) + assert r.data == ['a b', 'c', 'd'], r.data + assert str(r) == 'a b c d', str(r) + + r = f + [' c', 'd'] + assert isinstance(r, SCons.Util.CLVar), type(r) + assert r.data == ['a b', ' c', 'd'], r.data + assert str(r) == 'a b c d', str(r) + + f = SCons.Util.CLVar(['a', 'b']) + + r = f + 'c d' + assert isinstance(r, SCons.Util.CLVar), type(r) + assert r.data == ['a', 'b', 'c', 'd'], r.data + assert str(r) == 'a b c d', str(r) + + r = f + ' c d' + assert isinstance(r, SCons.Util.CLVar), type(r) + assert r.data == ['a', 'b', 'c', 'd'], r.data + assert str(r) == 'a b c d', str(r) + + r = f + ['c d'] + assert isinstance(r, SCons.Util.CLVar), type(r) + assert r.data == ['a', 'b', 'c d'], r.data + assert str(r) == 'a b c d', str(r) + + r = f + [' c d'] + assert isinstance(r, SCons.Util.CLVar), type(r) + assert r.data == ['a', 'b', ' c d'], r.data + assert str(r) == 'a b c d', str(r) + + r = f + ['c', 'd'] + assert isinstance(r, SCons.Util.CLVar), type(r) + assert r.data == ['a', 'b', 'c', 'd'], r.data + assert str(r) == 'a b c d', str(r) + + r = f + [' c', 'd'] + assert isinstance(r, SCons.Util.CLVar), type(r) + assert r.data == ['a', 'b', ' c', 'd'], r.data + assert str(r) == 'a b c d', str(r) + + loc = {} + loc['FOO'] = 'foo' + loc['BAR'] = SCons.Util.CLVar('bar') + loc['CALL'] = lambda target, source, env, for_signature: 'call' + env = DummyEnv(loc) + + cmd = SCons.Util.CLVar("test $FOO $BAR $CALL test") + + newcmd = scons_subst(cmd, env) + assert newcmd == 'test foo bar call test', newcmd + + cmd_list = scons_subst_list(cmd, env) + assert len(cmd_list) == 1, cmd_list + assert cmd_list[0][0] == "test", cmd_list[0][0] + assert cmd_list[0][1] == "foo", cmd_list[0][1] + assert cmd_list[0][2] == "bar", cmd_list[0][2] + assert cmd_list[0][3] == "call", cmd_list[0][3] + assert cmd_list[0][4] == "test", cmd_list[0][4] + def test_Selector(self): """Test the Selector class""" |