blob: 606b5d7bf176abc6984d32869d095265d340dacf [file] [log] [blame]
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001# Copyright 2012 the V8 project authors. All rights reserved.
Ben Murdoch69a99ed2011-11-30 16:03:39 +00002# 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
29# Variable default definitions. Override them by exporting them in your shell.
Ben Murdoch3ef787d2012-04-12 10:51:47 +010030CXX ?= g++
31LINK ?= g++
Ben Murdoch69a99ed2011-11-30 16:03:39 +000032OUTDIR ?= out
Ben Murdochb8a8cc12014-11-26 15:28:44 +000033TESTJOBS ?=
Ben Murdoch69a99ed2011-11-30 16:03:39 +000034GYPFLAGS ?=
Ben Murdoch3ef787d2012-04-12 10:51:47 +010035TESTFLAGS ?=
36ANDROID_NDK_ROOT ?=
Ben Murdochb8a8cc12014-11-26 15:28:44 +000037ANDROID_NDK_HOST_ARCH ?=
38ANDROID_TOOLCHAIN ?=
39ANDROID_V8 ?= /data/local/tmp/v8
40NACL_SDK_ROOT ?=
Ben Murdoch69a99ed2011-11-30 16:03:39 +000041
42# Special build flags. Use them like this: "make library=shared"
43
44# library=shared || component=shared_library
45ifeq ($(library), shared)
46 GYPFLAGS += -Dcomponent=shared_library
47endif
48ifdef component
49 GYPFLAGS += -Dcomponent=$(component)
50endif
51# console=readline
52ifdef console
53 GYPFLAGS += -Dconsole=$(console)
54endif
55# disassembler=on
56ifeq ($(disassembler), on)
57 GYPFLAGS += -Dv8_enable_disassembler=1
58endif
Ben Murdoch3ef787d2012-04-12 10:51:47 +010059# objectprint=on
60ifeq ($(objectprint), on)
61 GYPFLAGS += -Dv8_object_print=1
62endif
Ben Murdochb8a8cc12014-11-26 15:28:44 +000063# verifyheap=on
64ifeq ($(verifyheap), on)
65 GYPFLAGS += -Dv8_enable_verify_heap=1
66endif
Emily Bernierd0a1eb72015-03-24 16:35:39 -040067# tracemaps=on
68ifeq ($(tracemaps), on)
69 GYPFLAGS += -Dv8_trace_maps=1
70endif
Ben Murdochb8a8cc12014-11-26 15:28:44 +000071# backtrace=off
72ifeq ($(backtrace), off)
73 GYPFLAGS += -Dv8_enable_backtrace=0
74else
75 GYPFLAGS += -Dv8_enable_backtrace=1
76endif
77# verifypredictable=on
78ifeq ($(verifypredictable), on)
79 GYPFLAGS += -Dv8_enable_verify_predictable=1
80endif
Ben Murdoch69a99ed2011-11-30 16:03:39 +000081# snapshot=off
82ifeq ($(snapshot), off)
83 GYPFLAGS += -Dv8_use_snapshot='false'
84endif
Emily Bernierd0a1eb72015-03-24 16:35:39 -040085ifeq ($(snapshot), external)
86 GYPFLAGS += -Dv8_use_external_startup_data=1
87endif
Ben Murdochb8a8cc12014-11-26 15:28:44 +000088# extrachecks=on/off
89ifeq ($(extrachecks), on)
90 GYPFLAGS += -Dv8_enable_extra_checks=1 -Dv8_enable_handle_zapping=1
91endif
92ifeq ($(extrachecks), off)
93 GYPFLAGS += -Dv8_enable_extra_checks=0 -Dv8_enable_handle_zapping=0
94endif
95# gdbjit=on/off
Ben Murdoch69a99ed2011-11-30 16:03:39 +000096ifeq ($(gdbjit), on)
97 GYPFLAGS += -Dv8_enable_gdbjit=1
98endif
Ben Murdochb8a8cc12014-11-26 15:28:44 +000099ifeq ($(gdbjit), off)
100 GYPFLAGS += -Dv8_enable_gdbjit=0
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000101endif
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000102# vtunejit=on
103ifeq ($(vtunejit), on)
104 GYPFLAGS += -Dv8_enable_vtunejit=1
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000105endif
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000106# optdebug=on
107ifeq ($(optdebug), on)
108 GYPFLAGS += -Dv8_optimized_debug=2
109endif
110# unalignedaccess=on
111ifeq ($(unalignedaccess), on)
112 GYPFLAGS += -Dv8_can_use_unaligned_accesses=true
113endif
114# randomseed=12345, disable random seed via randomseed=0
115ifdef randomseed
116 GYPFLAGS += -Dv8_random_seed=$(randomseed)
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100117endif
Ben Murdoch589d6972011-11-30 16:04:58 +0000118# soname_version=1.2.3
119ifdef soname_version
120 GYPFLAGS += -Dsoname_version=$(soname_version)
121endif
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100122# werror=no
123ifeq ($(werror), no)
124 GYPFLAGS += -Dwerror=''
125endif
126# presubmit=no
127ifeq ($(presubmit), no)
128 TESTFLAGS += --no-presubmit
129endif
130# strictaliasing=off (workaround for GCC-4.5)
131ifeq ($(strictaliasing), off)
132 GYPFLAGS += -Dv8_no_strict_aliasing=1
133endif
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000134# regexp=interpreted
135ifeq ($(regexp), interpreted)
136 GYPFLAGS += -Dv8_interpreted_regexp=1
137endif
138# i18nsupport=off
139ifeq ($(i18nsupport), off)
140 GYPFLAGS += -Dv8_enable_i18n_support=0
141 TESTFLAGS += --noi18n
142endif
143# deprecation_warnings=on
144ifeq ($(deprecationwarnings), on)
145 GYPFLAGS += -Dv8_deprecation_warnings=1
146endif
147# asan=/path/to/clang++
148ifneq ($(strip $(asan)),)
149 GYPFLAGS += -Dasan=1
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400150 export CC=$(dir $(asan))clang
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000151 export CXX=$(asan)
152 export CXX_host=$(asan)
153 export LINK=$(asan)
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400154 export ASAN_SYMBOLIZER_PATH=$(dir $(asan))llvm-symbolizer
155 TESTFLAGS += --asan
156 ifeq ($(lsan), on)
157 GYPFLAGS += -Dlsan=1
158 endif
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000159endif
160
161# arm specific flags.
162# arm_version=<number | "default">
163ifneq ($(strip $(arm_version)),)
164 GYPFLAGS += -Darm_version=$(arm_version)
165else
166# Deprecated (use arm_version instead): armv7=false/true
167ifeq ($(armv7), false)
168 GYPFLAGS += -Darm_version=6
169else
170ifeq ($(armv7), true)
171 GYPFLAGS += -Darm_version=7
172endif
173endif
174endif
175# hardfp=on/off. Deprecated, use armfloatabi
176ifeq ($(hardfp),on)
177 GYPFLAGS += -Darm_float_abi=hard
178else
179ifeq ($(hardfp),off)
180 GYPFLAGS += -Darm_float_abi=softfp
181endif
182endif
183# fpu: armfpu=xxx
184# xxx: vfp, vfpv3-d16, vfpv3, neon.
185ifeq ($(armfpu),)
186 GYPFLAGS += -Darm_fpu=default
187else
188 GYPFLAGS += -Darm_fpu=$(armfpu)
189endif
190# float abi: armfloatabi=softfp/hard
191ifeq ($(armfloatabi),)
192ifeq ($(hardfp),)
193 GYPFLAGS += -Darm_float_abi=default
194endif
195else
196 GYPFLAGS += -Darm_float_abi=$(armfloatabi)
197endif
198# armthumb=on/off
199ifeq ($(armthumb), off)
200 GYPFLAGS += -Darm_thumb=0
201else
202ifeq ($(armthumb), on)
203 GYPFLAGS += -Darm_thumb=1
204endif
205endif
206# arm_test_noprobe=on
207# With this flag set, by default v8 will only use features implied
208# by the compiler (no probe). This is done by modifying the default
209# values of enable_armv7, enable_vfp3, enable_32dregs and enable_neon.
210# Modifying these flags when launching v8 will enable the probing for
211# the specified values.
212ifeq ($(arm_test_noprobe), on)
213 GYPFLAGS += -Darm_test_noprobe=on
214endif
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000215
216# ----------------- available targets: --------------------
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000217# - "builddeps": pulls in external dependencies for building
218# - "dependencies": pulls in all external dependencies
219# - "grokdump": rebuilds heap constants lists used by grokdump
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000220# - any arch listed in ARCHES (see below)
221# - any mode listed in MODES
222# - every combination <arch>.<mode>, e.g. "ia32.release"
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100223# - "native": current host's architecture, release mode
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000224# - any of the above with .check appended, e.g. "ia32.release.check"
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000225# - "android": cross-compile for Android/ARM
226# - "nacl" : cross-compile for Native Client (ia32 and x64)
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100227# - default (no target specified): build all DEFAULT_ARCHES and MODES
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000228# - "check": build all targets and run all tests
229# - "<arch>.clean" for any <arch> in ARCHES
230# - "clean": clean all ARCHES
231
232# ----------------- internal stuff ------------------------
233
234# Architectures and modes to be compiled. Consider these to be internal
235# variables, don't override them (use the targets instead).
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000236ARCHES = ia32 x64 x32 arm arm64 mips mipsel mips64el x87
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100237DEFAULT_ARCHES = ia32 x64 arm
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000238MODES = release debug optdebug
239DEFAULT_MODES = release debug
240ANDROID_ARCHES = android_ia32 android_arm android_arm64 android_mipsel android_x87
241NACL_ARCHES = nacl_ia32 nacl_x64
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000242
243# List of files that trigger Makefile regeneration:
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000244GYPFILES = build/all.gyp build/features.gypi build/standalone.gypi \
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400245 build/toolchain.gypi samples/samples.gyp src/d8.gyp \
246 test/cctest/cctest.gyp test/unittests/unittests.gyp tools/gyp/v8.gyp
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000247
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000248# If vtunejit=on, the v8vtune.gyp will be appended.
249ifeq ($(vtunejit), on)
250 GYPFILES += src/third_party/vtune/v8vtune.gyp
251endif
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000252# Generates all combinations of ARCHES and MODES, e.g. "ia32.release".
253BUILDS = $(foreach mode,$(MODES),$(addsuffix .$(mode),$(ARCHES)))
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000254ANDROID_BUILDS = $(foreach mode,$(MODES), \
255 $(addsuffix .$(mode),$(ANDROID_ARCHES)))
256NACL_BUILDS = $(foreach mode,$(MODES), \
257 $(addsuffix .$(mode),$(NACL_ARCHES)))
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000258# Generates corresponding test targets, e.g. "ia32.release.check".
259CHECKS = $(addsuffix .check,$(BUILDS))
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000260QUICKCHECKS = $(addsuffix .quickcheck,$(BUILDS))
261ANDROID_CHECKS = $(addsuffix .check,$(ANDROID_BUILDS))
262NACL_CHECKS = $(addsuffix .check,$(NACL_BUILDS))
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000263# File where previously used GYPFLAGS are stored.
264ENVFILE = $(OUTDIR)/environment
265
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000266.PHONY: all check clean builddeps dependencies $(ENVFILE).new native \
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400267 qc quickcheck $(QUICKCHECKS) turbocheck \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000268 $(addsuffix .quickcheck,$(MODES)) $(addsuffix .quickcheck,$(ARCHES)) \
Ben Murdoch589d6972011-11-30 16:04:58 +0000269 $(ARCHES) $(MODES) $(BUILDS) $(CHECKS) $(addsuffix .clean,$(ARCHES)) \
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100270 $(addsuffix .check,$(MODES)) $(addsuffix .check,$(ARCHES)) \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000271 $(ANDROID_ARCHES) $(ANDROID_BUILDS) $(ANDROID_CHECKS) \
272 must-set-ANDROID_NDK_ROOT_OR_TOOLCHAIN \
273 $(NACL_ARCHES) $(NACL_BUILDS) $(NACL_CHECKS) \
274 must-set-NACL_SDK_ROOT
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000275
276# Target definitions. "all" is the default.
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000277all: $(DEFAULT_MODES)
278
279# Special target for the buildbots to use. Depends on $(OUTDIR)/Makefile
280# having been created before.
281buildbot:
282 $(MAKE) -C "$(OUTDIR)" BUILDTYPE=$(BUILDTYPE) \
283 builddir="$(abspath $(OUTDIR))/$(BUILDTYPE)"
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000284
285# Compile targets. MODES and ARCHES are convenience targets.
286.SECONDEXPANSION:
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100287$(MODES): $(addsuffix .$$@,$(DEFAULT_ARCHES))
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000288
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000289$(ARCHES): $(addprefix $$@.,$(DEFAULT_MODES))
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000290
291# Defines how to build a particular target (e.g. ia32.release).
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000292$(BUILDS): $(OUTDIR)/Makefile.$$@
293 @$(MAKE) -C "$(OUTDIR)" -f Makefile.$@ \
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000294 CXX="$(CXX)" LINK="$(LINK)" \
295 BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000296 python -c "print \
297 raw_input().replace('opt', '').capitalize()") \
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000298 builddir="$(shell pwd)/$(OUTDIR)/$@"
299
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000300native: $(OUTDIR)/Makefile.native
301 @$(MAKE) -C "$(OUTDIR)" -f Makefile.native \
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100302 CXX="$(CXX)" LINK="$(LINK)" BUILDTYPE=Release \
303 builddir="$(shell pwd)/$(OUTDIR)/$@"
304
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000305$(ANDROID_ARCHES): $(addprefix $$@.,$(MODES))
306
307$(ANDROID_BUILDS): $(GYPFILES) $(ENVFILE) build/android.gypi \
308 must-set-ANDROID_NDK_ROOT_OR_TOOLCHAIN Makefile.android
309 @$(MAKE) -f Makefile.android $@ \
310 ARCH="$(basename $@)" \
311 MODE="$(subst .,,$(suffix $@))" \
312 OUTDIR="$(OUTDIR)" \
313 GYPFLAGS="$(GYPFLAGS)"
314
315$(NACL_ARCHES): $(addprefix $$@.,$(MODES))
316
317$(NACL_BUILDS): $(GYPFILES) $(ENVFILE) \
318 Makefile.nacl must-set-NACL_SDK_ROOT
319 @$(MAKE) -f Makefile.nacl $@ \
320 ARCH="$(basename $@)" \
321 MODE="$(subst .,,$(suffix $@))" \
322 OUTDIR="$(OUTDIR)" \
323 GYPFLAGS="$(GYPFLAGS)"
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100324
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000325# Test targets.
326check: all
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000327 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100328 --arch=$(shell echo $(DEFAULT_ARCHES) | sed -e 's/ /,/g') \
329 $(TESTFLAGS)
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000330
331$(addsuffix .check,$(MODES)): $$(basename $$@)
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000332 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100333 --mode=$(basename $@) $(TESTFLAGS)
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000334
335$(addsuffix .check,$(ARCHES)): $$(basename $$@)
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000336 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100337 --arch=$(basename $@) $(TESTFLAGS)
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000338
339$(CHECKS): $$(basename $$@)
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000340 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100341 --arch-and-mode=$(basename $@) $(TESTFLAGS)
342
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000343$(addsuffix .quickcheck,$(MODES)): $$(basename $$@)
344 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
345 --mode=$(basename $@) $(TESTFLAGS) --quickcheck
346
347$(addsuffix .quickcheck,$(ARCHES)): $$(basename $$@)
348 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
349 --arch=$(basename $@) $(TESTFLAGS) --quickcheck
350
351$(QUICKCHECKS): $$(basename $$@)
352 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
353 --arch-and-mode=$(basename $@) $(TESTFLAGS) --quickcheck
354
355$(addsuffix .sync, $(ANDROID_BUILDS)): $$(basename $$@)
356 @tools/android-sync.sh $(basename $@) $(OUTDIR) \
357 $(shell pwd) $(ANDROID_V8)
358
359$(addsuffix .check, $(ANDROID_BUILDS)): $$(basename $$@).sync
360 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
361 --arch-and-mode=$(basename $@) \
362 --timeout=600 \
363 --command-prefix="tools/android-run.py" $(TESTFLAGS)
364
365$(addsuffix .check, $(ANDROID_ARCHES)): \
366 $(addprefix $$(basename $$@).,$(MODES)).check
367
368$(addsuffix .check, $(NACL_BUILDS)): $$(basename $$@)
369 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
370 --arch-and-mode=$(basename $@) \
371 --timeout=600 --nopresubmit --noi18n \
372 --command-prefix="tools/nacl-run.py"
373
374$(addsuffix .check, $(NACL_ARCHES)): \
375 $(addprefix $$(basename $$@).,$(MODES)).check
376
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100377native.check: native
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000378 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR)/native \
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100379 --arch-and-mode=. $(TESTFLAGS)
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000380
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000381SUPERFASTTESTMODES = ia32.release
382FASTTESTMODES = $(SUPERFASTTESTMODES),x64.release,ia32.optdebug,x64.optdebug,arm.optdebug,arm64.release
383FASTCOMPILEMODES = $(FASTTESTMODES),arm64.optdebug
384
385COMMA = ,
386EMPTY =
387SPACE = $(EMPTY) $(EMPTY)
388quickcheck: $(subst $(COMMA),$(SPACE),$(FASTCOMPILEMODES))
389 tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
390 --arch-and-mode=$(SUPERFASTTESTMODES) $(TESTFLAGS) --quickcheck \
391 --download-data mozilla webkit
392 tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
393 --arch-and-mode=$(FASTTESTMODES) $(TESTFLAGS) --quickcheck
394qc: quickcheck
395
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400396turbocheck: $(subst $(COMMA),$(SPACE),$(FASTCOMPILEMODES))
397 tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
398 --arch-and-mode=$(SUPERFASTTESTMODES) $(TESTFLAGS) \
399 --quickcheck --variants=turbofan --download-data mozilla webkit
400 tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
401 --arch-and-mode=$(FASTTESTMODES) $(TESTFLAGS) \
402 --quickcheck --variants=turbofan
403tc: turbocheck
404
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000405# Clean targets. You can clean each architecture individually, or everything.
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000406$(addsuffix .clean, $(ARCHES) $(ANDROID_ARCHES) $(NACL_ARCHES)):
407 rm -f $(OUTDIR)/Makefile.$(basename $@)*
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000408 rm -rf $(OUTDIR)/$(basename $@).release
409 rm -rf $(OUTDIR)/$(basename $@).debug
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000410 rm -rf $(OUTDIR)/$(basename $@).optdebug
411 find $(OUTDIR) -regex '.*\(host\|target\)\.$(basename $@).*\.mk' -delete
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000412
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100413native.clean:
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000414 rm -f $(OUTDIR)/Makefile.native
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100415 rm -rf $(OUTDIR)/native
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000416 find $(OUTDIR) -regex '.*\(host\|target\)\.native\.mk' -delete
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100417
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000418clean: $(addsuffix .clean, $(ARCHES) $(ANDROID_ARCHES) $(NACL_ARCHES)) native.clean gtags.clean
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000419
420# GYP file generation targets.
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000421OUT_MAKEFILES = $(addprefix $(OUTDIR)/Makefile.,$(BUILDS))
422$(OUT_MAKEFILES): $(GYPFILES) $(ENVFILE)
423 $(eval CXX_TARGET_ARCH:=$(shell $(CXX) -v 2>&1 | grep ^Target: | \
424 cut -f 2 -d " " | cut -f 1 -d "-" ))
425 $(eval CXX_TARGET_ARCH:=$(subst aarch64,arm64,$(CXX_TARGET_ARCH)))
426 $(eval V8_TARGET_ARCH:=$(subst .,,$(suffix $(basename $@))))
427 PYTHONPATH="$(shell pwd)/tools/generate_shim_headers:$(shell pwd)/build:$(PYTHONPATH):$(shell pwd)/build/gyp/pylib:$(PYTHONPATH)" \
428 GYP_GENERATORS=make \
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000429 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000430 -Ibuild/standalone.gypi --depth=. \
431 -Dv8_target_arch=$(V8_TARGET_ARCH) \
432 $(if $(findstring $(CXX_TARGET_ARCH),$(V8_TARGET_ARCH)), \
433 -Dtarget_arch=$(V8_TARGET_ARCH),) \
434 $(if $(findstring optdebug,$@),-Dv8_optimized_debug=2,) \
435 -S$(suffix $(basename $@))$(suffix $@) $(GYPFLAGS)
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000436
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000437$(OUTDIR)/Makefile.native: $(GYPFILES) $(ENVFILE)
438 PYTHONPATH="$(shell pwd)/tools/generate_shim_headers:$(shell pwd)/build:$(PYTHONPATH):$(shell pwd)/build/gyp/pylib:$(PYTHONPATH)" \
439 GYP_GENERATORS=make \
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000440 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000441 -Ibuild/standalone.gypi --depth=. -S.native $(GYPFLAGS)
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000442
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000443must-set-ANDROID_NDK_ROOT_OR_TOOLCHAIN:
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100444ifndef ANDROID_NDK_ROOT
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000445ifndef ANDROID_TOOLCHAIN
446 $(error ANDROID_NDK_ROOT or ANDROID_TOOLCHAIN must be set))
447endif
448endif
449
450# Note that NACL_SDK_ROOT must be set to point to an appropriate
451# Native Client SDK before using this makefile. You can download
452# an SDK here:
453# https://developers.google.com/native-client/sdk/download
454# The path indicated by NACL_SDK_ROOT will typically end with
455# a folder for a pepper version such as "pepper_25" that should
456# have "tools" and "toolchain" subdirectories.
457must-set-NACL_SDK_ROOT:
458ifndef NACL_SDK_ROOT
459 $(error NACL_SDK_ROOT must be set)
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100460endif
461
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000462# Replaces the old with the new environment file if they're different, which
463# will trigger GYP to regenerate Makefiles.
464$(ENVFILE): $(ENVFILE).new
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000465 @if test -r $(ENVFILE) && cmp $(ENVFILE).new $(ENVFILE) > /dev/null; \
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000466 then rm $(ENVFILE).new; \
467 else mv $(ENVFILE).new $(ENVFILE); fi
468
469# Stores current GYPFLAGS in a file.
470$(ENVFILE).new:
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000471 @mkdir -p $(OUTDIR); echo "GYPFLAGS=$(GYPFLAGS)" > $(ENVFILE).new; \
472 echo "CXX=$(CXX)" >> $(ENVFILE).new
Ben Murdoch589d6972011-11-30 16:04:58 +0000473
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000474# Heap constants for grokdump.
475DUMP_FILE = tools/v8heapconst.py
476grokdump: ia32.release
477 @cat $(DUMP_FILE).tmpl > $(DUMP_FILE)
478 @$(OUTDIR)/ia32.release/d8 --dump-heap-constants >> $(DUMP_FILE)
479
480# Support for the GNU GLOBAL Source Code Tag System.
481gtags.files: $(GYPFILES) $(ENVFILE)
482 @find include src test -name '*.h' -o -name '*.cc' -o -name '*.c' > $@
483
484# We need to manually set the stack limit here, to work around bugs in
485# gmake-3.81 and global-5.7.1 on recent 64-bit Linux systems.
486GPATH GRTAGS GSYMS GTAGS: gtags.files $(shell cat gtags.files 2> /dev/null)
487 @bash -c 'ulimit -s 10240 && GTAGSFORCECPP=yes gtags -i -q -f $<'
488
489gtags.clean:
490 rm -f gtags.files GPATH GRTAGS GSYMS GTAGS
491
492# Dependencies. "builddeps" are dependencies required solely for building,
493# "dependencies" includes also dependencies required for development.
494# Remember to keep these in sync with the DEPS file.
495builddeps:
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400496 svn checkout --force https://gyp.googlecode.com/svn/trunk build/gyp \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000497 --revision 1831
498 if svn info third_party/icu 2>&1 | grep -q icu46 ; then \
499 svn switch --force \
500 https://src.chromium.org/chrome/trunk/deps/third_party/icu52 \
501 third_party/icu --revision 277999 ; \
502 else \
503 svn checkout --force \
504 https://src.chromium.org/chrome/trunk/deps/third_party/icu52 \
505 third_party/icu --revision 277999 ; \
506 fi
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400507 svn checkout --force https://googletest.googlecode.com/svn/trunk \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000508 testing/gtest --revision 692
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400509 svn checkout --force https://googlemock.googlecode.com/svn/trunk \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000510 testing/gmock --revision 485
511
512dependencies: builddeps
513 # The spec is a copy of the hooks in v8's DEPS file.
514 gclient sync -r fb782d4369d5ae04f17a2fceef7de5a63e50f07b --spec="solutions = [{u'managed': False, u'name': u'buildtools', u'url': u'https://chromium.googlesource.com/chromium/buildtools.git', u'custom_deps': {}, u'custom_hooks': [{u'name': u'clang_format_win',u'pattern': u'.',u'action': [u'download_from_google_storage',u'--no_resume',u'--platform=win32',u'--no_auth',u'--bucket',u'chromium-clang-format',u'-s',u'buildtools/win/clang-format.exe.sha1']},{u'name': u'clang_format_mac',u'pattern': u'.',u'action': [u'download_from_google_storage',u'--no_resume',u'--platform=darwin',u'--no_auth',u'--bucket',u'chromium-clang-format',u'-s',u'buildtools/mac/clang-format.sha1']},{u'name': u'clang_format_linux',u'pattern': u'.',u'action': [u'download_from_google_storage',u'--no_resume',u'--platform=linux*',u'--no_auth',u'--bucket',u'chromium-clang-format',u'-s',u'buildtools/linux64/clang-format.sha1']}],u'deps_file': u'.DEPS.git', u'safesync_url': u''}]"