sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 1 | # Copyright 2011 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 |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 30 | import subprocess |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 31 | import sys |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 32 | import os |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 33 | from os.path import join, dirname, abspath |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 34 | from types import DictType, StringTypes |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 35 | root_dir = dirname(File('SConstruct').rfile().abspath) |
ager@chromium.org | 0ee099b | 2011-01-25 14:06:47 +0000 | [diff] [blame] | 36 | sys.path.insert(0, join(root_dir, 'tools')) |
ager@chromium.org | c27e4e7 | 2008-09-04 13:52:27 +0000 | [diff] [blame] | 37 | import js2c, utils |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 38 | |
ricow@chromium.org | c9c8082 | 2010-04-21 08:22:37 +0000 | [diff] [blame] | 39 | # ARM_TARGET_LIB is the path to the dynamic library to use on the target |
whesse@chromium.org | ba5a61b | 2010-07-26 11:44:40 +0000 | [diff] [blame] | 40 | # machine if cross-compiling to an arm machine. You will also need to set |
ricow@chromium.org | c9c8082 | 2010-04-21 08:22:37 +0000 | [diff] [blame] | 41 | # the additional cross-compiling environment variables to the cross compiler. |
| 42 | ARM_TARGET_LIB = os.environ.get('ARM_TARGET_LIB') |
| 43 | if ARM_TARGET_LIB: |
| 44 | ARM_LINK_FLAGS = ['-Wl,-rpath=' + ARM_TARGET_LIB + '/lib:' + |
| 45 | ARM_TARGET_LIB + '/usr/lib', |
| 46 | '-Wl,--dynamic-linker=' + ARM_TARGET_LIB + |
| 47 | '/lib/ld-linux.so.3'] |
| 48 | else: |
| 49 | ARM_LINK_FLAGS = [] |
| 50 | |
ricow@chromium.org | 0b9f850 | 2010-08-18 07:45:01 +0000 | [diff] [blame] | 51 | GCC_EXTRA_CCFLAGS = [] |
| 52 | GCC_DTOA_EXTRA_CCFLAGS = [] |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 53 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 54 | LIBRARY_FLAGS = { |
| 55 | 'all': { |
kasperl@chromium.org | 68ac009 | 2009-07-09 06:00:35 +0000 | [diff] [blame] | 56 | 'CPPPATH': [join(root_dir, 'src')], |
ricow@chromium.org | c9c8082 | 2010-04-21 08:22:37 +0000 | [diff] [blame] | 57 | 'regexp:interpreted': { |
| 58 | 'CPPDEFINES': ['V8_INTERPRETED_REGEXP'] |
ager@chromium.org | 18ad94b | 2009-09-02 08:22:29 +0000 | [diff] [blame] | 59 | }, |
| 60 | 'mode:debug': { |
whesse@chromium.org | 023421e | 2010-12-21 12:19:12 +0000 | [diff] [blame] | 61 | 'CPPDEFINES': ['V8_ENABLE_CHECKS', 'OBJECT_PRINT'] |
ager@chromium.org | 4af710e | 2009-09-15 12:20:11 +0000 | [diff] [blame] | 62 | }, |
ager@chromium.org | 357bf65 | 2010-04-12 11:30:10 +0000 | [diff] [blame] | 63 | 'vmstate:on': { |
| 64 | 'CPPDEFINES': ['ENABLE_VMSTATE_TRACKING'], |
| 65 | }, |
whesse@chromium.org | 023421e | 2010-12-21 12:19:12 +0000 | [diff] [blame] | 66 | 'objectprint:on': { |
| 67 | 'CPPDEFINES': ['OBJECT_PRINT'], |
| 68 | }, |
ager@chromium.org | 357bf65 | 2010-04-12 11:30:10 +0000 | [diff] [blame] | 69 | 'protectheap:on': { |
| 70 | 'CPPDEFINES': ['ENABLE_VMSTATE_TRACKING', 'ENABLE_HEAP_PROTECTION'], |
| 71 | }, |
ager@chromium.org | 4af710e | 2009-09-15 12:20:11 +0000 | [diff] [blame] | 72 | 'profilingsupport:on': { |
ager@chromium.org | 357bf65 | 2010-04-12 11:30:10 +0000 | [diff] [blame] | 73 | 'CPPDEFINES': ['ENABLE_VMSTATE_TRACKING', 'ENABLE_LOGGING_AND_PROFILING'], |
ager@chromium.org | 4af710e | 2009-09-15 12:20:11 +0000 | [diff] [blame] | 74 | }, |
| 75 | 'debuggersupport:on': { |
| 76 | 'CPPDEFINES': ['ENABLE_DEBUGGER_SUPPORT'], |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 77 | }, |
| 78 | 'inspector:on': { |
| 79 | 'CPPDEFINES': ['INSPECTOR'], |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 80 | }, |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 81 | 'fasttls:on': { |
| 82 | 'CPPDEFINES': ['V8_FAST_TLS'], |
| 83 | }, |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 84 | 'liveobjectlist:on': { |
| 85 | 'CPPDEFINES': ['ENABLE_DEBUGGER_SUPPORT', 'INSPECTOR', |
| 86 | 'LIVE_OBJECT_LIST', 'OBJECT_PRINT'], |
kasperl@chromium.org | 68ac009 | 2009-07-09 06:00:35 +0000 | [diff] [blame] | 87 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 88 | }, |
| 89 | 'gcc': { |
| 90 | 'all': { |
kasperl@chromium.org | 41044eb | 2008-10-06 08:24:46 +0000 | [diff] [blame] | 91 | 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 92 | 'CXXFLAGS': ['$CCFLAGS', '-fno-rtti', '-fno-exceptions'], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 93 | }, |
ager@chromium.org | 4af710e | 2009-09-15 12:20:11 +0000 | [diff] [blame] | 94 | 'visibility:hidden': { |
| 95 | # Use visibility=default to disable this. |
| 96 | 'CXXFLAGS': ['-fvisibility=hidden'] |
| 97 | }, |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 98 | 'strictaliasing:off': { |
| 99 | 'CCFLAGS': ['-fno-strict-aliasing'] |
| 100 | }, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 101 | 'mode:debug': { |
| 102 | 'CCFLAGS': ['-g', '-O0'], |
ager@chromium.org | 71daaf6 | 2009-04-01 07:22:49 +0000 | [diff] [blame] | 103 | 'CPPDEFINES': ['ENABLE_DISASSEMBLER', 'DEBUG'], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 104 | }, |
| 105 | 'mode:release': { |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 106 | 'CCFLAGS': ['-O3', '-fomit-frame-pointer', '-fdata-sections', |
| 107 | '-ffunction-sections'], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 108 | }, |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 109 | 'os:linux': { |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 110 | 'CCFLAGS': ['-ansi'] + GCC_EXTRA_CCFLAGS, |
sgjesse@chromium.org | f8c8180 | 2009-03-30 07:19:14 +0000 | [diff] [blame] | 111 | 'library:shared': { |
sgjesse@chromium.org | b9d7da1 | 2009-08-05 08:38:10 +0000 | [diff] [blame] | 112 | 'CPPDEFINES': ['V8_SHARED'], |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 113 | 'LIBS': ['pthread'] |
sgjesse@chromium.org | f8c8180 | 2009-03-30 07:19:14 +0000 | [diff] [blame] | 114 | } |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 115 | }, |
| 116 | 'os:macos': { |
ager@chromium.org | 5aa501c | 2009-06-23 07:57:28 +0000 | [diff] [blame] | 117 | 'CCFLAGS': ['-ansi', '-mmacosx-version-min=10.4'], |
kmillikin@chromium.org | 13bd294 | 2009-12-16 15:36:05 +0000 | [diff] [blame] | 118 | 'library:shared': { |
| 119 | 'CPPDEFINES': ['V8_SHARED'] |
| 120 | } |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 121 | }, |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 122 | 'os:freebsd': { |
ager@chromium.org | e2902be | 2009-06-08 12:21:35 +0000 | [diff] [blame] | 123 | 'CPPPATH' : ['/usr/local/include'], |
| 124 | 'LIBPATH' : ['/usr/local/lib'], |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 125 | 'CCFLAGS': ['-ansi'], |
ricow@chromium.org | badaffc | 2011-03-17 12:15:27 +0000 | [diff] [blame] | 126 | 'LIBS': ['execinfo'] |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 127 | }, |
sgjesse@chromium.org | ac6aa17 | 2009-12-04 12:29:05 +0000 | [diff] [blame] | 128 | 'os:openbsd': { |
| 129 | 'CPPPATH' : ['/usr/local/include'], |
| 130 | 'LIBPATH' : ['/usr/local/lib'], |
| 131 | 'CCFLAGS': ['-ansi'], |
| 132 | }, |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 133 | 'os:solaris': { |
vegorov@chromium.org | dff694e | 2010-05-17 09:10:26 +0000 | [diff] [blame] | 134 | # On Solaris, to get isinf, INFINITY, fpclassify and other macros one |
| 135 | # needs to define __C99FEATURES__. |
| 136 | 'CPPDEFINES': ['__C99FEATURES__'], |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 137 | 'CPPPATH' : ['/usr/local/include'], |
| 138 | 'LIBPATH' : ['/usr/local/lib'], |
| 139 | 'CCFLAGS': ['-ansi'], |
| 140 | }, |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 141 | 'os:win32': { |
| 142 | 'CCFLAGS': ['-DWIN32'], |
| 143 | 'CXXFLAGS': ['-DWIN32'], |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 144 | }, |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 145 | 'arch:ia32': { |
kasperl@chromium.org | e959c18 | 2009-07-27 08:59:04 +0000 | [diff] [blame] | 146 | 'CPPDEFINES': ['V8_TARGET_ARCH_IA32'], |
| 147 | 'CCFLAGS': ['-m32'], |
| 148 | 'LINKFLAGS': ['-m32'] |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 149 | }, |
| 150 | 'arch:arm': { |
ricow@chromium.org | 30ce411 | 2010-05-31 10:38:25 +0000 | [diff] [blame] | 151 | 'CPPDEFINES': ['V8_TARGET_ARCH_ARM'], |
| 152 | 'unalignedaccesses:on' : { |
| 153 | 'CPPDEFINES' : ['CAN_USE_UNALIGNED_ACCESSES=1'] |
| 154 | }, |
| 155 | 'unalignedaccesses:off' : { |
| 156 | 'CPPDEFINES' : ['CAN_USE_UNALIGNED_ACCESSES=0'] |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 157 | }, |
| 158 | 'armeabi:soft' : { |
| 159 | 'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0'], |
| 160 | 'simulator:none': { |
| 161 | 'CCFLAGS': ['-mfloat-abi=soft'], |
| 162 | } |
| 163 | }, |
| 164 | 'armeabi:softfp' : { |
fschneider@chromium.org | fb144a0 | 2011-05-04 12:43:48 +0000 | [diff] [blame] | 165 | 'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0', 'CAN_USE_VFP_INSTRUCTIONS'], |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 166 | 'simulator:none': { |
| 167 | 'CCFLAGS': ['-mfloat-abi=softfp'], |
| 168 | } |
| 169 | }, |
| 170 | 'armeabi:hard' : { |
| 171 | 'CPPDEFINES' : ['USE_EABI_HARDFLOAT=1', 'CAN_USE_VFP_INSTRUCTIONS'], |
| 172 | 'simulator:none': { |
| 173 | 'CCFLAGS': ['-mfloat-abi=hard'], |
| 174 | } |
ricow@chromium.org | 30ce411 | 2010-05-31 10:38:25 +0000 | [diff] [blame] | 175 | } |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 176 | }, |
kasperl@chromium.org | e959c18 | 2009-07-27 08:59:04 +0000 | [diff] [blame] | 177 | 'simulator:arm': { |
ricow@chromium.org | 30ce411 | 2010-05-31 10:38:25 +0000 | [diff] [blame] | 178 | 'CCFLAGS': ['-m32'], |
vegorov@chromium.org | 4284196 | 2010-10-18 11:18:59 +0000 | [diff] [blame] | 179 | 'LINKFLAGS': ['-m32'], |
kasperl@chromium.org | e959c18 | 2009-07-27 08:59:04 +0000 | [diff] [blame] | 180 | }, |
ager@chromium.org | 5c83825 | 2010-02-19 08:53:10 +0000 | [diff] [blame] | 181 | 'arch:mips': { |
| 182 | 'CPPDEFINES': ['V8_TARGET_ARCH_MIPS'], |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 183 | 'mips_arch_variant:mips32r2': { |
| 184 | 'CPPDEFINES': ['_MIPS_ARCH_MIPS32R2'] |
| 185 | }, |
ager@chromium.org | 5c83825 | 2010-02-19 08:53:10 +0000 | [diff] [blame] | 186 | 'simulator:none': { |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 187 | 'CCFLAGS': ['-EL'], |
| 188 | 'LINKFLAGS': ['-EL'], |
| 189 | 'mips_arch_variant:mips32r2': { |
| 190 | 'CCFLAGS': ['-mips32r2', '-Wa,-mips32r2'] |
| 191 | }, |
| 192 | 'mips_arch_variant:mips32r1': { |
| 193 | 'CCFLAGS': ['-mips32', '-Wa,-mips32'] |
| 194 | }, |
| 195 | 'library:static': { |
| 196 | 'LINKFLAGS': ['-static', '-static-libgcc'] |
| 197 | }, |
| 198 | 'mipsabi:softfloat': { |
| 199 | 'CCFLAGS': ['-msoft-float'], |
| 200 | 'LINKFLAGS': ['-msoft-float'] |
| 201 | }, |
| 202 | 'mipsabi:hardfloat': { |
| 203 | 'CCFLAGS': ['-mhard-float'], |
| 204 | 'LINKFLAGS': ['-mhard-float'] |
| 205 | } |
ager@chromium.org | 5c83825 | 2010-02-19 08:53:10 +0000 | [diff] [blame] | 206 | } |
| 207 | }, |
| 208 | 'simulator:mips': { |
| 209 | 'CCFLAGS': ['-m32'], |
vegorov@chromium.org | 4284196 | 2010-10-18 11:18:59 +0000 | [diff] [blame] | 210 | 'LINKFLAGS': ['-m32'], |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 211 | 'mipsabi:softfloat': { |
| 212 | 'CPPDEFINES': ['__mips_soft_float=1'], |
danno@chromium.org | 40cb878 | 2011-05-25 07:58:50 +0000 | [diff] [blame] | 213 | }, |
| 214 | 'mipsabi:hardfloat': { |
| 215 | 'CPPDEFINES': ['__mips_hard_float=1'], |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 216 | } |
ager@chromium.org | 5c83825 | 2010-02-19 08:53:10 +0000 | [diff] [blame] | 217 | }, |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 218 | 'arch:x64': { |
kasperl@chromium.org | e959c18 | 2009-07-27 08:59:04 +0000 | [diff] [blame] | 219 | 'CPPDEFINES': ['V8_TARGET_ARCH_X64'], |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 220 | 'CCFLAGS': ['-m64'], |
kasperl@chromium.org | e959c18 | 2009-07-27 08:59:04 +0000 | [diff] [blame] | 221 | 'LINKFLAGS': ['-m64'], |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 222 | }, |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 223 | 'gdbjit:on': { |
| 224 | 'CPPDEFINES': ['ENABLE_GDB_JIT_INTERFACE'] |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 225 | }, |
| 226 | 'compress_startup_data:bz2': { |
| 227 | 'CPPDEFINES': ['COMPRESS_STARTUP_DATA_BZ2'] |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 228 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 229 | }, |
| 230 | 'msvc': { |
| 231 | 'all': { |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 232 | 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], |
v8.team.kasperl | 727e995 | 2008-09-02 14:56:44 +0000 | [diff] [blame] | 233 | 'CXXFLAGS': ['$CCFLAGS', '/GR-', '/Gy'], |
ager@chromium.org | 18ad94b | 2009-09-02 08:22:29 +0000 | [diff] [blame] | 234 | 'CPPDEFINES': ['WIN32'], |
| 235 | 'LINKFLAGS': ['/INCREMENTAL:NO', '/NXCOMPAT', '/IGNORE:4221'], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 236 | 'CCPDBFLAGS': ['/Zi'] |
| 237 | }, |
ager@chromium.org | 18ad94b | 2009-09-02 08:22:29 +0000 | [diff] [blame] | 238 | 'verbose:off': { |
| 239 | 'DIALECTFLAGS': ['/nologo'], |
| 240 | 'ARFLAGS': ['/NOLOGO'] |
| 241 | }, |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 242 | 'arch:ia32': { |
ager@chromium.org | 18ad94b | 2009-09-02 08:22:29 +0000 | [diff] [blame] | 243 | 'CPPDEFINES': ['V8_TARGET_ARCH_IA32', '_USE_32BIT_TIME_T'], |
| 244 | 'LINKFLAGS': ['/MACHINE:X86'], |
| 245 | 'ARFLAGS': ['/MACHINE:X86'] |
| 246 | }, |
| 247 | 'arch:x64': { |
| 248 | 'CPPDEFINES': ['V8_TARGET_ARCH_X64'], |
| 249 | 'LINKFLAGS': ['/MACHINE:X64'], |
| 250 | 'ARFLAGS': ['/MACHINE:X64'] |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 251 | }, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 252 | 'mode:debug': { |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 253 | 'CCFLAGS': ['/Od', '/Gm'], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 254 | 'CPPDEFINES': ['_DEBUG', 'ENABLE_DISASSEMBLER', 'DEBUG'], |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 255 | 'LINKFLAGS': ['/DEBUG'], |
| 256 | 'msvcrt:static': { |
| 257 | 'CCFLAGS': ['/MTd'] |
| 258 | }, |
| 259 | 'msvcrt:shared': { |
| 260 | 'CCFLAGS': ['/MDd'] |
| 261 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 262 | }, |
| 263 | 'mode:release': { |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 264 | 'CCFLAGS': ['/O2'], |
| 265 | 'LINKFLAGS': ['/OPT:REF', '/OPT:ICF'], |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 266 | 'msvcrt:static': { |
| 267 | 'CCFLAGS': ['/MT'] |
| 268 | }, |
| 269 | 'msvcrt:shared': { |
| 270 | 'CCFLAGS': ['/MD'] |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 271 | }, |
| 272 | 'msvcltcg:on': { |
| 273 | 'CCFLAGS': ['/GL'], |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 274 | 'ARFLAGS': ['/LTCG'], |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 275 | 'pgo:off': { |
| 276 | 'LINKFLAGS': ['/LTCG'], |
| 277 | }, |
| 278 | 'pgo:instrument': { |
| 279 | 'LINKFLAGS': ['/LTCG:PGI'] |
| 280 | }, |
| 281 | 'pgo:optimize': { |
| 282 | 'LINKFLAGS': ['/LTCG:PGO'] |
| 283 | } |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 284 | } |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 285 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 286 | } |
| 287 | } |
| 288 | |
| 289 | |
| 290 | V8_EXTRA_FLAGS = { |
| 291 | 'gcc': { |
| 292 | 'all': { |
sgjesse@chromium.org | b9d7da1 | 2009-08-05 08:38:10 +0000 | [diff] [blame] | 293 | 'WARNINGFLAGS': ['-Wall', |
| 294 | '-Werror', |
| 295 | '-W', |
| 296 | '-Wno-unused-parameter', |
| 297 | '-Wnon-virtual-dtor'] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 298 | }, |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 299 | 'os:win32': { |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 300 | 'WARNINGFLAGS': ['-pedantic', '-Wno-long-long'] |
| 301 | }, |
| 302 | 'os:linux': { |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 303 | 'WARNINGFLAGS': ['-pedantic'], |
| 304 | 'library:shared': { |
| 305 | 'soname:on': { |
| 306 | 'LINKFLAGS': ['-Wl,-soname,${SONAME}'] |
| 307 | } |
| 308 | } |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 309 | }, |
| 310 | 'os:macos': { |
| 311 | 'WARNINGFLAGS': ['-pedantic'] |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 312 | }, |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 313 | 'arch:arm': { |
| 314 | # This is to silence warnings about ABI changes that some versions of the |
| 315 | # CodeSourcery G++ tool chain produce for each occurrence of varargs. |
| 316 | 'WARNINGFLAGS': ['-Wno-abi'] |
| 317 | }, |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 318 | 'disassembler:on': { |
| 319 | 'CPPDEFINES': ['ENABLE_DISASSEMBLER'] |
| 320 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 321 | }, |
| 322 | 'msvc': { |
| 323 | 'all': { |
ager@chromium.org | 0ee099b | 2011-01-25 14:06:47 +0000 | [diff] [blame] | 324 | 'WARNINGFLAGS': ['/W3', '/WX', '/wd4351', '/wd4355', '/wd4800'] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 325 | }, |
sgjesse@chromium.org | 4e421f4 | 2009-09-07 07:18:16 +0000 | [diff] [blame] | 326 | 'library:shared': { |
| 327 | 'CPPDEFINES': ['BUILDING_V8_SHARED'], |
| 328 | 'LIBS': ['winmm', 'ws2_32'] |
| 329 | }, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 330 | 'arch:arm': { |
ager@chromium.org | 9085a01 | 2009-05-11 19:22:57 +0000 | [diff] [blame] | 331 | 'CPPDEFINES': ['V8_TARGET_ARCH_ARM'], |
ager@chromium.org | 3bf7b91 | 2008-11-17 09:09:45 +0000 | [diff] [blame] | 332 | # /wd4996 is to silence the warning about sscanf |
| 333 | # used by the arm simulator. |
| 334 | 'WARNINGFLAGS': ['/wd4996'] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 335 | }, |
ager@chromium.org | 5c83825 | 2010-02-19 08:53:10 +0000 | [diff] [blame] | 336 | 'arch:mips': { |
| 337 | 'CPPDEFINES': ['V8_TARGET_ARCH_MIPS'], |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 338 | 'mips_arch_variant:mips32r2': { |
| 339 | 'CPPDEFINES': ['_MIPS_ARCH_MIPS32R2'] |
| 340 | }, |
ager@chromium.org | 5c83825 | 2010-02-19 08:53:10 +0000 | [diff] [blame] | 341 | }, |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 342 | 'disassembler:on': { |
| 343 | 'CPPDEFINES': ['ENABLE_DISASSEMBLER'] |
| 344 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 345 | } |
| 346 | } |
| 347 | |
| 348 | |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 349 | MKSNAPSHOT_EXTRA_FLAGS = { |
| 350 | 'gcc': { |
| 351 | 'os:linux': { |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 352 | 'LIBS': ['pthread'], |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 353 | }, |
| 354 | 'os:macos': { |
| 355 | 'LIBS': ['pthread'], |
| 356 | }, |
| 357 | 'os:freebsd': { |
ager@chromium.org | e2902be | 2009-06-08 12:21:35 +0000 | [diff] [blame] | 358 | 'LIBS': ['execinfo', 'pthread'] |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 359 | }, |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 360 | 'os:solaris': { |
| 361 | 'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'], |
| 362 | 'LINKFLAGS': ['-mt'] |
| 363 | }, |
sgjesse@chromium.org | ac6aa17 | 2009-12-04 12:29:05 +0000 | [diff] [blame] | 364 | 'os:openbsd': { |
| 365 | 'LIBS': ['execinfo', 'pthread'] |
| 366 | }, |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 367 | 'os:win32': { |
ager@chromium.org | 381abbb | 2009-02-25 13:23:22 +0000 | [diff] [blame] | 368 | 'LIBS': ['winmm', 'ws2_32'], |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 369 | }, |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 370 | 'compress_startup_data:bz2': { |
| 371 | 'os:linux': { |
| 372 | 'LIBS': ['bz2'] |
| 373 | } |
| 374 | }, |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 375 | }, |
| 376 | 'msvc': { |
| 377 | 'all': { |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 378 | 'CPPDEFINES': ['_HAS_EXCEPTIONS=0'], |
ager@chromium.org | 381abbb | 2009-02-25 13:23:22 +0000 | [diff] [blame] | 379 | 'LIBS': ['winmm', 'ws2_32'] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 380 | } |
| 381 | } |
| 382 | } |
| 383 | |
| 384 | |
| 385 | DTOA_EXTRA_FLAGS = { |
| 386 | 'gcc': { |
| 387 | 'all': { |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 388 | 'WARNINGFLAGS': ['-Werror', '-Wno-uninitialized'], |
| 389 | 'CCFLAGS': GCC_DTOA_EXTRA_CCFLAGS |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 390 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 391 | }, |
| 392 | 'msvc': { |
| 393 | 'all': { |
| 394 | 'WARNINGFLAGS': ['/WX', '/wd4018', '/wd4244'] |
| 395 | } |
| 396 | } |
| 397 | } |
| 398 | |
| 399 | |
| 400 | CCTEST_EXTRA_FLAGS = { |
| 401 | 'all': { |
| 402 | 'CPPPATH': [join(root_dir, 'src')], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 403 | }, |
| 404 | 'gcc': { |
| 405 | 'all': { |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 406 | 'LIBPATH': [abspath('.')], |
| 407 | 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], |
| 408 | 'CXXFLAGS': ['$CCFLAGS', '-fno-rtti', '-fno-exceptions'], |
| 409 | 'LINKFLAGS': ['$CCFLAGS'], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 410 | }, |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 411 | 'os:linux': { |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 412 | 'LIBS': ['pthread'], |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 413 | }, |
| 414 | 'os:macos': { |
| 415 | 'LIBS': ['pthread'], |
| 416 | }, |
| 417 | 'os:freebsd': { |
| 418 | 'LIBS': ['execinfo', 'pthread'] |
| 419 | }, |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 420 | 'os:solaris': { |
| 421 | 'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'], |
| 422 | 'LINKFLAGS': ['-mt'] |
| 423 | }, |
sgjesse@chromium.org | ac6aa17 | 2009-12-04 12:29:05 +0000 | [diff] [blame] | 424 | 'os:openbsd': { |
| 425 | 'LIBS': ['execinfo', 'pthread'] |
| 426 | }, |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 427 | 'os:win32': { |
ager@chromium.org | 381abbb | 2009-02-25 13:23:22 +0000 | [diff] [blame] | 428 | 'LIBS': ['winmm', 'ws2_32'] |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 429 | }, |
ricow@chromium.org | c9c8082 | 2010-04-21 08:22:37 +0000 | [diff] [blame] | 430 | 'arch:arm': { |
| 431 | 'LINKFLAGS': ARM_LINK_FLAGS |
| 432 | }, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 433 | }, |
| 434 | 'msvc': { |
| 435 | 'all': { |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 436 | 'CPPDEFINES': ['_HAS_EXCEPTIONS=0'], |
ager@chromium.org | 381abbb | 2009-02-25 13:23:22 +0000 | [diff] [blame] | 437 | 'LIBS': ['winmm', 'ws2_32'] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 438 | }, |
| 439 | 'library:shared': { |
| 440 | 'CPPDEFINES': ['USING_V8_SHARED'] |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 441 | }, |
| 442 | 'arch:ia32': { |
ager@chromium.org | 9085a01 | 2009-05-11 19:22:57 +0000 | [diff] [blame] | 443 | 'CPPDEFINES': ['V8_TARGET_ARCH_IA32'] |
ager@chromium.org | 18ad94b | 2009-09-02 08:22:29 +0000 | [diff] [blame] | 444 | }, |
| 445 | 'arch:x64': { |
christian.plesner.hansen@gmail.com | 9d58c2b | 2009-10-16 11:48:38 +0000 | [diff] [blame] | 446 | 'CPPDEFINES': ['V8_TARGET_ARCH_X64'], |
| 447 | 'LINKFLAGS': ['/STACK:2091752'] |
ager@chromium.org | 18ad94b | 2009-09-02 08:22:29 +0000 | [diff] [blame] | 448 | }, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 449 | } |
| 450 | } |
| 451 | |
| 452 | |
| 453 | SAMPLE_FLAGS = { |
| 454 | 'all': { |
v8.team.kasperl | 727e995 | 2008-09-02 14:56:44 +0000 | [diff] [blame] | 455 | 'CPPPATH': [join(abspath('.'), 'include')], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 456 | }, |
| 457 | 'gcc': { |
| 458 | 'all': { |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 459 | 'LIBPATH': ['.'], |
| 460 | 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], |
| 461 | 'CXXFLAGS': ['$CCFLAGS', '-fno-rtti', '-fno-exceptions'], |
| 462 | 'LINKFLAGS': ['$CCFLAGS'], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 463 | }, |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 464 | 'os:linux': { |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 465 | 'LIBS': ['pthread'], |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 466 | }, |
| 467 | 'os:macos': { |
| 468 | 'LIBS': ['pthread'], |
| 469 | }, |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 470 | 'os:freebsd': { |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 471 | 'LIBPATH' : ['/usr/local/lib'], |
| 472 | 'LIBS': ['execinfo', 'pthread'] |
sgjesse@chromium.org | ac6aa17 | 2009-12-04 12:29:05 +0000 | [diff] [blame] | 473 | }, |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 474 | 'os:solaris': { |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 475 | 'LIBPATH' : ['/usr/local/lib'], |
| 476 | 'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'], |
| 477 | 'LINKFLAGS': ['-mt'] |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 478 | }, |
sgjesse@chromium.org | ac6aa17 | 2009-12-04 12:29:05 +0000 | [diff] [blame] | 479 | 'os:openbsd': { |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 480 | 'LIBPATH' : ['/usr/local/lib'], |
| 481 | 'LIBS': ['execinfo', 'pthread'] |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 482 | }, |
| 483 | 'os:win32': { |
ager@chromium.org | 381abbb | 2009-02-25 13:23:22 +0000 | [diff] [blame] | 484 | 'LIBS': ['winmm', 'ws2_32'] |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 485 | }, |
ricow@chromium.org | c9c8082 | 2010-04-21 08:22:37 +0000 | [diff] [blame] | 486 | 'arch:arm': { |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 487 | 'LINKFLAGS': ARM_LINK_FLAGS, |
| 488 | 'armeabi:soft' : { |
| 489 | 'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0'], |
| 490 | 'simulator:none': { |
| 491 | 'CCFLAGS': ['-mfloat-abi=soft'], |
| 492 | } |
| 493 | }, |
| 494 | 'armeabi:softfp' : { |
| 495 | 'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0'], |
| 496 | 'simulator:none': { |
| 497 | 'CCFLAGS': ['-mfloat-abi=softfp'], |
| 498 | } |
| 499 | }, |
| 500 | 'armeabi:hard' : { |
| 501 | 'CPPDEFINES' : ['USE_EABI_HARDFLOAT=1', 'CAN_USE_VFP_INSTRUCTIONS'], |
| 502 | 'simulator:none': { |
| 503 | 'CCFLAGS': ['-mfloat-abi=hard'], |
| 504 | } |
| 505 | } |
ricow@chromium.org | c9c8082 | 2010-04-21 08:22:37 +0000 | [diff] [blame] | 506 | }, |
kasperl@chromium.org | e959c18 | 2009-07-27 08:59:04 +0000 | [diff] [blame] | 507 | 'arch:ia32': { |
| 508 | 'CCFLAGS': ['-m32'], |
| 509 | 'LINKFLAGS': ['-m32'] |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 510 | }, |
kasperl@chromium.org | e959c18 | 2009-07-27 08:59:04 +0000 | [diff] [blame] | 511 | 'arch:x64': { |
| 512 | 'CCFLAGS': ['-m64'], |
| 513 | 'LINKFLAGS': ['-m64'] |
| 514 | }, |
ager@chromium.org | 5c83825 | 2010-02-19 08:53:10 +0000 | [diff] [blame] | 515 | 'arch:mips': { |
| 516 | 'CPPDEFINES': ['V8_TARGET_ARCH_MIPS'], |
danno@chromium.org | 40cb878 | 2011-05-25 07:58:50 +0000 | [diff] [blame] | 517 | 'mips_arch_variant:mips32r2': { |
| 518 | 'CPPDEFINES': ['_MIPS_ARCH_MIPS32R2'] |
| 519 | }, |
ager@chromium.org | 5c83825 | 2010-02-19 08:53:10 +0000 | [diff] [blame] | 520 | 'simulator:none': { |
danno@chromium.org | 40cb878 | 2011-05-25 07:58:50 +0000 | [diff] [blame] | 521 | 'CCFLAGS': ['-EL'], |
ager@chromium.org | 5c83825 | 2010-02-19 08:53:10 +0000 | [diff] [blame] | 522 | 'LINKFLAGS': ['-EL'], |
danno@chromium.org | 40cb878 | 2011-05-25 07:58:50 +0000 | [diff] [blame] | 523 | 'mips_arch_variant:mips32r2': { |
| 524 | 'CCFLAGS': ['-mips32r2', '-Wa,-mips32r2'] |
| 525 | }, |
| 526 | 'mips_arch_variant:mips32r1': { |
| 527 | 'CCFLAGS': ['-mips32', '-Wa,-mips32'] |
| 528 | }, |
| 529 | 'library:static': { |
| 530 | 'LINKFLAGS': ['-static', '-static-libgcc'] |
| 531 | }, |
| 532 | 'mipsabi:softfloat': { |
| 533 | 'CCFLAGS': ['-msoft-float'], |
| 534 | 'LINKFLAGS': ['-msoft-float'] |
| 535 | }, |
| 536 | 'mipsabi:hardfloat': { |
| 537 | 'CCFLAGS': ['-mhard-float'], |
| 538 | 'LINKFLAGS': ['-mhard-float'] |
| 539 | } |
ager@chromium.org | 5c83825 | 2010-02-19 08:53:10 +0000 | [diff] [blame] | 540 | } |
| 541 | }, |
kasperl@chromium.org | e959c18 | 2009-07-27 08:59:04 +0000 | [diff] [blame] | 542 | 'simulator:arm': { |
| 543 | 'CCFLAGS': ['-m32'], |
| 544 | 'LINKFLAGS': ['-m32'] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 545 | }, |
ager@chromium.org | 5c83825 | 2010-02-19 08:53:10 +0000 | [diff] [blame] | 546 | 'simulator:mips': { |
| 547 | 'CCFLAGS': ['-m32'], |
| 548 | 'LINKFLAGS': ['-m32'] |
| 549 | }, |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 550 | 'mode:release': { |
| 551 | 'CCFLAGS': ['-O2'] |
| 552 | }, |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 553 | 'mode:debug': { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 554 | 'CCFLAGS': ['-g', '-O0'], |
| 555 | 'CPPDEFINES': ['DEBUG'] |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 556 | }, |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 557 | 'compress_startup_data:bz2': { |
| 558 | 'CPPDEFINES': ['COMPRESS_STARTUP_DATA_BZ2'], |
| 559 | 'os:linux': { |
| 560 | 'LIBS': ['bz2'] |
| 561 | } |
| 562 | }, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 563 | }, |
| 564 | 'msvc': { |
| 565 | 'all': { |
ager@chromium.org | 381abbb | 2009-02-25 13:23:22 +0000 | [diff] [blame] | 566 | 'LIBS': ['winmm', 'ws2_32'] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 567 | }, |
ager@chromium.org | 18ad94b | 2009-09-02 08:22:29 +0000 | [diff] [blame] | 568 | 'verbose:off': { |
| 569 | 'CCFLAGS': ['/nologo'], |
| 570 | 'LINKFLAGS': ['/NOLOGO'] |
| 571 | }, |
| 572 | 'verbose:on': { |
| 573 | 'LINKFLAGS': ['/VERBOSE'] |
| 574 | }, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 575 | 'library:shared': { |
| 576 | 'CPPDEFINES': ['USING_V8_SHARED'] |
| 577 | }, |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 578 | 'prof:on': { |
| 579 | 'LINKFLAGS': ['/MAP'] |
| 580 | }, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 581 | 'mode:release': { |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 582 | 'CCFLAGS': ['/O2'], |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 583 | 'LINKFLAGS': ['/OPT:REF', '/OPT:ICF'], |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 584 | 'msvcrt:static': { |
| 585 | 'CCFLAGS': ['/MT'] |
| 586 | }, |
| 587 | 'msvcrt:shared': { |
| 588 | 'CCFLAGS': ['/MD'] |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 589 | }, |
| 590 | 'msvcltcg:on': { |
| 591 | 'CCFLAGS': ['/GL'], |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 592 | 'pgo:off': { |
| 593 | 'LINKFLAGS': ['/LTCG'], |
| 594 | }, |
| 595 | }, |
| 596 | 'pgo:instrument': { |
| 597 | 'LINKFLAGS': ['/LTCG:PGI'] |
| 598 | }, |
| 599 | 'pgo:optimize': { |
| 600 | 'LINKFLAGS': ['/LTCG:PGO'] |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 601 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 602 | }, |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 603 | 'arch:ia32': { |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 604 | 'CPPDEFINES': ['V8_TARGET_ARCH_IA32', 'WIN32'], |
ager@chromium.org | 18ad94b | 2009-09-02 08:22:29 +0000 | [diff] [blame] | 605 | 'LINKFLAGS': ['/MACHINE:X86'] |
| 606 | }, |
| 607 | 'arch:x64': { |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 608 | 'CPPDEFINES': ['V8_TARGET_ARCH_X64', 'WIN32'], |
christian.plesner.hansen@gmail.com | 9d58c2b | 2009-10-16 11:48:38 +0000 | [diff] [blame] | 609 | 'LINKFLAGS': ['/MACHINE:X64', '/STACK:2091752'] |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 610 | }, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 611 | 'mode:debug': { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 612 | 'CCFLAGS': ['/Od'], |
| 613 | 'LINKFLAGS': ['/DEBUG'], |
| 614 | 'CPPDEFINES': ['DEBUG'], |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 615 | 'msvcrt:static': { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 616 | 'CCFLAGS': ['/MTd'] |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 617 | }, |
| 618 | 'msvcrt:shared': { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 619 | 'CCFLAGS': ['/MDd'] |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 620 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 621 | } |
| 622 | } |
| 623 | } |
| 624 | |
| 625 | |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 626 | PREPARSER_FLAGS = { |
| 627 | 'all': { |
| 628 | 'CPPPATH': [join(abspath('.'), 'include'), join(abspath('.'), 'src')] |
| 629 | }, |
| 630 | 'gcc': { |
| 631 | 'all': { |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 632 | 'LIBPATH': ['.'], |
| 633 | 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], |
| 634 | 'CXXFLAGS': ['$CCFLAGS', '-fno-rtti', '-fno-exceptions'], |
| 635 | 'LINKFLAGS': ['$CCFLAGS'], |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 636 | }, |
| 637 | 'os:win32': { |
| 638 | 'LIBS': ['winmm', 'ws2_32'] |
| 639 | }, |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 640 | 'arch:arm': { |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 641 | 'LINKFLAGS': ARM_LINK_FLAGS, |
| 642 | 'armeabi:soft' : { |
| 643 | 'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0'], |
| 644 | 'simulator:none': { |
| 645 | 'CCFLAGS': ['-mfloat-abi=soft'], |
| 646 | } |
| 647 | }, |
| 648 | 'armeabi:softfp' : { |
| 649 | 'simulator:none': { |
| 650 | 'CCFLAGS': ['-mfloat-abi=softfp'], |
| 651 | } |
| 652 | }, |
| 653 | 'armeabi:hard' : { |
| 654 | 'simulator:none': { |
| 655 | 'CCFLAGS': ['-mfloat-abi=hard'], |
| 656 | } |
| 657 | } |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 658 | }, |
| 659 | 'arch:ia32': { |
| 660 | 'CCFLAGS': ['-m32'], |
| 661 | 'LINKFLAGS': ['-m32'] |
| 662 | }, |
| 663 | 'arch:x64': { |
| 664 | 'CCFLAGS': ['-m64'], |
| 665 | 'LINKFLAGS': ['-m64'] |
| 666 | }, |
| 667 | 'arch:mips': { |
| 668 | 'CPPDEFINES': ['V8_TARGET_ARCH_MIPS'], |
| 669 | 'mips_arch_variant:mips32r2': { |
| 670 | 'CPPDEFINES': ['_MIPS_ARCH_MIPS32R2'] |
| 671 | }, |
| 672 | 'simulator:none': { |
| 673 | 'CCFLAGS': ['-EL'], |
| 674 | 'LINKFLAGS': ['-EL'], |
| 675 | 'mips_arch_variant:mips32r2': { |
| 676 | 'CCFLAGS': ['-mips32r2', '-Wa,-mips32r2'] |
| 677 | }, |
| 678 | 'mips_arch_variant:mips32r1': { |
| 679 | 'CCFLAGS': ['-mips32', '-Wa,-mips32'] |
| 680 | }, |
| 681 | 'library:static': { |
| 682 | 'LINKFLAGS': ['-static', '-static-libgcc'] |
| 683 | }, |
| 684 | 'mipsabi:softfloat': { |
| 685 | 'CCFLAGS': ['-msoft-float'], |
| 686 | 'LINKFLAGS': ['-msoft-float'] |
| 687 | }, |
| 688 | 'mipsabi:hardfloat': { |
| 689 | 'CCFLAGS': ['-mhard-float'], |
| 690 | 'LINKFLAGS': ['-mhard-float'] |
| 691 | } |
| 692 | } |
| 693 | }, |
| 694 | 'simulator:arm': { |
| 695 | 'CCFLAGS': ['-m32'], |
| 696 | 'LINKFLAGS': ['-m32'] |
| 697 | }, |
| 698 | 'simulator:mips': { |
| 699 | 'CCFLAGS': ['-m32'], |
| 700 | 'LINKFLAGS': ['-m32'], |
| 701 | 'mipsabi:softfloat': { |
| 702 | 'CPPDEFINES': ['__mips_soft_float=1'], |
danno@chromium.org | 40cb878 | 2011-05-25 07:58:50 +0000 | [diff] [blame] | 703 | }, |
| 704 | 'mipsabi:hardfloat': { |
| 705 | 'CPPDEFINES': ['__mips_hard_float=1'], |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 706 | } |
| 707 | }, |
| 708 | 'mode:release': { |
| 709 | 'CCFLAGS': ['-O2'] |
| 710 | }, |
| 711 | 'mode:debug': { |
| 712 | 'CCFLAGS': ['-g', '-O0'], |
| 713 | 'CPPDEFINES': ['DEBUG'] |
| 714 | }, |
| 715 | }, |
| 716 | 'msvc': { |
| 717 | 'all': { |
| 718 | 'LIBS': ['winmm', 'ws2_32'] |
| 719 | }, |
| 720 | 'verbose:off': { |
| 721 | 'CCFLAGS': ['/nologo'], |
| 722 | 'LINKFLAGS': ['/NOLOGO'] |
| 723 | }, |
| 724 | 'verbose:on': { |
| 725 | 'LINKFLAGS': ['/VERBOSE'] |
| 726 | }, |
| 727 | 'library:shared': { |
| 728 | 'CPPDEFINES': ['USING_V8_SHARED'] |
| 729 | }, |
| 730 | 'prof:on': { |
| 731 | 'LINKFLAGS': ['/MAP'] |
| 732 | }, |
| 733 | 'mode:release': { |
| 734 | 'CCFLAGS': ['/O2'], |
| 735 | 'LINKFLAGS': ['/OPT:REF', '/OPT:ICF'], |
| 736 | 'msvcrt:static': { |
| 737 | 'CCFLAGS': ['/MT'] |
| 738 | }, |
| 739 | 'msvcrt:shared': { |
| 740 | 'CCFLAGS': ['/MD'] |
| 741 | }, |
| 742 | 'msvcltcg:on': { |
| 743 | 'CCFLAGS': ['/GL'], |
| 744 | 'pgo:off': { |
| 745 | 'LINKFLAGS': ['/LTCG'], |
| 746 | }, |
| 747 | }, |
| 748 | 'pgo:instrument': { |
| 749 | 'LINKFLAGS': ['/LTCG:PGI'] |
| 750 | }, |
| 751 | 'pgo:optimize': { |
| 752 | 'LINKFLAGS': ['/LTCG:PGO'] |
| 753 | } |
| 754 | }, |
| 755 | 'arch:ia32': { |
| 756 | 'CPPDEFINES': ['V8_TARGET_ARCH_IA32', 'WIN32'], |
| 757 | 'LINKFLAGS': ['/MACHINE:X86'] |
| 758 | }, |
| 759 | 'arch:x64': { |
| 760 | 'CPPDEFINES': ['V8_TARGET_ARCH_X64', 'WIN32'], |
| 761 | 'LINKFLAGS': ['/MACHINE:X64', '/STACK:2091752'] |
| 762 | }, |
| 763 | 'mode:debug': { |
| 764 | 'CCFLAGS': ['/Od'], |
| 765 | 'LINKFLAGS': ['/DEBUG'], |
| 766 | 'CPPDEFINES': ['DEBUG'], |
| 767 | 'msvcrt:static': { |
| 768 | 'CCFLAGS': ['/MTd'] |
| 769 | }, |
| 770 | 'msvcrt:shared': { |
| 771 | 'CCFLAGS': ['/MDd'] |
| 772 | } |
| 773 | } |
| 774 | } |
| 775 | } |
| 776 | |
| 777 | |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 778 | D8_FLAGS = { |
| 779 | 'gcc': { |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 780 | 'all': { |
| 781 | 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], |
| 782 | 'CXXFLAGS': ['$CCFLAGS', '-fno-rtti', '-fno-exceptions'], |
| 783 | 'LINKFLAGS': ['$CCFLAGS'], |
| 784 | }, |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 785 | 'console:readline': { |
| 786 | 'LIBS': ['readline'] |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 787 | }, |
| 788 | 'os:linux': { |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 789 | 'LIBS': ['pthread'], |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 790 | }, |
| 791 | 'os:macos': { |
| 792 | 'LIBS': ['pthread'], |
| 793 | }, |
| 794 | 'os:freebsd': { |
| 795 | 'LIBS': ['pthread'], |
| 796 | }, |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 797 | 'os:solaris': { |
| 798 | 'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'], |
| 799 | 'LINKFLAGS': ['-mt'] |
| 800 | }, |
sgjesse@chromium.org | ac6aa17 | 2009-12-04 12:29:05 +0000 | [diff] [blame] | 801 | 'os:openbsd': { |
| 802 | 'LIBS': ['pthread'], |
| 803 | }, |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 804 | 'os:win32': { |
ager@chromium.org | 381abbb | 2009-02-25 13:23:22 +0000 | [diff] [blame] | 805 | 'LIBS': ['winmm', 'ws2_32'], |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 806 | }, |
whesse@chromium.org | ba5a61b | 2010-07-26 11:44:40 +0000 | [diff] [blame] | 807 | 'arch:arm': { |
| 808 | 'LINKFLAGS': ARM_LINK_FLAGS |
| 809 | }, |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame^] | 810 | 'compress_startup_data:bz2': { |
| 811 | 'CPPDEFINES': ['COMPRESS_STARTUP_DATA_BZ2'], |
| 812 | 'os:linux': { |
| 813 | 'LIBS': ['bz2'] |
| 814 | } |
| 815 | } |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 816 | }, |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 817 | 'msvc': { |
| 818 | 'all': { |
ager@chromium.org | 381abbb | 2009-02-25 13:23:22 +0000 | [diff] [blame] | 819 | 'LIBS': ['winmm', 'ws2_32'] |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 820 | } |
| 821 | } |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 822 | } |
| 823 | |
| 824 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 825 | SUFFIXES = { |
| 826 | 'release': '', |
| 827 | 'debug': '_g' |
| 828 | } |
| 829 | |
| 830 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 831 | def Abort(message): |
| 832 | print message |
| 833 | sys.exit(1) |
| 834 | |
| 835 | |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 836 | def GuessOS(env): |
| 837 | return utils.GuessOS() |
| 838 | |
| 839 | |
| 840 | def GuessArch(env): |
| 841 | return utils.GuessArchitecture() |
| 842 | |
| 843 | |
| 844 | def GuessToolchain(env): |
| 845 | tools = env['TOOLS'] |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 846 | if 'gcc' in tools: |
kasper.lund | 7276f14 | 2008-07-30 08:49:36 +0000 | [diff] [blame] | 847 | return 'gcc' |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 848 | elif 'msvc' in tools: |
| 849 | return 'msvc' |
| 850 | else: |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 851 | return None |
| 852 | |
| 853 | |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 854 | def GuessVisibility(env): |
| 855 | os = env['os'] |
| 856 | toolchain = env['toolchain']; |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 857 | if (os == 'win32' or os == 'cygwin') and toolchain == 'gcc': |
| 858 | # MinGW / Cygwin can't do it. |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 859 | return 'default' |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 860 | elif os == 'solaris': |
| 861 | return 'default' |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 862 | else: |
| 863 | return 'hidden' |
| 864 | |
| 865 | |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 866 | def GuessStrictAliasing(env): |
| 867 | # There seems to be a problem with gcc 4.5.x. |
| 868 | # See http://code.google.com/p/v8/issues/detail?id=884 |
| 869 | # It can be worked around by disabling strict aliasing. |
| 870 | toolchain = env['toolchain']; |
| 871 | if toolchain == 'gcc': |
| 872 | env = Environment(tools=['gcc']) |
| 873 | # The gcc version should be available in env['CCVERSION'], |
| 874 | # but when scons detects msvc this value is not set. |
| 875 | version = subprocess.Popen([env['CC'], '-dumpversion'], |
| 876 | stdout=subprocess.PIPE).communicate()[0] |
| 877 | if version.find('4.5') == 0: |
| 878 | return 'off' |
| 879 | return 'default' |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 880 | |
| 881 | |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 882 | PLATFORM_OPTIONS = { |
| 883 | 'arch': { |
| 884 | 'values': ['arm', 'ia32', 'x64', 'mips'], |
| 885 | 'guess': GuessArch, |
| 886 | 'help': 'the architecture to build for' |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 887 | }, |
| 888 | 'os': { |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 889 | 'values': ['freebsd', 'linux', 'macos', 'win32', 'openbsd', 'solaris', 'cygwin'], |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 890 | 'guess': GuessOS, |
| 891 | 'help': 'the os to build for' |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 892 | }, |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 893 | 'toolchain': { |
| 894 | 'values': ['gcc', 'msvc'], |
| 895 | 'guess': GuessToolchain, |
| 896 | 'help': 'the toolchain to use' |
| 897 | } |
| 898 | } |
| 899 | |
| 900 | SIMPLE_OPTIONS = { |
kasperl@chromium.org | 68ac009 | 2009-07-09 06:00:35 +0000 | [diff] [blame] | 901 | 'regexp': { |
| 902 | 'values': ['native', 'interpreted'], |
| 903 | 'default': 'native', |
| 904 | 'help': 'Whether to use native or interpreted regexp implementation' |
| 905 | }, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 906 | 'snapshot': { |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 907 | 'values': ['on', 'off', 'nobuild'], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 908 | 'default': 'off', |
| 909 | 'help': 'build using snapshots for faster start-up' |
| 910 | }, |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 911 | 'prof': { |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 912 | 'values': ['on', 'off'], |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 913 | 'default': 'off', |
| 914 | 'help': 'enable profiling of build target' |
| 915 | }, |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 916 | 'gdbjit': { |
| 917 | 'values': ['on', 'off'], |
| 918 | 'default': 'off', |
| 919 | 'help': 'enable GDB JIT interface' |
| 920 | }, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 921 | 'library': { |
| 922 | 'values': ['static', 'shared'], |
| 923 | 'default': 'static', |
| 924 | 'help': 'the type of library to produce' |
| 925 | }, |
ager@chromium.org | 357bf65 | 2010-04-12 11:30:10 +0000 | [diff] [blame] | 926 | 'vmstate': { |
| 927 | 'values': ['on', 'off'], |
| 928 | 'default': 'off', |
| 929 | 'help': 'enable VM state tracking' |
| 930 | }, |
whesse@chromium.org | 023421e | 2010-12-21 12:19:12 +0000 | [diff] [blame] | 931 | 'objectprint': { |
| 932 | 'values': ['on', 'off'], |
| 933 | 'default': 'off', |
| 934 | 'help': 'enable object printing' |
| 935 | }, |
ager@chromium.org | 357bf65 | 2010-04-12 11:30:10 +0000 | [diff] [blame] | 936 | 'protectheap': { |
| 937 | 'values': ['on', 'off'], |
| 938 | 'default': 'off', |
| 939 | 'help': 'enable heap protection' |
| 940 | }, |
ager@chromium.org | 4af710e | 2009-09-15 12:20:11 +0000 | [diff] [blame] | 941 | 'profilingsupport': { |
| 942 | 'values': ['on', 'off'], |
| 943 | 'default': 'on', |
| 944 | 'help': 'enable profiling of JavaScript code' |
| 945 | }, |
| 946 | 'debuggersupport': { |
| 947 | 'values': ['on', 'off'], |
| 948 | 'default': 'on', |
| 949 | 'help': 'enable debugging of JavaScript code' |
| 950 | }, |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 951 | 'inspector': { |
| 952 | 'values': ['on', 'off'], |
| 953 | 'default': 'off', |
| 954 | 'help': 'enable inspector features' |
| 955 | }, |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 956 | 'liveobjectlist': { |
| 957 | 'values': ['on', 'off'], |
| 958 | 'default': 'off', |
| 959 | 'help': 'enable live object list features in the debugger' |
| 960 | }, |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 961 | 'soname': { |
| 962 | 'values': ['on', 'off'], |
| 963 | 'default': 'off', |
| 964 | 'help': 'turn on setting soname for Linux shared library' |
| 965 | }, |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 966 | 'msvcrt': { |
| 967 | 'values': ['static', 'shared'], |
| 968 | 'default': 'static', |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 969 | 'help': 'the type of Microsoft Visual C++ runtime library to use' |
| 970 | }, |
| 971 | 'msvcltcg': { |
| 972 | 'values': ['on', 'off'], |
| 973 | 'default': 'on', |
| 974 | 'help': 'use Microsoft Visual C++ link-time code generation' |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 975 | }, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 976 | 'simulator': { |
ager@chromium.org | 5c83825 | 2010-02-19 08:53:10 +0000 | [diff] [blame] | 977 | 'values': ['arm', 'mips', 'none'], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 978 | 'default': 'none', |
| 979 | 'help': 'build with simulator' |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 980 | }, |
ricow@chromium.org | 30ce411 | 2010-05-31 10:38:25 +0000 | [diff] [blame] | 981 | 'unalignedaccesses': { |
| 982 | 'values': ['default', 'on', 'off'], |
| 983 | 'default': 'default', |
| 984 | 'help': 'set whether the ARM target supports unaligned accesses' |
| 985 | }, |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 986 | 'disassembler': { |
| 987 | 'values': ['on', 'off'], |
| 988 | 'default': 'off', |
| 989 | 'help': 'enable the disassembler to inspect generated code' |
| 990 | }, |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 991 | 'fasttls': { |
| 992 | 'values': ['on', 'off'], |
| 993 | 'default': 'on', |
| 994 | 'help': 'enable fast thread local storage support ' |
| 995 | '(if available on the current architecture/platform)' |
| 996 | }, |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 997 | 'sourcesignatures': { |
| 998 | 'values': ['MD5', 'timestamp'], |
| 999 | 'default': 'MD5', |
| 1000 | 'help': 'set how the build system detects file changes' |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 1001 | }, |
| 1002 | 'console': { |
| 1003 | 'values': ['dumb', 'readline'], |
| 1004 | 'default': 'dumb', |
| 1005 | 'help': 'the console to use for the d8 shell' |
ager@chromium.org | 18ad94b | 2009-09-02 08:22:29 +0000 | [diff] [blame] | 1006 | }, |
| 1007 | 'verbose': { |
| 1008 | 'values': ['on', 'off'], |
| 1009 | 'default': 'off', |
| 1010 | 'help': 'more output from compiler and linker' |
ager@chromium.org | 4af710e | 2009-09-15 12:20:11 +0000 | [diff] [blame] | 1011 | }, |
| 1012 | 'visibility': { |
| 1013 | 'values': ['default', 'hidden'], |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 1014 | 'guess': GuessVisibility, |
| 1015 | 'help': 'shared library symbol visibility' |
| 1016 | }, |
| 1017 | 'strictaliasing': { |
| 1018 | 'values': ['default', 'off'], |
| 1019 | 'guess': GuessStrictAliasing, |
| 1020 | 'help': 'assume strict aliasing while optimizing' |
kmillikin@chromium.org | 13bd294 | 2009-12-16 15:36:05 +0000 | [diff] [blame] | 1021 | }, |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 1022 | 'pgo': { |
| 1023 | 'values': ['off', 'instrument', 'optimize'], |
| 1024 | 'default': 'off', |
| 1025 | 'help': 'select profile guided optimization variant', |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 1026 | }, |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 1027 | 'armeabi': { |
| 1028 | 'values': ['hard', 'softfp', 'soft'], |
| 1029 | 'default': 'softfp', |
| 1030 | 'help': 'generate calling conventiont according to selected ARM EABI variant' |
| 1031 | }, |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 1032 | 'mipsabi': { |
| 1033 | 'values': ['hardfloat', 'softfloat', 'none'], |
| 1034 | 'default': 'hardfloat', |
| 1035 | 'help': 'generate calling conventiont according to selected mips ABI' |
| 1036 | }, |
| 1037 | 'mips_arch_variant': { |
| 1038 | 'values': ['mips32r2', 'mips32r1'], |
| 1039 | 'default': 'mips32r2', |
| 1040 | 'help': 'mips variant' |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 1041 | }, |
| 1042 | 'compress_startup_data': { |
| 1043 | 'values': ['off', 'bz2'], |
| 1044 | 'default': 'off', |
| 1045 | 'help': 'compress startup data (snapshot) [Linux only]' |
| 1046 | }, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1047 | } |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 1048 | |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 1049 | ALL_OPTIONS = dict(PLATFORM_OPTIONS, **SIMPLE_OPTIONS) |
| 1050 | |
| 1051 | |
| 1052 | def AddOptions(options, result): |
| 1053 | guess_env = Environment(options=result) |
| 1054 | for (name, option) in options.iteritems(): |
| 1055 | if 'guess' in option: |
| 1056 | # Option has a guess function |
| 1057 | guess = option.get('guess') |
| 1058 | default = guess(guess_env) |
| 1059 | else: |
| 1060 | # Option has a fixed default |
| 1061 | default = option.get('default') |
| 1062 | help = '%s (%s)' % (option.get('help'), ", ".join(option['values'])) |
| 1063 | result.Add(name, help, default) |
| 1064 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 1065 | |
| 1066 | def GetOptions(): |
| 1067 | result = Options() |
kasper.lund | 7276f14 | 2008-07-30 08:49:36 +0000 | [diff] [blame] | 1068 | result.Add('mode', 'compilation mode (debug, release)', 'release') |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 1069 | result.Add('sample', 'build sample (shell, process, lineprocessor)', '') |
ager@chromium.org | 2cc82ae | 2010-06-14 07:35:38 +0000 | [diff] [blame] | 1070 | result.Add('cache', 'directory to use for scons build cache', '') |
kasperl@chromium.org | 8ccb0be | 2009-04-07 07:21:39 +0000 | [diff] [blame] | 1071 | result.Add('env', 'override environment settings (NAME0:value0,NAME1:value1,...)', '') |
| 1072 | result.Add('importenv', 'import environment settings (NAME0,NAME1,...)', '') |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 1073 | AddOptions(PLATFORM_OPTIONS, result) |
| 1074 | AddOptions(SIMPLE_OPTIONS, result) |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 1075 | return result |
| 1076 | |
| 1077 | |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 1078 | def GetTools(opts): |
| 1079 | env = Environment(options=opts) |
| 1080 | os = env['os'] |
| 1081 | toolchain = env['toolchain'] |
| 1082 | if os == 'win32' and toolchain == 'gcc': |
| 1083 | return ['mingw'] |
| 1084 | elif os == 'win32' and toolchain == 'msvc': |
| 1085 | return ['msvc', 'mslink', 'mslib', 'msvs'] |
| 1086 | else: |
| 1087 | return ['default'] |
| 1088 | |
| 1089 | |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 1090 | def GetVersionComponents(): |
| 1091 | MAJOR_VERSION_PATTERN = re.compile(r"#define\s+MAJOR_VERSION\s+(.*)") |
| 1092 | MINOR_VERSION_PATTERN = re.compile(r"#define\s+MINOR_VERSION\s+(.*)") |
| 1093 | BUILD_NUMBER_PATTERN = re.compile(r"#define\s+BUILD_NUMBER\s+(.*)") |
| 1094 | PATCH_LEVEL_PATTERN = re.compile(r"#define\s+PATCH_LEVEL\s+(.*)") |
| 1095 | |
| 1096 | patterns = [MAJOR_VERSION_PATTERN, |
| 1097 | MINOR_VERSION_PATTERN, |
| 1098 | BUILD_NUMBER_PATTERN, |
| 1099 | PATCH_LEVEL_PATTERN] |
| 1100 | |
| 1101 | source = open(join(root_dir, 'src', 'version.cc')).read() |
| 1102 | version_components = [] |
| 1103 | for pattern in patterns: |
| 1104 | match = pattern.search(source) |
| 1105 | if match: |
| 1106 | version_components.append(match.group(1).strip()) |
| 1107 | else: |
| 1108 | version_components.append('0') |
| 1109 | |
| 1110 | return version_components |
| 1111 | |
| 1112 | |
| 1113 | def GetVersion(): |
| 1114 | version_components = GetVersionComponents() |
ager@chromium.org | 5aa501c | 2009-06-23 07:57:28 +0000 | [diff] [blame] | 1115 | |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 1116 | if version_components[len(version_components) - 1] == '0': |
| 1117 | version_components.pop() |
| 1118 | return '.'.join(version_components) |
| 1119 | |
| 1120 | |
| 1121 | def GetSpecificSONAME(): |
| 1122 | SONAME_PATTERN = re.compile(r"#define\s+SONAME\s+\"(.*)\"") |
ager@chromium.org | 5aa501c | 2009-06-23 07:57:28 +0000 | [diff] [blame] | 1123 | |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 1124 | source = open(join(root_dir, 'src', 'version.cc')).read() |
| 1125 | match = SONAME_PATTERN.search(source) |
ager@chromium.org | 5aa501c | 2009-06-23 07:57:28 +0000 | [diff] [blame] | 1126 | |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 1127 | if match: |
| 1128 | return match.group(1).strip() |
| 1129 | else: |
| 1130 | return '' |
| 1131 | |
| 1132 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1133 | def SplitList(str): |
| 1134 | return [ s for s in str.split(",") if len(s) > 0 ] |
| 1135 | |
| 1136 | |
| 1137 | def IsLegal(env, option, values): |
| 1138 | str = env[option] |
| 1139 | for s in SplitList(str): |
| 1140 | if not s in values: |
| 1141 | Abort("Illegal value for option %s '%s'." % (option, s)) |
| 1142 | return False |
| 1143 | return True |
| 1144 | |
| 1145 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 1146 | def VerifyOptions(env): |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1147 | if not IsLegal(env, 'mode', ['debug', 'release']): |
| 1148 | return False |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 1149 | if not IsLegal(env, 'sample', ["shell", "process", "lineprocessor"]): |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1150 | return False |
kasperl@chromium.org | 68ac009 | 2009-07-09 06:00:35 +0000 | [diff] [blame] | 1151 | if not IsLegal(env, 'regexp', ["native", "interpreted"]): |
| 1152 | return False |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 1153 | if env['os'] == 'win32' and env['library'] == 'shared' and env['prof'] == 'on': |
| 1154 | Abort("Profiling on windows only supported for static library.") |
kmillikin@chromium.org | 49edbdf | 2011-02-16 12:32:18 +0000 | [diff] [blame] | 1155 | if env['gdbjit'] == 'on' and (env['os'] != 'linux' or (env['arch'] != 'ia32' and env['arch'] != 'x64' and env['arch'] != 'arm')): |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1156 | Abort("GDBJIT interface is supported only for Intel-compatible (ia32 or x64) Linux target.") |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 1157 | if env['os'] == 'win32' and env['soname'] == 'on': |
| 1158 | Abort("Shared Object soname not applicable for Windows.") |
| 1159 | if env['soname'] == 'on' and env['library'] == 'static': |
| 1160 | Abort("Shared Object soname not applicable for static library.") |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 1161 | if env['os'] != 'win32' and env['pgo'] != 'off': |
| 1162 | Abort("Profile guided optimization only supported on Windows.") |
ager@chromium.org | 2cc82ae | 2010-06-14 07:35:38 +0000 | [diff] [blame] | 1163 | if env['cache'] and not os.path.isdir(env['cache']): |
| 1164 | Abort("The specified cache directory does not exist.") |
ricow@chromium.org | 30ce411 | 2010-05-31 10:38:25 +0000 | [diff] [blame] | 1165 | if not (env['arch'] == 'arm' or env['simulator'] == 'arm') and ('unalignedaccesses' in ARGUMENTS): |
| 1166 | print env['arch'] |
| 1167 | print env['simulator'] |
| 1168 | Abort("Option unalignedaccesses only supported for the ARM architecture.") |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 1169 | if env['os'] != 'linux' and env['compress_startup_data'] != 'off': |
| 1170 | Abort("Startup data compression is only available on Linux") |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 1171 | for (name, option) in ALL_OPTIONS.iteritems(): |
| 1172 | if (not name in env): |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1173 | message = ("A value for option %s must be specified (%s)." % |
| 1174 | (name, ", ".join(option['values']))) |
| 1175 | Abort(message) |
| 1176 | if not env[name] in option['values']: |
| 1177 | message = ("Unknown %s value '%s'. Possible values are (%s)." % |
| 1178 | (name, env[name], ", ".join(option['values']))) |
| 1179 | Abort(message) |
| 1180 | |
| 1181 | |
| 1182 | class BuildContext(object): |
| 1183 | |
v8.team.kasperl | 727e995 | 2008-09-02 14:56:44 +0000 | [diff] [blame] | 1184 | def __init__(self, options, env_overrides, samples): |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1185 | self.library_targets = [] |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 1186 | self.mksnapshot_targets = [] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1187 | self.cctest_targets = [] |
| 1188 | self.sample_targets = [] |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 1189 | self.d8_targets = [] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1190 | self.options = options |
v8.team.kasperl | 727e995 | 2008-09-02 14:56:44 +0000 | [diff] [blame] | 1191 | self.env_overrides = env_overrides |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1192 | self.samples = samples |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 1193 | self.preparser_targets = [] |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 1194 | self.use_snapshot = (options['snapshot'] != 'off') |
| 1195 | self.build_snapshot = (options['snapshot'] == 'on') |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1196 | self.flags = None |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 1197 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1198 | def AddRelevantFlags(self, initial, flags): |
| 1199 | result = initial.copy() |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1200 | toolchain = self.options['toolchain'] |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 1201 | if toolchain in flags: |
| 1202 | self.AppendFlags(result, flags[toolchain].get('all')) |
| 1203 | for option in sorted(self.options.keys()): |
| 1204 | value = self.options[option] |
| 1205 | self.AppendFlags(result, flags[toolchain].get(option + ':' + value)) |
ager@chromium.org | 3a37e9b | 2009-04-27 09:26:21 +0000 | [diff] [blame] | 1206 | self.AppendFlags(result, flags.get('all')) |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 1207 | return result |
| 1208 | |
| 1209 | def AddRelevantSubFlags(self, options, flags): |
| 1210 | self.AppendFlags(options, flags.get('all')) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1211 | for option in sorted(self.options.keys()): |
| 1212 | value = self.options[option] |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 1213 | self.AppendFlags(options, flags.get(option + ':' + value)) |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 1214 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1215 | def GetRelevantSources(self, source): |
| 1216 | result = [] |
| 1217 | result += source.get('all', []) |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 1218 | for (name, value) in self.options.iteritems(): |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 1219 | source_value = source.get(name + ':' + value, []) |
| 1220 | if type(source_value) == dict: |
| 1221 | result += self.GetRelevantSources(source_value) |
| 1222 | else: |
| 1223 | result += source_value |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1224 | return sorted(result) |
| 1225 | |
| 1226 | def AppendFlags(self, options, added): |
| 1227 | if not added: |
| 1228 | return |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 1229 | for (key, value) in added.iteritems(): |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 1230 | if key.find(':') != -1: |
| 1231 | self.AddRelevantSubFlags(options, { key: value }) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1232 | else: |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 1233 | if not key in options: |
| 1234 | options[key] = value |
| 1235 | else: |
| 1236 | prefix = options[key] |
| 1237 | if isinstance(prefix, StringTypes): prefix = prefix.split() |
| 1238 | options[key] = prefix + value |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1239 | |
| 1240 | def ConfigureObject(self, env, input, **kw): |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 1241 | if (kw.has_key('CPPPATH') and env.has_key('CPPPATH')): |
| 1242 | kw['CPPPATH'] += env['CPPPATH'] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1243 | if self.options['library'] == 'static': |
| 1244 | return env.StaticObject(input, **kw) |
| 1245 | else: |
| 1246 | return env.SharedObject(input, **kw) |
| 1247 | |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 1248 | def ApplyEnvOverrides(self, env): |
| 1249 | if not self.env_overrides: |
| 1250 | return |
| 1251 | if type(env['ENV']) == DictType: |
| 1252 | env['ENV'].update(**self.env_overrides) |
| 1253 | else: |
| 1254 | env['ENV'] = self.env_overrides |
| 1255 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1256 | |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 1257 | def PostprocessOptions(options, os): |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1258 | # Adjust architecture if the simulator option has been set |
| 1259 | if (options['simulator'] != 'none') and (options['arch'] != options['simulator']): |
| 1260 | if 'arch' in ARGUMENTS: |
| 1261 | # Print a warning if arch has explicitly been set |
| 1262 | print "Warning: forcing architecture to match simulator (%s)" % options['simulator'] |
| 1263 | options['arch'] = options['simulator'] |
ager@chromium.org | 4af710e | 2009-09-15 12:20:11 +0000 | [diff] [blame] | 1264 | if (options['prof'] != 'off') and (options['profilingsupport'] == 'off'): |
| 1265 | # Print a warning if profiling is enabled without profiling support |
| 1266 | print "Warning: forcing profilingsupport on when prof is on" |
| 1267 | options['profilingsupport'] = 'on' |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 1268 | if os == 'win32' and options['pgo'] != 'off' and options['msvcltcg'] == 'off': |
| 1269 | if 'msvcltcg' in ARGUMENTS: |
| 1270 | print "Warning: forcing msvcltcg on as it is required for pgo (%s)" % options['pgo'] |
| 1271 | options['msvcltcg'] = 'on' |
danno@chromium.org | 40cb878 | 2011-05-25 07:58:50 +0000 | [diff] [blame] | 1272 | if (options['mipsabi'] != 'none') and (options['arch'] != 'mips') and (options['simulator'] != 'mips'): |
| 1273 | options['mipsabi'] = 'none' |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 1274 | if options['liveobjectlist'] == 'on': |
| 1275 | if (options['debuggersupport'] != 'on') or (options['mode'] == 'release'): |
| 1276 | # Print a warning that liveobjectlist will implicitly enable the debugger |
| 1277 | print "Warning: forcing debuggersupport on for liveobjectlist" |
| 1278 | options['debuggersupport'] = 'on' |
ager@chromium.org | 0ee099b | 2011-01-25 14:06:47 +0000 | [diff] [blame] | 1279 | options['inspector'] = 'on' |
| 1280 | options['objectprint'] = 'on' |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1281 | |
| 1282 | |
kasperl@chromium.org | 8ccb0be | 2009-04-07 07:21:39 +0000 | [diff] [blame] | 1283 | def ParseEnvOverrides(arg, imports): |
| 1284 | # The environment overrides are in the format NAME0:value0,NAME1:value1,... |
| 1285 | # The environment imports are in the format NAME0,NAME1,... |
v8.team.kasperl | 727e995 | 2008-09-02 14:56:44 +0000 | [diff] [blame] | 1286 | overrides = {} |
kasperl@chromium.org | 8ccb0be | 2009-04-07 07:21:39 +0000 | [diff] [blame] | 1287 | for var in imports.split(','): |
| 1288 | if var in os.environ: |
| 1289 | overrides[var] = os.environ[var] |
v8.team.kasperl | 727e995 | 2008-09-02 14:56:44 +0000 | [diff] [blame] | 1290 | for override in arg.split(','): |
| 1291 | pos = override.find(':') |
| 1292 | if pos == -1: |
| 1293 | continue |
| 1294 | overrides[override[:pos].strip()] = override[pos+1:].strip() |
| 1295 | return overrides |
| 1296 | |
| 1297 | |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 1298 | def BuildSpecific(env, mode, env_overrides, tools): |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1299 | options = {'mode': mode} |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 1300 | for option in ALL_OPTIONS: |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1301 | options[option] = env[option] |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 1302 | PostprocessOptions(options, env['os']) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1303 | |
v8.team.kasperl | 727e995 | 2008-09-02 14:56:44 +0000 | [diff] [blame] | 1304 | context = BuildContext(options, env_overrides, samples=SplitList(env['sample'])) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1305 | |
ager@chromium.org | ab99eea | 2009-08-25 07:05:41 +0000 | [diff] [blame] | 1306 | # Remove variables which can't be imported from the user's external |
| 1307 | # environment into a construction environment. |
| 1308 | user_environ = os.environ.copy() |
| 1309 | try: |
| 1310 | del user_environ['ENV'] |
| 1311 | except KeyError: |
| 1312 | pass |
| 1313 | |
| 1314 | library_flags = context.AddRelevantFlags(user_environ, LIBRARY_FLAGS) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1315 | v8_flags = context.AddRelevantFlags(library_flags, V8_EXTRA_FLAGS) |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 1316 | mksnapshot_flags = context.AddRelevantFlags(library_flags, MKSNAPSHOT_EXTRA_FLAGS) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1317 | dtoa_flags = context.AddRelevantFlags(library_flags, DTOA_EXTRA_FLAGS) |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 1318 | cctest_flags = context.AddRelevantFlags(v8_flags, CCTEST_EXTRA_FLAGS) |
ager@chromium.org | ab99eea | 2009-08-25 07:05:41 +0000 | [diff] [blame] | 1319 | sample_flags = context.AddRelevantFlags(user_environ, SAMPLE_FLAGS) |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 1320 | preparser_flags = context.AddRelevantFlags(user_environ, PREPARSER_FLAGS) |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 1321 | d8_flags = context.AddRelevantFlags(library_flags, D8_FLAGS) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1322 | |
| 1323 | context.flags = { |
| 1324 | 'v8': v8_flags, |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 1325 | 'mksnapshot': mksnapshot_flags, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1326 | 'dtoa': dtoa_flags, |
| 1327 | 'cctest': cctest_flags, |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 1328 | 'sample': sample_flags, |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 1329 | 'd8': d8_flags, |
| 1330 | 'preparser': preparser_flags |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1331 | } |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 1332 | |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 1333 | # Generate library base name. |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1334 | target_id = mode |
| 1335 | suffix = SUFFIXES[target_id] |
| 1336 | library_name = 'v8' + suffix |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 1337 | preparser_library_name = 'v8preparser' + suffix |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 1338 | version = GetVersion() |
| 1339 | if context.options['soname'] == 'on': |
| 1340 | # When building shared object with SONAME version the library name. |
| 1341 | library_name += '-' + version |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1342 | |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 1343 | # Generate library SONAME if required by the build. |
| 1344 | if context.options['soname'] == 'on': |
| 1345 | soname = GetSpecificSONAME() |
| 1346 | if soname == '': |
| 1347 | soname = 'lib' + library_name + '.so' |
| 1348 | env['SONAME'] = soname |
| 1349 | |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 1350 | # Build the object files by invoking SCons recursively. |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 1351 | (object_files, shell_files, mksnapshot, preparser_files) = env.SConscript( |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1352 | join('src', 'SConscript'), |
| 1353 | build_dir=join('obj', target_id), |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 1354 | exports='context tools', |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1355 | duplicate=False |
| 1356 | ) |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 1357 | |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 1358 | context.mksnapshot_targets.append(mksnapshot) |
| 1359 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1360 | # Link the object files into a library. |
kasperl@chromium.org | b912362 | 2008-09-17 14:05:56 +0000 | [diff] [blame] | 1361 | env.Replace(**context.flags['v8']) |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 1362 | |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 1363 | context.ApplyEnvOverrides(env) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1364 | if context.options['library'] == 'static': |
| 1365 | library = env.StaticLibrary(library_name, object_files) |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 1366 | preparser_library = env.StaticLibrary(preparser_library_name, |
| 1367 | preparser_files) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1368 | else: |
| 1369 | # There seems to be a glitch in the way scons decides where to put |
| 1370 | # PDB files when compiling using MSVC so we specify it manually. |
| 1371 | # This should not affect any other platforms. |
| 1372 | pdb_name = library_name + '.dll.pdb' |
| 1373 | library = env.SharedLibrary(library_name, object_files, PDB=pdb_name) |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 1374 | preparser_pdb_name = preparser_library_name + '.dll.pdb'; |
| 1375 | preparser_library = env.SharedLibrary(preparser_library_name, |
| 1376 | preparser_files, |
| 1377 | PDB=preparser_pdb_name) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1378 | context.library_targets.append(library) |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 1379 | context.library_targets.append(preparser_library) |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 1380 | |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 1381 | d8_env = Environment(tools=tools) |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 1382 | d8_env.Replace(**context.flags['d8']) |
fschneider@chromium.org | 0c20e67 | 2010-01-14 15:28:53 +0000 | [diff] [blame] | 1383 | context.ApplyEnvOverrides(d8_env) |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 1384 | shell = d8_env.Program('d8' + suffix, object_files + shell_files) |
| 1385 | context.d8_targets.append(shell) |
| 1386 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1387 | for sample in context.samples: |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 1388 | sample_env = Environment(tools=tools) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1389 | sample_env.Replace(**context.flags['sample']) |
sgjesse@chromium.org | df7a284 | 2010-03-25 14:34:15 +0000 | [diff] [blame] | 1390 | sample_env.Prepend(LIBS=[library_name]) |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 1391 | context.ApplyEnvOverrides(sample_env) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1392 | sample_object = sample_env.SConscript( |
| 1393 | join('samples', 'SConscript'), |
| 1394 | build_dir=join('obj', 'sample', sample, target_id), |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 1395 | exports='sample context tools', |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1396 | duplicate=False |
| 1397 | ) |
| 1398 | sample_name = sample + suffix |
| 1399 | sample_program = sample_env.Program(sample_name, sample_object) |
| 1400 | sample_env.Depends(sample_program, library) |
| 1401 | context.sample_targets.append(sample_program) |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 1402 | |
ager@chromium.org | b26c50a | 2010-03-26 09:27:16 +0000 | [diff] [blame] | 1403 | cctest_env = env.Copy() |
| 1404 | cctest_env.Prepend(LIBS=[library_name]) |
| 1405 | cctest_program = cctest_env.SConscript( |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1406 | join('test', 'cctest', 'SConscript'), |
| 1407 | build_dir=join('obj', 'test', target_id), |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 1408 | exports='context object_files tools', |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1409 | duplicate=False |
| 1410 | ) |
| 1411 | context.cctest_targets.append(cctest_program) |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 1412 | |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 1413 | preparser_env = env.Copy() |
| 1414 | preparser_env.Replace(**context.flags['preparser']) |
| 1415 | preparser_env.Prepend(LIBS=[preparser_library_name]) |
| 1416 | context.ApplyEnvOverrides(preparser_env) |
| 1417 | preparser_object = preparser_env.SConscript( |
| 1418 | join('preparser', 'SConscript'), |
| 1419 | build_dir=join('obj', 'preparser', target_id), |
| 1420 | exports='context', |
| 1421 | duplicate=False |
| 1422 | ) |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 1423 | preparser_name = join('obj', 'preparser', target_id, 'preparser') |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 1424 | preparser_program = preparser_env.Program(preparser_name, preparser_object); |
| 1425 | preparser_env.Depends(preparser_program, preparser_library) |
| 1426 | context.preparser_targets.append(preparser_program) |
| 1427 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1428 | return context |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 1429 | |
| 1430 | |
kasper.lund | 7276f14 | 2008-07-30 08:49:36 +0000 | [diff] [blame] | 1431 | def Build(): |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 1432 | opts = GetOptions() |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 1433 | tools = GetTools(opts) |
| 1434 | env = Environment(options=opts, tools=tools) |
| 1435 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 1436 | Help(opts.GenerateHelpText(env)) |
| 1437 | VerifyOptions(env) |
kasperl@chromium.org | 8ccb0be | 2009-04-07 07:21:39 +0000 | [diff] [blame] | 1438 | env_overrides = ParseEnvOverrides(env['env'], env['importenv']) |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 1439 | |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 1440 | SourceSignatures(env['sourcesignatures']) |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 1441 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1442 | libraries = [] |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 1443 | mksnapshots = [] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1444 | cctests = [] |
| 1445 | samples = [] |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 1446 | preparsers = [] |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 1447 | d8s = [] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1448 | modes = SplitList(env['mode']) |
| 1449 | for mode in modes: |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 1450 | context = BuildSpecific(env.Copy(), mode, env_overrides, tools) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1451 | libraries += context.library_targets |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 1452 | mksnapshots += context.mksnapshot_targets |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1453 | cctests += context.cctest_targets |
| 1454 | samples += context.sample_targets |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 1455 | preparsers += context.preparser_targets |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 1456 | d8s += context.d8_targets |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 1457 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1458 | env.Alias('library', libraries) |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 1459 | env.Alias('mksnapshot', mksnapshots) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1460 | env.Alias('cctests', cctests) |
| 1461 | env.Alias('sample', samples) |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 1462 | env.Alias('d8', d8s) |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 1463 | env.Alias('preparser', preparsers) |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 1464 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1465 | if env['sample']: |
| 1466 | env.Default('sample') |
kasper.lund | 7276f14 | 2008-07-30 08:49:36 +0000 | [diff] [blame] | 1467 | else: |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1468 | env.Default('library') |
kasper.lund | 7276f14 | 2008-07-30 08:49:36 +0000 | [diff] [blame] | 1469 | |
ager@chromium.org | 2cc82ae | 2010-06-14 07:35:38 +0000 | [diff] [blame] | 1470 | if env['cache']: |
| 1471 | CacheDir(env['cache']) |
kasper.lund | 7276f14 | 2008-07-30 08:49:36 +0000 | [diff] [blame] | 1472 | |
v8.team.kasperl | 727e995 | 2008-09-02 14:56:44 +0000 | [diff] [blame] | 1473 | # We disable deprecation warnings because we need to be able to use |
| 1474 | # env.Copy without getting warnings for compatibility with older |
| 1475 | # version of scons. Also, there's a bug in some revisions that |
| 1476 | # doesn't allow this flag to be set, so we swallow any exceptions. |
| 1477 | # Lovely. |
| 1478 | try: |
| 1479 | SetOption('warn', 'no-deprecated') |
| 1480 | except: |
| 1481 | pass |
| 1482 | |
| 1483 | |
kasper.lund | 7276f14 | 2008-07-30 08:49:36 +0000 | [diff] [blame] | 1484 | Build() |