blob: 4fb6ee0162275f88737145bdff58d20d3e3f1cf4 [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 Murdoch69a99ed2011-11-30 16:03:39 +000030OUTDIR ?= out
Ben Murdochb8a8cc12014-11-26 15:28:44 +000031TESTJOBS ?=
Ben Murdoch69a99ed2011-11-30 16:03:39 +000032GYPFLAGS ?=
Ben Murdoch3ef787d2012-04-12 10:51:47 +010033TESTFLAGS ?=
Ben Murdochb8a8cc12014-11-26 15:28:44 +000034ANDROID_NDK_HOST_ARCH ?=
Ben Murdochb8a8cc12014-11-26 15:28:44 +000035ANDROID_V8 ?= /data/local/tmp/v8
36NACL_SDK_ROOT ?=
Ben Murdoch69a99ed2011-11-30 16:03:39 +000037
38# Special build flags. Use them like this: "make library=shared"
39
40# library=shared || component=shared_library
41ifeq ($(library), shared)
42 GYPFLAGS += -Dcomponent=shared_library
43endif
44ifdef component
45 GYPFLAGS += -Dcomponent=$(component)
46endif
Ben Murdoch69a99ed2011-11-30 16:03:39 +000047# disassembler=on
48ifeq ($(disassembler), on)
49 GYPFLAGS += -Dv8_enable_disassembler=1
50endif
Ben Murdoch3ef787d2012-04-12 10:51:47 +010051# objectprint=on
52ifeq ($(objectprint), on)
53 GYPFLAGS += -Dv8_object_print=1
54endif
Ben Murdochb8a8cc12014-11-26 15:28:44 +000055# verifyheap=on
56ifeq ($(verifyheap), on)
57 GYPFLAGS += -Dv8_enable_verify_heap=1
58endif
Emily Bernierd0a1eb72015-03-24 16:35:39 -040059# tracemaps=on
60ifeq ($(tracemaps), on)
61 GYPFLAGS += -Dv8_trace_maps=1
62endif
Ben Murdochb8a8cc12014-11-26 15:28:44 +000063# backtrace=off
64ifeq ($(backtrace), off)
65 GYPFLAGS += -Dv8_enable_backtrace=0
66else
67 GYPFLAGS += -Dv8_enable_backtrace=1
68endif
69# verifypredictable=on
70ifeq ($(verifypredictable), on)
71 GYPFLAGS += -Dv8_enable_verify_predictable=1
72endif
Ben Murdoch69a99ed2011-11-30 16:03:39 +000073# snapshot=off
74ifeq ($(snapshot), off)
75 GYPFLAGS += -Dv8_use_snapshot='false'
76endif
Emily Bernierd0a1eb72015-03-24 16:35:39 -040077ifeq ($(snapshot), external)
78 GYPFLAGS += -Dv8_use_external_startup_data=1
79endif
Ben Murdochb8a8cc12014-11-26 15:28:44 +000080# extrachecks=on/off
81ifeq ($(extrachecks), on)
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000082 GYPFLAGS += -Ddcheck_always_on=1 -Dv8_enable_handle_zapping=1
Ben Murdochb8a8cc12014-11-26 15:28:44 +000083endif
84ifeq ($(extrachecks), off)
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000085 GYPFLAGS += -Ddcheck_always_on=0 -Dv8_enable_handle_zapping=0
86endif
87# slowdchecks=on/off
88ifeq ($(slowdchecks), on)
89 GYPFLAGS += -Dv8_enable_slow_dchecks=1
90endif
91ifeq ($(slowdchecks), off)
92 GYPFLAGS += -Dv8_enable_slow_dchecks=0
93endif
94# debugsymbols=on
95ifeq ($(debugsymbols), on)
96 GYPFLAGS += -Drelease_extra_cflags=-ggdb3
Ben Murdochb8a8cc12014-11-26 15:28:44 +000097endif
98# gdbjit=on/off
Ben Murdoch69a99ed2011-11-30 16:03:39 +000099ifeq ($(gdbjit), on)
100 GYPFLAGS += -Dv8_enable_gdbjit=1
101endif
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000102ifeq ($(gdbjit), off)
103 GYPFLAGS += -Dv8_enable_gdbjit=0
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000104endif
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000105# vtunejit=on
106ifeq ($(vtunejit), on)
107 GYPFLAGS += -Dv8_enable_vtunejit=1
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000108endif
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000109# unalignedaccess=on
110ifeq ($(unalignedaccess), on)
111 GYPFLAGS += -Dv8_can_use_unaligned_accesses=true
112endif
113# randomseed=12345, disable random seed via randomseed=0
114ifdef randomseed
115 GYPFLAGS += -Dv8_random_seed=$(randomseed)
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100116endif
Ben Murdoch589d6972011-11-30 16:04:58 +0000117# soname_version=1.2.3
118ifdef soname_version
119 GYPFLAGS += -Dsoname_version=$(soname_version)
120endif
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100121# werror=no
122ifeq ($(werror), no)
123 GYPFLAGS += -Dwerror=''
124endif
125# presubmit=no
126ifeq ($(presubmit), no)
127 TESTFLAGS += --no-presubmit
128endif
129# strictaliasing=off (workaround for GCC-4.5)
130ifeq ($(strictaliasing), off)
131 GYPFLAGS += -Dv8_no_strict_aliasing=1
132endif
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000133# regexp=interpreted
134ifeq ($(regexp), interpreted)
135 GYPFLAGS += -Dv8_interpreted_regexp=1
136endif
137# i18nsupport=off
138ifeq ($(i18nsupport), off)
139 GYPFLAGS += -Dv8_enable_i18n_support=0
140 TESTFLAGS += --noi18n
141endif
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000142# deprecationwarnings=on
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000143ifeq ($(deprecationwarnings), on)
144 GYPFLAGS += -Dv8_deprecation_warnings=1
145endif
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000146# vectorstores=on
147ifeq ($(vectorstores), on)
148 GYPFLAGS += -Dv8_vector_stores=1
149endif
150# imminentdeprecationwarnings=on
151ifeq ($(imminentdeprecationwarnings), on)
152 GYPFLAGS += -Dv8_imminent_deprecation_warnings=1
153endif
154# asan=on
155ifeq ($(asan), on)
156 GYPFLAGS += -Dasan=1 -Dclang=1
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400157 TESTFLAGS += --asan
158 ifeq ($(lsan), on)
159 GYPFLAGS += -Dlsan=1
160 endif
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000161endif
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000162ifdef embedscript
163 GYPFLAGS += -Dembed_script=$(embedscript)
164endif
165ifeq ($(goma), on)
166 GYPFLAGS += -Duse_goma=1
167endif
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000168# arm specific flags.
169# arm_version=<number | "default">
170ifneq ($(strip $(arm_version)),)
171 GYPFLAGS += -Darm_version=$(arm_version)
172else
173# Deprecated (use arm_version instead): armv7=false/true
174ifeq ($(armv7), false)
175 GYPFLAGS += -Darm_version=6
176else
177ifeq ($(armv7), true)
178 GYPFLAGS += -Darm_version=7
179endif
180endif
181endif
182# hardfp=on/off. Deprecated, use armfloatabi
183ifeq ($(hardfp),on)
184 GYPFLAGS += -Darm_float_abi=hard
185else
186ifeq ($(hardfp),off)
187 GYPFLAGS += -Darm_float_abi=softfp
188endif
189endif
190# fpu: armfpu=xxx
191# xxx: vfp, vfpv3-d16, vfpv3, neon.
192ifeq ($(armfpu),)
193 GYPFLAGS += -Darm_fpu=default
194else
195 GYPFLAGS += -Darm_fpu=$(armfpu)
196endif
197# float abi: armfloatabi=softfp/hard
198ifeq ($(armfloatabi),)
199ifeq ($(hardfp),)
200 GYPFLAGS += -Darm_float_abi=default
201endif
202else
203 GYPFLAGS += -Darm_float_abi=$(armfloatabi)
204endif
205# armthumb=on/off
206ifeq ($(armthumb), off)
207 GYPFLAGS += -Darm_thumb=0
208else
209ifeq ($(armthumb), on)
210 GYPFLAGS += -Darm_thumb=1
211endif
212endif
213# arm_test_noprobe=on
214# With this flag set, by default v8 will only use features implied
215# by the compiler (no probe). This is done by modifying the default
216# values of enable_armv7, enable_vfp3, enable_32dregs and enable_neon.
217# Modifying these flags when launching v8 will enable the probing for
218# the specified values.
219ifeq ($(arm_test_noprobe), on)
220 GYPFLAGS += -Darm_test_noprobe=on
221endif
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000222
223# ----------------- available targets: --------------------
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000224# - "grokdump": rebuilds heap constants lists used by grokdump
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000225# - any arch listed in ARCHES (see below)
226# - any mode listed in MODES
227# - every combination <arch>.<mode>, e.g. "ia32.release"
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100228# - "native": current host's architecture, release mode
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000229# - any of the above with .check appended, e.g. "ia32.release.check"
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000230# - "android": cross-compile for Android/ARM
231# - "nacl" : cross-compile for Native Client (ia32 and x64)
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100232# - default (no target specified): build all DEFAULT_ARCHES and MODES
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000233# - "check": build all targets and run all tests
234# - "<arch>.clean" for any <arch> in ARCHES
235# - "clean": clean all ARCHES
236
237# ----------------- internal stuff ------------------------
238
239# Architectures and modes to be compiled. Consider these to be internal
240# variables, don't override them (use the targets instead).
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000241ARCHES = ia32 x64 x32 arm arm64 mips mipsel mips64 mips64el x87 ppc ppc64 \
242 s390 s390x
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100243DEFAULT_ARCHES = ia32 x64 arm
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000244MODES = release debug optdebug
245DEFAULT_MODES = release debug
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000246ANDROID_ARCHES = android_ia32 android_x64 android_arm android_arm64 \
247 android_mipsel android_x87
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000248NACL_ARCHES = nacl_ia32 nacl_x64
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000249
250# List of files that trigger Makefile regeneration:
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000251GYPFILES = third_party/icu/icu.gypi third_party/icu/icu.gyp \
252 build/shim_headers.gypi build/features.gypi build/standalone.gypi \
253 build/toolchain.gypi build/all.gyp build/mac/asan.gyp \
Ben Murdoch097c5b22016-05-18 11:27:45 +0100254 test/cctest/cctest.gyp test/fuzzer/fuzzer.gyp \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000255 test/unittests/unittests.gyp tools/gyp/v8.gyp \
256 tools/parser-shell.gyp testing/gmock.gyp testing/gtest.gyp \
257 buildtools/third_party/libc++abi/libc++abi.gyp \
258 buildtools/third_party/libc++/libc++.gyp samples/samples.gyp \
259 src/third_party/vtune/v8vtune.gyp src/d8.gyp
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000260
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000261# If vtunejit=on, the v8vtune.gyp will be appended.
262ifeq ($(vtunejit), on)
263 GYPFILES += src/third_party/vtune/v8vtune.gyp
264endif
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000265# Generates all combinations of ARCHES and MODES, e.g. "ia32.release".
266BUILDS = $(foreach mode,$(MODES),$(addsuffix .$(mode),$(ARCHES)))
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000267ANDROID_BUILDS = $(foreach mode,$(MODES), \
268 $(addsuffix .$(mode),$(ANDROID_ARCHES)))
269NACL_BUILDS = $(foreach mode,$(MODES), \
270 $(addsuffix .$(mode),$(NACL_ARCHES)))
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000271# Generates corresponding test targets, e.g. "ia32.release.check".
272CHECKS = $(addsuffix .check,$(BUILDS))
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000273QUICKCHECKS = $(addsuffix .quickcheck,$(BUILDS))
274ANDROID_CHECKS = $(addsuffix .check,$(ANDROID_BUILDS))
275NACL_CHECKS = $(addsuffix .check,$(NACL_BUILDS))
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000276# File where previously used GYPFLAGS are stored.
277ENVFILE = $(OUTDIR)/environment
278
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000279.PHONY: all check clean builddeps dependencies $(ENVFILE).new native \
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400280 qc quickcheck $(QUICKCHECKS) turbocheck \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000281 $(addsuffix .quickcheck,$(MODES)) $(addsuffix .quickcheck,$(ARCHES)) \
Ben Murdoch589d6972011-11-30 16:04:58 +0000282 $(ARCHES) $(MODES) $(BUILDS) $(CHECKS) $(addsuffix .clean,$(ARCHES)) \
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100283 $(addsuffix .check,$(MODES)) $(addsuffix .check,$(ARCHES)) \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000284 $(ANDROID_ARCHES) $(ANDROID_BUILDS) $(ANDROID_CHECKS) \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000285 $(NACL_ARCHES) $(NACL_BUILDS) $(NACL_CHECKS) \
286 must-set-NACL_SDK_ROOT
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000287
288# Target definitions. "all" is the default.
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000289all: $(DEFAULT_MODES)
290
291# Special target for the buildbots to use. Depends on $(OUTDIR)/Makefile
292# having been created before.
293buildbot:
294 $(MAKE) -C "$(OUTDIR)" BUILDTYPE=$(BUILDTYPE) \
295 builddir="$(abspath $(OUTDIR))/$(BUILDTYPE)"
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000296
297# Compile targets. MODES and ARCHES are convenience targets.
298.SECONDEXPANSION:
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100299$(MODES): $(addsuffix .$$@,$(DEFAULT_ARCHES))
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000300
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000301$(ARCHES): $(addprefix $$@.,$(DEFAULT_MODES))
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000302
303# Defines how to build a particular target (e.g. ia32.release).
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000304$(BUILDS): $(OUTDIR)/Makefile.$$@
305 @$(MAKE) -C "$(OUTDIR)" -f Makefile.$@ \
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000306 BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000307 python -c "print \
308 raw_input().replace('opt', '').capitalize()") \
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000309 builddir="$(shell pwd)/$(OUTDIR)/$@"
310
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000311native: $(OUTDIR)/Makefile.native
312 @$(MAKE) -C "$(OUTDIR)" -f Makefile.native \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000313 BUILDTYPE=Release \
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100314 builddir="$(shell pwd)/$(OUTDIR)/$@"
315
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000316$(ANDROID_ARCHES): $(addprefix $$@.,$(MODES))
317
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000318$(ANDROID_BUILDS): $(GYPFILES) $(ENVFILE) Makefile.android
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000319 @$(MAKE) -f Makefile.android $@ \
320 ARCH="$(basename $@)" \
321 MODE="$(subst .,,$(suffix $@))" \
322 OUTDIR="$(OUTDIR)" \
323 GYPFLAGS="$(GYPFLAGS)"
324
325$(NACL_ARCHES): $(addprefix $$@.,$(MODES))
326
327$(NACL_BUILDS): $(GYPFILES) $(ENVFILE) \
328 Makefile.nacl must-set-NACL_SDK_ROOT
329 @$(MAKE) -f Makefile.nacl $@ \
330 ARCH="$(basename $@)" \
331 MODE="$(subst .,,$(suffix $@))" \
332 OUTDIR="$(OUTDIR)" \
333 GYPFLAGS="$(GYPFLAGS)"
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100334
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000335# Test targets.
336check: all
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000337 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100338 --arch=$(shell echo $(DEFAULT_ARCHES) | sed -e 's/ /,/g') \
339 $(TESTFLAGS)
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000340
341$(addsuffix .check,$(MODES)): $$(basename $$@)
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000342 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100343 --mode=$(basename $@) $(TESTFLAGS)
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000344
345$(addsuffix .check,$(ARCHES)): $$(basename $$@)
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000346 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100347 --arch=$(basename $@) $(TESTFLAGS)
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000348
349$(CHECKS): $$(basename $$@)
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000350 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100351 --arch-and-mode=$(basename $@) $(TESTFLAGS)
352
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000353$(addsuffix .quickcheck,$(MODES)): $$(basename $$@)
354 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
355 --mode=$(basename $@) $(TESTFLAGS) --quickcheck
356
357$(addsuffix .quickcheck,$(ARCHES)): $$(basename $$@)
358 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
359 --arch=$(basename $@) $(TESTFLAGS) --quickcheck
360
361$(QUICKCHECKS): $$(basename $$@)
362 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
363 --arch-and-mode=$(basename $@) $(TESTFLAGS) --quickcheck
364
365$(addsuffix .sync, $(ANDROID_BUILDS)): $$(basename $$@)
366 @tools/android-sync.sh $(basename $@) $(OUTDIR) \
367 $(shell pwd) $(ANDROID_V8)
368
369$(addsuffix .check, $(ANDROID_BUILDS)): $$(basename $$@).sync
370 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
371 --arch-and-mode=$(basename $@) \
372 --timeout=600 \
373 --command-prefix="tools/android-run.py" $(TESTFLAGS)
374
375$(addsuffix .check, $(ANDROID_ARCHES)): \
376 $(addprefix $$(basename $$@).,$(MODES)).check
377
378$(addsuffix .check, $(NACL_BUILDS)): $$(basename $$@)
379 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
380 --arch-and-mode=$(basename $@) \
381 --timeout=600 --nopresubmit --noi18n \
382 --command-prefix="tools/nacl-run.py"
383
384$(addsuffix .check, $(NACL_ARCHES)): \
385 $(addprefix $$(basename $$@).,$(MODES)).check
386
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100387native.check: native
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000388 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR)/native \
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100389 --arch-and-mode=. $(TESTFLAGS)
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000390
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000391SUPERFASTTESTMODES = ia32.release
392FASTTESTMODES = $(SUPERFASTTESTMODES),x64.release,ia32.optdebug,x64.optdebug,arm.optdebug,arm64.release
393FASTCOMPILEMODES = $(FASTTESTMODES),arm64.optdebug
394
395COMMA = ,
396EMPTY =
397SPACE = $(EMPTY) $(EMPTY)
398quickcheck: $(subst $(COMMA),$(SPACE),$(FASTCOMPILEMODES))
399 tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
400 --arch-and-mode=$(SUPERFASTTESTMODES) $(TESTFLAGS) --quickcheck \
401 --download-data mozilla webkit
402 tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
403 --arch-and-mode=$(FASTTESTMODES) $(TESTFLAGS) --quickcheck
404qc: quickcheck
405
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400406turbocheck: $(subst $(COMMA),$(SPACE),$(FASTCOMPILEMODES))
407 tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
408 --arch-and-mode=$(SUPERFASTTESTMODES) $(TESTFLAGS) \
409 --quickcheck --variants=turbofan --download-data mozilla webkit
410 tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
411 --arch-and-mode=$(FASTTESTMODES) $(TESTFLAGS) \
412 --quickcheck --variants=turbofan
413tc: turbocheck
414
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000415# Clean targets. You can clean each architecture individually, or everything.
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000416$(addsuffix .clean, $(ARCHES) $(ANDROID_ARCHES) $(NACL_ARCHES)):
417 rm -f $(OUTDIR)/Makefile.$(basename $@)*
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000418 rm -rf $(OUTDIR)/$(basename $@).release
419 rm -rf $(OUTDIR)/$(basename $@).debug
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000420 rm -rf $(OUTDIR)/$(basename $@).optdebug
421 find $(OUTDIR) -regex '.*\(host\|target\)\.$(basename $@).*\.mk' -delete
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000422
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100423native.clean:
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000424 rm -f $(OUTDIR)/Makefile.native
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100425 rm -rf $(OUTDIR)/native
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000426 find $(OUTDIR) -regex '.*\(host\|target\)\.native\.mk' -delete
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100427
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000428clean: $(addsuffix .clean, $(ARCHES) $(ANDROID_ARCHES) $(NACL_ARCHES)) native.clean gtags.clean
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000429
430# GYP file generation targets.
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000431OUT_MAKEFILES = $(addprefix $(OUTDIR)/Makefile.,$(BUILDS))
432$(OUT_MAKEFILES): $(GYPFILES) $(ENVFILE)
433 $(eval CXX_TARGET_ARCH:=$(shell $(CXX) -v 2>&1 | grep ^Target: | \
434 cut -f 2 -d " " | cut -f 1 -d "-" ))
435 $(eval CXX_TARGET_ARCH:=$(subst aarch64,arm64,$(CXX_TARGET_ARCH)))
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000436 $(eval CXX_TARGET_ARCH:=$(subst x86_64,x64,$(CXX_TARGET_ARCH)))
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000437 $(eval V8_TARGET_ARCH:=$(subst .,,$(suffix $(basename $@))))
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=. \
442 -Dv8_target_arch=$(V8_TARGET_ARCH) \
443 $(if $(findstring $(CXX_TARGET_ARCH),$(V8_TARGET_ARCH)), \
444 -Dtarget_arch=$(V8_TARGET_ARCH),) \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000445 $(if $(findstring optdebug,$@),-Dv8_optimized_debug=1,) \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000446 -S$(suffix $(basename $@))$(suffix $@) $(GYPFLAGS)
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000447
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000448$(OUTDIR)/Makefile.native: $(GYPFILES) $(ENVFILE)
449 PYTHONPATH="$(shell pwd)/tools/generate_shim_headers:$(shell pwd)/build:$(PYTHONPATH):$(shell pwd)/build/gyp/pylib:$(PYTHONPATH)" \
450 GYP_GENERATORS=make \
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000451 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000452 -Ibuild/standalone.gypi --depth=. -S.native $(GYPFLAGS)
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000453
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000454# Note that NACL_SDK_ROOT must be set to point to an appropriate
455# Native Client SDK before using this makefile. You can download
456# an SDK here:
457# https://developers.google.com/native-client/sdk/download
458# The path indicated by NACL_SDK_ROOT will typically end with
459# a folder for a pepper version such as "pepper_25" that should
460# have "tools" and "toolchain" subdirectories.
461must-set-NACL_SDK_ROOT:
462ifndef NACL_SDK_ROOT
463 $(error NACL_SDK_ROOT must be set)
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100464endif
465
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000466# Replaces the old with the new environment file if they're different, which
467# will trigger GYP to regenerate Makefiles.
468$(ENVFILE): $(ENVFILE).new
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000469 @if test -r $(ENVFILE) && cmp $(ENVFILE).new $(ENVFILE) > /dev/null; \
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000470 then rm $(ENVFILE).new; \
471 else mv $(ENVFILE).new $(ENVFILE); fi
472
473# Stores current GYPFLAGS in a file.
474$(ENVFILE).new:
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000475 $(eval CXX_TARGET_ARCH:=$(shell $(CXX) -v 2>&1 | grep ^Target: | \
476 cut -f 2 -d " " | cut -f 1 -d "-" ))
477 $(eval CXX_TARGET_ARCH:=$(subst aarch64,arm64,$(CXX_TARGET_ARCH)))
478 $(eval CXX_TARGET_ARCH:=$(subst x86_64,x64,$(CXX_TARGET_ARCH)))
479 @mkdir -p $(OUTDIR); echo "GYPFLAGS=$(GYPFLAGS) -Dtarget_arch=$(CXX_TARGET_ARCH)" > $(ENVFILE).new;
Ben Murdoch589d6972011-11-30 16:04:58 +0000480
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000481# Heap constants for grokdump.
482DUMP_FILE = tools/v8heapconst.py
483grokdump: ia32.release
484 @cat $(DUMP_FILE).tmpl > $(DUMP_FILE)
485 @$(OUTDIR)/ia32.release/d8 --dump-heap-constants >> $(DUMP_FILE)
486
487# Support for the GNU GLOBAL Source Code Tag System.
488gtags.files: $(GYPFILES) $(ENVFILE)
489 @find include src test -name '*.h' -o -name '*.cc' -o -name '*.c' > $@
490
491# We need to manually set the stack limit here, to work around bugs in
492# gmake-3.81 and global-5.7.1 on recent 64-bit Linux systems.
493GPATH GRTAGS GSYMS GTAGS: gtags.files $(shell cat gtags.files 2> /dev/null)
494 @bash -c 'ulimit -s 10240 && GTAGSFORCECPP=yes gtags -i -q -f $<'
495
496gtags.clean:
497 rm -f gtags.files GPATH GRTAGS GSYMS GTAGS
498
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000499dependencies builddeps:
500 $(error Use 'gclient sync' instead)