ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 1 | # Copyright 2008 the V8 project authors. All rights reserved. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 2 | # Redistribution and use in source and binary forms, with or without |
| 3 | # modification, are permitted provided that the following conditions are |
| 4 | # met: |
| 5 | # |
| 6 | # * Redistributions of source code must retain the above copyright |
| 7 | # notice, this list of conditions and the following disclaimer. |
| 8 | # * Redistributions in binary form must reproduce the above |
| 9 | # copyright notice, this list of conditions and the following |
| 10 | # disclaimer in the documentation and/or other materials provided |
| 11 | # with the distribution. |
| 12 | # * Neither the name of Google Inc. nor the names of its |
| 13 | # contributors may be used to endorse or promote products derived |
| 14 | # from this software without specific prior written permission. |
| 15 | # |
| 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | |
| 28 | import platform |
kasper.lund | 212ac23 | 2008-07-16 07:07:30 +0000 | [diff] [blame] | 29 | import re |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 30 | import sys |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 31 | import os |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 32 | from os.path import join, dirname, abspath |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 33 | from types import DictType, StringTypes |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 34 | root_dir = dirname(File('SConstruct').rfile().abspath) |
| 35 | sys.path.append(join(root_dir, 'tools')) |
ager@chromium.org | c27e4e7 | 2008-09-04 13:52:27 +0000 | [diff] [blame] | 36 | import js2c, utils |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 37 | |
| 38 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 39 | LIBRARY_FLAGS = { |
| 40 | 'all': { |
| 41 | 'CPPDEFINES': ['ENABLE_LOGGING_AND_PROFILING'] |
| 42 | }, |
| 43 | 'gcc': { |
| 44 | 'all': { |
kasperl@chromium.org | 41044eb | 2008-10-06 08:24:46 +0000 | [diff] [blame] | 45 | 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 46 | 'CXXFLAGS': ['$CCFLAGS', '-fno-rtti', '-fno-exceptions'], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 47 | }, |
| 48 | 'mode:debug': { |
| 49 | 'CCFLAGS': ['-g', '-O0'], |
| 50 | 'CPPDEFINES': ['ENABLE_DISASSEMBLER', 'DEBUG'] |
| 51 | }, |
| 52 | 'mode:release': { |
ager@chromium.org | ddb913d | 2009-01-27 10:01:48 +0000 | [diff] [blame] | 53 | 'CCFLAGS': ['-O3', '-fomit-frame-pointer', '-fdata-sections', '-ffunction-sections'] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 54 | }, |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 55 | 'os:linux': { |
| 56 | 'CCFLAGS': ['-ansi'], |
| 57 | }, |
| 58 | 'os:macos': { |
| 59 | 'CCFLAGS': ['-ansi'], |
| 60 | }, |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 61 | 'os:freebsd': { |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 62 | 'CCFLAGS': ['-ansi'], |
| 63 | }, |
| 64 | 'os:win32': { |
| 65 | 'CCFLAGS': ['-DWIN32'], |
| 66 | 'CXXFLAGS': ['-DWIN32'], |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 67 | }, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 68 | 'wordsize:64': { |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 69 | 'CCFLAGS': ['-m32'], |
| 70 | 'LINKFLAGS': ['-m32'] |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame^] | 71 | }, |
| 72 | 'prof:oprofile': { |
| 73 | 'CPPDEFINES': ['ENABLE_OPROFILE_AGENT'] |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 74 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 75 | }, |
| 76 | 'msvc': { |
| 77 | 'all': { |
| 78 | 'DIALECTFLAGS': ['/nologo'], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 79 | 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], |
v8.team.kasperl | 727e995 | 2008-09-02 14:56:44 +0000 | [diff] [blame] | 80 | 'CXXFLAGS': ['$CCFLAGS', '/GR-', '/Gy'], |
kasperl@chromium.org | b912362 | 2008-09-17 14:05:56 +0000 | [diff] [blame] | 81 | 'CPPDEFINES': ['WIN32', '_USE_32BIT_TIME_T', 'PCRE_STATIC'], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 82 | 'LINKFLAGS': ['/NOLOGO', '/MACHINE:X86', '/INCREMENTAL:NO', |
| 83 | '/NXCOMPAT', '/IGNORE:4221'], |
| 84 | 'ARFLAGS': ['/NOLOGO'], |
| 85 | 'CCPDBFLAGS': ['/Zi'] |
| 86 | }, |
| 87 | 'mode:debug': { |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 88 | 'CCFLAGS': ['/Od', '/Gm'], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 89 | 'CPPDEFINES': ['_DEBUG', 'ENABLE_DISASSEMBLER', 'DEBUG'], |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 90 | 'LINKFLAGS': ['/DEBUG'], |
| 91 | 'msvcrt:static': { |
| 92 | 'CCFLAGS': ['/MTd'] |
| 93 | }, |
| 94 | 'msvcrt:shared': { |
| 95 | 'CCFLAGS': ['/MDd'] |
| 96 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 97 | }, |
| 98 | 'mode:release': { |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 99 | 'CCFLAGS': ['/O2', '/GL'], |
kasperl@chromium.org | 41044eb | 2008-10-06 08:24:46 +0000 | [diff] [blame] | 100 | 'LINKFLAGS': ['/OPT:REF', '/OPT:ICF', '/LTCG'], |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 101 | 'ARFLAGS': ['/LTCG'], |
| 102 | 'msvcrt:static': { |
| 103 | 'CCFLAGS': ['/MT'] |
| 104 | }, |
| 105 | 'msvcrt:shared': { |
| 106 | 'CCFLAGS': ['/MD'] |
| 107 | } |
| 108 | }, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 109 | } |
| 110 | } |
| 111 | |
| 112 | |
| 113 | V8_EXTRA_FLAGS = { |
| 114 | 'gcc': { |
| 115 | 'all': { |
| 116 | 'CXXFLAGS': [], #['-fvisibility=hidden'], |
| 117 | 'WARNINGFLAGS': ['-pedantic', '-Wall', '-Werror', '-W', |
| 118 | '-Wno-unused-parameter'] |
| 119 | }, |
| 120 | 'arch:arm': { |
| 121 | 'CPPDEFINES': ['ARM'] |
| 122 | }, |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 123 | 'os:win32': { |
| 124 | 'WARNINGFLAGS': ['-Wno-long-long'] |
| 125 | }, |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 126 | 'disassembler:on': { |
| 127 | 'CPPDEFINES': ['ENABLE_DISASSEMBLER'] |
| 128 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 129 | }, |
| 130 | 'msvc': { |
| 131 | 'all': { |
| 132 | 'WARNINGFLAGS': ['/W3', '/WX', '/wd4355', '/wd4800'] |
| 133 | }, |
| 134 | 'library:shared': { |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame^] | 135 | 'CPPDEFINES': ['BUILDING_V8_SHARED'], |
| 136 | 'LIBS': ['winmm', 'ws2_32'] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 137 | }, |
| 138 | 'arch:arm': { |
ager@chromium.org | 3bf7b91 | 2008-11-17 09:09:45 +0000 | [diff] [blame] | 139 | 'CPPDEFINES': ['ARM'], |
| 140 | # /wd4996 is to silence the warning about sscanf |
| 141 | # used by the arm simulator. |
| 142 | 'WARNINGFLAGS': ['/wd4996'] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 143 | }, |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 144 | 'disassembler:on': { |
| 145 | 'CPPDEFINES': ['ENABLE_DISASSEMBLER'] |
| 146 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 147 | } |
| 148 | } |
| 149 | |
| 150 | |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 151 | MKSNAPSHOT_EXTRA_FLAGS = { |
| 152 | 'gcc': { |
| 153 | 'os:linux': { |
| 154 | 'LIBS': ['pthread'], |
| 155 | }, |
| 156 | 'os:macos': { |
| 157 | 'LIBS': ['pthread'], |
| 158 | }, |
| 159 | 'os:freebsd': { |
| 160 | 'LIBS': ['pthread'], |
| 161 | }, |
| 162 | 'os:win32': { |
ager@chromium.org | 381abbb | 2009-02-25 13:23:22 +0000 | [diff] [blame] | 163 | 'LIBS': ['winmm', 'ws2_32'], |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 164 | }, |
| 165 | }, |
| 166 | 'msvc': { |
| 167 | 'all': { |
ager@chromium.org | 381abbb | 2009-02-25 13:23:22 +0000 | [diff] [blame] | 168 | 'LIBS': ['winmm', 'ws2_32'] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 169 | } |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | |
| 174 | DTOA_EXTRA_FLAGS = { |
| 175 | 'gcc': { |
| 176 | 'all': { |
| 177 | 'WARNINGFLAGS': ['-Werror'] |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 178 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 179 | }, |
| 180 | 'msvc': { |
| 181 | 'all': { |
| 182 | 'WARNINGFLAGS': ['/WX', '/wd4018', '/wd4244'] |
| 183 | } |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | |
| 188 | CCTEST_EXTRA_FLAGS = { |
| 189 | 'all': { |
| 190 | 'CPPPATH': [join(root_dir, 'src')], |
| 191 | 'LIBS': ['$LIBRARY'] |
| 192 | }, |
| 193 | 'gcc': { |
| 194 | 'all': { |
| 195 | 'LIBPATH': [abspath('.')] |
| 196 | }, |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 197 | 'os:linux': { |
| 198 | 'LIBS': ['pthread'], |
| 199 | }, |
| 200 | 'os:macos': { |
| 201 | 'LIBS': ['pthread'], |
| 202 | }, |
| 203 | 'os:freebsd': { |
| 204 | 'LIBS': ['execinfo', 'pthread'] |
| 205 | }, |
| 206 | 'os:win32': { |
ager@chromium.org | 381abbb | 2009-02-25 13:23:22 +0000 | [diff] [blame] | 207 | 'LIBS': ['winmm', 'ws2_32'] |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 208 | }, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 209 | 'wordsize:64': { |
| 210 | 'CCFLAGS': ['-m32'], |
| 211 | 'LINKFLAGS': ['-m32'] |
| 212 | }, |
| 213 | }, |
| 214 | 'msvc': { |
| 215 | 'all': { |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 216 | 'CPPDEFINES': ['_HAS_EXCEPTIONS=0'], |
ager@chromium.org | 381abbb | 2009-02-25 13:23:22 +0000 | [diff] [blame] | 217 | 'LIBS': ['winmm', 'ws2_32'] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 218 | }, |
| 219 | 'library:shared': { |
| 220 | 'CPPDEFINES': ['USING_V8_SHARED'] |
| 221 | } |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | |
| 226 | SAMPLE_FLAGS = { |
| 227 | 'all': { |
v8.team.kasperl | 727e995 | 2008-09-02 14:56:44 +0000 | [diff] [blame] | 228 | 'CPPPATH': [join(abspath('.'), 'include')], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 229 | 'LIBS': ['$LIBRARY'], |
| 230 | }, |
| 231 | 'gcc': { |
| 232 | 'all': { |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 233 | 'LIBPATH': ['.'] |
| 234 | }, |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 235 | 'os:linux': { |
| 236 | 'LIBS': ['pthread'], |
| 237 | }, |
| 238 | 'os:macos': { |
| 239 | 'LIBS': ['pthread'], |
| 240 | }, |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 241 | 'os:freebsd': { |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 242 | 'LIBS': ['execinfo', 'pthread'] |
| 243 | }, |
| 244 | 'os:win32': { |
ager@chromium.org | 381abbb | 2009-02-25 13:23:22 +0000 | [diff] [blame] | 245 | 'LIBS': ['winmm', 'ws2_32'] |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 246 | }, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 247 | 'wordsize:64': { |
| 248 | 'CCFLAGS': ['-m32'], |
| 249 | 'LINKFLAGS': ['-m32'] |
| 250 | }, |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 251 | 'mode:release': { |
| 252 | 'CCFLAGS': ['-O2'] |
| 253 | }, |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 254 | 'mode:debug': { |
| 255 | 'CCFLAGS': ['-g', '-O0'] |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame^] | 256 | }, |
| 257 | 'prof:oprofile': { |
| 258 | 'LIBPATH': ['/usr/lib32', '/usr/lib32/oprofile'], |
| 259 | 'LIBS': ['opagent'] |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 260 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 261 | }, |
| 262 | 'msvc': { |
| 263 | 'all': { |
| 264 | 'CCFLAGS': ['/nologo'], |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 265 | 'LINKFLAGS': ['/nologo'], |
ager@chromium.org | 381abbb | 2009-02-25 13:23:22 +0000 | [diff] [blame] | 266 | 'LIBS': ['winmm', 'ws2_32'] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 267 | }, |
| 268 | 'library:shared': { |
| 269 | 'CPPDEFINES': ['USING_V8_SHARED'] |
| 270 | }, |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 271 | 'prof:on': { |
| 272 | 'LINKFLAGS': ['/MAP'] |
| 273 | }, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 274 | 'mode:release': { |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 275 | 'CCFLAGS': ['/O2'], |
| 276 | 'LINKFLAGS': ['/OPT:REF', '/OPT:ICF', '/LTCG'], |
| 277 | 'msvcrt:static': { |
| 278 | 'CCFLAGS': ['/MT'] |
| 279 | }, |
| 280 | 'msvcrt:shared': { |
| 281 | 'CCFLAGS': ['/MD'] |
| 282 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 283 | }, |
| 284 | 'mode:debug': { |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 285 | 'CCFLAGS': ['/Od'], |
| 286 | 'LINKFLAGS': ['/DEBUG'], |
| 287 | 'msvcrt:static': { |
| 288 | 'CCFLAGS': ['/MTd'] |
| 289 | }, |
| 290 | 'msvcrt:shared': { |
| 291 | 'CCFLAGS': ['/MDd'] |
| 292 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 293 | } |
| 294 | } |
| 295 | } |
| 296 | |
| 297 | |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 298 | D8_FLAGS = { |
| 299 | 'gcc': { |
| 300 | 'console:readline': { |
| 301 | 'LIBS': ['readline'] |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 302 | }, |
| 303 | 'os:linux': { |
| 304 | 'LIBS': ['pthread'], |
| 305 | }, |
| 306 | 'os:macos': { |
| 307 | 'LIBS': ['pthread'], |
| 308 | }, |
| 309 | 'os:freebsd': { |
| 310 | 'LIBS': ['pthread'], |
| 311 | }, |
| 312 | 'os:win32': { |
ager@chromium.org | 381abbb | 2009-02-25 13:23:22 +0000 | [diff] [blame] | 313 | 'LIBS': ['winmm', 'ws2_32'], |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 314 | }, |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 315 | }, |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 316 | 'msvc': { |
| 317 | 'all': { |
ager@chromium.org | 381abbb | 2009-02-25 13:23:22 +0000 | [diff] [blame] | 318 | 'LIBS': ['winmm', 'ws2_32'] |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 319 | } |
| 320 | } |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 321 | } |
| 322 | |
| 323 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 324 | SUFFIXES = { |
| 325 | 'release': '', |
| 326 | 'debug': '_g' |
| 327 | } |
| 328 | |
| 329 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 330 | def Abort(message): |
| 331 | print message |
| 332 | sys.exit(1) |
| 333 | |
| 334 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 335 | def GuessToolchain(os): |
| 336 | tools = Environment()['TOOLS'] |
| 337 | if 'gcc' in tools: |
kasper.lund | 7276f14 | 2008-07-30 08:49:36 +0000 | [diff] [blame] | 338 | return 'gcc' |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 339 | elif 'msvc' in tools: |
| 340 | return 'msvc' |
| 341 | else: |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 342 | return None |
| 343 | |
| 344 | |
ager@chromium.org | 870a0b6 | 2008-11-04 11:43:05 +0000 | [diff] [blame] | 345 | OS_GUESS = utils.GuessOS() |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 346 | TOOLCHAIN_GUESS = GuessToolchain(OS_GUESS) |
ager@chromium.org | c27e4e7 | 2008-09-04 13:52:27 +0000 | [diff] [blame] | 347 | ARCH_GUESS = utils.GuessArchitecture() |
ager@chromium.org | 870a0b6 | 2008-11-04 11:43:05 +0000 | [diff] [blame] | 348 | WORDSIZE_GUESS = utils.GuessWordsize() |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 349 | |
| 350 | |
| 351 | SIMPLE_OPTIONS = { |
| 352 | 'toolchain': { |
| 353 | 'values': ['gcc', 'msvc'], |
| 354 | 'default': TOOLCHAIN_GUESS, |
| 355 | 'help': 'the toolchain to use' |
| 356 | }, |
| 357 | 'os': { |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 358 | 'values': ['freebsd', 'linux', 'macos', 'win32'], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 359 | 'default': OS_GUESS, |
| 360 | 'help': 'the os to build for' |
| 361 | }, |
| 362 | 'arch': { |
| 363 | 'values':['arm', 'ia32'], |
| 364 | 'default': ARCH_GUESS, |
| 365 | 'help': 'the architecture to build for' |
| 366 | }, |
| 367 | 'snapshot': { |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 368 | 'values': ['on', 'off', 'nobuild'], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 369 | 'default': 'off', |
| 370 | 'help': 'build using snapshots for faster start-up' |
| 371 | }, |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 372 | 'prof': { |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame^] | 373 | 'values': ['on', 'off', 'oprofile'], |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 374 | 'default': 'off', |
| 375 | 'help': 'enable profiling of build target' |
| 376 | }, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 377 | 'library': { |
| 378 | 'values': ['static', 'shared'], |
| 379 | 'default': 'static', |
| 380 | 'help': 'the type of library to produce' |
| 381 | }, |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 382 | 'msvcrt': { |
| 383 | 'values': ['static', 'shared'], |
| 384 | 'default': 'static', |
| 385 | 'help': 'the type of MSVCRT library to use' |
| 386 | }, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 387 | 'wordsize': { |
| 388 | 'values': ['64', '32'], |
| 389 | 'default': WORDSIZE_GUESS, |
| 390 | 'help': 'the word size' |
| 391 | }, |
| 392 | 'simulator': { |
| 393 | 'values': ['arm', 'none'], |
| 394 | 'default': 'none', |
| 395 | 'help': 'build with simulator' |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 396 | }, |
| 397 | 'disassembler': { |
| 398 | 'values': ['on', 'off'], |
| 399 | 'default': 'off', |
| 400 | 'help': 'enable the disassembler to inspect generated code' |
| 401 | }, |
| 402 | 'sourcesignatures': { |
| 403 | 'values': ['MD5', 'timestamp'], |
| 404 | 'default': 'MD5', |
| 405 | 'help': 'set how the build system detects file changes' |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 406 | }, |
| 407 | 'console': { |
| 408 | 'values': ['dumb', 'readline'], |
| 409 | 'default': 'dumb', |
| 410 | 'help': 'the console to use for the d8 shell' |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 411 | } |
| 412 | } |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 413 | |
| 414 | |
| 415 | def GetOptions(): |
| 416 | result = Options() |
kasper.lund | 7276f14 | 2008-07-30 08:49:36 +0000 | [diff] [blame] | 417 | result.Add('mode', 'compilation mode (debug, release)', 'release') |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 418 | result.Add('sample', 'build sample (shell, process)', '') |
v8.team.kasperl | 727e995 | 2008-09-02 14:56:44 +0000 | [diff] [blame] | 419 | result.Add('env', 'override environment settings (NAME1:value1,NAME2:value2)', '') |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 420 | for (name, option) in SIMPLE_OPTIONS.iteritems(): |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 421 | help = '%s (%s)' % (name, ", ".join(option['values'])) |
| 422 | result.Add(name, help, option.get('default')) |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 423 | return result |
| 424 | |
| 425 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 426 | def SplitList(str): |
| 427 | return [ s for s in str.split(",") if len(s) > 0 ] |
| 428 | |
| 429 | |
| 430 | def IsLegal(env, option, values): |
| 431 | str = env[option] |
| 432 | for s in SplitList(str): |
| 433 | if not s in values: |
| 434 | Abort("Illegal value for option %s '%s'." % (option, s)) |
| 435 | return False |
| 436 | return True |
| 437 | |
| 438 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 439 | def VerifyOptions(env): |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 440 | if not IsLegal(env, 'mode', ['debug', 'release']): |
| 441 | return False |
| 442 | if not IsLegal(env, 'sample', ["shell", "process"]): |
| 443 | return False |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 444 | if env['os'] == 'win32' and env['library'] == 'shared' and env['prof'] == 'on': |
| 445 | Abort("Profiling on windows only supported for static library.") |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame^] | 446 | if env['prof'] == 'oprofile' and env['os'] != 'linux': |
| 447 | Abort("OProfile is only supported on Linux.") |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 448 | for (name, option) in SIMPLE_OPTIONS.iteritems(): |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 449 | if (not option.get('default')) and (name not in ARGUMENTS): |
| 450 | message = ("A value for option %s must be specified (%s)." % |
| 451 | (name, ", ".join(option['values']))) |
| 452 | Abort(message) |
| 453 | if not env[name] in option['values']: |
| 454 | message = ("Unknown %s value '%s'. Possible values are (%s)." % |
| 455 | (name, env[name], ", ".join(option['values']))) |
| 456 | Abort(message) |
| 457 | |
| 458 | |
| 459 | class BuildContext(object): |
| 460 | |
v8.team.kasperl | 727e995 | 2008-09-02 14:56:44 +0000 | [diff] [blame] | 461 | def __init__(self, options, env_overrides, samples): |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 462 | self.library_targets = [] |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 463 | self.mksnapshot_targets = [] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 464 | self.cctest_targets = [] |
| 465 | self.sample_targets = [] |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 466 | self.d8_targets = [] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 467 | self.options = options |
v8.team.kasperl | 727e995 | 2008-09-02 14:56:44 +0000 | [diff] [blame] | 468 | self.env_overrides = env_overrides |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 469 | self.samples = samples |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 470 | self.use_snapshot = (options['snapshot'] != 'off') |
| 471 | self.build_snapshot = (options['snapshot'] == 'on') |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 472 | self.flags = None |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 473 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 474 | def AddRelevantFlags(self, initial, flags): |
| 475 | result = initial.copy() |
| 476 | self.AppendFlags(result, flags.get('all')) |
| 477 | toolchain = self.options['toolchain'] |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 478 | if toolchain in flags: |
| 479 | self.AppendFlags(result, flags[toolchain].get('all')) |
| 480 | for option in sorted(self.options.keys()): |
| 481 | value = self.options[option] |
| 482 | self.AppendFlags(result, flags[toolchain].get(option + ':' + value)) |
| 483 | return result |
| 484 | |
| 485 | def AddRelevantSubFlags(self, options, flags): |
| 486 | self.AppendFlags(options, flags.get('all')) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 487 | for option in sorted(self.options.keys()): |
| 488 | value = self.options[option] |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 489 | self.AppendFlags(options, flags.get(option + ':' + value)) |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 490 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 491 | def GetRelevantSources(self, source): |
| 492 | result = [] |
| 493 | result += source.get('all', []) |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 494 | for (name, value) in self.options.iteritems(): |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 495 | result += source.get(name + ':' + value, []) |
| 496 | return sorted(result) |
| 497 | |
| 498 | def AppendFlags(self, options, added): |
| 499 | if not added: |
| 500 | return |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 501 | for (key, value) in added.iteritems(): |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 502 | if key.find(':') != -1: |
| 503 | self.AddRelevantSubFlags(options, { key: value }) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 504 | else: |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 505 | if not key in options: |
| 506 | options[key] = value |
| 507 | else: |
| 508 | prefix = options[key] |
| 509 | if isinstance(prefix, StringTypes): prefix = prefix.split() |
| 510 | options[key] = prefix + value |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 511 | |
| 512 | def ConfigureObject(self, env, input, **kw): |
| 513 | if self.options['library'] == 'static': |
| 514 | return env.StaticObject(input, **kw) |
| 515 | else: |
| 516 | return env.SharedObject(input, **kw) |
| 517 | |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 518 | def ApplyEnvOverrides(self, env): |
| 519 | if not self.env_overrides: |
| 520 | return |
| 521 | if type(env['ENV']) == DictType: |
| 522 | env['ENV'].update(**self.env_overrides) |
| 523 | else: |
| 524 | env['ENV'] = self.env_overrides |
| 525 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 526 | |
| 527 | def PostprocessOptions(options): |
| 528 | # Adjust architecture if the simulator option has been set |
| 529 | if (options['simulator'] != 'none') and (options['arch'] != options['simulator']): |
| 530 | if 'arch' in ARGUMENTS: |
| 531 | # Print a warning if arch has explicitly been set |
| 532 | print "Warning: forcing architecture to match simulator (%s)" % options['simulator'] |
| 533 | options['arch'] = options['simulator'] |
| 534 | |
| 535 | |
v8.team.kasperl | 727e995 | 2008-09-02 14:56:44 +0000 | [diff] [blame] | 536 | def ParseEnvOverrides(arg): |
| 537 | # The environment overrides are in the format NAME1:value1,NAME2:value2 |
| 538 | overrides = {} |
| 539 | for override in arg.split(','): |
| 540 | pos = override.find(':') |
| 541 | if pos == -1: |
| 542 | continue |
| 543 | overrides[override[:pos].strip()] = override[pos+1:].strip() |
| 544 | return overrides |
| 545 | |
| 546 | |
| 547 | def BuildSpecific(env, mode, env_overrides): |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 548 | options = {'mode': mode} |
| 549 | for option in SIMPLE_OPTIONS: |
| 550 | options[option] = env[option] |
| 551 | PostprocessOptions(options) |
| 552 | |
v8.team.kasperl | 727e995 | 2008-09-02 14:56:44 +0000 | [diff] [blame] | 553 | context = BuildContext(options, env_overrides, samples=SplitList(env['sample'])) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 554 | |
| 555 | library_flags = context.AddRelevantFlags(os.environ, LIBRARY_FLAGS) |
| 556 | v8_flags = context.AddRelevantFlags(library_flags, V8_EXTRA_FLAGS) |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 557 | mksnapshot_flags = context.AddRelevantFlags(library_flags, MKSNAPSHOT_EXTRA_FLAGS) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 558 | dtoa_flags = context.AddRelevantFlags(library_flags, DTOA_EXTRA_FLAGS) |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 559 | cctest_flags = context.AddRelevantFlags(v8_flags, CCTEST_EXTRA_FLAGS) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 560 | sample_flags = context.AddRelevantFlags(os.environ, SAMPLE_FLAGS) |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 561 | d8_flags = context.AddRelevantFlags(library_flags, D8_FLAGS) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 562 | |
| 563 | context.flags = { |
| 564 | 'v8': v8_flags, |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 565 | 'mksnapshot': mksnapshot_flags, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 566 | 'dtoa': dtoa_flags, |
| 567 | 'cctest': cctest_flags, |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 568 | 'sample': sample_flags, |
| 569 | 'd8': d8_flags |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 570 | } |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 571 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 572 | target_id = mode |
| 573 | suffix = SUFFIXES[target_id] |
| 574 | library_name = 'v8' + suffix |
| 575 | env['LIBRARY'] = library_name |
| 576 | |
| 577 | # Build the object files by invoking SCons recursively. |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 578 | (object_files, shell_files, mksnapshot) = env.SConscript( |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 579 | join('src', 'SConscript'), |
| 580 | build_dir=join('obj', target_id), |
| 581 | exports='context', |
| 582 | duplicate=False |
| 583 | ) |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 584 | |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 585 | context.mksnapshot_targets.append(mksnapshot) |
| 586 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 587 | # Link the object files into a library. |
kasperl@chromium.org | b912362 | 2008-09-17 14:05:56 +0000 | [diff] [blame] | 588 | env.Replace(**context.flags['v8']) |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 589 | context.ApplyEnvOverrides(env) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 590 | if context.options['library'] == 'static': |
| 591 | library = env.StaticLibrary(library_name, object_files) |
| 592 | else: |
| 593 | # There seems to be a glitch in the way scons decides where to put |
| 594 | # PDB files when compiling using MSVC so we specify it manually. |
| 595 | # This should not affect any other platforms. |
| 596 | pdb_name = library_name + '.dll.pdb' |
| 597 | library = env.SharedLibrary(library_name, object_files, PDB=pdb_name) |
| 598 | context.library_targets.append(library) |
| 599 | |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 600 | d8_env = Environment() |
| 601 | d8_env.Replace(**context.flags['d8']) |
| 602 | shell = d8_env.Program('d8' + suffix, object_files + shell_files) |
| 603 | context.d8_targets.append(shell) |
| 604 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 605 | for sample in context.samples: |
| 606 | sample_env = Environment(LIBRARY=library_name) |
| 607 | sample_env.Replace(**context.flags['sample']) |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 608 | context.ApplyEnvOverrides(sample_env) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 609 | sample_object = sample_env.SConscript( |
| 610 | join('samples', 'SConscript'), |
| 611 | build_dir=join('obj', 'sample', sample, target_id), |
| 612 | exports='sample context', |
| 613 | duplicate=False |
| 614 | ) |
| 615 | sample_name = sample + suffix |
| 616 | sample_program = sample_env.Program(sample_name, sample_object) |
| 617 | sample_env.Depends(sample_program, library) |
| 618 | context.sample_targets.append(sample_program) |
| 619 | |
| 620 | cctest_program = env.SConscript( |
| 621 | join('test', 'cctest', 'SConscript'), |
| 622 | build_dir=join('obj', 'test', target_id), |
| 623 | exports='context object_files', |
| 624 | duplicate=False |
| 625 | ) |
| 626 | context.cctest_targets.append(cctest_program) |
| 627 | |
| 628 | return context |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 629 | |
| 630 | |
kasper.lund | 7276f14 | 2008-07-30 08:49:36 +0000 | [diff] [blame] | 631 | def Build(): |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 632 | opts = GetOptions() |
| 633 | env = Environment(options=opts) |
| 634 | Help(opts.GenerateHelpText(env)) |
| 635 | VerifyOptions(env) |
v8.team.kasperl | 727e995 | 2008-09-02 14:56:44 +0000 | [diff] [blame] | 636 | env_overrides = ParseEnvOverrides(env['env']) |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 637 | |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 638 | SourceSignatures(env['sourcesignatures']) |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 639 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 640 | libraries = [] |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 641 | mksnapshots = [] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 642 | cctests = [] |
| 643 | samples = [] |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 644 | d8s = [] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 645 | modes = SplitList(env['mode']) |
| 646 | for mode in modes: |
v8.team.kasperl | 727e995 | 2008-09-02 14:56:44 +0000 | [diff] [blame] | 647 | context = BuildSpecific(env.Copy(), mode, env_overrides) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 648 | libraries += context.library_targets |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 649 | mksnapshots += context.mksnapshot_targets |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 650 | cctests += context.cctest_targets |
| 651 | samples += context.sample_targets |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 652 | d8s += context.d8_targets |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 653 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 654 | env.Alias('library', libraries) |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 655 | env.Alias('mksnapshot', mksnapshots) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 656 | env.Alias('cctests', cctests) |
| 657 | env.Alias('sample', samples) |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 658 | env.Alias('d8', d8s) |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 659 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 660 | if env['sample']: |
| 661 | env.Default('sample') |
kasper.lund | 7276f14 | 2008-07-30 08:49:36 +0000 | [diff] [blame] | 662 | else: |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 663 | env.Default('library') |
kasper.lund | 7276f14 | 2008-07-30 08:49:36 +0000 | [diff] [blame] | 664 | |
| 665 | |
v8.team.kasperl | 727e995 | 2008-09-02 14:56:44 +0000 | [diff] [blame] | 666 | # We disable deprecation warnings because we need to be able to use |
| 667 | # env.Copy without getting warnings for compatibility with older |
| 668 | # version of scons. Also, there's a bug in some revisions that |
| 669 | # doesn't allow this flag to be set, so we swallow any exceptions. |
| 670 | # Lovely. |
| 671 | try: |
| 672 | SetOption('warn', 'no-deprecated') |
| 673 | except: |
| 674 | pass |
| 675 | |
| 676 | |
kasper.lund | 7276f14 | 2008-07-30 08:49:36 +0000 | [diff] [blame] | 677 | Build() |