1 # Copyright 2012 the V8 project authors. All rights reserved.
2 # Redistribution and use in source and binary forms, with or without
3 # modification, are permitted provided that the following conditions are
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.
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.
29 # Variable default definitions. Override them by exporting them in your shell.
37 ANDROID_NDK_HOST_ARCH ?=
39 ANDROID_V8 ?= /data/local/tmp/v8
42 # Special build flags. Use them like this: "make library=shared"
44 # library=shared || component=shared_library
45 ifeq ($(library), shared)
46 GYPFLAGS += -Dcomponent=shared_library
49 GYPFLAGS += -Dcomponent=$(component)
53 GYPFLAGS += -Dconsole=$(console)
56 ifeq ($(disassembler), on)
57 GYPFLAGS += -Dv8_enable_disassembler=1
60 ifeq ($(objectprint), on)
61 GYPFLAGS += -Dv8_object_print=1
64 ifeq ($(verifyheap), on)
65 GYPFLAGS += -Dv8_enable_verify_heap=1
68 ifeq ($(backtrace), off)
69 GYPFLAGS += -Dv8_enable_backtrace=0
71 GYPFLAGS += -Dv8_enable_backtrace=1
74 ifeq ($(snapshot), off)
75 GYPFLAGS += -Dv8_use_snapshot='false'
78 ifeq ($(extrachecks), on)
79 GYPFLAGS += -Dv8_enable_extra_checks=1 -Dv8_enable_handle_zapping=1
81 ifeq ($(extrachecks), off)
82 GYPFLAGS += -Dv8_enable_extra_checks=0 -Dv8_enable_handle_zapping=0
86 GYPFLAGS += -Dv8_enable_gdbjit=1
89 GYPFLAGS += -Dv8_enable_gdbjit=0
92 ifeq ($(vtunejit), on)
93 GYPFLAGS += -Dv8_enable_vtunejit=1
96 ifeq ($(optdebug), on)
97 GYPFLAGS += -Dv8_optimized_debug=1
100 ifeq ($(debuggersupport), off)
101 GYPFLAGS += -Dv8_enable_debugger_support=0
104 ifeq ($(unalignedaccess), on)
105 GYPFLAGS += -Dv8_can_use_unaligned_accesses=true
107 # soname_version=1.2.3
109 GYPFLAGS += -Dsoname_version=$(soname_version)
113 GYPFLAGS += -Dwerror=''
116 ifeq ($(presubmit), no)
117 TESTFLAGS += --no-presubmit
119 # strictaliasing=off (workaround for GCC-4.5)
120 ifeq ($(strictaliasing), off)
121 GYPFLAGS += -Dv8_no_strict_aliasing=1
124 ifeq ($(regexp), interpreted)
125 GYPFLAGS += -Dv8_interpreted_regexp=1
128 ifeq ($(i18nsupport), off)
129 GYPFLAGS += -Dv8_enable_i18n_support=0
130 TESTFLAGS += --noi18n
132 # deprecation_warnings=on
133 ifeq ($(deprecationwarnings), on)
134 GYPFLAGS += -Dv8_deprecation_warnings=1
136 # arm specific flags.
138 ifeq ($(armv7), false)
139 GYPFLAGS += -Darmv7=0
141 ifeq ($(armv7), true)
142 GYPFLAGS += -Darmv7=1
145 # vfp2=off. Deprecated, use armfpu=
146 # vfp3=off. Deprecated, use armfpu=
148 GYPFLAGS += -Darm_fpu=vfp
150 # hardfp=on/off. Deprecated, use armfloatabi
152 GYPFLAGS += -Darm_float_abi=hard
155 GYPFLAGS += -Darm_float_abi=softfp
159 ifeq ($(armneon), on)
160 GYPFLAGS += -Darm_neon=1
163 # xxx: vfp, vfpv3-d16, vfpv3, neon.
166 GYPFLAGS += -Darm_fpu=default
169 GYPFLAGS += -Darm_fpu=$(armfpu)
171 # float abi: armfloatabi=softfp/hard
172 ifeq ($(armfloatabi),)
174 GYPFLAGS += -Darm_float_abi=default
177 GYPFLAGS += -Darm_float_abi=$(armfloatabi)
180 ifeq ($(armthumb), off)
181 GYPFLAGS += -Darm_thumb=0
183 ifeq ($(armthumb), on)
184 GYPFLAGS += -Darm_thumb=1
188 # With this flag set, by default v8 will only use features implied
189 # by the compiler (no probe). This is done by modifying the default
190 # values of enable_armv7, enable_vfp2, enable_vfp3 and enable_32dregs.
191 # Modifying these flags when launching v8 will enable the probing for
192 # the specified values.
193 # When using the simulator, this flag is implied.
194 ifeq ($(armtest), on)
195 GYPFLAGS += -Darm_test=on
198 # ----------------- available targets: --------------------
199 # - "dependencies": pulls in external dependencies (currently: GYP)
200 # - "grokdump": rebuilds heap constants lists used by grokdump
201 # - any arch listed in ARCHES (see below)
202 # - any mode listed in MODES
203 # - every combination <arch>.<mode>, e.g. "ia32.release"
204 # - "native": current host's architecture, release mode
205 # - any of the above with .check appended, e.g. "ia32.release.check"
206 # - "android": cross-compile for Android/ARM
207 # - "nacl" : cross-compile for Native Client (ia32 and x64)
208 # - default (no target specified): build all DEFAULT_ARCHES and MODES
209 # - "check": build all targets and run all tests
210 # - "<arch>.clean" for any <arch> in ARCHES
211 # - "clean": clean all ARCHES
213 # ----------------- internal stuff ------------------------
215 # Architectures and modes to be compiled. Consider these to be internal
216 # variables, don't override them (use the targets instead).
217 ARCHES = ia32 x64 arm mipsel
218 DEFAULT_ARCHES = ia32 x64 arm
219 MODES = release debug
220 ANDROID_ARCHES = android_ia32 android_arm android_mipsel
221 NACL_ARCHES = nacl_ia32 nacl_x64
223 # List of files that trigger Makefile regeneration:
224 GYPFILES = build/all.gyp build/features.gypi build/standalone.gypi \
225 build/toolchain.gypi samples/samples.gyp src/d8.gyp \
226 test/cctest/cctest.gyp tools/gyp/v8.gyp
228 # If vtunejit=on, the v8vtune.gyp will be appended.
229 ifeq ($(vtunejit), on)
230 GYPFILES += src/third_party/vtune/v8vtune.gyp
232 # Generates all combinations of ARCHES and MODES, e.g. "ia32.release".
233 BUILDS = $(foreach mode,$(MODES),$(addsuffix .$(mode),$(ARCHES)))
234 ANDROID_BUILDS = $(foreach mode,$(MODES), \
235 $(addsuffix .$(mode),$(ANDROID_ARCHES)))
236 NACL_BUILDS = $(foreach mode,$(MODES), \
237 $(addsuffix .$(mode),$(NACL_ARCHES)))
238 # Generates corresponding test targets, e.g. "ia32.release.check".
239 CHECKS = $(addsuffix .check,$(BUILDS))
240 ANDROID_CHECKS = $(addsuffix .check,$(ANDROID_BUILDS))
241 NACL_CHECKS = $(addsuffix .check,$(NACL_BUILDS))
242 # File where previously used GYPFLAGS are stored.
243 ENVFILE = $(OUTDIR)/environment
245 .PHONY: all check clean dependencies $(ENVFILE).new native \
246 $(ARCHES) $(MODES) $(BUILDS) $(CHECKS) $(addsuffix .clean,$(ARCHES)) \
247 $(addsuffix .check,$(MODES)) $(addsuffix .check,$(ARCHES)) \
248 $(ANDROID_ARCHES) $(ANDROID_BUILDS) $(ANDROID_CHECKS) \
249 must-set-ANDROID_NDK_ROOT_OR_TOOLCHAIN \
250 $(NACL_ARCHES) $(NACL_BUILDS) $(NACL_CHECKS) \
251 must-set-NACL_SDK_ROOT
253 # Target definitions. "all" is the default.
256 # Special target for the buildbots to use. Depends on $(OUTDIR)/Makefile
257 # having been created before.
259 $(MAKE) -C "$(OUTDIR)" BUILDTYPE=$(BUILDTYPE) \
260 builddir="$(abspath $(OUTDIR))/$(BUILDTYPE)"
262 mips mips.release mips.debug:
263 @echo "V8 does not support big-endian MIPS builds at the moment," \
264 "please use little-endian builds (mipsel)."
266 # Compile targets. MODES and ARCHES are convenience targets.
268 $(MODES): $(addsuffix .$$@,$(DEFAULT_ARCHES))
270 $(ARCHES): $(addprefix $$@.,$(MODES))
272 # Defines how to build a particular target (e.g. ia32.release).
273 $(BUILDS): $(OUTDIR)/Makefile.$$(basename $$@)
274 @$(MAKE) -C "$(OUTDIR)" -f Makefile.$(basename $@) \
275 CXX="$(CXX)" LINK="$(LINK)" \
276 BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \
277 python -c "print raw_input().capitalize()") \
278 builddir="$(shell pwd)/$(OUTDIR)/$@"
280 native: $(OUTDIR)/Makefile.native
281 @$(MAKE) -C "$(OUTDIR)" -f Makefile.native \
282 CXX="$(CXX)" LINK="$(LINK)" BUILDTYPE=Release \
283 builddir="$(shell pwd)/$(OUTDIR)/$@"
285 $(ANDROID_ARCHES): $(addprefix $$@.,$(MODES))
287 $(ANDROID_BUILDS): $(GYPFILES) $(ENVFILE) build/android.gypi \
288 must-set-ANDROID_NDK_ROOT_OR_TOOLCHAIN Makefile.android
289 @$(MAKE) -f Makefile.android $@ \
290 ARCH="$(basename $@)" \
291 MODE="$(subst .,,$(suffix $@))" \
293 GYPFLAGS="$(GYPFLAGS)"
295 $(NACL_ARCHES): $(addprefix $$@.,$(MODES))
297 $(NACL_BUILDS): $(GYPFILES) $(ENVFILE) \
298 Makefile.nacl must-set-NACL_SDK_ROOT
299 @$(MAKE) -f Makefile.nacl $@ \
300 ARCH="$(basename $@)" \
301 MODE="$(subst .,,$(suffix $@))" \
303 GYPFLAGS="$(GYPFLAGS)"
307 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
308 --arch=$(shell echo $(DEFAULT_ARCHES) | sed -e 's/ /,/g') \
311 $(addsuffix .check,$(MODES)): $$(basename $$@)
312 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
313 --mode=$(basename $@) $(TESTFLAGS)
315 $(addsuffix .check,$(ARCHES)): $$(basename $$@)
316 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
317 --arch=$(basename $@) $(TESTFLAGS)
319 $(CHECKS): $$(basename $$@)
320 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
321 --arch-and-mode=$(basename $@) $(TESTFLAGS)
323 $(addsuffix .sync, $(ANDROID_BUILDS)): $$(basename $$@)
324 @tools/android-sync.sh $(basename $@) $(OUTDIR) \
325 $(shell pwd) $(ANDROID_V8)
327 $(addsuffix .check, $(ANDROID_BUILDS)): $$(basename $$@).sync
328 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
329 --arch-and-mode=$(basename $@) \
331 --command-prefix="tools/android-run.py" $(TESTFLAGS)
333 $(addsuffix .check, $(ANDROID_ARCHES)): \
334 $(addprefix $$(basename $$@).,$(MODES)).check
336 $(addsuffix .check, $(NACL_BUILDS)): $$(basename $$@)
337 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
338 --arch-and-mode=$(basename $@) \
339 --timeout=600 --nopresubmit --noi18n \
340 --command-prefix="tools/nacl-run.py"
342 $(addsuffix .check, $(NACL_ARCHES)): \
343 $(addprefix $$(basename $$@).,$(MODES)).check
346 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR)/native \
347 --arch-and-mode=. $(TESTFLAGS)
349 # Clean targets. You can clean each architecture individually, or everything.
350 $(addsuffix .clean, $(ARCHES) $(ANDROID_ARCHES) $(NACL_ARCHES)):
351 rm -f $(OUTDIR)/Makefile.$(basename $@)
352 rm -rf $(OUTDIR)/$(basename $@).release
353 rm -rf $(OUTDIR)/$(basename $@).debug
354 find $(OUTDIR) -regex '.*\(host\|target\).$(basename $@)\.mk' -delete
357 rm -f $(OUTDIR)/Makefile.native
358 rm -rf $(OUTDIR)/native
359 find $(OUTDIR) -regex '.*\(host\|target\).native\.mk' -delete
361 clean: $(addsuffix .clean, $(ARCHES) $(ANDROID_ARCHES) $(NACL_ARCHES)) native.clean
363 # GYP file generation targets.
364 OUT_MAKEFILES = $(addprefix $(OUTDIR)/Makefile.,$(ARCHES))
365 $(OUT_MAKEFILES): $(GYPFILES) $(ENVFILE)
366 PYTHONPATH="$(shell pwd)/tools/generate_shim_headers:$(PYTHONPATH)" \
367 GYP_GENERATORS=make \
368 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \
369 -Ibuild/standalone.gypi --depth=. \
370 -Dv8_target_arch=$(subst .,,$(suffix $@)) \
371 -S.$(subst .,,$(suffix $@)) $(GYPFLAGS)
373 $(OUTDIR)/Makefile.native: $(GYPFILES) $(ENVFILE)
374 PYTHONPATH="$(shell pwd)/tools/generate_shim_headers:$(PYTHONPATH)" \
375 GYP_GENERATORS=make \
376 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \
377 -Ibuild/standalone.gypi --depth=. -S.native $(GYPFLAGS)
379 must-set-ANDROID_NDK_ROOT_OR_TOOLCHAIN:
380 ifndef ANDROID_NDK_ROOT
381 ifndef ANDROID_TOOLCHAIN
382 $(error ANDROID_NDK_ROOT or ANDROID_TOOLCHAIN must be set))
386 # Note that NACL_SDK_ROOT must be set to point to an appropriate
387 # Native Client SDK before using this makefile. You can download
389 # https://developers.google.com/native-client/sdk/download
390 # The path indicated by NACL_SDK_ROOT will typically end with
391 # a folder for a pepper version such as "pepper_25" that should
392 # have "tools" and "toolchain" subdirectories.
393 must-set-NACL_SDK_ROOT:
395 $(error NACL_SDK_ROOT must be set)
398 # Replaces the old with the new environment file if they're different, which
399 # will trigger GYP to regenerate Makefiles.
400 $(ENVFILE): $(ENVFILE).new
401 @if test -r $(ENVFILE) && cmp $(ENVFILE).new $(ENVFILE) > /dev/null; \
402 then rm $(ENVFILE).new; \
403 else mv $(ENVFILE).new $(ENVFILE); fi
405 # Stores current GYPFLAGS in a file.
407 @mkdir -p $(OUTDIR); echo "GYPFLAGS=$(GYPFLAGS)" > $(ENVFILE).new; \
408 echo "CXX=$(CXX)" >> $(ENVFILE).new
410 # Heap constants for grokdump.
411 DUMP_FILE = tools/v8heapconst.py
412 grokdump: ia32.release
413 @cat $(DUMP_FILE).tmpl > $(DUMP_FILE)
414 @$(OUTDIR)/ia32.release/d8 --dump-heap-constants >> $(DUMP_FILE)
417 # Remember to keep these in sync with the DEPS file.
419 svn checkout --force http://gyp.googlecode.com/svn/trunk build/gyp \
421 svn checkout --force \
422 https://src.chromium.org/chrome/trunk/deps/third_party/icu46 \
423 third_party/icu --revision 214189