ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 1 | # Copyright 2008 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 | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 38 | |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 39 | # ANDROID_TOP is the top of the Android checkout, fetched from the environment |
| 40 | # variable 'TOP'. You will also need to set the CXX, CC, AR and RANLIB |
| 41 | # environment variables to the cross-compiling tools. |
| 42 | ANDROID_TOP = os.environ.get('TOP') |
| 43 | if ANDROID_TOP is None: |
| 44 | ANDROID_TOP="" |
| 45 | |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 46 | # 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^] | 47 | # on linux we need these compiler flags to avoid crashes in the v8 test suite |
| 48 | # and avoid dtoa.c strict aliasing issues |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 49 | if os.environ.get('GCC_VERSION') == '44': |
ager@chromium.org | e2902be | 2009-06-08 12:21:35 +0000 | [diff] [blame^] | 50 | GCC_EXTRA_CCFLAGS = ['-fno-tree-vrp'] |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 51 | GCC_DTOA_EXTRA_CCFLAGS = ['-fno-strict-aliasing'] |
| 52 | else: |
| 53 | GCC_EXTRA_CCFLAGS = [] |
| 54 | GCC_DTOA_EXTRA_CCFLAGS = [] |
| 55 | |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 56 | ANDROID_FLAGS = ['-march=armv5te', |
| 57 | '-mtune=xscale', |
| 58 | '-msoft-float', |
| 59 | '-fpic', |
| 60 | '-mthumb-interwork', |
| 61 | '-funwind-tables', |
| 62 | '-fstack-protector', |
| 63 | '-fno-short-enums', |
| 64 | '-fmessage-length=0', |
| 65 | '-finline-functions', |
| 66 | '-fno-inline-functions-called-once', |
| 67 | '-fgcse-after-reload', |
| 68 | '-frerun-cse-after-loop', |
| 69 | '-frename-registers', |
| 70 | '-fomit-frame-pointer', |
| 71 | '-fno-strict-aliasing', |
| 72 | '-finline-limit=64', |
| 73 | '-MD'] |
| 74 | |
| 75 | ANDROID_INCLUDES = [ANDROID_TOP + '/bionic/libc/arch-arm/include', |
| 76 | ANDROID_TOP + '/bionic/libc/include', |
| 77 | ANDROID_TOP + '/bionic/libstdc++/include', |
| 78 | ANDROID_TOP + '/bionic/libc/kernel/common', |
| 79 | ANDROID_TOP + '/bionic/libc/kernel/arch-arm', |
| 80 | ANDROID_TOP + '/bionic/libm/include', |
| 81 | ANDROID_TOP + '/bionic/libm/include/arch/arm', |
| 82 | ANDROID_TOP + '/bionic/libthread_db/include'] |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 83 | |
kasperl@chromium.org | f5aa837 | 2009-03-24 14:47:14 +0000 | [diff] [blame] | 84 | ANDROID_LINKFLAGS = ['-nostdlib', |
| 85 | '-Bdynamic', |
| 86 | '-Wl,-T,' + ANDROID_TOP + '/build/core/armelf.x', |
| 87 | '-Wl,-dynamic-linker,/system/bin/linker', |
| 88 | '-Wl,--gc-sections', |
| 89 | '-Wl,-z,nocopyreloc', |
| 90 | '-Wl,-rpath-link=' + ANDROID_TOP + '/out/target/product/generic/obj/lib', |
| 91 | ANDROID_TOP + '/out/target/product/generic/obj/lib/crtbegin_dynamic.o', |
| 92 | ANDROID_TOP + '/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/lib/gcc/arm-eabi/4.2.1/interwork/libgcc.a', |
| 93 | ANDROID_TOP + '/out/target/product/generic/obj/lib/crtend_android.o']; |
| 94 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 95 | LIBRARY_FLAGS = { |
| 96 | 'all': { |
ager@chromium.org | 3a37e9b | 2009-04-27 09:26:21 +0000 | [diff] [blame] | 97 | 'CPPDEFINES': ['ENABLE_LOGGING_AND_PROFILING'], |
| 98 | 'CPPPATH': [join(root_dir, 'src')] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 99 | }, |
| 100 | 'gcc': { |
| 101 | 'all': { |
kasperl@chromium.org | 41044eb | 2008-10-06 08:24:46 +0000 | [diff] [blame] | 102 | 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 103 | 'CXXFLAGS': ['$CCFLAGS', '-fno-rtti', '-fno-exceptions'], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 104 | }, |
| 105 | 'mode:debug': { |
| 106 | 'CCFLAGS': ['-g', '-O0'], |
ager@chromium.org | 71daaf6 | 2009-04-01 07:22:49 +0000 | [diff] [blame] | 107 | 'CPPDEFINES': ['ENABLE_DISASSEMBLER', 'DEBUG'], |
| 108 | 'os:android': { |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 109 | 'CPPDEFINES': ['ENABLE_DEBUGGER_SUPPORT'], |
ager@chromium.org | 71daaf6 | 2009-04-01 07:22:49 +0000 | [diff] [blame] | 110 | 'CCFLAGS': ['-mthumb'] |
| 111 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 112 | }, |
| 113 | 'mode:release': { |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 114 | 'CCFLAGS': ['-O3', '-fomit-frame-pointer', '-fdata-sections', |
| 115 | '-ffunction-sections'], |
| 116 | 'os:android': { |
ager@chromium.org | 71daaf6 | 2009-04-01 07:22:49 +0000 | [diff] [blame] | 117 | 'CCFLAGS': ['-mthumb', '-Os'], |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 118 | 'CPPDEFINES': ['SK_RELEASE', 'NDEBUG', 'ENABLE_DEBUGGER_SUPPORT'] |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 119 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 120 | }, |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 121 | 'os:linux': { |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 122 | 'CCFLAGS': ['-ansi'] + GCC_EXTRA_CCFLAGS, |
sgjesse@chromium.org | f8c8180 | 2009-03-30 07:19:14 +0000 | [diff] [blame] | 123 | 'library:shared': { |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 124 | 'LIBS': ['pthread'] |
sgjesse@chromium.org | f8c8180 | 2009-03-30 07:19:14 +0000 | [diff] [blame] | 125 | } |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 126 | }, |
| 127 | 'os:macos': { |
| 128 | 'CCFLAGS': ['-ansi'], |
| 129 | }, |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 130 | 'os:freebsd': { |
ager@chromium.org | e2902be | 2009-06-08 12:21:35 +0000 | [diff] [blame^] | 131 | 'CPPPATH' : ['/usr/local/include'], |
| 132 | 'LIBPATH' : ['/usr/local/lib'], |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 133 | 'CCFLAGS': ['-ansi'], |
| 134 | }, |
| 135 | 'os:win32': { |
| 136 | 'CCFLAGS': ['-DWIN32'], |
| 137 | 'CXXFLAGS': ['-DWIN32'], |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 138 | }, |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 139 | 'os:android': { |
| 140 | 'CPPDEFINES': ['ANDROID', '__ARM_ARCH_5__', '__ARM_ARCH_5T__', |
| 141 | '__ARM_ARCH_5E__', '__ARM_ARCH_5TE__'], |
| 142 | 'CCFLAGS': ANDROID_FLAGS, |
| 143 | 'WARNINGFLAGS': ['-Wall', '-Wno-unused', '-Werror=return-type', |
| 144 | '-Wstrict-aliasing=2'], |
| 145 | 'CPPPATH': ANDROID_INCLUDES, |
| 146 | }, |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 147 | 'wordsize:32': { |
| 148 | 'arch:x64': { |
| 149 | 'CCFLAGS': ['-m64'], |
| 150 | 'LINKFLAGS': ['-m64'] |
| 151 | } |
| 152 | }, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 153 | 'wordsize:64': { |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 154 | 'arch:ia32': { |
| 155 | 'CCFLAGS': ['-m32'], |
| 156 | 'LINKFLAGS': ['-m32'] |
| 157 | }, |
| 158 | 'arch:arm': { |
| 159 | 'CCFLAGS': ['-m32'], |
| 160 | 'LINKFLAGS': ['-m32'] |
| 161 | } |
| 162 | }, |
| 163 | 'arch:ia32': { |
ager@chromium.org | 9085a01 | 2009-05-11 19:22:57 +0000 | [diff] [blame] | 164 | 'CPPDEFINES': ['V8_TARGET_ARCH_IA32'] |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 165 | }, |
| 166 | 'arch:arm': { |
ager@chromium.org | 9085a01 | 2009-05-11 19:22:57 +0000 | [diff] [blame] | 167 | 'CPPDEFINES': ['V8_TARGET_ARCH_ARM'] |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 168 | }, |
| 169 | 'arch:x64': { |
ager@chromium.org | 9085a01 | 2009-05-11 19:22:57 +0000 | [diff] [blame] | 170 | 'CPPDEFINES': ['V8_TARGET_ARCH_X64'] |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 171 | }, |
| 172 | 'prof:oprofile': { |
| 173 | 'CPPDEFINES': ['ENABLE_OPROFILE_AGENT'] |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 174 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 175 | }, |
| 176 | 'msvc': { |
| 177 | 'all': { |
| 178 | 'DIALECTFLAGS': ['/nologo'], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 179 | 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], |
v8.team.kasperl | 727e995 | 2008-09-02 14:56:44 +0000 | [diff] [blame] | 180 | 'CXXFLAGS': ['$CCFLAGS', '/GR-', '/Gy'], |
kasperl@chromium.org | acae378 | 2009-04-11 09:17:08 +0000 | [diff] [blame] | 181 | 'CPPDEFINES': ['WIN32', '_USE_32BIT_TIME_T'], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 182 | 'LINKFLAGS': ['/NOLOGO', '/MACHINE:X86', '/INCREMENTAL:NO', |
| 183 | '/NXCOMPAT', '/IGNORE:4221'], |
| 184 | 'ARFLAGS': ['/NOLOGO'], |
| 185 | 'CCPDBFLAGS': ['/Zi'] |
| 186 | }, |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 187 | 'arch:ia32': { |
ager@chromium.org | 9085a01 | 2009-05-11 19:22:57 +0000 | [diff] [blame] | 188 | 'CPPDEFINES': ['V8_TARGET_ARCH_IA32'] |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 189 | }, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 190 | 'mode:debug': { |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 191 | 'CCFLAGS': ['/Od', '/Gm'], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 192 | 'CPPDEFINES': ['_DEBUG', 'ENABLE_DISASSEMBLER', 'DEBUG'], |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 193 | 'LINKFLAGS': ['/DEBUG'], |
| 194 | 'msvcrt:static': { |
| 195 | 'CCFLAGS': ['/MTd'] |
| 196 | }, |
| 197 | 'msvcrt:shared': { |
| 198 | 'CCFLAGS': ['/MDd'] |
| 199 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 200 | }, |
| 201 | 'mode:release': { |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 202 | 'CCFLAGS': ['/O2'], |
| 203 | 'LINKFLAGS': ['/OPT:REF', '/OPT:ICF'], |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 204 | 'msvcrt:static': { |
| 205 | 'CCFLAGS': ['/MT'] |
| 206 | }, |
| 207 | 'msvcrt:shared': { |
| 208 | 'CCFLAGS': ['/MD'] |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 209 | }, |
| 210 | 'msvcltcg:on': { |
| 211 | 'CCFLAGS': ['/GL'], |
| 212 | 'LINKFLAGS': ['/LTCG'], |
| 213 | 'ARFLAGS': ['/LTCG'], |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 214 | } |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 215 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 216 | } |
| 217 | } |
| 218 | |
| 219 | |
| 220 | V8_EXTRA_FLAGS = { |
| 221 | 'gcc': { |
| 222 | 'all': { |
| 223 | 'CXXFLAGS': [], #['-fvisibility=hidden'], |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 224 | 'WARNINGFLAGS': ['-Wall', '-Werror', '-W', |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 225 | '-Wno-unused-parameter'] |
| 226 | }, |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 227 | 'os:win32': { |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 228 | 'WARNINGFLAGS': ['-pedantic', '-Wno-long-long'] |
| 229 | }, |
| 230 | 'os:linux': { |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 231 | 'WARNINGFLAGS': ['-pedantic'], |
| 232 | 'library:shared': { |
| 233 | 'soname:on': { |
| 234 | 'LINKFLAGS': ['-Wl,-soname,${SONAME}'] |
| 235 | } |
| 236 | } |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 237 | }, |
| 238 | 'os:macos': { |
| 239 | 'WARNINGFLAGS': ['-pedantic'] |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 240 | }, |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 241 | 'disassembler:on': { |
| 242 | 'CPPDEFINES': ['ENABLE_DISASSEMBLER'] |
| 243 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 244 | }, |
| 245 | 'msvc': { |
| 246 | 'all': { |
| 247 | 'WARNINGFLAGS': ['/W3', '/WX', '/wd4355', '/wd4800'] |
| 248 | }, |
| 249 | 'library:shared': { |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 250 | 'CPPDEFINES': ['BUILDING_V8_SHARED'], |
| 251 | 'LIBS': ['winmm', 'ws2_32'] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 252 | }, |
| 253 | 'arch:arm': { |
ager@chromium.org | 9085a01 | 2009-05-11 19:22:57 +0000 | [diff] [blame] | 254 | 'CPPDEFINES': ['V8_TARGET_ARCH_ARM'], |
ager@chromium.org | 3bf7b91 | 2008-11-17 09:09:45 +0000 | [diff] [blame] | 255 | # /wd4996 is to silence the warning about sscanf |
| 256 | # used by the arm simulator. |
| 257 | 'WARNINGFLAGS': ['/wd4996'] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 258 | }, |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 259 | 'disassembler:on': { |
| 260 | 'CPPDEFINES': ['ENABLE_DISASSEMBLER'] |
| 261 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 262 | } |
| 263 | } |
| 264 | |
| 265 | |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 266 | MKSNAPSHOT_EXTRA_FLAGS = { |
| 267 | 'gcc': { |
| 268 | 'os:linux': { |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 269 | 'LIBS': ['pthread'], |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 270 | }, |
| 271 | 'os:macos': { |
| 272 | 'LIBS': ['pthread'], |
| 273 | }, |
| 274 | 'os:freebsd': { |
ager@chromium.org | e2902be | 2009-06-08 12:21:35 +0000 | [diff] [blame^] | 275 | 'LIBS': ['execinfo', 'pthread'] |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 276 | }, |
| 277 | 'os:win32': { |
ager@chromium.org | 381abbb | 2009-02-25 13:23:22 +0000 | [diff] [blame] | 278 | 'LIBS': ['winmm', 'ws2_32'], |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 279 | }, |
| 280 | }, |
| 281 | 'msvc': { |
| 282 | 'all': { |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 283 | 'CPPDEFINES': ['_HAS_EXCEPTIONS=0'], |
ager@chromium.org | 381abbb | 2009-02-25 13:23:22 +0000 | [diff] [blame] | 284 | 'LIBS': ['winmm', 'ws2_32'] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 285 | } |
| 286 | } |
| 287 | } |
| 288 | |
| 289 | |
| 290 | DTOA_EXTRA_FLAGS = { |
| 291 | 'gcc': { |
| 292 | 'all': { |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 293 | 'WARNINGFLAGS': ['-Werror', '-Wno-uninitialized'], |
| 294 | 'CCFLAGS': GCC_DTOA_EXTRA_CCFLAGS |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 295 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 296 | }, |
| 297 | 'msvc': { |
| 298 | 'all': { |
| 299 | 'WARNINGFLAGS': ['/WX', '/wd4018', '/wd4244'] |
| 300 | } |
| 301 | } |
| 302 | } |
| 303 | |
| 304 | |
| 305 | CCTEST_EXTRA_FLAGS = { |
| 306 | 'all': { |
| 307 | 'CPPPATH': [join(root_dir, 'src')], |
| 308 | 'LIBS': ['$LIBRARY'] |
| 309 | }, |
| 310 | 'gcc': { |
| 311 | 'all': { |
| 312 | 'LIBPATH': [abspath('.')] |
| 313 | }, |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 314 | 'os:linux': { |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 315 | 'LIBS': ['pthread'], |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 316 | }, |
| 317 | 'os:macos': { |
| 318 | 'LIBS': ['pthread'], |
| 319 | }, |
| 320 | 'os:freebsd': { |
| 321 | 'LIBS': ['execinfo', 'pthread'] |
| 322 | }, |
| 323 | 'os:win32': { |
ager@chromium.org | 381abbb | 2009-02-25 13:23:22 +0000 | [diff] [blame] | 324 | 'LIBS': ['winmm', 'ws2_32'] |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 325 | }, |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 326 | 'os:android': { |
| 327 | 'CPPDEFINES': ['ANDROID', '__ARM_ARCH_5__', '__ARM_ARCH_5T__', |
| 328 | '__ARM_ARCH_5E__', '__ARM_ARCH_5TE__'], |
| 329 | 'CCFLAGS': ANDROID_FLAGS, |
| 330 | 'CPPPATH': ANDROID_INCLUDES, |
| 331 | 'LIBPATH': [ANDROID_TOP + '/out/target/product/generic/obj/lib'], |
| 332 | 'LINKFLAGS': ANDROID_LINKFLAGS, |
| 333 | 'LIBS': ['c', 'stdc++', 'm'], |
| 334 | 'mode:release': { |
| 335 | 'CPPDEFINES': ['SK_RELEASE', 'NDEBUG'] |
| 336 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 337 | }, |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 338 | 'wordsize:32': { |
| 339 | 'arch:x64': { |
| 340 | 'CCFLAGS': ['-m64'], |
| 341 | 'LINKFLAGS': ['-m64'] |
| 342 | } |
| 343 | }, |
| 344 | 'wordsize:64': { |
| 345 | 'arch:ia32': { |
| 346 | 'CCFLAGS': ['-m32'], |
| 347 | 'LINKFLAGS': ['-m32'] |
| 348 | }, |
| 349 | 'arch:arm': { |
| 350 | 'CCFLAGS': ['-m32'], |
| 351 | 'LINKFLAGS': ['-m32'] |
| 352 | } |
| 353 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 354 | }, |
| 355 | 'msvc': { |
| 356 | 'all': { |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 357 | 'CPPDEFINES': ['_HAS_EXCEPTIONS=0'], |
ager@chromium.org | 381abbb | 2009-02-25 13:23:22 +0000 | [diff] [blame] | 358 | 'LIBS': ['winmm', 'ws2_32'] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 359 | }, |
| 360 | 'library:shared': { |
| 361 | 'CPPDEFINES': ['USING_V8_SHARED'] |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 362 | }, |
| 363 | 'arch:ia32': { |
ager@chromium.org | 9085a01 | 2009-05-11 19:22:57 +0000 | [diff] [blame] | 364 | 'CPPDEFINES': ['V8_TARGET_ARCH_IA32'] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 365 | } |
| 366 | } |
| 367 | } |
| 368 | |
| 369 | |
| 370 | SAMPLE_FLAGS = { |
| 371 | 'all': { |
v8.team.kasperl | 727e995 | 2008-09-02 14:56:44 +0000 | [diff] [blame] | 372 | 'CPPPATH': [join(abspath('.'), 'include')], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 373 | 'LIBS': ['$LIBRARY'], |
| 374 | }, |
| 375 | 'gcc': { |
| 376 | 'all': { |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 377 | 'LIBPATH': ['.'], |
| 378 | 'CCFLAGS': ['-fno-rtti', '-fno-exceptions'] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 379 | }, |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 380 | 'os:linux': { |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 381 | 'LIBS': ['pthread'], |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 382 | }, |
| 383 | 'os:macos': { |
| 384 | 'LIBS': ['pthread'], |
| 385 | }, |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 386 | 'os:freebsd': { |
ager@chromium.org | e2902be | 2009-06-08 12:21:35 +0000 | [diff] [blame^] | 387 | 'LIBPATH' : ['/usr/local/lib'], |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 388 | 'LIBS': ['execinfo', 'pthread'] |
| 389 | }, |
| 390 | 'os:win32': { |
ager@chromium.org | 381abbb | 2009-02-25 13:23:22 +0000 | [diff] [blame] | 391 | 'LIBS': ['winmm', 'ws2_32'] |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 392 | }, |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 393 | 'os:android': { |
| 394 | 'CPPDEFINES': ['ANDROID', '__ARM_ARCH_5__', '__ARM_ARCH_5T__', |
| 395 | '__ARM_ARCH_5E__', '__ARM_ARCH_5TE__'], |
| 396 | 'CCFLAGS': ANDROID_FLAGS, |
| 397 | 'CPPPATH': ANDROID_INCLUDES, |
| 398 | 'LIBPATH': [ANDROID_TOP + '/out/target/product/generic/obj/lib'], |
kasperl@chromium.org | f5aa837 | 2009-03-24 14:47:14 +0000 | [diff] [blame] | 399 | 'LINKFLAGS': ANDROID_LINKFLAGS, |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 400 | 'LIBS': ['c', 'stdc++', 'm'], |
| 401 | 'mode:release': { |
| 402 | 'CPPDEFINES': ['SK_RELEASE', 'NDEBUG'] |
| 403 | } |
| 404 | }, |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 405 | 'wordsize:32': { |
| 406 | 'arch:x64': { |
| 407 | 'CCFLAGS': ['-m64'], |
| 408 | 'LINKFLAGS': ['-m64'] |
| 409 | } |
| 410 | }, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 411 | 'wordsize:64': { |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 412 | 'arch:ia32': { |
| 413 | 'CCFLAGS': ['-m32'], |
| 414 | 'LINKFLAGS': ['-m32'] |
| 415 | }, |
| 416 | 'arch:arm': { |
| 417 | 'CCFLAGS': ['-m32'], |
| 418 | 'LINKFLAGS': ['-m32'] |
| 419 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 420 | }, |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 421 | 'mode:release': { |
| 422 | 'CCFLAGS': ['-O2'] |
| 423 | }, |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 424 | 'mode:debug': { |
| 425 | 'CCFLAGS': ['-g', '-O0'] |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 426 | }, |
| 427 | 'prof:oprofile': { |
| 428 | 'LIBPATH': ['/usr/lib32', '/usr/lib32/oprofile'], |
| 429 | 'LIBS': ['opagent'] |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 430 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 431 | }, |
| 432 | 'msvc': { |
| 433 | 'all': { |
| 434 | 'CCFLAGS': ['/nologo'], |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 435 | 'LINKFLAGS': ['/nologo'], |
ager@chromium.org | 381abbb | 2009-02-25 13:23:22 +0000 | [diff] [blame] | 436 | 'LIBS': ['winmm', 'ws2_32'] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 437 | }, |
| 438 | 'library:shared': { |
| 439 | 'CPPDEFINES': ['USING_V8_SHARED'] |
| 440 | }, |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 441 | 'prof:on': { |
| 442 | 'LINKFLAGS': ['/MAP'] |
| 443 | }, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 444 | 'mode:release': { |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 445 | 'CCFLAGS': ['/O2'], |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 446 | 'LINKFLAGS': ['/OPT:REF', '/OPT:ICF'], |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 447 | 'msvcrt:static': { |
| 448 | 'CCFLAGS': ['/MT'] |
| 449 | }, |
| 450 | 'msvcrt:shared': { |
| 451 | 'CCFLAGS': ['/MD'] |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 452 | }, |
| 453 | 'msvcltcg:on': { |
| 454 | 'CCFLAGS': ['/GL'], |
| 455 | 'LINKFLAGS': ['/LTCG'], |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 456 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 457 | }, |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 458 | 'arch:ia32': { |
ager@chromium.org | 9085a01 | 2009-05-11 19:22:57 +0000 | [diff] [blame] | 459 | 'CPPDEFINES': ['V8_TARGET_ARCH_IA32'] |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 460 | }, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 461 | 'mode:debug': { |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 462 | 'CCFLAGS': ['/Od'], |
| 463 | 'LINKFLAGS': ['/DEBUG'], |
| 464 | 'msvcrt:static': { |
| 465 | 'CCFLAGS': ['/MTd'] |
| 466 | }, |
| 467 | 'msvcrt:shared': { |
| 468 | 'CCFLAGS': ['/MDd'] |
| 469 | } |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 470 | } |
| 471 | } |
| 472 | } |
| 473 | |
| 474 | |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 475 | D8_FLAGS = { |
| 476 | 'gcc': { |
| 477 | 'console:readline': { |
| 478 | 'LIBS': ['readline'] |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 479 | }, |
| 480 | 'os:linux': { |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 481 | 'LIBS': ['pthread'], |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 482 | }, |
| 483 | 'os:macos': { |
| 484 | 'LIBS': ['pthread'], |
| 485 | }, |
| 486 | 'os:freebsd': { |
| 487 | 'LIBS': ['pthread'], |
| 488 | }, |
kasperl@chromium.org | f5aa837 | 2009-03-24 14:47:14 +0000 | [diff] [blame] | 489 | 'os:android': { |
| 490 | 'LIBPATH': [ANDROID_TOP + '/out/target/product/generic/obj/lib'], |
| 491 | 'LINKFLAGS': ANDROID_LINKFLAGS, |
| 492 | 'LIBS': ['c', 'stdc++', 'm'], |
| 493 | }, |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 494 | 'os:win32': { |
ager@chromium.org | 381abbb | 2009-02-25 13:23:22 +0000 | [diff] [blame] | 495 | 'LIBS': ['winmm', 'ws2_32'], |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 496 | }, |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 497 | }, |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 498 | 'msvc': { |
| 499 | 'all': { |
ager@chromium.org | 381abbb | 2009-02-25 13:23:22 +0000 | [diff] [blame] | 500 | 'LIBS': ['winmm', 'ws2_32'] |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 501 | } |
| 502 | } |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 503 | } |
| 504 | |
| 505 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 506 | SUFFIXES = { |
| 507 | 'release': '', |
| 508 | 'debug': '_g' |
| 509 | } |
| 510 | |
| 511 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 512 | def Abort(message): |
| 513 | print message |
| 514 | sys.exit(1) |
| 515 | |
| 516 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 517 | def GuessToolchain(os): |
| 518 | tools = Environment()['TOOLS'] |
| 519 | if 'gcc' in tools: |
kasper.lund | 7276f14 | 2008-07-30 08:49:36 +0000 | [diff] [blame] | 520 | return 'gcc' |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 521 | elif 'msvc' in tools: |
| 522 | return 'msvc' |
| 523 | else: |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 524 | return None |
| 525 | |
| 526 | |
ager@chromium.org | 870a0b6 | 2008-11-04 11:43:05 +0000 | [diff] [blame] | 527 | OS_GUESS = utils.GuessOS() |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 528 | TOOLCHAIN_GUESS = GuessToolchain(OS_GUESS) |
ager@chromium.org | c27e4e7 | 2008-09-04 13:52:27 +0000 | [diff] [blame] | 529 | ARCH_GUESS = utils.GuessArchitecture() |
ager@chromium.org | 870a0b6 | 2008-11-04 11:43:05 +0000 | [diff] [blame] | 530 | WORDSIZE_GUESS = utils.GuessWordsize() |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 531 | |
| 532 | |
| 533 | SIMPLE_OPTIONS = { |
| 534 | 'toolchain': { |
| 535 | 'values': ['gcc', 'msvc'], |
| 536 | 'default': TOOLCHAIN_GUESS, |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 537 | 'help': 'the toolchain to use (' + TOOLCHAIN_GUESS + ')' |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 538 | }, |
| 539 | 'os': { |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 540 | 'values': ['freebsd', 'linux', 'macos', 'win32', 'android'], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 541 | 'default': OS_GUESS, |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 542 | 'help': 'the os to build for (' + OS_GUESS + ')' |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 543 | }, |
| 544 | 'arch': { |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 545 | 'values':['arm', 'ia32', 'x64'], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 546 | 'default': ARCH_GUESS, |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 547 | 'help': 'the architecture to build for (' + ARCH_GUESS + ')' |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 548 | }, |
| 549 | 'snapshot': { |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 550 | 'values': ['on', 'off', 'nobuild'], |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 551 | 'default': 'off', |
| 552 | 'help': 'build using snapshots for faster start-up' |
| 553 | }, |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 554 | 'prof': { |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 555 | 'values': ['on', 'off', 'oprofile'], |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 556 | 'default': 'off', |
| 557 | 'help': 'enable profiling of build target' |
| 558 | }, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 559 | 'library': { |
| 560 | 'values': ['static', 'shared'], |
| 561 | 'default': 'static', |
| 562 | 'help': 'the type of library to produce' |
| 563 | }, |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 564 | 'soname': { |
| 565 | 'values': ['on', 'off'], |
| 566 | 'default': 'off', |
| 567 | 'help': 'turn on setting soname for Linux shared library' |
| 568 | }, |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 569 | 'msvcrt': { |
| 570 | 'values': ['static', 'shared'], |
| 571 | 'default': 'static', |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 572 | 'help': 'the type of Microsoft Visual C++ runtime library to use' |
| 573 | }, |
| 574 | 'msvcltcg': { |
| 575 | 'values': ['on', 'off'], |
| 576 | 'default': 'on', |
| 577 | 'help': 'use Microsoft Visual C++ link-time code generation' |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 578 | }, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 579 | 'wordsize': { |
| 580 | 'values': ['64', '32'], |
| 581 | 'default': WORDSIZE_GUESS, |
| 582 | 'help': 'the word size' |
| 583 | }, |
| 584 | 'simulator': { |
| 585 | 'values': ['arm', 'none'], |
| 586 | 'default': 'none', |
| 587 | 'help': 'build with simulator' |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 588 | }, |
| 589 | 'disassembler': { |
| 590 | 'values': ['on', 'off'], |
| 591 | 'default': 'off', |
| 592 | 'help': 'enable the disassembler to inspect generated code' |
| 593 | }, |
| 594 | 'sourcesignatures': { |
| 595 | 'values': ['MD5', 'timestamp'], |
| 596 | 'default': 'MD5', |
| 597 | 'help': 'set how the build system detects file changes' |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 598 | }, |
| 599 | 'console': { |
| 600 | 'values': ['dumb', 'readline'], |
| 601 | 'default': 'dumb', |
| 602 | 'help': 'the console to use for the d8 shell' |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 603 | } |
| 604 | } |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 605 | |
| 606 | |
| 607 | def GetOptions(): |
| 608 | result = Options() |
kasper.lund | 7276f14 | 2008-07-30 08:49:36 +0000 | [diff] [blame] | 609 | result.Add('mode', 'compilation mode (debug, release)', 'release') |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 610 | result.Add('sample', 'build sample (shell, process)', '') |
kasperl@chromium.org | 8ccb0be | 2009-04-07 07:21:39 +0000 | [diff] [blame] | 611 | result.Add('env', 'override environment settings (NAME0:value0,NAME1:value1,...)', '') |
| 612 | result.Add('importenv', 'import environment settings (NAME0,NAME1,...)', '') |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 613 | for (name, option) in SIMPLE_OPTIONS.iteritems(): |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 614 | help = '%s (%s)' % (name, ", ".join(option['values'])) |
| 615 | result.Add(name, help, option.get('default')) |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 616 | return result |
| 617 | |
| 618 | |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 619 | def GetVersionComponents(): |
| 620 | MAJOR_VERSION_PATTERN = re.compile(r"#define\s+MAJOR_VERSION\s+(.*)") |
| 621 | MINOR_VERSION_PATTERN = re.compile(r"#define\s+MINOR_VERSION\s+(.*)") |
| 622 | BUILD_NUMBER_PATTERN = re.compile(r"#define\s+BUILD_NUMBER\s+(.*)") |
| 623 | PATCH_LEVEL_PATTERN = re.compile(r"#define\s+PATCH_LEVEL\s+(.*)") |
| 624 | |
| 625 | patterns = [MAJOR_VERSION_PATTERN, |
| 626 | MINOR_VERSION_PATTERN, |
| 627 | BUILD_NUMBER_PATTERN, |
| 628 | PATCH_LEVEL_PATTERN] |
| 629 | |
| 630 | source = open(join(root_dir, 'src', 'version.cc')).read() |
| 631 | version_components = [] |
| 632 | for pattern in patterns: |
| 633 | match = pattern.search(source) |
| 634 | if match: |
| 635 | version_components.append(match.group(1).strip()) |
| 636 | else: |
| 637 | version_components.append('0') |
| 638 | |
| 639 | return version_components |
| 640 | |
| 641 | |
| 642 | def GetVersion(): |
| 643 | version_components = GetVersionComponents() |
| 644 | |
| 645 | if version_components[len(version_components) - 1] == '0': |
| 646 | version_components.pop() |
| 647 | return '.'.join(version_components) |
| 648 | |
| 649 | |
| 650 | def GetSpecificSONAME(): |
| 651 | SONAME_PATTERN = re.compile(r"#define\s+SONAME\s+\"(.*)\"") |
| 652 | |
| 653 | source = open(join(root_dir, 'src', 'version.cc')).read() |
| 654 | match = SONAME_PATTERN.search(source) |
| 655 | |
| 656 | if match: |
| 657 | return match.group(1).strip() |
| 658 | else: |
| 659 | return '' |
| 660 | |
| 661 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 662 | def SplitList(str): |
| 663 | return [ s for s in str.split(",") if len(s) > 0 ] |
| 664 | |
| 665 | |
| 666 | def IsLegal(env, option, values): |
| 667 | str = env[option] |
| 668 | for s in SplitList(str): |
| 669 | if not s in values: |
| 670 | Abort("Illegal value for option %s '%s'." % (option, s)) |
| 671 | return False |
| 672 | return True |
| 673 | |
| 674 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 675 | def VerifyOptions(env): |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 676 | if not IsLegal(env, 'mode', ['debug', 'release']): |
| 677 | return False |
| 678 | if not IsLegal(env, 'sample', ["shell", "process"]): |
| 679 | return False |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 680 | if env['os'] == 'win32' and env['library'] == 'shared' and env['prof'] == 'on': |
| 681 | Abort("Profiling on windows only supported for static library.") |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 682 | if env['prof'] == 'oprofile' and env['os'] != 'linux': |
| 683 | Abort("OProfile is only supported on Linux.") |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 684 | if env['os'] == 'win32' and env['soname'] == 'on': |
| 685 | Abort("Shared Object soname not applicable for Windows.") |
| 686 | if env['soname'] == 'on' and env['library'] == 'static': |
| 687 | Abort("Shared Object soname not applicable for static library.") |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 688 | for (name, option) in SIMPLE_OPTIONS.iteritems(): |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 689 | if (not option.get('default')) and (name not in ARGUMENTS): |
| 690 | message = ("A value for option %s must be specified (%s)." % |
| 691 | (name, ", ".join(option['values']))) |
| 692 | Abort(message) |
| 693 | if not env[name] in option['values']: |
| 694 | message = ("Unknown %s value '%s'. Possible values are (%s)." % |
| 695 | (name, env[name], ", ".join(option['values']))) |
| 696 | Abort(message) |
| 697 | |
| 698 | |
| 699 | class BuildContext(object): |
| 700 | |
v8.team.kasperl | 727e995 | 2008-09-02 14:56:44 +0000 | [diff] [blame] | 701 | def __init__(self, options, env_overrides, samples): |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 702 | self.library_targets = [] |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 703 | self.mksnapshot_targets = [] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 704 | self.cctest_targets = [] |
| 705 | self.sample_targets = [] |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 706 | self.d8_targets = [] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 707 | self.options = options |
v8.team.kasperl | 727e995 | 2008-09-02 14:56:44 +0000 | [diff] [blame] | 708 | self.env_overrides = env_overrides |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 709 | self.samples = samples |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 710 | self.use_snapshot = (options['snapshot'] != 'off') |
| 711 | self.build_snapshot = (options['snapshot'] == 'on') |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 712 | self.flags = None |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 713 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 714 | def AddRelevantFlags(self, initial, flags): |
| 715 | result = initial.copy() |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 716 | toolchain = self.options['toolchain'] |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 717 | if toolchain in flags: |
| 718 | self.AppendFlags(result, flags[toolchain].get('all')) |
| 719 | for option in sorted(self.options.keys()): |
| 720 | value = self.options[option] |
| 721 | self.AppendFlags(result, flags[toolchain].get(option + ':' + value)) |
ager@chromium.org | 3a37e9b | 2009-04-27 09:26:21 +0000 | [diff] [blame] | 722 | self.AppendFlags(result, flags.get('all')) |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 723 | return result |
| 724 | |
| 725 | def AddRelevantSubFlags(self, options, flags): |
| 726 | self.AppendFlags(options, flags.get('all')) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 727 | for option in sorted(self.options.keys()): |
| 728 | value = self.options[option] |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 729 | self.AppendFlags(options, flags.get(option + ':' + value)) |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 730 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 731 | def GetRelevantSources(self, source): |
| 732 | result = [] |
| 733 | result += source.get('all', []) |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 734 | for (name, value) in self.options.iteritems(): |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 735 | result += source.get(name + ':' + value, []) |
| 736 | return sorted(result) |
| 737 | |
| 738 | def AppendFlags(self, options, added): |
| 739 | if not added: |
| 740 | return |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 741 | for (key, value) in added.iteritems(): |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 742 | if key.find(':') != -1: |
| 743 | self.AddRelevantSubFlags(options, { key: value }) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 744 | else: |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 745 | if not key in options: |
| 746 | options[key] = value |
| 747 | else: |
| 748 | prefix = options[key] |
| 749 | if isinstance(prefix, StringTypes): prefix = prefix.split() |
| 750 | options[key] = prefix + value |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 751 | |
| 752 | def ConfigureObject(self, env, input, **kw): |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 753 | if (kw.has_key('CPPPATH') and env.has_key('CPPPATH')): |
| 754 | kw['CPPPATH'] += env['CPPPATH'] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 755 | if self.options['library'] == 'static': |
| 756 | return env.StaticObject(input, **kw) |
| 757 | else: |
| 758 | return env.SharedObject(input, **kw) |
| 759 | |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 760 | def ApplyEnvOverrides(self, env): |
| 761 | if not self.env_overrides: |
| 762 | return |
| 763 | if type(env['ENV']) == DictType: |
| 764 | env['ENV'].update(**self.env_overrides) |
| 765 | else: |
| 766 | env['ENV'] = self.env_overrides |
| 767 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 768 | |
| 769 | def PostprocessOptions(options): |
| 770 | # Adjust architecture if the simulator option has been set |
| 771 | if (options['simulator'] != 'none') and (options['arch'] != options['simulator']): |
| 772 | if 'arch' in ARGUMENTS: |
| 773 | # Print a warning if arch has explicitly been set |
| 774 | print "Warning: forcing architecture to match simulator (%s)" % options['simulator'] |
| 775 | options['arch'] = options['simulator'] |
| 776 | |
| 777 | |
kasperl@chromium.org | 8ccb0be | 2009-04-07 07:21:39 +0000 | [diff] [blame] | 778 | def ParseEnvOverrides(arg, imports): |
| 779 | # The environment overrides are in the format NAME0:value0,NAME1:value1,... |
| 780 | # The environment imports are in the format NAME0,NAME1,... |
v8.team.kasperl | 727e995 | 2008-09-02 14:56:44 +0000 | [diff] [blame] | 781 | overrides = {} |
kasperl@chromium.org | 8ccb0be | 2009-04-07 07:21:39 +0000 | [diff] [blame] | 782 | for var in imports.split(','): |
| 783 | if var in os.environ: |
| 784 | overrides[var] = os.environ[var] |
v8.team.kasperl | 727e995 | 2008-09-02 14:56:44 +0000 | [diff] [blame] | 785 | for override in arg.split(','): |
| 786 | pos = override.find(':') |
| 787 | if pos == -1: |
| 788 | continue |
| 789 | overrides[override[:pos].strip()] = override[pos+1:].strip() |
| 790 | return overrides |
| 791 | |
| 792 | |
| 793 | def BuildSpecific(env, mode, env_overrides): |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 794 | options = {'mode': mode} |
| 795 | for option in SIMPLE_OPTIONS: |
| 796 | options[option] = env[option] |
| 797 | PostprocessOptions(options) |
| 798 | |
v8.team.kasperl | 727e995 | 2008-09-02 14:56:44 +0000 | [diff] [blame] | 799 | context = BuildContext(options, env_overrides, samples=SplitList(env['sample'])) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 800 | |
| 801 | library_flags = context.AddRelevantFlags(os.environ, LIBRARY_FLAGS) |
| 802 | v8_flags = context.AddRelevantFlags(library_flags, V8_EXTRA_FLAGS) |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 803 | mksnapshot_flags = context.AddRelevantFlags(library_flags, MKSNAPSHOT_EXTRA_FLAGS) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 804 | dtoa_flags = context.AddRelevantFlags(library_flags, DTOA_EXTRA_FLAGS) |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 805 | cctest_flags = context.AddRelevantFlags(v8_flags, CCTEST_EXTRA_FLAGS) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 806 | sample_flags = context.AddRelevantFlags(os.environ, SAMPLE_FLAGS) |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 807 | d8_flags = context.AddRelevantFlags(library_flags, D8_FLAGS) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 808 | |
| 809 | context.flags = { |
| 810 | 'v8': v8_flags, |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 811 | 'mksnapshot': mksnapshot_flags, |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 812 | 'dtoa': dtoa_flags, |
| 813 | 'cctest': cctest_flags, |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 814 | 'sample': sample_flags, |
| 815 | 'd8': d8_flags |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 816 | } |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 817 | |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 818 | # Generate library base name. |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 819 | target_id = mode |
| 820 | suffix = SUFFIXES[target_id] |
| 821 | library_name = 'v8' + suffix |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 822 | version = GetVersion() |
| 823 | if context.options['soname'] == 'on': |
| 824 | # When building shared object with SONAME version the library name. |
| 825 | library_name += '-' + version |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 826 | env['LIBRARY'] = library_name |
| 827 | |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 828 | # Generate library SONAME if required by the build. |
| 829 | if context.options['soname'] == 'on': |
| 830 | soname = GetSpecificSONAME() |
| 831 | if soname == '': |
| 832 | soname = 'lib' + library_name + '.so' |
| 833 | env['SONAME'] = soname |
| 834 | |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 835 | # Build the object files by invoking SCons recursively. |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 836 | (object_files, shell_files, mksnapshot) = env.SConscript( |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 837 | join('src', 'SConscript'), |
| 838 | build_dir=join('obj', target_id), |
| 839 | exports='context', |
| 840 | duplicate=False |
| 841 | ) |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 842 | |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 843 | context.mksnapshot_targets.append(mksnapshot) |
| 844 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 845 | # Link the object files into a library. |
kasperl@chromium.org | b912362 | 2008-09-17 14:05:56 +0000 | [diff] [blame] | 846 | env.Replace(**context.flags['v8']) |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 847 | context.ApplyEnvOverrides(env) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 848 | if context.options['library'] == 'static': |
| 849 | library = env.StaticLibrary(library_name, object_files) |
| 850 | else: |
| 851 | # There seems to be a glitch in the way scons decides where to put |
| 852 | # PDB files when compiling using MSVC so we specify it manually. |
| 853 | # This should not affect any other platforms. |
| 854 | pdb_name = library_name + '.dll.pdb' |
| 855 | library = env.SharedLibrary(library_name, object_files, PDB=pdb_name) |
| 856 | context.library_targets.append(library) |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 857 | |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 858 | d8_env = Environment() |
| 859 | d8_env.Replace(**context.flags['d8']) |
| 860 | shell = d8_env.Program('d8' + suffix, object_files + shell_files) |
| 861 | context.d8_targets.append(shell) |
| 862 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 863 | for sample in context.samples: |
| 864 | sample_env = Environment(LIBRARY=library_name) |
| 865 | sample_env.Replace(**context.flags['sample']) |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 866 | context.ApplyEnvOverrides(sample_env) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 867 | sample_object = sample_env.SConscript( |
| 868 | join('samples', 'SConscript'), |
| 869 | build_dir=join('obj', 'sample', sample, target_id), |
| 870 | exports='sample context', |
| 871 | duplicate=False |
| 872 | ) |
| 873 | sample_name = sample + suffix |
| 874 | sample_program = sample_env.Program(sample_name, sample_object) |
| 875 | sample_env.Depends(sample_program, library) |
| 876 | context.sample_targets.append(sample_program) |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 877 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 878 | cctest_program = env.SConscript( |
| 879 | join('test', 'cctest', 'SConscript'), |
| 880 | build_dir=join('obj', 'test', target_id), |
| 881 | exports='context object_files', |
| 882 | duplicate=False |
| 883 | ) |
| 884 | context.cctest_targets.append(cctest_program) |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 885 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 886 | return context |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 887 | |
| 888 | |
kasper.lund | 7276f14 | 2008-07-30 08:49:36 +0000 | [diff] [blame] | 889 | def Build(): |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 890 | opts = GetOptions() |
| 891 | env = Environment(options=opts) |
| 892 | Help(opts.GenerateHelpText(env)) |
| 893 | VerifyOptions(env) |
kasperl@chromium.org | 8ccb0be | 2009-04-07 07:21:39 +0000 | [diff] [blame] | 894 | env_overrides = ParseEnvOverrides(env['env'], env['importenv']) |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 895 | |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 896 | SourceSignatures(env['sourcesignatures']) |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 897 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 898 | libraries = [] |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 899 | mksnapshots = [] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 900 | cctests = [] |
| 901 | samples = [] |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 902 | d8s = [] |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 903 | modes = SplitList(env['mode']) |
| 904 | for mode in modes: |
v8.team.kasperl | 727e995 | 2008-09-02 14:56:44 +0000 | [diff] [blame] | 905 | context = BuildSpecific(env.Copy(), mode, env_overrides) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 906 | libraries += context.library_targets |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 907 | mksnapshots += context.mksnapshot_targets |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 908 | cctests += context.cctest_targets |
| 909 | samples += context.sample_targets |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 910 | d8s += context.d8_targets |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 911 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 912 | env.Alias('library', libraries) |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 913 | env.Alias('mksnapshot', mksnapshots) |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 914 | env.Alias('cctests', cctests) |
| 915 | env.Alias('sample', samples) |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 916 | env.Alias('d8', d8s) |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 917 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 918 | if env['sample']: |
| 919 | env.Default('sample') |
kasper.lund | 7276f14 | 2008-07-30 08:49:36 +0000 | [diff] [blame] | 920 | else: |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 921 | env.Default('library') |
kasper.lund | 7276f14 | 2008-07-30 08:49:36 +0000 | [diff] [blame] | 922 | |
| 923 | |
v8.team.kasperl | 727e995 | 2008-09-02 14:56:44 +0000 | [diff] [blame] | 924 | # We disable deprecation warnings because we need to be able to use |
| 925 | # env.Copy without getting warnings for compatibility with older |
| 926 | # version of scons. Also, there's a bug in some revisions that |
| 927 | # doesn't allow this flag to be set, so we swallow any exceptions. |
| 928 | # Lovely. |
| 929 | try: |
| 930 | SetOption('warn', 'no-deprecated') |
| 931 | except: |
| 932 | pass |
| 933 | |
| 934 | |
kasper.lund | 7276f14 | 2008-07-30 08:49:36 +0000 | [diff] [blame] | 935 | Build() |