blob: a0c08a6d9634c7b5e7f5590f1e6905701f288fbf [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
Ben Murdochda12d292016-06-02 14:46:10 +0100165ifdef warmupscript
166 GYPFLAGS += -Dwarmup_script=$(warmupscript)
167endif
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000168ifeq ($(goma), on)
169 GYPFLAGS += -Duse_goma=1
170endif
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000171# arm specific flags.
172# arm_version=<number | "default">
173ifneq ($(strip $(arm_version)),)
174 GYPFLAGS += -Darm_version=$(arm_version)
175else
176# Deprecated (use arm_version instead): armv7=false/true
177ifeq ($(armv7), false)
178 GYPFLAGS += -Darm_version=6
179else
180ifeq ($(armv7), true)
181 GYPFLAGS += -Darm_version=7
182endif
183endif
184endif
185# hardfp=on/off. Deprecated, use armfloatabi
186ifeq ($(hardfp),on)
187 GYPFLAGS += -Darm_float_abi=hard
188else
189ifeq ($(hardfp),off)
190 GYPFLAGS += -Darm_float_abi=softfp
191endif
192endif
193# fpu: armfpu=xxx
194# xxx: vfp, vfpv3-d16, vfpv3, neon.
195ifeq ($(armfpu),)
196 GYPFLAGS += -Darm_fpu=default
197else
198 GYPFLAGS += -Darm_fpu=$(armfpu)
199endif
200# float abi: armfloatabi=softfp/hard
201ifeq ($(armfloatabi),)
202ifeq ($(hardfp),)
203 GYPFLAGS += -Darm_float_abi=default
204endif
205else
206 GYPFLAGS += -Darm_float_abi=$(armfloatabi)
207endif
208# armthumb=on/off
209ifeq ($(armthumb), off)
210 GYPFLAGS += -Darm_thumb=0
211else
212ifeq ($(armthumb), on)
213 GYPFLAGS += -Darm_thumb=1
214endif
215endif
216# arm_test_noprobe=on
217# With this flag set, by default v8 will only use features implied
218# by the compiler (no probe). This is done by modifying the default
219# values of enable_armv7, enable_vfp3, enable_32dregs and enable_neon.
220# Modifying these flags when launching v8 will enable the probing for
221# the specified values.
222ifeq ($(arm_test_noprobe), on)
223 GYPFLAGS += -Darm_test_noprobe=on
224endif
Ben Murdochda12d292016-06-02 14:46:10 +0100225# Do not omit the frame pointer, needed for profiling with perf
226ifeq ($(no_omit_framepointer), on)
227 GYPFLAGS += -Drelease_extra_cflags=-fno-omit-frame-pointer
228endif
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000229
230# ----------------- available targets: --------------------
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000231# - "grokdump": rebuilds heap constants lists used by grokdump
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000232# - any arch listed in ARCHES (see below)
233# - any mode listed in MODES
234# - every combination <arch>.<mode>, e.g. "ia32.release"
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100235# - "native": current host's architecture, release mode
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000236# - any of the above with .check appended, e.g. "ia32.release.check"
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000237# - "android": cross-compile for Android/ARM
238# - "nacl" : cross-compile for Native Client (ia32 and x64)
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100239# - default (no target specified): build all DEFAULT_ARCHES and MODES
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000240# - "check": build all targets and run all tests
241# - "<arch>.clean" for any <arch> in ARCHES
242# - "clean": clean all ARCHES
243
244# ----------------- internal stuff ------------------------
245
246# Architectures and modes to be compiled. Consider these to be internal
247# variables, don't override them (use the targets instead).
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000248ARCHES = ia32 x64 x32 arm arm64 mips mipsel mips64 mips64el x87 ppc ppc64 \
249 s390 s390x
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100250DEFAULT_ARCHES = ia32 x64 arm
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000251MODES = release debug optdebug
252DEFAULT_MODES = release debug
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000253ANDROID_ARCHES = android_ia32 android_x64 android_arm android_arm64 \
254 android_mipsel android_x87
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000255NACL_ARCHES = nacl_ia32 nacl_x64
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000256
257# List of files that trigger Makefile regeneration:
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000258GYPFILES = third_party/icu/icu.gypi third_party/icu/icu.gyp \
259 build/shim_headers.gypi build/features.gypi build/standalone.gypi \
260 build/toolchain.gypi build/all.gyp build/mac/asan.gyp \
Ben Murdoch097c5b22016-05-18 11:27:45 +0100261 test/cctest/cctest.gyp test/fuzzer/fuzzer.gyp \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000262 test/unittests/unittests.gyp tools/gyp/v8.gyp \
263 tools/parser-shell.gyp testing/gmock.gyp testing/gtest.gyp \
264 buildtools/third_party/libc++abi/libc++abi.gyp \
265 buildtools/third_party/libc++/libc++.gyp samples/samples.gyp \
266 src/third_party/vtune/v8vtune.gyp src/d8.gyp
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000267
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000268# If vtunejit=on, the v8vtune.gyp will be appended.
269ifeq ($(vtunejit), on)
270 GYPFILES += src/third_party/vtune/v8vtune.gyp
271endif
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000272# Generates all combinations of ARCHES and MODES, e.g. "ia32.release".
273BUILDS = $(foreach mode,$(MODES),$(addsuffix .$(mode),$(ARCHES)))
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000274ANDROID_BUILDS = $(foreach mode,$(MODES), \
275 $(addsuffix .$(mode),$(ANDROID_ARCHES)))
276NACL_BUILDS = $(foreach mode,$(MODES), \
277 $(addsuffix .$(mode),$(NACL_ARCHES)))
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000278# Generates corresponding test targets, e.g. "ia32.release.check".
279CHECKS = $(addsuffix .check,$(BUILDS))
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000280QUICKCHECKS = $(addsuffix .quickcheck,$(BUILDS))
281ANDROID_CHECKS = $(addsuffix .check,$(ANDROID_BUILDS))
282NACL_CHECKS = $(addsuffix .check,$(NACL_BUILDS))
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000283# File where previously used GYPFLAGS are stored.
284ENVFILE = $(OUTDIR)/environment
285
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000286.PHONY: all check clean builddeps dependencies $(ENVFILE).new native \
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400287 qc quickcheck $(QUICKCHECKS) turbocheck \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000288 $(addsuffix .quickcheck,$(MODES)) $(addsuffix .quickcheck,$(ARCHES)) \
Ben Murdoch589d6972011-11-30 16:04:58 +0000289 $(ARCHES) $(MODES) $(BUILDS) $(CHECKS) $(addsuffix .clean,$(ARCHES)) \
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100290 $(addsuffix .check,$(MODES)) $(addsuffix .check,$(ARCHES)) \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000291 $(ANDROID_ARCHES) $(ANDROID_BUILDS) $(ANDROID_CHECKS) \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000292 $(NACL_ARCHES) $(NACL_BUILDS) $(NACL_CHECKS) \
293 must-set-NACL_SDK_ROOT
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000294
295# Target definitions. "all" is the default.
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000296all: $(DEFAULT_MODES)
297
298# Special target for the buildbots to use. Depends on $(OUTDIR)/Makefile
299# having been created before.
300buildbot:
301 $(MAKE) -C "$(OUTDIR)" BUILDTYPE=$(BUILDTYPE) \
302 builddir="$(abspath $(OUTDIR))/$(BUILDTYPE)"
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000303
304# Compile targets. MODES and ARCHES are convenience targets.
305.SECONDEXPANSION:
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100306$(MODES): $(addsuffix .$$@,$(DEFAULT_ARCHES))
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000307
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000308$(ARCHES): $(addprefix $$@.,$(DEFAULT_MODES))
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000309
310# Defines how to build a particular target (e.g. ia32.release).
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000311$(BUILDS): $(OUTDIR)/Makefile.$$@
312 @$(MAKE) -C "$(OUTDIR)" -f Makefile.$@ \
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000313 BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000314 python -c "print \
315 raw_input().replace('opt', '').capitalize()") \
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000316 builddir="$(shell pwd)/$(OUTDIR)/$@"
317
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000318native: $(OUTDIR)/Makefile.native
319 @$(MAKE) -C "$(OUTDIR)" -f Makefile.native \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000320 BUILDTYPE=Release \
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100321 builddir="$(shell pwd)/$(OUTDIR)/$@"
322
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000323$(ANDROID_ARCHES): $(addprefix $$@.,$(MODES))
324
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000325$(ANDROID_BUILDS): $(GYPFILES) $(ENVFILE) Makefile.android
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000326 @$(MAKE) -f Makefile.android $@ \
327 ARCH="$(basename $@)" \
328 MODE="$(subst .,,$(suffix $@))" \
329 OUTDIR="$(OUTDIR)" \
330 GYPFLAGS="$(GYPFLAGS)"
331
332$(NACL_ARCHES): $(addprefix $$@.,$(MODES))
333
334$(NACL_BUILDS): $(GYPFILES) $(ENVFILE) \
335 Makefile.nacl must-set-NACL_SDK_ROOT
336 @$(MAKE) -f Makefile.nacl $@ \
337 ARCH="$(basename $@)" \
338 MODE="$(subst .,,$(suffix $@))" \
339 OUTDIR="$(OUTDIR)" \
340 GYPFLAGS="$(GYPFLAGS)"
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100341
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000342# Test targets.
343check: all
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000344 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100345 --arch=$(shell echo $(DEFAULT_ARCHES) | sed -e 's/ /,/g') \
346 $(TESTFLAGS)
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000347
348$(addsuffix .check,$(MODES)): $$(basename $$@)
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000349 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100350 --mode=$(basename $@) $(TESTFLAGS)
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000351
352$(addsuffix .check,$(ARCHES)): $$(basename $$@)
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000353 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100354 --arch=$(basename $@) $(TESTFLAGS)
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000355
356$(CHECKS): $$(basename $$@)
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000357 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100358 --arch-and-mode=$(basename $@) $(TESTFLAGS)
359
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000360$(addsuffix .quickcheck,$(MODES)): $$(basename $$@)
361 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
362 --mode=$(basename $@) $(TESTFLAGS) --quickcheck
363
364$(addsuffix .quickcheck,$(ARCHES)): $$(basename $$@)
365 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
366 --arch=$(basename $@) $(TESTFLAGS) --quickcheck
367
368$(QUICKCHECKS): $$(basename $$@)
369 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
370 --arch-and-mode=$(basename $@) $(TESTFLAGS) --quickcheck
371
372$(addsuffix .sync, $(ANDROID_BUILDS)): $$(basename $$@)
373 @tools/android-sync.sh $(basename $@) $(OUTDIR) \
374 $(shell pwd) $(ANDROID_V8)
375
376$(addsuffix .check, $(ANDROID_BUILDS)): $$(basename $$@).sync
377 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
378 --arch-and-mode=$(basename $@) \
379 --timeout=600 \
380 --command-prefix="tools/android-run.py" $(TESTFLAGS)
381
382$(addsuffix .check, $(ANDROID_ARCHES)): \
383 $(addprefix $$(basename $$@).,$(MODES)).check
384
385$(addsuffix .check, $(NACL_BUILDS)): $$(basename $$@)
386 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
387 --arch-and-mode=$(basename $@) \
388 --timeout=600 --nopresubmit --noi18n \
389 --command-prefix="tools/nacl-run.py"
390
391$(addsuffix .check, $(NACL_ARCHES)): \
392 $(addprefix $$(basename $$@).,$(MODES)).check
393
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100394native.check: native
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000395 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR)/native \
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100396 --arch-and-mode=. $(TESTFLAGS)
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000397
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000398SUPERFASTTESTMODES = ia32.release
399FASTTESTMODES = $(SUPERFASTTESTMODES),x64.release,ia32.optdebug,x64.optdebug,arm.optdebug,arm64.release
400FASTCOMPILEMODES = $(FASTTESTMODES),arm64.optdebug
401
402COMMA = ,
403EMPTY =
404SPACE = $(EMPTY) $(EMPTY)
405quickcheck: $(subst $(COMMA),$(SPACE),$(FASTCOMPILEMODES))
406 tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
407 --arch-and-mode=$(SUPERFASTTESTMODES) $(TESTFLAGS) --quickcheck \
408 --download-data mozilla webkit
409 tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
410 --arch-and-mode=$(FASTTESTMODES) $(TESTFLAGS) --quickcheck
411qc: quickcheck
412
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400413turbocheck: $(subst $(COMMA),$(SPACE),$(FASTCOMPILEMODES))
414 tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
415 --arch-and-mode=$(SUPERFASTTESTMODES) $(TESTFLAGS) \
416 --quickcheck --variants=turbofan --download-data mozilla webkit
417 tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
418 --arch-and-mode=$(FASTTESTMODES) $(TESTFLAGS) \
419 --quickcheck --variants=turbofan
420tc: turbocheck
421
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000422# Clean targets. You can clean each architecture individually, or everything.
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000423$(addsuffix .clean, $(ARCHES) $(ANDROID_ARCHES) $(NACL_ARCHES)):
424 rm -f $(OUTDIR)/Makefile.$(basename $@)*
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000425 rm -rf $(OUTDIR)/$(basename $@).release
426 rm -rf $(OUTDIR)/$(basename $@).debug
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000427 rm -rf $(OUTDIR)/$(basename $@).optdebug
428 find $(OUTDIR) -regex '.*\(host\|target\)\.$(basename $@).*\.mk' -delete
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000429
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100430native.clean:
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000431 rm -f $(OUTDIR)/Makefile.native
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100432 rm -rf $(OUTDIR)/native
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000433 find $(OUTDIR) -regex '.*\(host\|target\)\.native\.mk' -delete
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100434
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000435clean: $(addsuffix .clean, $(ARCHES) $(ANDROID_ARCHES) $(NACL_ARCHES)) native.clean gtags.clean
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000436
437# GYP file generation targets.
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000438OUT_MAKEFILES = $(addprefix $(OUTDIR)/Makefile.,$(BUILDS))
439$(OUT_MAKEFILES): $(GYPFILES) $(ENVFILE)
440 $(eval CXX_TARGET_ARCH:=$(shell $(CXX) -v 2>&1 | grep ^Target: | \
441 cut -f 2 -d " " | cut -f 1 -d "-" ))
442 $(eval CXX_TARGET_ARCH:=$(subst aarch64,arm64,$(CXX_TARGET_ARCH)))
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000443 $(eval CXX_TARGET_ARCH:=$(subst x86_64,x64,$(CXX_TARGET_ARCH)))
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000444 $(eval V8_TARGET_ARCH:=$(subst .,,$(suffix $(basename $@))))
445 PYTHONPATH="$(shell pwd)/tools/generate_shim_headers:$(shell pwd)/build:$(PYTHONPATH):$(shell pwd)/build/gyp/pylib:$(PYTHONPATH)" \
446 GYP_GENERATORS=make \
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000447 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000448 -Ibuild/standalone.gypi --depth=. \
449 -Dv8_target_arch=$(V8_TARGET_ARCH) \
450 $(if $(findstring $(CXX_TARGET_ARCH),$(V8_TARGET_ARCH)), \
451 -Dtarget_arch=$(V8_TARGET_ARCH),) \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000452 $(if $(findstring optdebug,$@),-Dv8_optimized_debug=1,) \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000453 -S$(suffix $(basename $@))$(suffix $@) $(GYPFLAGS)
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000454
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000455$(OUTDIR)/Makefile.native: $(GYPFILES) $(ENVFILE)
456 PYTHONPATH="$(shell pwd)/tools/generate_shim_headers:$(shell pwd)/build:$(PYTHONPATH):$(shell pwd)/build/gyp/pylib:$(PYTHONPATH)" \
457 GYP_GENERATORS=make \
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000458 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000459 -Ibuild/standalone.gypi --depth=. -S.native $(GYPFLAGS)
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000460
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000461# Note that NACL_SDK_ROOT must be set to point to an appropriate
462# Native Client SDK before using this makefile. You can download
463# an SDK here:
464# https://developers.google.com/native-client/sdk/download
465# The path indicated by NACL_SDK_ROOT will typically end with
466# a folder for a pepper version such as "pepper_25" that should
467# have "tools" and "toolchain" subdirectories.
468must-set-NACL_SDK_ROOT:
469ifndef NACL_SDK_ROOT
470 $(error NACL_SDK_ROOT must be set)
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100471endif
472
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000473# Replaces the old with the new environment file if they're different, which
474# will trigger GYP to regenerate Makefiles.
475$(ENVFILE): $(ENVFILE).new
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000476 @if test -r $(ENVFILE) && cmp $(ENVFILE).new $(ENVFILE) > /dev/null; \
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000477 then rm $(ENVFILE).new; \
478 else mv $(ENVFILE).new $(ENVFILE); fi
479
480# Stores current GYPFLAGS in a file.
481$(ENVFILE).new:
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000482 $(eval CXX_TARGET_ARCH:=$(shell $(CXX) -v 2>&1 | grep ^Target: | \
483 cut -f 2 -d " " | cut -f 1 -d "-" ))
484 $(eval CXX_TARGET_ARCH:=$(subst aarch64,arm64,$(CXX_TARGET_ARCH)))
485 $(eval CXX_TARGET_ARCH:=$(subst x86_64,x64,$(CXX_TARGET_ARCH)))
486 @mkdir -p $(OUTDIR); echo "GYPFLAGS=$(GYPFLAGS) -Dtarget_arch=$(CXX_TARGET_ARCH)" > $(ENVFILE).new;
Ben Murdoch589d6972011-11-30 16:04:58 +0000487
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000488# Heap constants for grokdump.
489DUMP_FILE = tools/v8heapconst.py
490grokdump: ia32.release
491 @cat $(DUMP_FILE).tmpl > $(DUMP_FILE)
492 @$(OUTDIR)/ia32.release/d8 --dump-heap-constants >> $(DUMP_FILE)
493
494# Support for the GNU GLOBAL Source Code Tag System.
495gtags.files: $(GYPFILES) $(ENVFILE)
496 @find include src test -name '*.h' -o -name '*.cc' -o -name '*.c' > $@
497
498# We need to manually set the stack limit here, to work around bugs in
499# gmake-3.81 and global-5.7.1 on recent 64-bit Linux systems.
500GPATH GRTAGS GSYMS GTAGS: gtags.files $(shell cat gtags.files 2> /dev/null)
501 @bash -c 'ulimit -s 10240 && GTAGSFORCECPP=yes gtags -i -q -f $<'
502
503gtags.clean:
504 rm -f gtags.files GPATH GRTAGS GSYMS GTAGS
505
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000506dependencies builddeps:
507 $(error Use 'gclient sync' instead)