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