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