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