SConstruct (12178:62b9e0a3b056) SConstruct (12222:6db0fc7407a5)
1# -*- mode:python -*-
2
3# Copyright (c) 2013, 2015, 2016 ARM Limited
4# All rights reserved.
5#
6# The license below extends only to copyright in the software and shall
7# not be construed as granting a license to any other intellectual
8# property including but not limited to intellectual property relating

--- 1393 unchanged lines hidden (view full) ---

1402main.Append(BUILDERS = { 'SwitchingHeader': switching_header_builder })
1403
1404def switching_headers(self, headers, source):
1405 for header in headers:
1406 self.SwitchingHeader(header, source)
1407
1408main.AddMethod(switching_headers, 'SwitchingHeaders')
1409
1# -*- mode:python -*-
2
3# Copyright (c) 2013, 2015, 2016 ARM Limited
4# All rights reserved.
5#
6# The license below extends only to copyright in the software and shall
7# not be construed as granting a license to any other intellectual
8# property including but not limited to intellectual property relating

--- 1393 unchanged lines hidden (view full) ---

1402main.Append(BUILDERS = { 'SwitchingHeader': switching_header_builder })
1403
1404def switching_headers(self, headers, source):
1405 for header in headers:
1406 self.SwitchingHeader(header, source)
1407
1408main.AddMethod(switching_headers, 'SwitchingHeaders')
1409
1410# all-isas -> all-deps -> all-environs -> all_targets
1411main.Alias('#all-isas', [])
1412main.Alias('#all-deps', '#all-isas')
1413
1414# Dummy target to ensure all environments are created before telling
1415# SCons what to actually make (the command line arguments). We attach
1416# them to the dependence graph after the environments are complete.
1417ORIG_BUILD_TARGETS = list(BUILD_TARGETS) # force a copy; gets closure to work.
1418def environsComplete(target, source, env):
1419 for t in ORIG_BUILD_TARGETS:
1420 main.Depends('#all-targets', t)
1421
1422# Each build/* switching_dir attaches its *-environs target to #all-environs.
1423main.Append(BUILDERS = {'CompleteEnvirons' :
1424 Builder(action=MakeAction(environsComplete, None))})
1425main.CompleteEnvirons('#all-environs', [])
1426
1427def doNothing(**ignored): pass
1428main.Append(BUILDERS = {'Dummy': Builder(action=MakeAction(doNothing, None))})
1429
1430# The final target to which all the original targets ultimately get attached.
1431main.Dummy('#all-targets', '#all-environs')
1432BUILD_TARGETS[:] = ['#all-targets']
1433
1434###################################################
1435#
1436# Define build environments for selected configurations.
1437#
1438###################################################
1439
1410###################################################
1411#
1412# Define build environments for selected configurations.
1413#
1414###################################################
1415
1440def variant_name(path):
1441 return os.path.basename(path).lower().replace('_', '-')
1442main['variant_name'] = variant_name
1443main['VARIANT_NAME'] = '${variant_name(BUILDDIR)}'
1444
1445for variant_path in variant_paths:
1446 if not GetOption('silent'):
1447 print "Building in", variant_path
1448
1449 # Make a copy of the build-root environment to use for this config.
1450 env = main.Clone()
1451 env['BUILDDIR'] = variant_path
1452

--- 95 unchanged lines hidden (view full) ---

1548 if env['USE_SSE2']:
1549 env.Append(CCFLAGS=['-msse2'])
1550
1551 # The src/SConscript file sets up the build rules in 'env' according
1552 # to the configured variables. It returns a list of environments,
1553 # one for each variant build (debug, opt, etc.)
1554 SConscript('src/SConscript', variant_dir = variant_path, exports = 'env')
1555
1416for variant_path in variant_paths:
1417 if not GetOption('silent'):
1418 print "Building in", variant_path
1419
1420 # Make a copy of the build-root environment to use for this config.
1421 env = main.Clone()
1422 env['BUILDDIR'] = variant_path
1423

--- 95 unchanged lines hidden (view full) ---

1519 if env['USE_SSE2']:
1520 env.Append(CCFLAGS=['-msse2'])
1521
1522 # The src/SConscript file sets up the build rules in 'env' according
1523 # to the configured variables. It returns a list of environments,
1524 # one for each variant build (debug, opt, etc.)
1525 SConscript('src/SConscript', variant_dir = variant_path, exports = 'env')
1526
1556def pairwise(iterable):
1557 "s -> (s0,s1), (s1,s2), (s2, s3), ..."
1558 a, b = itertools.tee(iterable)
1559 b.next()
1560 return itertools.izip(a, b)
1561
1562variant_names = [variant_name(path) for path in variant_paths]
1563
1564# Create false dependencies so SCons will parse ISAs, establish
1565# dependencies, and setup the build Environments serially. Either
1566# SCons (likely) and/or our SConscripts (possibly) cannot cope with -j
1567# greater than 1. It appears to be standard race condition stuff; it
1568# doesn't always fail, but usually, and the behaviors are different.
1569# Every time I tried to remove this, builds would fail in some
1570# creative new way. So, don't do that. You'll want to, though, because
1571# tests/SConscript takes a long time to make its Environments.
1572for t1, t2 in pairwise(sorted(variant_names)):
1573 main.Depends('#%s-deps' % t2, '#%s-deps' % t1)
1574 main.Depends('#%s-environs' % t2, '#%s-environs' % t1)
1575
1576# base help text
1577Help('''
1578Usage: scons [scons options] [build variables] [target(s)]
1579
1580Extra scons options:
1581%(options)s
1582
1583Global build variables:
1584%(global_vars)s
1585
1586%(local_vars)s
1587''' % help_texts)
1527# base help text
1528Help('''
1529Usage: scons [scons options] [build variables] [target(s)]
1530
1531Extra scons options:
1532%(options)s
1533
1534Global build variables:
1535%(global_vars)s
1536
1537%(local_vars)s
1538''' % help_texts)