diff options
author | Steven Knight <knight@baldmt.com> | 2003-03-13 14:18:35 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2003-03-13 14:18:35 (GMT) |
commit | 71a49faea8b046709ef816aee7b7bb5f9e4a1ccc (patch) | |
tree | 5ebbb790d2e1f160925b8a749029572076e2613b /src/engine/SCons/Tool/mslink.py | |
parent | 739a3fa86075710448e66e6488135b65a9e3f9c4 (diff) | |
download | SCons-71a49faea8b046709ef816aee7b7bb5f9e4a1ccc.zip SCons-71a49faea8b046709ef816aee7b7bb5f9e4a1ccc.tar.gz SCons-71a49faea8b046709ef816aee7b7bb5f9e4a1ccc.tar.bz2 |
Support using construction variables as re-usable, callable command generators. (Charles Crain)
Diffstat (limited to 'src/engine/SCons/Tool/mslink.py')
-rw-r--r-- | src/engine/SCons/Tool/mslink.py | 77 |
1 files changed, 36 insertions, 41 deletions
diff --git a/src/engine/SCons/Tool/mslink.py b/src/engine/SCons/Tool/mslink.py index 6ef1542..fa174e4 100644 --- a/src/engine/SCons/Tool/mslink.py +++ b/src/engine/SCons/Tool/mslink.py @@ -42,44 +42,42 @@ import SCons.Errors import SCons.Util import msvc -from SCons.Platform.win32 import TempFileMunge from SCons.Tool.msvc import get_msdev_paths - -def win32LinkGenerator(env, target, source, for_signature): - args = [ '$LINK', '$LINKFLAGS', '/OUT:%s' % target[0], - '$(', '$_LIBDIRFLAGS', '$)', '$_LIBFLAGS' ] - - if env.has_key('PDB') and env['PDB']: - args.extend(['/PDB:%s'%target[0].File(env['PDB']), '/DEBUG']) - args.extend(map(SCons.Util.to_String, source)) - return TempFileMunge(env, args, for_signature) +def pdbGenerator(env, target, source): + if target and env.has_key('PDB') and env['PDB']: + return ['/PDB:%s'%target[0].File(env['PDB']), '/DEBUG'] -def win32LibGenerator(target, source, env, for_signature): - listCmd = [ "$SHLINK", "$SHLINKFLAGS" ] +def win32ShlinkTargets(target, source, env): + if target: + listCmd = [] + dll = env.FindIxes(target, 'SHLIBPREFIX', 'SHLIBSUFFIX') + if dll: listCmd.append("/out:%s"%dll) - if env.has_key('PDB') and env['PDB']: - listCmd.extend(['/PDB:%s'%target[0].File(env['PDB']), '/DEBUG']) - - dll = env.FindIxes(target, 'SHLIBPREFIX', 'SHLIBSUFFIX') - if dll: listCmd.append("/out:%s"%dll) - - implib = env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX') - if implib: listCmd.append("/implib:%s"%implib) - - listCmd.extend([ '$_LIBDIRFLAGS', '$_LIBFLAGS' ]) + implib = env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX') + if implib: listCmd.append("/implib:%s"%implib) - deffile = env.FindIxes(source, "WIN32DEFPREFIX", "WIN32DEFSUFFIX") - - for src in source: - if src == deffile: - # Treat this source as a .def file. - listCmd.append("/def:%s" % src) - else: - # Just treat it as a generic source file. - listCmd.append(str(src)) - - return TempFileMunge(env, listCmd, for_signature) + return listCmd + else: + # For signature calculation + return '/out:$TARGET' + +def win32ShlinkSources(target, source, env): + if target: + listCmd = [] + + deffile = env.FindIxes(source, "WIN32DEFPREFIX", "WIN32DEFSUFFIX") + for src in source: + if src == deffile: + # Treat this source as a .def file. + listCmd.append("/def:%s" % src) + else: + # Just treat it as a generic source file. + listCmd.append(str(src)) + return listCmd + else: + # For signature calculation + return "$SOURCES" def win32LibEmitter(target, source, env): msvc.validate_vars(env) @@ -120,9 +118,6 @@ def prog_emitter(target, source, env): return (target,source) -ShLibAction = SCons.Action.CommandGenerator(win32LibGenerator) -LinkAction = SCons.Action.CommandGenerator(win32LinkGenerator) - def generate(env, platform): """Add Builders and construction variables for ar to an Environment.""" env['BUILDERS']['SharedLibrary'] = SCons.Defaults.SharedLibrary @@ -130,14 +125,14 @@ def generate(env, platform): env['SHLINK'] = '$LINK' env['SHLINKFLAGS'] = '$LINKFLAGS /dll' - env['SHLINKCOM'] = ShLibAction + env['_SHLINK_TARGETS'] = win32ShlinkTargets + env['_SHLINK_SOURCES'] = win32ShlinkSources + env['SHLINKCOM'] = '${TEMPFILE("$SHLINK $SHLINKFLAGS $_SHLINK_TARGETS $( $_LIBDIRFLAGS $) $_LIBFLAGS $_PDB $_SHLINK_SOURCES")}' env['SHLIBEMITTER']= win32LibEmitter env['LINK'] = 'link' env['LINKFLAGS'] = '/nologo' - if str(platform) == 'cygwin': - env['LINKCOM'] = '$LINK $LINKFLAGS /OUT:$TARGET $( $_LIBDIRFLAGS $) $_LIBFLAGS $SOURCES' - else: - env['LINKCOM'] = LinkAction + env['_PDB'] = pdbGenerator + env['LINKCOM'] = '${TEMPFILE("$LINK $LINKFLAGS /OUT:$TARGET $( $_LIBDIRFLAGS $) $_LIBFLAGS $_PDB $SOURCES")}' env['PROGEMITTER'] = prog_emitter env['LIBDIRPREFIX']='/LIBPATH:' env['LIBDIRSUFFIX']='' |