diff options
Diffstat (limited to 'src/engine/SCons/Tool')
-rw-r--r-- | src/engine/SCons/Tool/bcc32.py | 6 | ||||
-rw-r--r-- | src/engine/SCons/Tool/cc.py | 6 | ||||
-rw-r--r-- | src/engine/SCons/Tool/cc.xml | 26 | ||||
-rw-r--r-- | src/engine/SCons/Tool/f90.py | 4 | ||||
-rw-r--r-- | src/engine/SCons/Tool/f95.py | 7 | ||||
-rw-r--r-- | src/engine/SCons/Tool/icc.py | 2 | ||||
-rw-r--r-- | src/engine/SCons/Tool/lex.py | 53 | ||||
-rw-r--r-- | src/engine/SCons/Tool/mingw.py | 2 | ||||
-rw-r--r-- | src/engine/SCons/Tool/msvc.py | 6 | ||||
-rw-r--r-- | src/engine/SCons/Tool/mwcc.py | 5 | ||||
-rw-r--r-- | src/engine/SCons/Tool/qt.py | 4 | ||||
-rw-r--r-- | src/engine/SCons/Tool/yacc.py | 53 | ||||
-rw-r--r-- | src/engine/SCons/Tool/yacc.xml | 17 |
13 files changed, 156 insertions, 35 deletions
diff --git a/src/engine/SCons/Tool/bcc32.py b/src/engine/SCons/Tool/bcc32.py index 826373f..86ca076 100644 --- a/src/engine/SCons/Tool/bcc32.py +++ b/src/engine/SCons/Tool/bcc32.py @@ -63,10 +63,12 @@ def generate(env): env['CC'] = 'bcc32' env['CCFLAGS'] = SCons.Util.CLVar('') - env['CCCOM'] = '$CC -q $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o$TARGET $SOURCES' + env['CFLAGS'] = SCons.Util.CLVar('') + env['CCCOM'] = '$CC -q $CFLAGS $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o$TARGET $SOURCES' env['SHCC'] = '$CC' env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS') - env['SHCCCOM'] = '$SHCC -WD $SHCCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o$TARGET $SOURCES' + env['SHCFLAGS'] = SCons.Util.CLVar('$CFLAGS') + env['SHCCCOM'] = '$SHCC -WD $SHCFLAGS $SHCCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o$TARGET $SOURCES' env['CPPDEFPREFIX'] = '-D' env['CPPDEFSUFFIX'] = '' env['INCPREFIX'] = '-I' diff --git a/src/engine/SCons/Tool/cc.py b/src/engine/SCons/Tool/cc.py index c4114b7..62b945f 100644 --- a/src/engine/SCons/Tool/cc.py +++ b/src/engine/SCons/Tool/cc.py @@ -63,10 +63,12 @@ def generate(env): env['CC'] = 'cc' env['CCFLAGS'] = SCons.Util.CLVar('') - env['CCCOM'] = '$CC -o $TARGET -c $CCFLAGS $_CCCOMCOM $SOURCES' + env['CFLAGS'] = SCons.Util.CLVar('') + env['CCCOM'] = '$CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES' env['SHCC'] = '$CC' env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS') - env['SHCCCOM'] = '$SHCC -o $TARGET -c $SHCCFLAGS $_CCCOMCOM $SOURCES' + env['SHCFLAGS'] = SCons.Util.CLVar('$CFLAGS') + env['SHCCCOM'] = '$SHCC -o $TARGET -c $SHCFLAGS $SHCCFLAGS $_CCCOMCOM $SOURCES' env['CPPDEFPREFIX'] = '-D' env['CPPDEFSUFFIX'] = '' diff --git a/src/engine/SCons/Tool/cc.xml b/src/engine/SCons/Tool/cc.xml index 84980db..0ebaf14 100644 --- a/src/engine/SCons/Tool/cc.xml +++ b/src/engine/SCons/Tool/cc.xml @@ -18,9 +18,10 @@ The C compiler. <cvar name="CCCOM"> <summary> -The command line used to compile a C source file to a (static) object file. -Any options specified in the &cv-CCFLAGS; and &cv-CPPFLAGS; construction variables -are included on this command line. +The command line used to compile a C source file to a (static) object +file. Any options specified in the &cv-CFLAGS;, &cv-CCFLAGS; and +&cv-CPPFLAGS; construction variables are included on this command +line. </summary> </cvar> @@ -38,7 +39,13 @@ env = Environment(CCCOMSTR = "Compiling static object $TARGET") <cvar name="CCFLAGS"> <summary> -General options that are passed to the C compiler. +General options that are passed to the C and C++ compilers. +</summary> +</cvar> + +<cvar name="CFLAGS"> +<summary> +General options that are passed to the C compiler (C only; not C++). </summary> </cvar> @@ -92,7 +99,7 @@ The C compiler used for generating shared-library objects. <summary> The command line used to compile a C source file to a shared-library object file. -Any options specified in the &cv-SHCCFLAGS; and &cv-CPPFLAGS; construction variables +Any options specified in the &cv-SHCFLAGS;, &cv-SHCCFLAGS; and &cv-CPPFLAGS; construction variables are included on this command line. </summary> </cvar> @@ -111,7 +118,14 @@ env = Environment(SHCCCOMSTR = "Compiling shared object $TARGET") <cvar name="SHCCFLAGS"> <summary> -Options that are passed to the C compiler +Options that are passed to the C and C++ compilers +to generate shared-library objects. +</summary> +</cvar> + +<cvar name="SHCFLAGS"> +<summary> +Options that are passed to the C compiler (only; not C++) to generate shared-library objects. </summary> </cvar> diff --git a/src/engine/SCons/Tool/f90.py b/src/engine/SCons/Tool/f90.py index 2e2b5b1..cb450b6 100644 --- a/src/engine/SCons/Tool/f90.py +++ b/src/engine/SCons/Tool/f90.py @@ -119,6 +119,10 @@ def add_to_env(env): def generate(env): fortran.add_to_env(env) + + import f77 + f77.add_to_env(env) + add_to_env(env) env['_FORTRAND'] = env.Detect(compilers) or 'f90' diff --git a/src/engine/SCons/Tool/f95.py b/src/engine/SCons/Tool/f95.py index 9cd2664..7adc80b 100644 --- a/src/engine/SCons/Tool/f95.py +++ b/src/engine/SCons/Tool/f95.py @@ -119,6 +119,13 @@ def add_to_env(env): def generate(env): fortran.add_to_env(env) + + import f77 + f77.add_to_env(env) + + import f90 + f90.add_to_env(env) + add_to_env(env) env['_FORTRAND'] = env.Detect(compilers) or 'f95' diff --git a/src/engine/SCons/Tool/icc.py b/src/engine/SCons/Tool/icc.py index 20bf17c..90dece7 100644 --- a/src/engine/SCons/Tool/icc.py +++ b/src/engine/SCons/Tool/icc.py @@ -40,7 +40,7 @@ def generate(env): cc.generate(env) env['CC'] = 'icc' - env['CCCOM'] = '$CC $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c $SOURCES /Fo$TARGET' + env['CCCOM'] = '$CC $CFLAGS $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c $SOURCES /Fo$TARGET' env['CXXCOM'] = '$CXX $CXXFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c $SOURCES /Fo$TARGET' env['CPPDEFPREFIX'] = '/D' env['CPPDEFSUFFIX'] = '' diff --git a/src/engine/SCons/Tool/lex.py b/src/engine/SCons/Tool/lex.py index 3331f6c..31f21a9 100644 --- a/src/engine/SCons/Tool/lex.py +++ b/src/engine/SCons/Tool/lex.py @@ -33,23 +33,60 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" +import os.path + +import string + import SCons.Action import SCons.Tool import SCons.Util LexAction = SCons.Action.Action("$LEXCOM", "$LEXCOMSTR") +def lexEmitter(target, source, env): + sourceBase, sourceExt = os.path.splitext(SCons.Util.to_String(source[0])) + + if sourceExt == ".lm": # If using Objective-C + target = [sourceBase + ".m"] # the extension is ".m". + + # This emitter essentially tries to add to the target all extra + # files generated by flex. + + # Different options that are used to trigger the creation of extra files. + fileGenOptions = ["--header-file=", "--tables-file="] + + for option in SCons.Util.CLVar(env.subst("$LEXFLAGS")): + for fileGenOption in fileGenOptions: + l = len(fileGenOption) + if option[:l] == fileGenOption: + # A file generating option is present, so add the + # file name to the target list. + fileName = string.strip(option[l:]) + target.append(fileName) + return (target, source) + def generate(env): """Add Builders and construction variables for lex to an Environment.""" c_file, cxx_file = SCons.Tool.createCFileBuilders(env) - c_file.add_action('.l', LexAction) - c_file.add_action('.lex', LexAction) - cxx_file.add_action('.ll', LexAction) + # C + c_file.add_action(".l", LexAction) + c_file.add_emitter(".l", lexEmitter) + + c_file.add_action(".lex", LexAction) + c_file.add_emitter(".lex", lexEmitter) + + # Objective-C + cxx_file.add_action(".lm", LexAction) + cxx_file.add_emitter(".lm", lexEmitter) + + # C++ + cxx_file.add_action(".ll", LexAction) + cxx_file.add_emitter(".ll", lexEmitter) + + env["LEX"] = env.Detect("flex") or "lex" + env["LEXFLAGS"] = SCons.Util.CLVar("") + env["LEXCOM"] = "$LEX $LEXFLAGS -t $SOURCES > $TARGET" - env['LEX'] = env.Detect('flex') or 'lex' - env['LEXFLAGS'] = SCons.Util.CLVar('') - env['LEXCOM'] = '$LEX $LEXFLAGS -t $SOURCES > $TARGET' - def exists(env): - return env.Detect(['flex', 'lex']) + return env.Detect(["flex", "lex"]) diff --git a/src/engine/SCons/Tool/mingw.py b/src/engine/SCons/Tool/mingw.py index d679b53..0639535 100644 --- a/src/engine/SCons/Tool/mingw.py +++ b/src/engine/SCons/Tool/mingw.py @@ -145,7 +145,7 @@ def generate(env): env['RCINCFLAGS'] = '$( ${_concat(RCINCPREFIX, CPPPATH, RCINCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' env['RCINCPREFIX'] = '--include-dir ' env['RCINCSUFFIX'] = '' - env['RCCOM'] = '$RC $_CPPDEFFLAGS $RCINCFLAGS ${RCINCPREFIX}${SOURCE.dir} $RCFLAGS -i $SOURCE -o $TARGET' + env['RCCOM'] = '$RC $_CPPDEFFLAGS $RCINCFLAGS ${RCINCPREFIX} ${SOURCE.dir} $RCFLAGS -i $SOURCE -o $TARGET' env['BUILDERS']['RES'] = res_builder # Some setting from the platform also have to be overridden: diff --git a/src/engine/SCons/Tool/msvc.py b/src/engine/SCons/Tool/msvc.py index 80b5926..7e476f5 100644 --- a/src/engine/SCons/Tool/msvc.py +++ b/src/engine/SCons/Tool/msvc.py @@ -687,10 +687,12 @@ def generate(env): env['CCCOMFLAGS'] = '$CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c $SOURCES /Fo$TARGET $CCPCHFLAGS $CCPDBFLAGS' env['CC'] = 'cl' env['CCFLAGS'] = SCons.Util.CLVar('/nologo') - env['CCCOM'] = '$CC $CCFLAGS $CCCOMFLAGS' + env['CFLAGS'] = SCons.Util.CLVar('') + env['CCCOM'] = '$CC $CFLAGS $CCFLAGS $CCCOMFLAGS' env['SHCC'] = '$CC' env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS') - env['SHCCCOM'] = '$SHCC $SHCCFLAGS $CCCOMFLAGS' + env['SHCFLAGS'] = SCons.Util.CLVar('$CFLAGS') + env['SHCCCOM'] = '$SHCC $SHCFLAGS $SHCCFLAGS $CCCOMFLAGS' env['CXX'] = '$CC' env['CXXFLAGS'] = SCons.Util.CLVar('$CCFLAGS $( /TP $)') env['CXXCOM'] = '$CXX $CXXFLAGS $CCCOMFLAGS' diff --git a/src/engine/SCons/Tool/mwcc.py b/src/engine/SCons/Tool/mwcc.py index 52f55ee..a1ede44 100644 --- a/src/engine/SCons/Tool/mwcc.py +++ b/src/engine/SCons/Tool/mwcc.py @@ -171,14 +171,15 @@ def generate(env): env['CCCOMFLAGS'] = '$CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -nolink -o $TARGET $SOURCES' env['CC'] = 'mwcc' - env['CCCOM'] = '$CC $CCFLAGS $CCCOMFLAGS' + env['CCCOM'] = '$CC $CFLAGS $CCFLAGS $CCCOMFLAGS' env['CXX'] = 'mwcc' env['CXXCOM'] = '$CXX $CXXFLAGS $CCCOMFLAGS' env['SHCC'] = '$CC' env['SHCCFLAGS'] = '$CCFLAGS' - env['SHCCCOM'] = '$SHCC $SHCCFLAGS $CCCOMFLAGS' + env['SHCFLAGS'] = '$CFLAGS' + env['SHCCCOM'] = '$SHCC $SHCFLAGS $SHCCFLAGS $CCCOMFLAGS' env['SHCXX'] = '$CXX' env['SHCXXFLAGS'] = '$CXXFLAGS' diff --git a/src/engine/SCons/Tool/qt.py b/src/engine/SCons/Tool/qt.py index 5077901..4d290c7 100644 --- a/src/engine/SCons/Tool/qt.py +++ b/src/engine/SCons/Tool/qt.py @@ -313,8 +313,8 @@ def generate(env): env['BUILDERS']['Uic'] = uicBld env['BUILDERS']['Moc'] = mocBld static_obj, shared_obj = SCons.Tool.createObjBuilders(env) - static_obj.src_builder.append('Uic') - shared_obj.src_builder.append('Uic') + static_obj.add_src_builder('Uic') + shared_obj.add_src_builder('Uic') # We use the emitters of Program / StaticLibrary / SharedLibrary # to scan for moc'able files diff --git a/src/engine/SCons/Tool/yacc.py b/src/engine/SCons/Tool/yacc.py index b8916ae..cbccb29 100644 --- a/src/engine/SCons/Tool/yacc.py +++ b/src/engine/SCons/Tool/yacc.py @@ -34,6 +34,7 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os.path +import string import SCons.Defaults import SCons.Tool @@ -42,31 +43,64 @@ import SCons.Util YaccAction = SCons.Action.Action("$YACCCOM", "$YACCCOMSTR") def _yaccEmitter(target, source, env, ysuf, hsuf): + flags = SCons.Util.CLVar(env.subst("$YACCFLAGS")) + targetBase, targetExt = os.path.splitext(SCons.Util.to_String(target[0])) + + if '.ym' in ysuf: # If using Objective-C + target = [targetBase + ".m"] # the extension is ".m". + + # 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 SCons.Util.CLVar(env.subst("$YACCFLAGS")): + # or .hpp file with the same name as the .c or .cpp output file. + if '-d' in flags: + target.append(targetBase + env.subst(hsuf)) + + # If -g is specified on the command line, yacc will emit a .vcg + # file with the same base name as the .y, .yacc, .ym or .yy file. + if "-g" in flags: base, ext = os.path.splitext(SCons.Util.to_String(source[0])) - if ext in ysuf: - base, ext = os.path.splitext(SCons.Util.to_String(target[0])) - target.append(base + env.subst(hsuf)) + target.append(base + env.subst("$YACCVCGFILESUFFIX")) + + # With --defines and --graph, the name of the file is totally defined + # in the options. + fileGenOptions = ["--defines=", "--graph="] + for option in flags: + for fileGenOption in fileGenOptions: + l = len(fileGenOption) + if option[:l] == fileGenOption: + # A file generating option is present, so add the file + # name to the list of targets. + fileName = string.strip(option[l:]) + target.append(fileName) + return (target, source) def yEmitter(target, source, env): return _yaccEmitter(target, source, env, ['.y', '.yacc'], '$YACCHFILESUFFIX') +def ymEmitter(target, source, env): + return _yaccEmitter(target, source, env, ['.ym'], '$YACCHFILESUFFIX') + def yyEmitter(target, source, env): return _yaccEmitter(target, source, env, ['.yy'], '$YACCHXXFILESUFFIX') def generate(env): """Add Builders and construction variables for yacc to an Environment.""" c_file, cxx_file = SCons.Tool.createCFileBuilders(env) - + + # C c_file.add_action('.y', YaccAction) - c_file.add_action('.yacc', YaccAction) - cxx_file.add_action('.yy', YaccAction) c_file.add_emitter('.y', yEmitter) + + c_file.add_action('.yacc', YaccAction) c_file.add_emitter('.yacc', yEmitter) + + # Objective-C + c_file.add_action('.ym', YaccAction) + c_file.add_emitter('.ym', ymEmitter) + + # C++ + cxx_file.add_action('.yy', YaccAction) cxx_file.add_emitter('.yy', yyEmitter) env['YACC'] = env.Detect('bison') or 'yacc' @@ -74,6 +108,7 @@ def generate(env): env['YACCCOM'] = '$YACC $YACCFLAGS -o $TARGET $SOURCES' env['YACCHFILESUFFIX'] = '.h' env['YACCHXXFILESUFFIX'] = '.hpp' + env['YACCVCGFILESUFFIX'] = '.vcg' def exists(env): return env.Detect(['bison', 'yacc']) diff --git a/src/engine/SCons/Tool/yacc.xml b/src/engine/SCons/Tool/yacc.xml index 48bb323..8a23d0b 100644 --- a/src/engine/SCons/Tool/yacc.xml +++ b/src/engine/SCons/Tool/yacc.xml @@ -79,3 +79,20 @@ The default value is <filename>.hpp</filename>. </summary> </cvar> + +<cvar name="YACCVCGFILESUFFIX"> +<summary> +The suffix of the file +containing the VCG grammar automaton definition +when the +<option>--graph=</option> +option is used. +Note that setting this variable does not cause +the parser generator to generate a VCG +file with the specified suffix, +it exists to allow you to specify +what suffix the parser generator will use of its own accord. +The default value is +<filename>.vcg</filename>. +</summary> +</cvar> |