Make ncval-annotate and ncval-stubout executable
[nativeclient.git] / site_scons / site_tools / target_platform_linux.py
blob775a033c943b5d85879afeaff5ee3ce6db826de8
1 #!/usr/bin/python2.4
2 # Copyright 2008, Google Inc.
3 # All rights reserved.
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are
7 # met:
9 # * Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 # * Redistributions in binary form must reproduce the above
12 # copyright notice, this list of conditions and the following disclaimer
13 # in the documentation and/or other materials provided with the
14 # distribution.
15 # * Neither the name of Google Inc. nor the names of its
16 # contributors may be used to endorse or promote products derived from
17 # this software without specific prior written permission.
19 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 """Build tool setup for Linux.
33 This module is a SCons tool which should be include in the topmost windows
34 environment.
35 It is used as follows:
36 env = base_env.Clone(tools = ['component_setup'])
37 linux_env = base_env.Clone(tools = ['target_platform_linux'])
38 """
41 def ComponentPlatformSetup(env, builder_name):
42 """Hook to allow platform to modify environment inside a component builder.
44 Args:
45 env: Environment to modify
46 builder_name: Name of the builder
47 """
48 if env.get('ENABLE_EXCEPTIONS'):
49 env.FilterOut(CCFLAGS=['-fno-exceptions'])
50 env.Append(CCFLAGS=['-fexceptions'])
52 #------------------------------------------------------------------------------
55 def generate(env):
56 # NOTE: SCons requires the use of this name, which fails gpylint.
57 """SCons entry point for this tool."""
59 # Use g++
60 env.Tool('g++')
61 env.Tool('gcc')
62 env.Tool('gnulink')
63 env.Tool('ar')
64 env.Tool('as')
66 # Set target platform bits
67 env.SetBits('linux', 'posix')
69 env.Replace(
70 TARGET_PLATFORM='LINUX',
71 COMPONENT_PLATFORM_SETUP=ComponentPlatformSetup,
72 CCFLAG_INCLUDE='-include', # Command line option to include a header
74 # Code coverage related.
75 COVERAGE_CCFLAGS=['-ftest-coverage', '-fprofile-arcs'],
76 COVERAGE_LIBS='gcov',
77 COVERAGE_STOP_CMD=[
78 '$COVERAGE_MCOV --directory "$TARGET_ROOT" --output "$TARGET"',
79 ('$COVERAGE_GENHTML --output-directory $COVERAGE_HTML_DIR '
80 '$COVERAGE_OUTPUT_FILE'),
84 env.Append(
85 HOST_PLATFORMS=['LINUX'],
86 CPPDEFINES=['OS_LINUX=OS_LINUX'],
88 # Settings for debug
89 CCFLAGS_DEBUG=[
90 '-O0', # turn off optimizations
91 '-g', # turn on debugging info
94 # Settings for optimized
95 CCFLAGS_OPTIMIZED=['-O2'],
97 # Settings for component_builders
98 COMPONENT_LIBRARY_LINK_SUFFIXES=['.so', '.a'],
99 COMPONENT_LIBRARY_DEBUG_SUFFIXES=[],