lrn@chromium.org | 25156de | 2010-04-06 13:10:27 +0000 | [diff] [blame] | 1 | # Copyright 2010 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 | |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 38 | # ANDROID_TOP is the top of the Android checkout, fetched from the environment |
| 39 | # variable 'TOP'. You will also need to set the CXX, CC, AR and RANLIB |
| 40 | # environment variables to the cross-compiling tools. |
| 41 | ANDROID_TOP = os.environ.get('TOP') |
| 42 | if ANDROID_TOP is None: |
| 43 | ANDROID_TOP="" |
| 44 | |
ricow@chromium.org | c9c8082 | 2010-04-21 08:22:37 +0000 | [diff] [blame] | 45 | # 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^] | 46 | # 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] | 47 | # the additional cross-compiling environment variables to the cross compiler. |
| 48 | ARM_TARGET_LIB = os.environ.get('ARM_TARGET_LIB') |
| 49 | if ARM_TARGET_LIB: |
| 50 | ARM_LINK_FLAGS = ['-Wl,-rpath=' + ARM_TARGET_LIB + '/lib:' + |
| 51 | ARM_TARGET_LIB + '/usr/lib', |
| 52 | '-Wl,--dynamic-linker=' + ARM_TARGET_LIB + |
| 53 | '/lib/ld-linux.so.3'] |
| 54 | else: |
| 55 | ARM_LINK_FLAGS = [] |
| 56 | |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 57 | # TODO: Sort these issues out properly but as a temporary solution for gcc 4.4 |
ager@chromium.org | e2902be | 2009-06-08 12:21:35 +0000 | [diff] [blame] | 58 | # on linux we need these compiler flags to avoid crashes in the v8 test suite |
| 59 | # and avoid dtoa.c strict aliasing issues |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 60 | if os.environ.get('GCC_VERSION') == '44': |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 61 | GCC_EXTRA_CCFLAGS = ['-fno-tree-vrp', '-fno-strict-aliasing'] |
| 62 | GCC_DTOA_EXTRA_CCFLAGS = [] |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 63 | else: |
| 64 | GCC_EXTRA_CCFLAGS = [] |
| 65 | GCC_DTOA_EXTRA_CCFLAGS = [] |
| 66 | |
whesse@chromium.org | b6e43bb | 2010-04-14 09:36:28 +0000 | [diff] [blame] | 67 | ANDROID_FLAGS = ['-march=armv7-a', |
| 68 | '-mtune=cortex-a8', |
| 69 | '-mfloat-abi=softfp', |
| 70 | '-mfpu=vfp', |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 71 | '-fpic', |
| 72 | '-mthumb-interwork', |
| 73 | '-funwind-tables', |
| 74 | '-fstack-protector', |
| 75 | '-fno-short-enums', |
| 76 | '-fmessage-length=0', |
| 77 | '-finline-functions', |
| 78 | '-fno-inline-functions-called-once', |
| 79 | '-fgcse-after-reload', |
| 80 | '-frerun-cse-after-loop', |
| 81 | '-frename-registers', |
| 82 | '-fomit-frame-pointer', |
| 83 | '-fno-strict-aliasing', |
| 84 | '-finline-limit=64', |
whesse@chromium.org | b6e43bb | 2010-04-14 09:36:28 +0000 | [diff] [blame] | 85 | '-DCAN_USE_VFP_INSTRUCTIONS=1', |
| 86 | '-DCAN_USE_ARMV7_INSTRUCTIONS=1', |
sgjesse@chromium.org | 720dc0b | 2010-05-10 09:25:39 +0000 | [diff] [blame] | 87 | '-DCAN_USE_UNALIGNED_ACCESSES=1', |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 88 | '-MD'] |
| 89 | |
| 90 | ANDROID_INCLUDES = [ANDROID_TOP + '/bionic/libc/arch-arm/include', |
| 91 | ANDROID_TOP + '/bionic/libc/include', |
| 92 | ANDROID_TOP + '/bionic/libstdc++/include', |
| 93 | ANDROID_TOP + '/bionic/libc/kernel/common', |
| 94 | ANDROID_TOP + '/bionic/libc/kernel/arch-arm', |
| 95 | ANDROID_TOP + '/bionic/libm/include', |
| 96 | ANDROID_TOP + '/bionic/libm/include/arch/arm', |
christian.plesner.hansen@gmail.com | 5a6af92 | 2009-08-12 14:20:51 +0000 | [diff] [blame] | 97 | ANDROID_TOP + '/bionic/libthread_db/include', |
| 98 | ANDROID_TOP + '/frameworks/base/include', |
| 99 | ANDROID_TOP + '/system/core/include'] |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 100 | |
kasperl@chromium.org | f5aa837 | 2009-03-24 14:47:14 +0000 | [diff] [blame] | 101 | ANDROID_LINKFLAGS = ['-nostdlib', |
| 102 | '-Bdynamic', |
| 103 | '-Wl,-T,' + ANDROID_TOP + '/build/core/armelf.x', |
| 104 | '-Wl,-dynamic-linker,/system/bin/linker', |
| 105 | '-Wl,--gc-sections', |
| 106 | '-Wl,-z,nocopyreloc', |
| 107 | '-Wl,-rpath-link=' + ANDROID_TOP + '/out/target/product/generic/obj/lib', |
| 108 | ANDROID_TOP + '/out/target/product/generic/obj/lib/crtbegin_dynamic.o', |
sgjesse@chromium.org | df7a284 | 2010-03-25 14:34:15 +0000 | [diff] [blame] | 109 | ANDROID_TOP + '/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/lib/gcc/arm-eabi/4.4.0/interwork/libgcc.a', |
kasperl@chromium.org | f5aa837 | 2009-03-24 14:47:14 +0000 | [diff] [blame] | 110 | ANDROID_TOP + '/out/target/product/generic/obj/lib/crtend_android.o']; |
| 111 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 112 | LIBRARY_FLAGS = { |
| 113 | 'all': { |
kasperl@chromium.org | 68ac009 | 2009-07-09 06:00:35 +0000 | [diff] [blame] | 114 | 'CPPPATH': [join(root_dir, 'src')], |
ricow@chromium.org | c9c8082 | 2010-04-21 08:22:37 +0000 | [diff] [blame] | 115 | 'regexp:interpreted': { |
| 116 | 'CPPDEFINES': ['V8_INTERPRETED_REGEXP'] |
ager@chromium.org | 18ad94b | 2009-09-02 08:22:29 +0000 | [diff] [blame] | 117 | }, |
| 118 | 'mode:debug': { |
| 119 | 'CPPDEFINES': ['V8_ENABLE_CHECKS'] |
ager@chromium.org | 4af710e | 2009-09-15 12:20:11 +0000 | [diff] [blame] | 120 | }, |
ager@chromium.org | 357bf65 | 2010-04-12 11:30:10 +0000 | [diff] [blame] | 121 | 'vmstate:on': { |
| 122 | 'CPPDEFINES': ['ENABLE_VMSTATE_TRACKING'], |
| 123 | }, |
| 124 | 'protectheap:on': { |
| 125 | 'CPPDEFINES': ['ENABLE_VMSTATE_TRACKING', 'ENABLE_HEAP_PROTECTION'], |
| 126 | }, |
ager@chromium.org | 4af710e | 2009-09-15 12:20:11 +0000 | [diff] [blame] | 127 | 'profilingsupport:on': { |
ager@chromium.org | 357bf65 | 2010-04-12 11:30:10 +0000 | [diff] [blame] | 128 | 'CPPDEFINES': ['ENABLE_VMSTATE_TRACKING', 'ENABLE_LOGGING_AND_PROFILING'], |
ager@chromium.org | 4af710e | 2009-09-15 12:20:11 +0000 | [diff] [blame] | 129 | }, |
| 130 | 'debuggersupport:on': { |
| 131 | 'CPPDEFINES': ['ENABLE_DEBUGGER_SUPPORT'], |
kasperl@chromium.org | 68ac009 | 2009-07-09 06:00:35 +0000 | [diff] [blame] | 132 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 133 | }, |
| 134 | 'gcc': { |
| 135 | 'all': { |
kasperl@chromium.org | 41044eb | 2008-10-06 08:24:46 +0000 | [diff] [blame] | 136 | 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 137 | 'CXXFLAGS': ['$CCFLAGS', '-fno-rtti', '-fno-exceptions'], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 138 | }, |
ager@chromium.org | 4af710e | 2009-09-15 12:20:11 +0000 | [diff] [blame] | 139 | 'visibility:hidden': { |
| 140 | # Use visibility=default to disable this. |
| 141 | 'CXXFLAGS': ['-fvisibility=hidden'] |
| 142 | }, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 143 | 'mode:debug': { |
| 144 | 'CCFLAGS': ['-g', '-O0'], |
ager@chromium.org | 71daaf6 | 2009-04-01 07:22:49 +0000 | [diff] [blame] | 145 | 'CPPDEFINES': ['ENABLE_DISASSEMBLER', 'DEBUG'], |
| 146 | 'os:android': { |
| 147 | 'CCFLAGS': ['-mthumb'] |
| 148 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 149 | }, |
| 150 | 'mode:release': { |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 151 | 'CCFLAGS': ['-O3', '-fomit-frame-pointer', '-fdata-sections', |
| 152 | '-ffunction-sections'], |
| 153 | 'os:android': { |
ager@chromium.org | 71daaf6 | 2009-04-01 07:22:49 +0000 | [diff] [blame] | 154 | 'CCFLAGS': ['-mthumb', '-Os'], |
ager@chromium.org | 4af710e | 2009-09-15 12:20:11 +0000 | [diff] [blame] | 155 | 'CPPDEFINES': ['SK_RELEASE', 'NDEBUG'] |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 156 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 157 | }, |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 158 | 'os:linux': { |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 159 | 'CCFLAGS': ['-ansi'] + GCC_EXTRA_CCFLAGS, |
sgjesse@chromium.org | f8c8180 | 2009-03-30 07:19:14 +0000 | [diff] [blame] | 160 | 'library:shared': { |
sgjesse@chromium.org | b9d7da1 | 2009-08-05 08:38:10 +0000 | [diff] [blame] | 161 | 'CPPDEFINES': ['V8_SHARED'], |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 162 | 'LIBS': ['pthread'] |
sgjesse@chromium.org | f8c8180 | 2009-03-30 07:19:14 +0000 | [diff] [blame] | 163 | } |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 164 | }, |
| 165 | 'os:macos': { |
ager@chromium.org | 5aa501c | 2009-06-23 07:57:28 +0000 | [diff] [blame] | 166 | 'CCFLAGS': ['-ansi', '-mmacosx-version-min=10.4'], |
kmillikin@chromium.org | 13bd294 | 2009-12-16 15:36:05 +0000 | [diff] [blame] | 167 | 'library:shared': { |
| 168 | 'CPPDEFINES': ['V8_SHARED'] |
| 169 | } |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 170 | }, |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 171 | 'os:freebsd': { |
ager@chromium.org | e2902be | 2009-06-08 12:21:35 +0000 | [diff] [blame] | 172 | 'CPPPATH' : ['/usr/local/include'], |
| 173 | 'LIBPATH' : ['/usr/local/lib'], |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 174 | 'CCFLAGS': ['-ansi'], |
| 175 | }, |
sgjesse@chromium.org | ac6aa17 | 2009-12-04 12:29:05 +0000 | [diff] [blame] | 176 | 'os:openbsd': { |
| 177 | 'CPPPATH' : ['/usr/local/include'], |
| 178 | 'LIBPATH' : ['/usr/local/lib'], |
| 179 | 'CCFLAGS': ['-ansi'], |
| 180 | }, |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 181 | 'os:solaris': { |
vegorov@chromium.org | dff694e | 2010-05-17 09:10:26 +0000 | [diff] [blame] | 182 | # On Solaris, to get isinf, INFINITY, fpclassify and other macros one |
| 183 | # needs to define __C99FEATURES__. |
| 184 | 'CPPDEFINES': ['__C99FEATURES__'], |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 185 | 'CPPPATH' : ['/usr/local/include'], |
| 186 | 'LIBPATH' : ['/usr/local/lib'], |
| 187 | 'CCFLAGS': ['-ansi'], |
| 188 | }, |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 189 | 'os:win32': { |
| 190 | 'CCFLAGS': ['-DWIN32'], |
| 191 | 'CXXFLAGS': ['-DWIN32'], |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 192 | }, |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 193 | 'os:android': { |
| 194 | 'CPPDEFINES': ['ANDROID', '__ARM_ARCH_5__', '__ARM_ARCH_5T__', |
| 195 | '__ARM_ARCH_5E__', '__ARM_ARCH_5TE__'], |
| 196 | 'CCFLAGS': ANDROID_FLAGS, |
| 197 | 'WARNINGFLAGS': ['-Wall', '-Wno-unused', '-Werror=return-type', |
| 198 | '-Wstrict-aliasing=2'], |
| 199 | 'CPPPATH': ANDROID_INCLUDES, |
| 200 | }, |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 201 | 'arch:ia32': { |
kasperl@chromium.org | e959c18 | 2009-07-27 08:59:04 +0000 | [diff] [blame] | 202 | 'CPPDEFINES': ['V8_TARGET_ARCH_IA32'], |
| 203 | 'CCFLAGS': ['-m32'], |
| 204 | 'LINKFLAGS': ['-m32'] |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 205 | }, |
| 206 | 'arch:arm': { |
ricow@chromium.org | 30ce411 | 2010-05-31 10:38:25 +0000 | [diff] [blame] | 207 | 'CPPDEFINES': ['V8_TARGET_ARCH_ARM'], |
| 208 | 'unalignedaccesses:on' : { |
| 209 | 'CPPDEFINES' : ['CAN_USE_UNALIGNED_ACCESSES=1'] |
| 210 | }, |
| 211 | 'unalignedaccesses:off' : { |
| 212 | 'CPPDEFINES' : ['CAN_USE_UNALIGNED_ACCESSES=0'] |
| 213 | } |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 214 | }, |
kasperl@chromium.org | e959c18 | 2009-07-27 08:59:04 +0000 | [diff] [blame] | 215 | 'simulator:arm': { |
ricow@chromium.org | 30ce411 | 2010-05-31 10:38:25 +0000 | [diff] [blame] | 216 | 'CCFLAGS': ['-m32'], |
kasperl@chromium.org | e959c18 | 2009-07-27 08:59:04 +0000 | [diff] [blame] | 217 | 'LINKFLAGS': ['-m32'] |
| 218 | }, |
ager@chromium.org | 5c83825 | 2010-02-19 08:53:10 +0000 | [diff] [blame] | 219 | 'arch:mips': { |
| 220 | 'CPPDEFINES': ['V8_TARGET_ARCH_MIPS'], |
| 221 | 'simulator:none': { |
| 222 | 'CCFLAGS': ['-EL', '-mips32r2', '-Wa,-mips32r2', '-fno-inline'], |
| 223 | 'LDFLAGS': ['-EL'] |
| 224 | } |
| 225 | }, |
| 226 | 'simulator:mips': { |
| 227 | 'CCFLAGS': ['-m32'], |
| 228 | 'LINKFLAGS': ['-m32'] |
| 229 | }, |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 230 | 'arch:x64': { |
kasperl@chromium.org | e959c18 | 2009-07-27 08:59:04 +0000 | [diff] [blame] | 231 | 'CPPDEFINES': ['V8_TARGET_ARCH_X64'], |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 232 | 'CCFLAGS': ['-m64'], |
kasperl@chromium.org | e959c18 | 2009-07-27 08:59:04 +0000 | [diff] [blame] | 233 | 'LINKFLAGS': ['-m64'], |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 234 | }, |
| 235 | 'prof:oprofile': { |
| 236 | 'CPPDEFINES': ['ENABLE_OPROFILE_AGENT'] |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 237 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 238 | }, |
| 239 | 'msvc': { |
| 240 | 'all': { |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 241 | 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], |
v8.team.kasperl | 727e995 | 2008-09-02 14:56:44 +0000 | [diff] [blame] | 242 | 'CXXFLAGS': ['$CCFLAGS', '/GR-', '/Gy'], |
ager@chromium.org | 18ad94b | 2009-09-02 08:22:29 +0000 | [diff] [blame] | 243 | 'CPPDEFINES': ['WIN32'], |
| 244 | 'LINKFLAGS': ['/INCREMENTAL:NO', '/NXCOMPAT', '/IGNORE:4221'], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 245 | 'CCPDBFLAGS': ['/Zi'] |
| 246 | }, |
ager@chromium.org | 18ad94b | 2009-09-02 08:22:29 +0000 | [diff] [blame] | 247 | 'verbose:off': { |
| 248 | 'DIALECTFLAGS': ['/nologo'], |
| 249 | 'ARFLAGS': ['/NOLOGO'] |
| 250 | }, |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 251 | 'arch:ia32': { |
ager@chromium.org | 18ad94b | 2009-09-02 08:22:29 +0000 | [diff] [blame] | 252 | 'CPPDEFINES': ['V8_TARGET_ARCH_IA32', '_USE_32BIT_TIME_T'], |
| 253 | 'LINKFLAGS': ['/MACHINE:X86'], |
| 254 | 'ARFLAGS': ['/MACHINE:X86'] |
| 255 | }, |
| 256 | 'arch:x64': { |
| 257 | 'CPPDEFINES': ['V8_TARGET_ARCH_X64'], |
| 258 | 'LINKFLAGS': ['/MACHINE:X64'], |
| 259 | 'ARFLAGS': ['/MACHINE:X64'] |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 260 | }, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 261 | 'mode:debug': { |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 262 | 'CCFLAGS': ['/Od', '/Gm'], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 263 | 'CPPDEFINES': ['_DEBUG', 'ENABLE_DISASSEMBLER', 'DEBUG'], |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 264 | 'LINKFLAGS': ['/DEBUG'], |
| 265 | 'msvcrt:static': { |
| 266 | 'CCFLAGS': ['/MTd'] |
| 267 | }, |
| 268 | 'msvcrt:shared': { |
| 269 | 'CCFLAGS': ['/MDd'] |
| 270 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 271 | }, |
| 272 | 'mode:release': { |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 273 | 'CCFLAGS': ['/O2'], |
| 274 | 'LINKFLAGS': ['/OPT:REF', '/OPT:ICF'], |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 275 | 'msvcrt:static': { |
| 276 | 'CCFLAGS': ['/MT'] |
| 277 | }, |
| 278 | 'msvcrt:shared': { |
| 279 | 'CCFLAGS': ['/MD'] |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 280 | }, |
| 281 | 'msvcltcg:on': { |
| 282 | 'CCFLAGS': ['/GL'], |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 283 | 'ARFLAGS': ['/LTCG'], |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 284 | 'pgo:off': { |
| 285 | 'LINKFLAGS': ['/LTCG'], |
| 286 | }, |
| 287 | 'pgo:instrument': { |
| 288 | 'LINKFLAGS': ['/LTCG:PGI'] |
| 289 | }, |
| 290 | 'pgo:optimize': { |
| 291 | 'LINKFLAGS': ['/LTCG:PGO'] |
| 292 | } |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 293 | } |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 294 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 295 | } |
| 296 | } |
| 297 | |
| 298 | |
| 299 | V8_EXTRA_FLAGS = { |
| 300 | 'gcc': { |
| 301 | 'all': { |
sgjesse@chromium.org | b9d7da1 | 2009-08-05 08:38:10 +0000 | [diff] [blame] | 302 | 'WARNINGFLAGS': ['-Wall', |
| 303 | '-Werror', |
| 304 | '-W', |
| 305 | '-Wno-unused-parameter', |
| 306 | '-Wnon-virtual-dtor'] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 307 | }, |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 308 | 'os:win32': { |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 309 | 'WARNINGFLAGS': ['-pedantic', '-Wno-long-long'] |
| 310 | }, |
| 311 | 'os:linux': { |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 312 | 'WARNINGFLAGS': ['-pedantic'], |
| 313 | 'library:shared': { |
| 314 | 'soname:on': { |
| 315 | 'LINKFLAGS': ['-Wl,-soname,${SONAME}'] |
| 316 | } |
| 317 | } |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 318 | }, |
| 319 | 'os:macos': { |
| 320 | 'WARNINGFLAGS': ['-pedantic'] |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 321 | }, |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 322 | 'disassembler:on': { |
| 323 | 'CPPDEFINES': ['ENABLE_DISASSEMBLER'] |
| 324 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 325 | }, |
| 326 | 'msvc': { |
| 327 | 'all': { |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 328 | 'WARNINGFLAGS': ['/W3', '/WX', '/wd4355', '/wd4800'] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 329 | }, |
sgjesse@chromium.org | 4e421f4 | 2009-09-07 07:18:16 +0000 | [diff] [blame] | 330 | 'library:shared': { |
| 331 | 'CPPDEFINES': ['BUILDING_V8_SHARED'], |
| 332 | 'LIBS': ['winmm', 'ws2_32'] |
| 333 | }, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 334 | 'arch:arm': { |
ager@chromium.org | 9085a01 | 2009-05-11 19:22:57 +0000 | [diff] [blame] | 335 | 'CPPDEFINES': ['V8_TARGET_ARCH_ARM'], |
ager@chromium.org | 3bf7b91 | 2008-11-17 09:09:45 +0000 | [diff] [blame] | 336 | # /wd4996 is to silence the warning about sscanf |
| 337 | # used by the arm simulator. |
| 338 | 'WARNINGFLAGS': ['/wd4996'] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 339 | }, |
ager@chromium.org | 5c83825 | 2010-02-19 08:53:10 +0000 | [diff] [blame] | 340 | 'arch:mips': { |
| 341 | 'CPPDEFINES': ['V8_TARGET_ARCH_MIPS'], |
| 342 | }, |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 343 | 'disassembler:on': { |
| 344 | 'CPPDEFINES': ['ENABLE_DISASSEMBLER'] |
| 345 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 346 | } |
| 347 | } |
| 348 | |
| 349 | |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 350 | MKSNAPSHOT_EXTRA_FLAGS = { |
| 351 | 'gcc': { |
| 352 | 'os:linux': { |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 353 | 'LIBS': ['pthread'], |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 354 | }, |
| 355 | 'os:macos': { |
| 356 | 'LIBS': ['pthread'], |
| 357 | }, |
| 358 | 'os:freebsd': { |
ager@chromium.org | e2902be | 2009-06-08 12:21:35 +0000 | [diff] [blame] | 359 | 'LIBS': ['execinfo', 'pthread'] |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 360 | }, |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 361 | 'os:solaris': { |
| 362 | 'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'], |
| 363 | 'LINKFLAGS': ['-mt'] |
| 364 | }, |
sgjesse@chromium.org | ac6aa17 | 2009-12-04 12:29:05 +0000 | [diff] [blame] | 365 | 'os:openbsd': { |
| 366 | 'LIBS': ['execinfo', 'pthread'] |
| 367 | }, |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 368 | 'os:win32': { |
ager@chromium.org | 381abbb | 2009-02-25 13:23:22 +0000 | [diff] [blame] | 369 | 'LIBS': ['winmm', 'ws2_32'], |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 370 | }, |
| 371 | }, |
| 372 | 'msvc': { |
| 373 | 'all': { |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 374 | 'CPPDEFINES': ['_HAS_EXCEPTIONS=0'], |
ager@chromium.org | 381abbb | 2009-02-25 13:23:22 +0000 | [diff] [blame] | 375 | 'LIBS': ['winmm', 'ws2_32'] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 376 | } |
| 377 | } |
| 378 | } |
| 379 | |
| 380 | |
| 381 | DTOA_EXTRA_FLAGS = { |
| 382 | 'gcc': { |
| 383 | 'all': { |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 384 | 'WARNINGFLAGS': ['-Werror', '-Wno-uninitialized'], |
| 385 | 'CCFLAGS': GCC_DTOA_EXTRA_CCFLAGS |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 386 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 387 | }, |
| 388 | 'msvc': { |
| 389 | 'all': { |
| 390 | 'WARNINGFLAGS': ['/WX', '/wd4018', '/wd4244'] |
| 391 | } |
| 392 | } |
| 393 | } |
| 394 | |
| 395 | |
| 396 | CCTEST_EXTRA_FLAGS = { |
| 397 | 'all': { |
| 398 | 'CPPPATH': [join(root_dir, 'src')], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 399 | }, |
| 400 | 'gcc': { |
| 401 | 'all': { |
| 402 | 'LIBPATH': [abspath('.')] |
| 403 | }, |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 404 | 'os:linux': { |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 405 | 'LIBS': ['pthread'], |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 406 | }, |
| 407 | 'os:macos': { |
| 408 | 'LIBS': ['pthread'], |
| 409 | }, |
| 410 | 'os:freebsd': { |
| 411 | 'LIBS': ['execinfo', 'pthread'] |
| 412 | }, |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 413 | 'os:solaris': { |
| 414 | 'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'], |
| 415 | 'LINKFLAGS': ['-mt'] |
| 416 | }, |
sgjesse@chromium.org | ac6aa17 | 2009-12-04 12:29:05 +0000 | [diff] [blame] | 417 | 'os:openbsd': { |
| 418 | 'LIBS': ['execinfo', 'pthread'] |
| 419 | }, |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 420 | 'os:win32': { |
ager@chromium.org | 381abbb | 2009-02-25 13:23:22 +0000 | [diff] [blame] | 421 | 'LIBS': ['winmm', 'ws2_32'] |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 422 | }, |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 423 | 'os:android': { |
| 424 | 'CPPDEFINES': ['ANDROID', '__ARM_ARCH_5__', '__ARM_ARCH_5T__', |
| 425 | '__ARM_ARCH_5E__', '__ARM_ARCH_5TE__'], |
| 426 | 'CCFLAGS': ANDROID_FLAGS, |
| 427 | 'CPPPATH': ANDROID_INCLUDES, |
sgjesse@chromium.org | df7a284 | 2010-03-25 14:34:15 +0000 | [diff] [blame] | 428 | 'LIBPATH': [ANDROID_TOP + '/out/target/product/generic/obj/lib', |
| 429 | ANDROID_TOP + '/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/lib/gcc/arm-eabi/4.4.0/interwork'], |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 430 | 'LINKFLAGS': ANDROID_LINKFLAGS, |
sgjesse@chromium.org | df7a284 | 2010-03-25 14:34:15 +0000 | [diff] [blame] | 431 | 'LIBS': ['log', 'c', 'stdc++', 'm', 'gcc'], |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 432 | 'mode:release': { |
| 433 | 'CPPDEFINES': ['SK_RELEASE', 'NDEBUG'] |
| 434 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 435 | }, |
ricow@chromium.org | c9c8082 | 2010-04-21 08:22:37 +0000 | [diff] [blame] | 436 | 'arch:arm': { |
| 437 | 'LINKFLAGS': ARM_LINK_FLAGS |
| 438 | }, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 439 | }, |
| 440 | 'msvc': { |
| 441 | 'all': { |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 442 | 'CPPDEFINES': ['_HAS_EXCEPTIONS=0'], |
ager@chromium.org | 381abbb | 2009-02-25 13:23:22 +0000 | [diff] [blame] | 443 | 'LIBS': ['winmm', 'ws2_32'] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 444 | }, |
| 445 | 'library:shared': { |
| 446 | 'CPPDEFINES': ['USING_V8_SHARED'] |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 447 | }, |
| 448 | 'arch:ia32': { |
ager@chromium.org | 9085a01 | 2009-05-11 19:22:57 +0000 | [diff] [blame] | 449 | 'CPPDEFINES': ['V8_TARGET_ARCH_IA32'] |
ager@chromium.org | 18ad94b | 2009-09-02 08:22:29 +0000 | [diff] [blame] | 450 | }, |
| 451 | 'arch:x64': { |
christian.plesner.hansen@gmail.com | 9d58c2b | 2009-10-16 11:48:38 +0000 | [diff] [blame] | 452 | 'CPPDEFINES': ['V8_TARGET_ARCH_X64'], |
| 453 | 'LINKFLAGS': ['/STACK:2091752'] |
ager@chromium.org | 18ad94b | 2009-09-02 08:22:29 +0000 | [diff] [blame] | 454 | }, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 455 | } |
| 456 | } |
| 457 | |
| 458 | |
| 459 | SAMPLE_FLAGS = { |
| 460 | 'all': { |
v8.team.kasperl | 727e995 | 2008-09-02 14:56:44 +0000 | [diff] [blame] | 461 | 'CPPPATH': [join(abspath('.'), 'include')], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 462 | }, |
| 463 | 'gcc': { |
| 464 | 'all': { |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 465 | 'LIBPATH': ['.'], |
| 466 | 'CCFLAGS': ['-fno-rtti', '-fno-exceptions'] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 467 | }, |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 468 | 'os:linux': { |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 469 | 'LIBS': ['pthread'], |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 470 | }, |
| 471 | 'os:macos': { |
| 472 | 'LIBS': ['pthread'], |
| 473 | }, |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 474 | 'os:freebsd': { |
ager@chromium.org | e2902be | 2009-06-08 12:21:35 +0000 | [diff] [blame] | 475 | 'LIBPATH' : ['/usr/local/lib'], |
sgjesse@chromium.org | ac6aa17 | 2009-12-04 12:29:05 +0000 | [diff] [blame] | 476 | 'LIBS': ['execinfo', 'pthread'] |
| 477 | }, |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 478 | 'os:solaris': { |
| 479 | 'LIBPATH' : ['/usr/local/lib'], |
| 480 | 'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'], |
| 481 | 'LINKFLAGS': ['-mt'] |
| 482 | }, |
sgjesse@chromium.org | ac6aa17 | 2009-12-04 12:29:05 +0000 | [diff] [blame] | 483 | 'os:openbsd': { |
| 484 | 'LIBPATH' : ['/usr/local/lib'], |
| 485 | 'LIBS': ['execinfo', 'pthread'] |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 486 | }, |
| 487 | 'os:win32': { |
ager@chromium.org | 381abbb | 2009-02-25 13:23:22 +0000 | [diff] [blame] | 488 | 'LIBS': ['winmm', 'ws2_32'] |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 489 | }, |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 490 | 'os:android': { |
| 491 | 'CPPDEFINES': ['ANDROID', '__ARM_ARCH_5__', '__ARM_ARCH_5T__', |
| 492 | '__ARM_ARCH_5E__', '__ARM_ARCH_5TE__'], |
| 493 | 'CCFLAGS': ANDROID_FLAGS, |
| 494 | 'CPPPATH': ANDROID_INCLUDES, |
sgjesse@chromium.org | df7a284 | 2010-03-25 14:34:15 +0000 | [diff] [blame] | 495 | 'LIBPATH': [ANDROID_TOP + '/out/target/product/generic/obj/lib', |
| 496 | ANDROID_TOP + '/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/lib/gcc/arm-eabi/4.4.0/interwork'], |
kasperl@chromium.org | f5aa837 | 2009-03-24 14:47:14 +0000 | [diff] [blame] | 497 | 'LINKFLAGS': ANDROID_LINKFLAGS, |
sgjesse@chromium.org | df7a284 | 2010-03-25 14:34:15 +0000 | [diff] [blame] | 498 | 'LIBS': ['log', 'c', 'stdc++', 'm', 'gcc'], |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 499 | 'mode:release': { |
| 500 | 'CPPDEFINES': ['SK_RELEASE', 'NDEBUG'] |
| 501 | } |
| 502 | }, |
ricow@chromium.org | c9c8082 | 2010-04-21 08:22:37 +0000 | [diff] [blame] | 503 | 'arch:arm': { |
| 504 | 'LINKFLAGS': ARM_LINK_FLAGS |
| 505 | }, |
kasperl@chromium.org | e959c18 | 2009-07-27 08:59:04 +0000 | [diff] [blame] | 506 | 'arch:ia32': { |
| 507 | 'CCFLAGS': ['-m32'], |
| 508 | 'LINKFLAGS': ['-m32'] |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 509 | }, |
kasperl@chromium.org | e959c18 | 2009-07-27 08:59:04 +0000 | [diff] [blame] | 510 | 'arch:x64': { |
| 511 | 'CCFLAGS': ['-m64'], |
| 512 | 'LINKFLAGS': ['-m64'] |
| 513 | }, |
ager@chromium.org | 5c83825 | 2010-02-19 08:53:10 +0000 | [diff] [blame] | 514 | 'arch:mips': { |
| 515 | 'CPPDEFINES': ['V8_TARGET_ARCH_MIPS'], |
| 516 | 'simulator:none': { |
| 517 | 'CCFLAGS': ['-EL', '-mips32r2', '-Wa,-mips32r2', '-fno-inline'], |
| 518 | 'LINKFLAGS': ['-EL'], |
| 519 | 'LDFLAGS': ['-EL'] |
| 520 | } |
| 521 | }, |
kasperl@chromium.org | e959c18 | 2009-07-27 08:59:04 +0000 | [diff] [blame] | 522 | 'simulator:arm': { |
| 523 | 'CCFLAGS': ['-m32'], |
| 524 | 'LINKFLAGS': ['-m32'] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 525 | }, |
ager@chromium.org | 5c83825 | 2010-02-19 08:53:10 +0000 | [diff] [blame] | 526 | 'simulator:mips': { |
| 527 | 'CCFLAGS': ['-m32'], |
| 528 | 'LINKFLAGS': ['-m32'] |
| 529 | }, |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 530 | 'mode:release': { |
| 531 | 'CCFLAGS': ['-O2'] |
| 532 | }, |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 533 | 'mode:debug': { |
| 534 | 'CCFLAGS': ['-g', '-O0'] |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 535 | }, |
| 536 | 'prof:oprofile': { |
| 537 | 'LIBPATH': ['/usr/lib32', '/usr/lib32/oprofile'], |
| 538 | 'LIBS': ['opagent'] |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 539 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 540 | }, |
| 541 | 'msvc': { |
| 542 | 'all': { |
ager@chromium.org | 381abbb | 2009-02-25 13:23:22 +0000 | [diff] [blame] | 543 | 'LIBS': ['winmm', 'ws2_32'] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 544 | }, |
ager@chromium.org | 18ad94b | 2009-09-02 08:22:29 +0000 | [diff] [blame] | 545 | 'verbose:off': { |
| 546 | 'CCFLAGS': ['/nologo'], |
| 547 | 'LINKFLAGS': ['/NOLOGO'] |
| 548 | }, |
| 549 | 'verbose:on': { |
| 550 | 'LINKFLAGS': ['/VERBOSE'] |
| 551 | }, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 552 | 'library:shared': { |
| 553 | 'CPPDEFINES': ['USING_V8_SHARED'] |
| 554 | }, |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 555 | 'prof:on': { |
| 556 | 'LINKFLAGS': ['/MAP'] |
| 557 | }, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 558 | 'mode:release': { |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 559 | 'CCFLAGS': ['/O2'], |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 560 | 'LINKFLAGS': ['/OPT:REF', '/OPT:ICF'], |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 561 | 'msvcrt:static': { |
| 562 | 'CCFLAGS': ['/MT'] |
| 563 | }, |
| 564 | 'msvcrt:shared': { |
| 565 | 'CCFLAGS': ['/MD'] |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 566 | }, |
| 567 | 'msvcltcg:on': { |
| 568 | 'CCFLAGS': ['/GL'], |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 569 | 'pgo:off': { |
| 570 | 'LINKFLAGS': ['/LTCG'], |
| 571 | }, |
| 572 | }, |
| 573 | 'pgo:instrument': { |
| 574 | 'LINKFLAGS': ['/LTCG:PGI'] |
| 575 | }, |
| 576 | 'pgo:optimize': { |
| 577 | 'LINKFLAGS': ['/LTCG:PGO'] |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 578 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 579 | }, |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 580 | 'arch:ia32': { |
ager@chromium.org | 18ad94b | 2009-09-02 08:22:29 +0000 | [diff] [blame] | 581 | 'CPPDEFINES': ['V8_TARGET_ARCH_IA32'], |
| 582 | 'LINKFLAGS': ['/MACHINE:X86'] |
| 583 | }, |
| 584 | 'arch:x64': { |
| 585 | 'CPPDEFINES': ['V8_TARGET_ARCH_X64'], |
christian.plesner.hansen@gmail.com | 9d58c2b | 2009-10-16 11:48:38 +0000 | [diff] [blame] | 586 | 'LINKFLAGS': ['/MACHINE:X64', '/STACK:2091752'] |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 587 | }, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 588 | 'mode:debug': { |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 589 | 'CCFLAGS': ['/Od'], |
| 590 | 'LINKFLAGS': ['/DEBUG'], |
| 591 | 'msvcrt:static': { |
| 592 | 'CCFLAGS': ['/MTd'] |
| 593 | }, |
| 594 | 'msvcrt:shared': { |
| 595 | 'CCFLAGS': ['/MDd'] |
| 596 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 597 | } |
| 598 | } |
| 599 | } |
| 600 | |
| 601 | |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 602 | D8_FLAGS = { |
| 603 | 'gcc': { |
| 604 | 'console:readline': { |
| 605 | 'LIBS': ['readline'] |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 606 | }, |
| 607 | 'os:linux': { |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 608 | 'LIBS': ['pthread'], |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 609 | }, |
| 610 | 'os:macos': { |
| 611 | 'LIBS': ['pthread'], |
| 612 | }, |
| 613 | 'os:freebsd': { |
| 614 | 'LIBS': ['pthread'], |
| 615 | }, |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 616 | 'os:solaris': { |
| 617 | 'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'], |
| 618 | 'LINKFLAGS': ['-mt'] |
| 619 | }, |
sgjesse@chromium.org | ac6aa17 | 2009-12-04 12:29:05 +0000 | [diff] [blame] | 620 | 'os:openbsd': { |
| 621 | 'LIBS': ['pthread'], |
| 622 | }, |
kasperl@chromium.org | f5aa837 | 2009-03-24 14:47:14 +0000 | [diff] [blame] | 623 | 'os:android': { |
sgjesse@chromium.org | df7a284 | 2010-03-25 14:34:15 +0000 | [diff] [blame] | 624 | 'LIBPATH': [ANDROID_TOP + '/out/target/product/generic/obj/lib', |
| 625 | ANDROID_TOP + '/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/lib/gcc/arm-eabi/4.4.0/interwork'], |
kasperl@chromium.org | f5aa837 | 2009-03-24 14:47:14 +0000 | [diff] [blame] | 626 | 'LINKFLAGS': ANDROID_LINKFLAGS, |
sgjesse@chromium.org | df7a284 | 2010-03-25 14:34:15 +0000 | [diff] [blame] | 627 | 'LIBS': ['log', 'c', 'stdc++', 'm', 'gcc'], |
kasperl@chromium.org | f5aa837 | 2009-03-24 14:47:14 +0000 | [diff] [blame] | 628 | }, |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 629 | 'os:win32': { |
ager@chromium.org | 381abbb | 2009-02-25 13:23:22 +0000 | [diff] [blame] | 630 | 'LIBS': ['winmm', 'ws2_32'], |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 631 | }, |
whesse@chromium.org | ba5a61b | 2010-07-26 11:44:40 +0000 | [diff] [blame^] | 632 | 'arch:arm': { |
| 633 | 'LINKFLAGS': ARM_LINK_FLAGS |
| 634 | }, |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 635 | }, |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 636 | 'msvc': { |
| 637 | 'all': { |
ager@chromium.org | 381abbb | 2009-02-25 13:23:22 +0000 | [diff] [blame] | 638 | 'LIBS': ['winmm', 'ws2_32'] |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 639 | } |
| 640 | } |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 641 | } |
| 642 | |
| 643 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 644 | SUFFIXES = { |
| 645 | 'release': '', |
| 646 | 'debug': '_g' |
| 647 | } |
| 648 | |
| 649 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 650 | def Abort(message): |
| 651 | print message |
| 652 | sys.exit(1) |
| 653 | |
| 654 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 655 | def GuessToolchain(os): |
| 656 | tools = Environment()['TOOLS'] |
| 657 | if 'gcc' in tools: |
kasper.lund | 7276f14 | 2008-07-30 08:49:36 +0000 | [diff] [blame] | 658 | return 'gcc' |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 659 | elif 'msvc' in tools: |
| 660 | return 'msvc' |
| 661 | else: |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 662 | return None |
| 663 | |
| 664 | |
ager@chromium.org | 870a0b6 | 2008-11-04 11:43:05 +0000 | [diff] [blame] | 665 | OS_GUESS = utils.GuessOS() |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 666 | TOOLCHAIN_GUESS = GuessToolchain(OS_GUESS) |
ager@chromium.org | c27e4e7 | 2008-09-04 13:52:27 +0000 | [diff] [blame] | 667 | ARCH_GUESS = utils.GuessArchitecture() |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 668 | |
| 669 | |
| 670 | SIMPLE_OPTIONS = { |
| 671 | 'toolchain': { |
| 672 | 'values': ['gcc', 'msvc'], |
| 673 | 'default': TOOLCHAIN_GUESS, |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 674 | 'help': 'the toolchain to use (' + TOOLCHAIN_GUESS + ')' |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 675 | }, |
| 676 | 'os': { |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 677 | 'values': ['freebsd', 'linux', 'macos', 'win32', 'android', 'openbsd', 'solaris'], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 678 | 'default': OS_GUESS, |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 679 | 'help': 'the os to build for (' + OS_GUESS + ')' |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 680 | }, |
| 681 | 'arch': { |
ager@chromium.org | 5c83825 | 2010-02-19 08:53:10 +0000 | [diff] [blame] | 682 | 'values':['arm', 'ia32', 'x64', 'mips'], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 683 | 'default': ARCH_GUESS, |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 684 | 'help': 'the architecture to build for (' + ARCH_GUESS + ')' |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 685 | }, |
kasperl@chromium.org | 68ac009 | 2009-07-09 06:00:35 +0000 | [diff] [blame] | 686 | 'regexp': { |
| 687 | 'values': ['native', 'interpreted'], |
| 688 | 'default': 'native', |
| 689 | 'help': 'Whether to use native or interpreted regexp implementation' |
| 690 | }, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 691 | 'snapshot': { |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 692 | 'values': ['on', 'off', 'nobuild'], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 693 | 'default': 'off', |
| 694 | 'help': 'build using snapshots for faster start-up' |
| 695 | }, |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 696 | 'prof': { |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 697 | 'values': ['on', 'off', 'oprofile'], |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 698 | 'default': 'off', |
| 699 | 'help': 'enable profiling of build target' |
| 700 | }, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 701 | 'library': { |
| 702 | 'values': ['static', 'shared'], |
| 703 | 'default': 'static', |
| 704 | 'help': 'the type of library to produce' |
| 705 | }, |
ager@chromium.org | 357bf65 | 2010-04-12 11:30:10 +0000 | [diff] [blame] | 706 | 'vmstate': { |
| 707 | 'values': ['on', 'off'], |
| 708 | 'default': 'off', |
| 709 | 'help': 'enable VM state tracking' |
| 710 | }, |
| 711 | 'protectheap': { |
| 712 | 'values': ['on', 'off'], |
| 713 | 'default': 'off', |
| 714 | 'help': 'enable heap protection' |
| 715 | }, |
ager@chromium.org | 4af710e | 2009-09-15 12:20:11 +0000 | [diff] [blame] | 716 | 'profilingsupport': { |
| 717 | 'values': ['on', 'off'], |
| 718 | 'default': 'on', |
| 719 | 'help': 'enable profiling of JavaScript code' |
| 720 | }, |
| 721 | 'debuggersupport': { |
| 722 | 'values': ['on', 'off'], |
| 723 | 'default': 'on', |
| 724 | 'help': 'enable debugging of JavaScript code' |
| 725 | }, |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 726 | 'soname': { |
| 727 | 'values': ['on', 'off'], |
| 728 | 'default': 'off', |
| 729 | 'help': 'turn on setting soname for Linux shared library' |
| 730 | }, |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 731 | 'msvcrt': { |
| 732 | 'values': ['static', 'shared'], |
| 733 | 'default': 'static', |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 734 | 'help': 'the type of Microsoft Visual C++ runtime library to use' |
| 735 | }, |
| 736 | 'msvcltcg': { |
| 737 | 'values': ['on', 'off'], |
| 738 | 'default': 'on', |
| 739 | 'help': 'use Microsoft Visual C++ link-time code generation' |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 740 | }, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 741 | 'simulator': { |
ager@chromium.org | 5c83825 | 2010-02-19 08:53:10 +0000 | [diff] [blame] | 742 | 'values': ['arm', 'mips', 'none'], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 743 | 'default': 'none', |
| 744 | 'help': 'build with simulator' |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 745 | }, |
ricow@chromium.org | 30ce411 | 2010-05-31 10:38:25 +0000 | [diff] [blame] | 746 | 'unalignedaccesses': { |
| 747 | 'values': ['default', 'on', 'off'], |
| 748 | 'default': 'default', |
| 749 | 'help': 'set whether the ARM target supports unaligned accesses' |
| 750 | }, |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 751 | 'disassembler': { |
| 752 | 'values': ['on', 'off'], |
| 753 | 'default': 'off', |
| 754 | 'help': 'enable the disassembler to inspect generated code' |
| 755 | }, |
| 756 | 'sourcesignatures': { |
| 757 | 'values': ['MD5', 'timestamp'], |
| 758 | 'default': 'MD5', |
| 759 | 'help': 'set how the build system detects file changes' |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 760 | }, |
| 761 | 'console': { |
| 762 | 'values': ['dumb', 'readline'], |
| 763 | 'default': 'dumb', |
| 764 | 'help': 'the console to use for the d8 shell' |
ager@chromium.org | 18ad94b | 2009-09-02 08:22:29 +0000 | [diff] [blame] | 765 | }, |
| 766 | 'verbose': { |
| 767 | 'values': ['on', 'off'], |
| 768 | 'default': 'off', |
| 769 | 'help': 'more output from compiler and linker' |
ager@chromium.org | 4af710e | 2009-09-15 12:20:11 +0000 | [diff] [blame] | 770 | }, |
| 771 | 'visibility': { |
| 772 | 'values': ['default', 'hidden'], |
| 773 | 'default': 'hidden', |
| 774 | 'help': 'shared library symbol visibility' |
kmillikin@chromium.org | 13bd294 | 2009-12-16 15:36:05 +0000 | [diff] [blame] | 775 | }, |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 776 | 'pgo': { |
| 777 | 'values': ['off', 'instrument', 'optimize'], |
| 778 | 'default': 'off', |
| 779 | 'help': 'select profile guided optimization variant', |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 780 | } |
| 781 | } |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 782 | |
| 783 | |
| 784 | def GetOptions(): |
| 785 | result = Options() |
kasper.lund | 7276f14 | 2008-07-30 08:49:36 +0000 | [diff] [blame] | 786 | result.Add('mode', 'compilation mode (debug, release)', 'release') |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 787 | result.Add('sample', 'build sample (shell, process, lineprocessor)', '') |
ager@chromium.org | 2cc82ae | 2010-06-14 07:35:38 +0000 | [diff] [blame] | 788 | result.Add('cache', 'directory to use for scons build cache', '') |
kasperl@chromium.org | 8ccb0be | 2009-04-07 07:21:39 +0000 | [diff] [blame] | 789 | result.Add('env', 'override environment settings (NAME0:value0,NAME1:value1,...)', '') |
| 790 | result.Add('importenv', 'import environment settings (NAME0,NAME1,...)', '') |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 791 | for (name, option) in SIMPLE_OPTIONS.iteritems(): |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 792 | help = '%s (%s)' % (name, ", ".join(option['values'])) |
| 793 | result.Add(name, help, option.get('default')) |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 794 | return result |
| 795 | |
| 796 | |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 797 | def GetVersionComponents(): |
| 798 | MAJOR_VERSION_PATTERN = re.compile(r"#define\s+MAJOR_VERSION\s+(.*)") |
| 799 | MINOR_VERSION_PATTERN = re.compile(r"#define\s+MINOR_VERSION\s+(.*)") |
| 800 | BUILD_NUMBER_PATTERN = re.compile(r"#define\s+BUILD_NUMBER\s+(.*)") |
| 801 | PATCH_LEVEL_PATTERN = re.compile(r"#define\s+PATCH_LEVEL\s+(.*)") |
| 802 | |
| 803 | patterns = [MAJOR_VERSION_PATTERN, |
| 804 | MINOR_VERSION_PATTERN, |
| 805 | BUILD_NUMBER_PATTERN, |
| 806 | PATCH_LEVEL_PATTERN] |
| 807 | |
| 808 | source = open(join(root_dir, 'src', 'version.cc')).read() |
| 809 | version_components = [] |
| 810 | for pattern in patterns: |
| 811 | match = pattern.search(source) |
| 812 | if match: |
| 813 | version_components.append(match.group(1).strip()) |
| 814 | else: |
| 815 | version_components.append('0') |
| 816 | |
| 817 | return version_components |
| 818 | |
| 819 | |
| 820 | def GetVersion(): |
| 821 | version_components = GetVersionComponents() |
ager@chromium.org | 5aa501c | 2009-06-23 07:57:28 +0000 | [diff] [blame] | 822 | |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 823 | if version_components[len(version_components) - 1] == '0': |
| 824 | version_components.pop() |
| 825 | return '.'.join(version_components) |
| 826 | |
| 827 | |
| 828 | def GetSpecificSONAME(): |
| 829 | SONAME_PATTERN = re.compile(r"#define\s+SONAME\s+\"(.*)\"") |
ager@chromium.org | 5aa501c | 2009-06-23 07:57:28 +0000 | [diff] [blame] | 830 | |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 831 | source = open(join(root_dir, 'src', 'version.cc')).read() |
| 832 | match = SONAME_PATTERN.search(source) |
ager@chromium.org | 5aa501c | 2009-06-23 07:57:28 +0000 | [diff] [blame] | 833 | |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 834 | if match: |
| 835 | return match.group(1).strip() |
| 836 | else: |
| 837 | return '' |
| 838 | |
| 839 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 840 | def SplitList(str): |
| 841 | return [ s for s in str.split(",") if len(s) > 0 ] |
| 842 | |
| 843 | |
| 844 | def IsLegal(env, option, values): |
| 845 | str = env[option] |
| 846 | for s in SplitList(str): |
| 847 | if not s in values: |
| 848 | Abort("Illegal value for option %s '%s'." % (option, s)) |
| 849 | return False |
| 850 | return True |
| 851 | |
| 852 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 853 | def VerifyOptions(env): |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 854 | if not IsLegal(env, 'mode', ['debug', 'release']): |
| 855 | return False |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 856 | if not IsLegal(env, 'sample', ["shell", "process", "lineprocessor"]): |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 857 | return False |
kasperl@chromium.org | 68ac009 | 2009-07-09 06:00:35 +0000 | [diff] [blame] | 858 | if not IsLegal(env, 'regexp', ["native", "interpreted"]): |
| 859 | return False |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 860 | if env['os'] == 'win32' and env['library'] == 'shared' and env['prof'] == 'on': |
| 861 | Abort("Profiling on windows only supported for static library.") |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 862 | if env['prof'] == 'oprofile' and env['os'] != 'linux': |
| 863 | Abort("OProfile is only supported on Linux.") |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 864 | if env['os'] == 'win32' and env['soname'] == 'on': |
| 865 | Abort("Shared Object soname not applicable for Windows.") |
| 866 | if env['soname'] == 'on' and env['library'] == 'static': |
| 867 | Abort("Shared Object soname not applicable for static library.") |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 868 | if env['os'] != 'win32' and env['pgo'] != 'off': |
| 869 | Abort("Profile guided optimization only supported on Windows.") |
ager@chromium.org | 2cc82ae | 2010-06-14 07:35:38 +0000 | [diff] [blame] | 870 | if env['cache'] and not os.path.isdir(env['cache']): |
| 871 | Abort("The specified cache directory does not exist.") |
ricow@chromium.org | 30ce411 | 2010-05-31 10:38:25 +0000 | [diff] [blame] | 872 | if not (env['arch'] == 'arm' or env['simulator'] == 'arm') and ('unalignedaccesses' in ARGUMENTS): |
| 873 | print env['arch'] |
| 874 | print env['simulator'] |
| 875 | Abort("Option unalignedaccesses only supported for the ARM architecture.") |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 876 | for (name, option) in SIMPLE_OPTIONS.iteritems(): |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 877 | if (not option.get('default')) and (name not in ARGUMENTS): |
| 878 | message = ("A value for option %s must be specified (%s)." % |
| 879 | (name, ", ".join(option['values']))) |
| 880 | Abort(message) |
| 881 | if not env[name] in option['values']: |
| 882 | message = ("Unknown %s value '%s'. Possible values are (%s)." % |
| 883 | (name, env[name], ", ".join(option['values']))) |
| 884 | Abort(message) |
| 885 | |
| 886 | |
| 887 | class BuildContext(object): |
| 888 | |
v8.team.kasperl | 727e995 | 2008-09-02 14:56:44 +0000 | [diff] [blame] | 889 | def __init__(self, options, env_overrides, samples): |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 890 | self.library_targets = [] |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 891 | self.mksnapshot_targets = [] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 892 | self.cctest_targets = [] |
| 893 | self.sample_targets = [] |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 894 | self.d8_targets = [] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 895 | self.options = options |
v8.team.kasperl | 727e995 | 2008-09-02 14:56:44 +0000 | [diff] [blame] | 896 | self.env_overrides = env_overrides |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 897 | self.samples = samples |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 898 | self.use_snapshot = (options['snapshot'] != 'off') |
| 899 | self.build_snapshot = (options['snapshot'] == 'on') |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 900 | self.flags = None |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 901 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 902 | def AddRelevantFlags(self, initial, flags): |
| 903 | result = initial.copy() |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 904 | toolchain = self.options['toolchain'] |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 905 | if toolchain in flags: |
| 906 | self.AppendFlags(result, flags[toolchain].get('all')) |
| 907 | for option in sorted(self.options.keys()): |
| 908 | value = self.options[option] |
| 909 | self.AppendFlags(result, flags[toolchain].get(option + ':' + value)) |
ager@chromium.org | 3a37e9b | 2009-04-27 09:26:21 +0000 | [diff] [blame] | 910 | self.AppendFlags(result, flags.get('all')) |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 911 | return result |
| 912 | |
| 913 | def AddRelevantSubFlags(self, options, flags): |
| 914 | self.AppendFlags(options, flags.get('all')) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 915 | for option in sorted(self.options.keys()): |
| 916 | value = self.options[option] |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 917 | self.AppendFlags(options, flags.get(option + ':' + value)) |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 918 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 919 | def GetRelevantSources(self, source): |
| 920 | result = [] |
| 921 | result += source.get('all', []) |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 922 | for (name, value) in self.options.iteritems(): |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 923 | source_value = source.get(name + ':' + value, []) |
| 924 | if type(source_value) == dict: |
| 925 | result += self.GetRelevantSources(source_value) |
| 926 | else: |
| 927 | result += source_value |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 928 | return sorted(result) |
| 929 | |
| 930 | def AppendFlags(self, options, added): |
| 931 | if not added: |
| 932 | return |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 933 | for (key, value) in added.iteritems(): |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 934 | if key.find(':') != -1: |
| 935 | self.AddRelevantSubFlags(options, { key: value }) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 936 | else: |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 937 | if not key in options: |
| 938 | options[key] = value |
| 939 | else: |
| 940 | prefix = options[key] |
| 941 | if isinstance(prefix, StringTypes): prefix = prefix.split() |
| 942 | options[key] = prefix + value |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 943 | |
| 944 | def ConfigureObject(self, env, input, **kw): |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 945 | if (kw.has_key('CPPPATH') and env.has_key('CPPPATH')): |
| 946 | kw['CPPPATH'] += env['CPPPATH'] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 947 | if self.options['library'] == 'static': |
| 948 | return env.StaticObject(input, **kw) |
| 949 | else: |
| 950 | return env.SharedObject(input, **kw) |
| 951 | |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 952 | def ApplyEnvOverrides(self, env): |
| 953 | if not self.env_overrides: |
| 954 | return |
| 955 | if type(env['ENV']) == DictType: |
| 956 | env['ENV'].update(**self.env_overrides) |
| 957 | else: |
| 958 | env['ENV'] = self.env_overrides |
| 959 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 960 | |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 961 | def PostprocessOptions(options, os): |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 962 | # Adjust architecture if the simulator option has been set |
| 963 | if (options['simulator'] != 'none') and (options['arch'] != options['simulator']): |
| 964 | if 'arch' in ARGUMENTS: |
| 965 | # Print a warning if arch has explicitly been set |
| 966 | print "Warning: forcing architecture to match simulator (%s)" % options['simulator'] |
| 967 | options['arch'] = options['simulator'] |
ager@chromium.org | 4af710e | 2009-09-15 12:20:11 +0000 | [diff] [blame] | 968 | if (options['prof'] != 'off') and (options['profilingsupport'] == 'off'): |
| 969 | # Print a warning if profiling is enabled without profiling support |
| 970 | print "Warning: forcing profilingsupport on when prof is on" |
| 971 | options['profilingsupport'] = 'on' |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 972 | if os == 'win32' and options['pgo'] != 'off' and options['msvcltcg'] == 'off': |
| 973 | if 'msvcltcg' in ARGUMENTS: |
| 974 | print "Warning: forcing msvcltcg on as it is required for pgo (%s)" % options['pgo'] |
| 975 | options['msvcltcg'] = 'on' |
ager@chromium.org | 5c83825 | 2010-02-19 08:53:10 +0000 | [diff] [blame] | 976 | if options['arch'] == 'mips': |
| 977 | if ('regexp' in ARGUMENTS) and options['regexp'] == 'native': |
| 978 | # Print a warning if native regexp is specified for mips |
| 979 | print "Warning: forcing regexp to interpreted for mips" |
| 980 | options['regexp'] = 'interpreted' |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 981 | |
| 982 | |
kasperl@chromium.org | 8ccb0be | 2009-04-07 07:21:39 +0000 | [diff] [blame] | 983 | def ParseEnvOverrides(arg, imports): |
| 984 | # The environment overrides are in the format NAME0:value0,NAME1:value1,... |
| 985 | # The environment imports are in the format NAME0,NAME1,... |
v8.team.kasperl | 727e995 | 2008-09-02 14:56:44 +0000 | [diff] [blame] | 986 | overrides = {} |
kasperl@chromium.org | 8ccb0be | 2009-04-07 07:21:39 +0000 | [diff] [blame] | 987 | for var in imports.split(','): |
| 988 | if var in os.environ: |
| 989 | overrides[var] = os.environ[var] |
v8.team.kasperl | 727e995 | 2008-09-02 14:56:44 +0000 | [diff] [blame] | 990 | for override in arg.split(','): |
| 991 | pos = override.find(':') |
| 992 | if pos == -1: |
| 993 | continue |
| 994 | overrides[override[:pos].strip()] = override[pos+1:].strip() |
| 995 | return overrides |
| 996 | |
| 997 | |
| 998 | def BuildSpecific(env, mode, env_overrides): |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 999 | options = {'mode': mode} |
| 1000 | for option in SIMPLE_OPTIONS: |
| 1001 | options[option] = env[option] |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 1002 | PostprocessOptions(options, env['os']) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1003 | |
v8.team.kasperl | 727e995 | 2008-09-02 14:56:44 +0000 | [diff] [blame] | 1004 | context = BuildContext(options, env_overrides, samples=SplitList(env['sample'])) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1005 | |
ager@chromium.org | ab99eea | 2009-08-25 07:05:41 +0000 | [diff] [blame] | 1006 | # Remove variables which can't be imported from the user's external |
| 1007 | # environment into a construction environment. |
| 1008 | user_environ = os.environ.copy() |
| 1009 | try: |
| 1010 | del user_environ['ENV'] |
| 1011 | except KeyError: |
| 1012 | pass |
| 1013 | |
| 1014 | library_flags = context.AddRelevantFlags(user_environ, LIBRARY_FLAGS) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1015 | v8_flags = context.AddRelevantFlags(library_flags, V8_EXTRA_FLAGS) |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 1016 | mksnapshot_flags = context.AddRelevantFlags(library_flags, MKSNAPSHOT_EXTRA_FLAGS) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1017 | dtoa_flags = context.AddRelevantFlags(library_flags, DTOA_EXTRA_FLAGS) |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 1018 | cctest_flags = context.AddRelevantFlags(v8_flags, CCTEST_EXTRA_FLAGS) |
ager@chromium.org | ab99eea | 2009-08-25 07:05:41 +0000 | [diff] [blame] | 1019 | sample_flags = context.AddRelevantFlags(user_environ, SAMPLE_FLAGS) |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 1020 | d8_flags = context.AddRelevantFlags(library_flags, D8_FLAGS) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1021 | |
| 1022 | context.flags = { |
| 1023 | 'v8': v8_flags, |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 1024 | 'mksnapshot': mksnapshot_flags, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1025 | 'dtoa': dtoa_flags, |
| 1026 | 'cctest': cctest_flags, |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 1027 | 'sample': sample_flags, |
| 1028 | 'd8': d8_flags |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1029 | } |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 1030 | |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 1031 | # Generate library base name. |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1032 | target_id = mode |
| 1033 | suffix = SUFFIXES[target_id] |
| 1034 | library_name = 'v8' + suffix |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 1035 | version = GetVersion() |
| 1036 | if context.options['soname'] == 'on': |
| 1037 | # When building shared object with SONAME version the library name. |
| 1038 | library_name += '-' + version |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1039 | |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 1040 | # Generate library SONAME if required by the build. |
| 1041 | if context.options['soname'] == 'on': |
| 1042 | soname = GetSpecificSONAME() |
| 1043 | if soname == '': |
| 1044 | soname = 'lib' + library_name + '.so' |
| 1045 | env['SONAME'] = soname |
| 1046 | |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 1047 | # Build the object files by invoking SCons recursively. |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 1048 | (object_files, shell_files, mksnapshot) = env.SConscript( |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1049 | join('src', 'SConscript'), |
| 1050 | build_dir=join('obj', target_id), |
| 1051 | exports='context', |
| 1052 | duplicate=False |
| 1053 | ) |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 1054 | |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 1055 | context.mksnapshot_targets.append(mksnapshot) |
| 1056 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1057 | # Link the object files into a library. |
kasperl@chromium.org | b912362 | 2008-09-17 14:05:56 +0000 | [diff] [blame] | 1058 | env.Replace(**context.flags['v8']) |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 1059 | |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 1060 | context.ApplyEnvOverrides(env) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1061 | if context.options['library'] == 'static': |
| 1062 | library = env.StaticLibrary(library_name, object_files) |
| 1063 | else: |
| 1064 | # There seems to be a glitch in the way scons decides where to put |
| 1065 | # PDB files when compiling using MSVC so we specify it manually. |
| 1066 | # This should not affect any other platforms. |
| 1067 | pdb_name = library_name + '.dll.pdb' |
| 1068 | library = env.SharedLibrary(library_name, object_files, PDB=pdb_name) |
| 1069 | context.library_targets.append(library) |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 1070 | |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 1071 | d8_env = Environment() |
| 1072 | d8_env.Replace(**context.flags['d8']) |
fschneider@chromium.org | 0c20e67 | 2010-01-14 15:28:53 +0000 | [diff] [blame] | 1073 | context.ApplyEnvOverrides(d8_env) |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 1074 | shell = d8_env.Program('d8' + suffix, object_files + shell_files) |
| 1075 | context.d8_targets.append(shell) |
| 1076 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1077 | for sample in context.samples: |
sgjesse@chromium.org | df7a284 | 2010-03-25 14:34:15 +0000 | [diff] [blame] | 1078 | sample_env = Environment() |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1079 | sample_env.Replace(**context.flags['sample']) |
sgjesse@chromium.org | df7a284 | 2010-03-25 14:34:15 +0000 | [diff] [blame] | 1080 | sample_env.Prepend(LIBS=[library_name]) |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 1081 | context.ApplyEnvOverrides(sample_env) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1082 | sample_object = sample_env.SConscript( |
| 1083 | join('samples', 'SConscript'), |
| 1084 | build_dir=join('obj', 'sample', sample, target_id), |
| 1085 | exports='sample context', |
| 1086 | duplicate=False |
| 1087 | ) |
| 1088 | sample_name = sample + suffix |
| 1089 | sample_program = sample_env.Program(sample_name, sample_object) |
| 1090 | sample_env.Depends(sample_program, library) |
| 1091 | context.sample_targets.append(sample_program) |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 1092 | |
ager@chromium.org | b26c50a | 2010-03-26 09:27:16 +0000 | [diff] [blame] | 1093 | cctest_env = env.Copy() |
| 1094 | cctest_env.Prepend(LIBS=[library_name]) |
| 1095 | cctest_program = cctest_env.SConscript( |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1096 | join('test', 'cctest', 'SConscript'), |
| 1097 | build_dir=join('obj', 'test', target_id), |
| 1098 | exports='context object_files', |
| 1099 | duplicate=False |
| 1100 | ) |
| 1101 | context.cctest_targets.append(cctest_program) |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 1102 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1103 | return context |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 1104 | |
| 1105 | |
kasper.lund | 7276f14 | 2008-07-30 08:49:36 +0000 | [diff] [blame] | 1106 | def Build(): |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 1107 | opts = GetOptions() |
| 1108 | env = Environment(options=opts) |
| 1109 | Help(opts.GenerateHelpText(env)) |
| 1110 | VerifyOptions(env) |
kasperl@chromium.org | 8ccb0be | 2009-04-07 07:21:39 +0000 | [diff] [blame] | 1111 | env_overrides = ParseEnvOverrides(env['env'], env['importenv']) |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 1112 | |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 1113 | SourceSignatures(env['sourcesignatures']) |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 1114 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1115 | libraries = [] |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 1116 | mksnapshots = [] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1117 | cctests = [] |
| 1118 | samples = [] |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 1119 | d8s = [] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1120 | modes = SplitList(env['mode']) |
| 1121 | for mode in modes: |
v8.team.kasperl | 727e995 | 2008-09-02 14:56:44 +0000 | [diff] [blame] | 1122 | context = BuildSpecific(env.Copy(), mode, env_overrides) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1123 | libraries += context.library_targets |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 1124 | mksnapshots += context.mksnapshot_targets |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1125 | cctests += context.cctest_targets |
| 1126 | samples += context.sample_targets |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 1127 | d8s += context.d8_targets |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 1128 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1129 | env.Alias('library', libraries) |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 1130 | env.Alias('mksnapshot', mksnapshots) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1131 | env.Alias('cctests', cctests) |
| 1132 | env.Alias('sample', samples) |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 1133 | env.Alias('d8', d8s) |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 1134 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1135 | if env['sample']: |
| 1136 | env.Default('sample') |
kasper.lund | 7276f14 | 2008-07-30 08:49:36 +0000 | [diff] [blame] | 1137 | else: |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 1138 | env.Default('library') |
kasper.lund | 7276f14 | 2008-07-30 08:49:36 +0000 | [diff] [blame] | 1139 | |
ager@chromium.org | 2cc82ae | 2010-06-14 07:35:38 +0000 | [diff] [blame] | 1140 | if env['cache']: |
| 1141 | CacheDir(env['cache']) |
kasper.lund | 7276f14 | 2008-07-30 08:49:36 +0000 | [diff] [blame] | 1142 | |
v8.team.kasperl | 727e995 | 2008-09-02 14:56:44 +0000 | [diff] [blame] | 1143 | # We disable deprecation warnings because we need to be able to use |
| 1144 | # env.Copy without getting warnings for compatibility with older |
| 1145 | # version of scons. Also, there's a bug in some revisions that |
| 1146 | # doesn't allow this flag to be set, so we swallow any exceptions. |
| 1147 | # Lovely. |
| 1148 | try: |
| 1149 | SetOption('warn', 'no-deprecated') |
| 1150 | except: |
| 1151 | pass |
| 1152 | |
| 1153 | |
kasper.lund | 7276f14 | 2008-07-30 08:49:36 +0000 | [diff] [blame] | 1154 | Build() |