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