summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2004-05-03 13:58:44 (GMT)
committerSteven Knight <knight@baldmt.com>2004-05-03 13:58:44 (GMT)
commit3fef0c7ddcea8790e9ff097036101450781ec906 (patch)
treee2f60398593bd1b100aa33c67e99ba988a70508e /src
parent8c2c140e7ffb05c2201b35326db04abb864f4c98 (diff)
downloadSCons-3fef0c7ddcea8790e9ff097036101450781ec906.zip
SCons-3fef0c7ddcea8790e9ff097036101450781ec906.tar.gz
SCons-3fef0c7ddcea8790e9ff097036101450781ec906.tar.bz2
Have ParseConfig() support the -Wl option.
Diffstat (limited to 'src')
-rw-r--r--src/CHANGES.txt3
-rw-r--r--src/engine/SCons/Environment.py47
-rw-r--r--src/engine/SCons/EnvironmentTests.py11
3 files changed, 39 insertions, 22 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index 3e7fa91..3d3d4ce 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -104,6 +104,9 @@ RELEASE 0.96 - XXX
- Speed up turning file system Nodes into strings by caching the
values after we're finished reading the SConscript files.
+ - Have ParseConfig() recognize and supporting adding the -Wa, -Wl,
+ and -Wp, flags to ASFLAGS, LINKFLAGS and CPPFLAGS, respectively.
+
From Gary Oberbrunner:
- Add a --debug=presub option to print actions prior to substitution.
diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py
index d214e9b..d4279d1 100644
--- a/src/engine/SCons/Environment.py
+++ b/src/engine/SCons/Environment.py
@@ -701,40 +701,47 @@ class Base:
def ParseConfig(self, command, function=None):
"""
Use the specified function to parse the output of the command
- in order to modify the current environment. The 'command'
- can be a string or a list of strings representing a command and
+ in order to modify the current environment. The 'command' can
+ be a string or a list of strings representing a command and
it's arguments. 'Function' is an optional argument that takes
the environment and the output of the command. If no function is
specified, the output will be treated as the output of a typical
- 'X-config' command (i.e. gtk-config) and used to set the CPPPATH,
- LIBPATH, LIBS, and CCFLAGS variables.
+ 'X-config' command (i.e. gtk-config) and used to append to the
+ ASFLAGS, CCFLAGS, CPPFLAGS, CPPPATH, LIBPATH, LIBS, LINKFLAGS
+ and CCFLAGS variables.
"""
# the default parse function
def parse_conf(env, output):
dict = {
- 'CPPPATH' : [],
- 'LIBPATH' : [],
- 'LIBS' : [],
- 'CCFLAGS' : [],
+ 'ASFLAGS' : [],
+ 'CCFLAGS' : [],
+ 'CPPFLAGS' : [],
+ 'CPPPATH' : [],
+ 'LIBPATH' : [],
+ 'LIBS' : [],
+ 'LINKFLAGS' : [],
}
static_libs = []
params = string.split(output)
for arg in params:
- switch = arg[0:1]
- opt = arg[1:2]
- if switch == '-':
- if opt == 'L':
- dict['LIBPATH'].append(arg[2:])
- elif opt == 'l':
- dict['LIBS'].append(arg[2:])
- elif opt == 'I':
- dict['CPPPATH'].append(arg[2:])
- else:
- dict['CCFLAGS'].append(arg)
- else:
+ if arg[0] != '-':
static_libs.append(arg)
+ elif arg[:2] == '-L':
+ dict['LIBPATH'].append(arg[2:])
+ elif arg[:2] == '-l':
+ dict['LIBS'].append(arg[2:])
+ elif arg[:2] == '-I':
+ dict['CPPPATH'].append(arg[2:])
+ elif arg[:4] == '-Wa,':
+ dict['ASFLAGS'].append(arg)
+ elif arg[:4] == '-Wl,':
+ dict['LINKFLAGS'].append(arg)
+ elif arg[:4] == '-Wp,':
+ dict['CPPFLAGS'].append(arg)
+ else:
+ dict['CCFLAGS'].append(arg)
apply(env.Append, (), dict)
return static_libs
diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py
index d141d49..8bab246 100644
--- a/src/engine/SCons/EnvironmentTests.py
+++ b/src/engine/SCons/EnvironmentTests.py
@@ -1302,10 +1302,13 @@ class EnvironmentTestCase(unittest.TestCase):
def test_ParseConfig(self):
"""Test the ParseConfig() method"""
- env = Environment(COMMAND='command',
+ env = Environment(ASFLAGS='assembler',
+ COMMAND='command',
+ CPPFLAGS=[''],
CPPPATH='string',
LIBPATH=['list'],
LIBS='',
+ LINKFLAGS=[''],
CCFLAGS=[''])
save_command = []
orig_popen = os.popen
@@ -1314,16 +1317,20 @@ class EnvironmentTestCase(unittest.TestCase):
class fake_file:
def read(self):
return "-I/usr/include/fum -Ibar -X\n" + \
- "-L/usr/fax -Lfoo -lxxx abc"
+ "-L/usr/fax -Lfoo -lxxx " + \
+ "-Wa,-as -Wl,-link -Wp,-cpp abc"
return fake_file()
try:
os.popen = my_popen
libs = env.ParseConfig("fake $COMMAND")
assert save_command == ['fake command'], save_command
assert libs == ['abc'], libs
+ assert env['ASFLAGS'] == ['assembler', '-Wa,-as'], env['ASFLAGS']
assert env['CPPPATH'] == ['string', '/usr/include/fum', 'bar'], env['CPPPATH']
+ assert env['CPPFLAGS'] == ['', '-Wp,-cpp'], env['CPPFLAGS']
assert env['LIBPATH'] == ['list', '/usr/fax', 'foo'], env['LIBPATH']
assert env['LIBS'] == ['xxx'], env['LIBS']
+ assert env['LINKFLAGS'] == ['', '-Wl,-link'], env['LINKFLAGS']
assert env['CCFLAGS'] == ['', '-X'], env['CCFLAGS']
finally:
os.popen = orig_popen