diff options
| author | Steven Knight <knight@baldmt.com> | 2002-06-27 15:00:50 (GMT) |
|---|---|---|
| committer | Steven Knight <knight@baldmt.com> | 2002-06-27 15:00:50 (GMT) |
| commit | 0cd4837fd6a10791576c5dcafa09514d47c0fc97 (patch) | |
| tree | fc4c551de3335992c11ccf2fdfde73d4d731a9bd /src/engine | |
| parent | 5dd473bc401492d93a372b03965f2718b05426b8 (diff) | |
| download | SCons-0cd4837fd6a10791576c5dcafa09514d47c0fc97.zip SCons-0cd4837fd6a10791576c5dcafa09514d47c0fc97.tar.gz SCons-0cd4837fd6a10791576c5dcafa09514d47c0fc97.tar.bz2 | |
Add support for assembly language (.s and .S) Tools. Still needs support for building shared objects.
Diffstat (limited to 'src/engine')
| -rw-r--r-- | src/engine/MANIFEST.in | 3 | ||||
| -rw-r--r-- | src/engine/SCons/Defaults.py | 4 | ||||
| -rw-r--r-- | src/engine/SCons/Platform/cygwin.py | 15 | ||||
| -rw-r--r-- | src/engine/SCons/Platform/posix.py | 15 | ||||
| -rw-r--r-- | src/engine/SCons/Platform/win32.py | 14 | ||||
| -rw-r--r-- | src/engine/SCons/Tool/.aeignore | 5 | ||||
| -rw-r--r-- | src/engine/SCons/Tool/gas.py | 61 | ||||
| -rw-r--r-- | src/engine/SCons/Tool/masm.py | 61 | ||||
| -rw-r--r-- | src/engine/SCons/Tool/nasm.py | 61 |
9 files changed, 233 insertions, 6 deletions
diff --git a/src/engine/MANIFEST.in b/src/engine/MANIFEST.in index b67d63a..9a05787 100644 --- a/src/engine/MANIFEST.in +++ b/src/engine/MANIFEST.in @@ -29,13 +29,16 @@ SCons/Tool/dvipdf.py SCons/Tool/dvips.py SCons/Tool/g++.py SCons/Tool/g77.py +SCons/Tool/gas.py SCons/Tool/gcc.py SCons/Tool/gnulink.py SCons/Tool/latex.py SCons/Tool/lex.py SCons/Tool/lib.py +SCons/Tool/masm.py SCons/Tool/mslink.py SCons/Tool/msvc.py +SCons/Tool/nasm.py SCons/Tool/pdflatex.py SCons/Tool/pdftex.py SCons/Tool/tex.py diff --git a/src/engine/SCons/Defaults.py b/src/engine/SCons/Defaults.py index 778517d..2a616c8 100644 --- a/src/engine/SCons/Defaults.py +++ b/src/engine/SCons/Defaults.py @@ -116,11 +116,15 @@ CAction = SCons.Action.Action([ StaticCheck, "$CCCOM" ]) ShCAction = SCons.Action.Action([ SharedCheck, "$SHCCCOM" ]) CXXAction = SCons.Action.Action([ StaticCheck, "$CXXCOM" ]) ShCXXAction = SCons.Action.Action([ SharedCheck, "$SHCXXCOM" ]) + F77Action = SCons.Action.Action([ StaticCheck, "$F77COM" ]) ShF77Action = SCons.Action.Action([ SharedCheck, "$SHF77COM" ]) F77PPAction = SCons.Action.Action([ StaticCheck, "$F77PPCOM" ]) ShF77PPAction = SCons.Action.Action([ SharedCheck, "$SHF77PPCOM" ]) +ASAction = SCons.Action.Action([ StaticCheck, "$ASCOM" ]) +ASPPAction = SCons.Action.Action([ StaticCheck, "$ASPPCOM" ]) + def StaticObject(): """A function for generating the static object Builder.""" diff --git a/src/engine/SCons/Platform/cygwin.py b/src/engine/SCons/Platform/cygwin.py index 6a21ae9..8858dd1 100644 --- a/src/engine/SCons/Platform/cygwin.py +++ b/src/engine/SCons/Platform/cygwin.py @@ -32,9 +32,20 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" +import SCons.Util + def tool_list(): - return ['ar', 'dvipdf', 'dvips', 'g++', 'g77', 'gcc', 'latex', 'lex', - 'pdflatex', 'pdftex', 'tex', 'yacc', 'gnulink' ] + as = SCons.Util.WhereIs('as') + nasm = SCons.Util.WhereIs('nasm') + if nasm and not as: + assembler = 'nasm' + else: + assembler = 'gas' + return ['ar', 'dvipdf', 'dvips', + 'g++', 'g77', 'gcc', 'gnulink', + 'latex', 'lex', + 'pdflatex', 'pdftex', 'tex', 'yacc', + assembler] def generate(env): if not env.has_key('ENV'): diff --git a/src/engine/SCons/Platform/posix.py b/src/engine/SCons/Platform/posix.py index 3d20263..79adebd 100644 --- a/src/engine/SCons/Platform/posix.py +++ b/src/engine/SCons/Platform/posix.py @@ -32,9 +32,20 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" +import SCons.Util + def tool_list(): - return ['ar', 'dvipdf', 'dvips', 'g++', 'g77', 'gcc', 'latex', 'lex', - 'pdflatex', 'pdftex', 'tex', 'yacc', 'gnulink' ] + as = SCons.Util.WhereIs('as') + nasm = SCons.Util.WhereIs('nasm') + if nasm and not as: + assembler = 'nasm' + else: + assembler = 'gas' + return ['ar', 'dvipdf', 'dvips', + 'g++', 'g77', 'gcc', 'gnulink', + 'latex', 'lex', + 'pdflatex', 'pdftex', 'tex', 'yacc', + assembler] def generate(env): if not env.has_key('ENV'): diff --git a/src/engine/SCons/Platform/win32.py b/src/engine/SCons/Platform/win32.py index 9bcea18..957aead 100644 --- a/src/engine/SCons/Platform/win32.py +++ b/src/engine/SCons/Platform/win32.py @@ -32,9 +32,19 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" +import SCons.Util + def tool_list(): - return ['dvipdf', 'latex', 'dvips', 'g77', 'lex', 'lib', 'msvc', - 'pdflatex', 'pdftex', 'tex', 'yacc', 'mslink' ] + masm = SCons.Util.WhereIs('ml') + nasm = SCons.Util.WhereIs('nasm') + if nasm and not masm: + assembler = 'nasm' + else: + assembler = 'masm' + return ['dvipdf', 'dvips', 'g77', + 'latex', 'lex', 'lib', 'mslink', 'msvc', + 'pdflatex', 'pdftex', 'tex', 'yacc', + assembler] def generate(env): if not env.has_key('ENV'): diff --git a/src/engine/SCons/Tool/.aeignore b/src/engine/SCons/Tool/.aeignore new file mode 100644 index 0000000..22ebd62 --- /dev/null +++ b/src/engine/SCons/Tool/.aeignore @@ -0,0 +1,5 @@ +*,D +*.pyc +.*.swp +.consign +.sconsign diff --git a/src/engine/SCons/Tool/gas.py b/src/engine/SCons/Tool/gas.py new file mode 100644 index 0000000..6fc3d8c --- /dev/null +++ b/src/engine/SCons/Tool/gas.py @@ -0,0 +1,61 @@ +"""SCons.Tool.as + +Tool-specific initialization for as, the Gnu assembler. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002 Steven Knight +# +# 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 SCons.Defaults +import SCons.Tool + +ASSuffixes = ['.s', '.asm', '.ASM'] +ASPPSuffixes = ['.spp', '.SPP'] +if os.path.normcase('.s') == os.path.normcase('.S'): + ASSuffixes.extend(['.S']) +else: + ASPPSuffixes.extend(['.S']) + +def generate(env, platform): + """Add Builders and construction variables for as to an Environment.""" + static_obj, shared_obj = SCons.Tool.createObjBuilders(env) + + for suffix in ASSuffixes: + static_obj.add_action(suffix, SCons.Defaults.ASAction) + + for suffix in ASPPSuffixes: + static_obj.add_action(suffix, SCons.Defaults.ASPPAction) + + env['AS'] = 'as' + env['ASFLAGS'] = '' + env['ASCOM'] = '$AS $ASFLAGS -o $TARGET $SOURCES' + env['ASPPCOM'] = '$CC $ASFLAGS $CPPFLAGS -o $TARGET $SOURCES' diff --git a/src/engine/SCons/Tool/masm.py b/src/engine/SCons/Tool/masm.py new file mode 100644 index 0000000..e88266d --- /dev/null +++ b/src/engine/SCons/Tool/masm.py @@ -0,0 +1,61 @@ +"""SCons.Tool.masm + +Tool-specific initialization for the Microsoft Assembler. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002 Steven Knight +# +# 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 SCons.Defaults +import SCons.Tool + +ASSuffixes = ['.s', '.asm', '.ASM'] +ASPPSuffixes = ['.spp', '.SPP'] +if os.path.normcase('.s') == os.path.normcase('.S'): + ASSuffixes.extend(['.S']) +else: + ASPPSuffixes.extend(['.S']) + +def generate(env, platform): + """Add Builders and construction variables for masm to an Environment.""" + static_obj, shared_obj = SCons.Tool.createObjBuilders(env) + + for suffix in ASSuffixes: + static_obj.add_action(suffix, SCons.Defaults.ASAction) + + for suffix in ASPPSuffixes: + static_obj.add_action(suffix, SCons.Defaults.ASPPAction) + + env['AS'] = 'ml' + env['ASFLAGS'] = '/nologo' + env['ASCOM'] = '$AS $ASFLAGS /c /Fo$TARGET $SOURCES' + env['ASPPCOM'] = '$CC $ASFLAGS $CPPFLAGS /c /Fo$TARGET $SOURCES' diff --git a/src/engine/SCons/Tool/nasm.py b/src/engine/SCons/Tool/nasm.py new file mode 100644 index 0000000..b757a53 --- /dev/null +++ b/src/engine/SCons/Tool/nasm.py @@ -0,0 +1,61 @@ +"""SCons.Tool.nasm + +Tool-specific initialization for nasm, the famous Netwide Assembler. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002 Steven Knight +# +# 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 SCons.Defaults +import SCons.Tool + +ASSuffixes = ['.s', '.asm', '.ASM'] +ASPPSuffixes = ['.spp', '.SPP'] +if os.path.normcase('.s') == os.path.normcase('.S'): + ASSuffixes.extend(['.S']) +else: + ASPPSuffixes.extend(['.S']) + +def generate(env, platform): + """Add Builders and construction variables for nasm to an Environment.""" + static_obj, shared_obj = SCons.Tool.createObjBuilders(env) + + for suffix in ASSuffixes: + static_obj.add_action(suffix, SCons.Defaults.ASAction) + + for suffix in ASPPSuffixes: + static_obj.add_action(suffix, SCons.Defaults.ASPPAction) + + env['AS'] = 'nasm' + env['ASFLAGS'] = '' + env['ASCOM'] = '$AS $ASFLAGS -o $TARGET $SOURCES' + env['ASPPCOM'] = '$CC $ASFLAGS $CPPFLAGS -c -o $TARGET $SOURCES' |
