blob: 2fbe1ba7dbc95f2880c8270fd427486de5ce656e [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
67# backtrace=off
68ifeq ($(backtrace), off)
69 GYPFLAGS += -Dv8_enable_backtrace=0
70else
71 GYPFLAGS += -Dv8_enable_backtrace=1
72endif
73# verifypredictable=on
74ifeq ($(verifypredictable), on)
75 GYPFLAGS += -Dv8_enable_verify_predictable=1
76endif
Ben Murdoch69a99ed2011-11-30 16:03:39 +000077# snapshot=off
78ifeq ($(snapshot), off)
79 GYPFLAGS += -Dv8_use_snapshot='false'
80endif
Ben Murdochb8a8cc12014-11-26 15:28:44 +000081# extrachecks=on/off
82ifeq ($(extrachecks), on)
83 GYPFLAGS += -Dv8_enable_extra_checks=1 -Dv8_enable_handle_zapping=1
84endif
85ifeq ($(extrachecks), off)
86 GYPFLAGS += -Dv8_enable_extra_checks=0 -Dv8_enable_handle_zapping=0
87endif
88# gdbjit=on/off
Ben Murdoch69a99ed2011-11-30 16:03:39 +000089ifeq ($(gdbjit), on)
90 GYPFLAGS += -Dv8_enable_gdbjit=1
91endif
Ben Murdochb8a8cc12014-11-26 15:28:44 +000092ifeq ($(gdbjit), off)
93 GYPFLAGS += -Dv8_enable_gdbjit=0
Ben Murdoch69a99ed2011-11-30 16:03:39 +000094endif
Ben Murdochb8a8cc12014-11-26 15:28:44 +000095# vtunejit=on
96ifeq ($(vtunejit), on)
97 GYPFLAGS += -Dv8_enable_vtunejit=1
Ben Murdoch69a99ed2011-11-30 16:03:39 +000098endif
Ben Murdochb8a8cc12014-11-26 15:28:44 +000099# optdebug=on
100ifeq ($(optdebug), on)
101 GYPFLAGS += -Dv8_optimized_debug=2
102endif
103# unalignedaccess=on
104ifeq ($(unalignedaccess), on)
105 GYPFLAGS += -Dv8_can_use_unaligned_accesses=true
106endif
107# randomseed=12345, disable random seed via randomseed=0
108ifdef randomseed
109 GYPFLAGS += -Dv8_random_seed=$(randomseed)
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100110endif
Ben Murdoch589d6972011-11-30 16:04:58 +0000111# soname_version=1.2.3
112ifdef soname_version
113 GYPFLAGS += -Dsoname_version=$(soname_version)
114endif
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100115# werror=no
116ifeq ($(werror), no)
117 GYPFLAGS += -Dwerror=''
118endif
119# presubmit=no
120ifeq ($(presubmit), no)
121 TESTFLAGS += --no-presubmit
122endif
123# strictaliasing=off (workaround for GCC-4.5)
124ifeq ($(strictaliasing), off)
125 GYPFLAGS += -Dv8_no_strict_aliasing=1
126endif
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000127# regexp=interpreted
128ifeq ($(regexp), interpreted)
129 GYPFLAGS += -Dv8_interpreted_regexp=1
130endif
131# i18nsupport=off
132ifeq ($(i18nsupport), off)
133 GYPFLAGS += -Dv8_enable_i18n_support=0
134 TESTFLAGS += --noi18n
135endif
136# deprecation_warnings=on
137ifeq ($(deprecationwarnings), on)
138 GYPFLAGS += -Dv8_deprecation_warnings=1
139endif
140# asan=/path/to/clang++
141ifneq ($(strip $(asan)),)
142 GYPFLAGS += -Dasan=1
143 export CXX=$(asan)
144 export CXX_host=$(asan)
145 export LINK=$(asan)
146 export ASAN_SYMBOLIZER_PATH="$(dir $(asan))llvm-symbolizer"
147endif
148
149# arm specific flags.
150# arm_version=<number | "default">
151ifneq ($(strip $(arm_version)),)
152 GYPFLAGS += -Darm_version=$(arm_version)
153else
154# Deprecated (use arm_version instead): armv7=false/true
155ifeq ($(armv7), false)
156 GYPFLAGS += -Darm_version=6
157else
158ifeq ($(armv7), true)
159 GYPFLAGS += -Darm_version=7
160endif
161endif
162endif
163# hardfp=on/off. Deprecated, use armfloatabi
164ifeq ($(hardfp),on)
165 GYPFLAGS += -Darm_float_abi=hard
166else
167ifeq ($(hardfp),off)
168 GYPFLAGS += -Darm_float_abi=softfp
169endif
170endif
171# fpu: armfpu=xxx
172# xxx: vfp, vfpv3-d16, vfpv3, neon.
173ifeq ($(armfpu),)
174 GYPFLAGS += -Darm_fpu=default
175else
176 GYPFLAGS += -Darm_fpu=$(armfpu)
177endif
178# float abi: armfloatabi=softfp/hard
179ifeq ($(armfloatabi),)
180ifeq ($(hardfp),)
181 GYPFLAGS += -Darm_float_abi=default
182endif
183else
184 GYPFLAGS += -Darm_float_abi=$(armfloatabi)
185endif
186# armthumb=on/off
187ifeq ($(armthumb), off)
188 GYPFLAGS += -Darm_thumb=0
189else
190ifeq ($(armthumb), on)
191 GYPFLAGS += -Darm_thumb=1
192endif
193endif
194# arm_test_noprobe=on
195# With this flag set, by default v8 will only use features implied
196# by the compiler (no probe). This is done by modifying the default
197# values of enable_armv7, enable_vfp3, enable_32dregs and enable_neon.
198# Modifying these flags when launching v8 will enable the probing for
199# the specified values.
200ifeq ($(arm_test_noprobe), on)
201 GYPFLAGS += -Darm_test_noprobe=on
202endif
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000203
204# ----------------- available targets: --------------------
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000205# - "builddeps": pulls in external dependencies for building
206# - "dependencies": pulls in all external dependencies
207# - "grokdump": rebuilds heap constants lists used by grokdump
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000208# - any arch listed in ARCHES (see below)
209# - any mode listed in MODES
210# - every combination <arch>.<mode>, e.g. "ia32.release"
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100211# - "native": current host's architecture, release mode
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000212# - any of the above with .check appended, e.g. "ia32.release.check"
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000213# - "android": cross-compile for Android/ARM
214# - "nacl" : cross-compile for Native Client (ia32 and x64)
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100215# - default (no target specified): build all DEFAULT_ARCHES and MODES
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000216# - "check": build all targets and run all tests
217# - "<arch>.clean" for any <arch> in ARCHES
218# - "clean": clean all ARCHES
219
220# ----------------- internal stuff ------------------------
221
222# Architectures and modes to be compiled. Consider these to be internal
223# variables, don't override them (use the targets instead).
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000224ARCHES = ia32 x64 x32 arm arm64 mips mipsel mips64el x87
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100225DEFAULT_ARCHES = ia32 x64 arm
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000226MODES = release debug optdebug
227DEFAULT_MODES = release debug
228ANDROID_ARCHES = android_ia32 android_arm android_arm64 android_mipsel android_x87
229NACL_ARCHES = nacl_ia32 nacl_x64
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000230
231# List of files that trigger Makefile regeneration:
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000232GYPFILES = build/all.gyp build/features.gypi build/standalone.gypi \
233 build/toolchain.gypi samples/samples.gyp src/compiler/compiler.gyp \
234 src/d8.gyp test/cctest/cctest.gyp tools/gyp/v8.gyp
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000235
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000236# If vtunejit=on, the v8vtune.gyp will be appended.
237ifeq ($(vtunejit), on)
238 GYPFILES += src/third_party/vtune/v8vtune.gyp
239endif
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000240# Generates all combinations of ARCHES and MODES, e.g. "ia32.release".
241BUILDS = $(foreach mode,$(MODES),$(addsuffix .$(mode),$(ARCHES)))
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000242ANDROID_BUILDS = $(foreach mode,$(MODES), \
243 $(addsuffix .$(mode),$(ANDROID_ARCHES)))
244NACL_BUILDS = $(foreach mode,$(MODES), \
245 $(addsuffix .$(mode),$(NACL_ARCHES)))
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000246# Generates corresponding test targets, e.g. "ia32.release.check".
247CHECKS = $(addsuffix .check,$(BUILDS))
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000248QUICKCHECKS = $(addsuffix .quickcheck,$(BUILDS))
249ANDROID_CHECKS = $(addsuffix .check,$(ANDROID_BUILDS))
250NACL_CHECKS = $(addsuffix .check,$(NACL_BUILDS))
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000251# File where previously used GYPFLAGS are stored.
252ENVFILE = $(OUTDIR)/environment
253
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000254.PHONY: all check clean builddeps dependencies $(ENVFILE).new native \
255 qc quickcheck $(QUICKCHECKS) \
256 $(addsuffix .quickcheck,$(MODES)) $(addsuffix .quickcheck,$(ARCHES)) \
Ben Murdoch589d6972011-11-30 16:04:58 +0000257 $(ARCHES) $(MODES) $(BUILDS) $(CHECKS) $(addsuffix .clean,$(ARCHES)) \
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100258 $(addsuffix .check,$(MODES)) $(addsuffix .check,$(ARCHES)) \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000259 $(ANDROID_ARCHES) $(ANDROID_BUILDS) $(ANDROID_CHECKS) \
260 must-set-ANDROID_NDK_ROOT_OR_TOOLCHAIN \
261 $(NACL_ARCHES) $(NACL_BUILDS) $(NACL_CHECKS) \
262 must-set-NACL_SDK_ROOT
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000263
264# Target definitions. "all" is the default.
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000265all: $(DEFAULT_MODES)
266
267# Special target for the buildbots to use. Depends on $(OUTDIR)/Makefile
268# having been created before.
269buildbot:
270 $(MAKE) -C "$(OUTDIR)" BUILDTYPE=$(BUILDTYPE) \
271 builddir="$(abspath $(OUTDIR))/$(BUILDTYPE)"
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000272
273# Compile targets. MODES and ARCHES are convenience targets.
274.SECONDEXPANSION:
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100275$(MODES): $(addsuffix .$$@,$(DEFAULT_ARCHES))
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000276
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000277$(ARCHES): $(addprefix $$@.,$(DEFAULT_MODES))
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000278
279# Defines how to build a particular target (e.g. ia32.release).
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000280$(BUILDS): $(OUTDIR)/Makefile.$$@
281 @$(MAKE) -C "$(OUTDIR)" -f Makefile.$@ \
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000282 CXX="$(CXX)" LINK="$(LINK)" \
283 BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000284 python -c "print \
285 raw_input().replace('opt', '').capitalize()") \
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000286 builddir="$(shell pwd)/$(OUTDIR)/$@"
287
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000288native: $(OUTDIR)/Makefile.native
289 @$(MAKE) -C "$(OUTDIR)" -f Makefile.native \
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100290 CXX="$(CXX)" LINK="$(LINK)" BUILDTYPE=Release \
291 builddir="$(shell pwd)/$(OUTDIR)/$@"
292
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000293$(ANDROID_ARCHES): $(addprefix $$@.,$(MODES))
294
295$(ANDROID_BUILDS): $(GYPFILES) $(ENVFILE) build/android.gypi \
296 must-set-ANDROID_NDK_ROOT_OR_TOOLCHAIN Makefile.android
297 @$(MAKE) -f Makefile.android $@ \
298 ARCH="$(basename $@)" \
299 MODE="$(subst .,,$(suffix $@))" \
300 OUTDIR="$(OUTDIR)" \
301 GYPFLAGS="$(GYPFLAGS)"
302
303$(NACL_ARCHES): $(addprefix $$@.,$(MODES))
304
305$(NACL_BUILDS): $(GYPFILES) $(ENVFILE) \
306 Makefile.nacl must-set-NACL_SDK_ROOT
307 @$(MAKE) -f Makefile.nacl $@ \
308 ARCH="$(basename $@)" \
309 MODE="$(subst .,,$(suffix $@))" \
310 OUTDIR="$(OUTDIR)" \
311 GYPFLAGS="$(GYPFLAGS)"
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100312
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000313# Test targets.
314check: all
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000315 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100316 --arch=$(shell echo $(DEFAULT_ARCHES) | sed -e 's/ /,/g') \
317 $(TESTFLAGS)
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000318
319$(addsuffix .check,$(MODES)): $$(basename $$@)
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000320 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100321 --mode=$(basename $@) $(TESTFLAGS)
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000322
323$(addsuffix .check,$(ARCHES)): $$(basename $$@)
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000324 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100325 --arch=$(basename $@) $(TESTFLAGS)
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000326
327$(CHECKS): $$(basename $$@)
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000328 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100329 --arch-and-mode=$(basename $@) $(TESTFLAGS)
330
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000331$(addsuffix .quickcheck,$(MODES)): $$(basename $$@)
332 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
333 --mode=$(basename $@) $(TESTFLAGS) --quickcheck
334
335$(addsuffix .quickcheck,$(ARCHES)): $$(basename $$@)
336 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
337 --arch=$(basename $@) $(TESTFLAGS) --quickcheck
338
339$(QUICKCHECKS): $$(basename $$@)
340 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
341 --arch-and-mode=$(basename $@) $(TESTFLAGS) --quickcheck
342
343$(addsuffix .sync, $(ANDROID_BUILDS)): $$(basename $$@)
344 @tools/android-sync.sh $(basename $@) $(OUTDIR) \
345 $(shell pwd) $(ANDROID_V8)
346
347$(addsuffix .check, $(ANDROID_BUILDS)): $$(basename $$@).sync
348 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
349 --arch-and-mode=$(basename $@) \
350 --timeout=600 \
351 --command-prefix="tools/android-run.py" $(TESTFLAGS)
352
353$(addsuffix .check, $(ANDROID_ARCHES)): \
354 $(addprefix $$(basename $$@).,$(MODES)).check
355
356$(addsuffix .check, $(NACL_BUILDS)): $$(basename $$@)
357 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
358 --arch-and-mode=$(basename $@) \
359 --timeout=600 --nopresubmit --noi18n \
360 --command-prefix="tools/nacl-run.py"
361
362$(addsuffix .check, $(NACL_ARCHES)): \
363 $(addprefix $$(basename $$@).,$(MODES)).check
364
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100365native.check: native
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000366 @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR)/native \
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100367 --arch-and-mode=. $(TESTFLAGS)
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000368
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000369SUPERFASTTESTMODES = ia32.release
370FASTTESTMODES = $(SUPERFASTTESTMODES),x64.release,ia32.optdebug,x64.optdebug,arm.optdebug,arm64.release
371FASTCOMPILEMODES = $(FASTTESTMODES),arm64.optdebug
372
373COMMA = ,
374EMPTY =
375SPACE = $(EMPTY) $(EMPTY)
376quickcheck: $(subst $(COMMA),$(SPACE),$(FASTCOMPILEMODES))
377 tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
378 --arch-and-mode=$(SUPERFASTTESTMODES) $(TESTFLAGS) --quickcheck \
379 --download-data mozilla webkit
380 tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
381 --arch-and-mode=$(FASTTESTMODES) $(TESTFLAGS) --quickcheck
382qc: quickcheck
383
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000384# Clean targets. You can clean each architecture individually, or everything.
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000385$(addsuffix .clean, $(ARCHES) $(ANDROID_ARCHES) $(NACL_ARCHES)):
386 rm -f $(OUTDIR)/Makefile.$(basename $@)*
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000387 rm -rf $(OUTDIR)/$(basename $@).release
388 rm -rf $(OUTDIR)/$(basename $@).debug
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000389 rm -rf $(OUTDIR)/$(basename $@).optdebug
390 find $(OUTDIR) -regex '.*\(host\|target\)\.$(basename $@).*\.mk' -delete
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000391
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100392native.clean:
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000393 rm -f $(OUTDIR)/Makefile.native
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100394 rm -rf $(OUTDIR)/native
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000395 find $(OUTDIR) -regex '.*\(host\|target\)\.native\.mk' -delete
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100396
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000397clean: $(addsuffix .clean, $(ARCHES) $(ANDROID_ARCHES) $(NACL_ARCHES)) native.clean gtags.clean
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000398
399# GYP file generation targets.
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000400OUT_MAKEFILES = $(addprefix $(OUTDIR)/Makefile.,$(BUILDS))
401$(OUT_MAKEFILES): $(GYPFILES) $(ENVFILE)
402 $(eval CXX_TARGET_ARCH:=$(shell $(CXX) -v 2>&1 | grep ^Target: | \
403 cut -f 2 -d " " | cut -f 1 -d "-" ))
404 $(eval CXX_TARGET_ARCH:=$(subst aarch64,arm64,$(CXX_TARGET_ARCH)))
405 $(eval V8_TARGET_ARCH:=$(subst .,,$(suffix $(basename $@))))
406 PYTHONPATH="$(shell pwd)/tools/generate_shim_headers:$(shell pwd)/build:$(PYTHONPATH):$(shell pwd)/build/gyp/pylib:$(PYTHONPATH)" \
407 GYP_GENERATORS=make \
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000408 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000409 -Ibuild/standalone.gypi --depth=. \
410 -Dv8_target_arch=$(V8_TARGET_ARCH) \
411 $(if $(findstring $(CXX_TARGET_ARCH),$(V8_TARGET_ARCH)), \
412 -Dtarget_arch=$(V8_TARGET_ARCH),) \
413 $(if $(findstring optdebug,$@),-Dv8_optimized_debug=2,) \
414 -S$(suffix $(basename $@))$(suffix $@) $(GYPFLAGS)
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000415
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000416$(OUTDIR)/Makefile.native: $(GYPFILES) $(ENVFILE)
417 PYTHONPATH="$(shell pwd)/tools/generate_shim_headers:$(shell pwd)/build:$(PYTHONPATH):$(shell pwd)/build/gyp/pylib:$(PYTHONPATH)" \
418 GYP_GENERATORS=make \
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000419 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000420 -Ibuild/standalone.gypi --depth=. -S.native $(GYPFLAGS)
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000421
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000422must-set-ANDROID_NDK_ROOT_OR_TOOLCHAIN:
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100423ifndef ANDROID_NDK_ROOT
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000424ifndef ANDROID_TOOLCHAIN
425 $(error ANDROID_NDK_ROOT or ANDROID_TOOLCHAIN must be set))
426endif
427endif
428
429# Note that NACL_SDK_ROOT must be set to point to an appropriate
430# Native Client SDK before using this makefile. You can download
431# an SDK here:
432# https://developers.google.com/native-client/sdk/download
433# The path indicated by NACL_SDK_ROOT will typically end with
434# a folder for a pepper version such as "pepper_25" that should
435# have "tools" and "toolchain" subdirectories.
436must-set-NACL_SDK_ROOT:
437ifndef NACL_SDK_ROOT
438 $(error NACL_SDK_ROOT must be set)
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100439endif
440
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000441# Replaces the old with the new environment file if they're different, which
442# will trigger GYP to regenerate Makefiles.
443$(ENVFILE): $(ENVFILE).new
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000444 @if test -r $(ENVFILE) && cmp $(ENVFILE).new $(ENVFILE) > /dev/null; \
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000445 then rm $(ENVFILE).new; \
446 else mv $(ENVFILE).new $(ENVFILE); fi
447
448# Stores current GYPFLAGS in a file.
449$(ENVFILE).new:
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000450 @mkdir -p $(OUTDIR); echo "GYPFLAGS=$(GYPFLAGS)" > $(ENVFILE).new; \
451 echo "CXX=$(CXX)" >> $(ENVFILE).new
Ben Murdoch589d6972011-11-30 16:04:58 +0000452
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000453# Heap constants for grokdump.
454DUMP_FILE = tools/v8heapconst.py
455grokdump: ia32.release
456 @cat $(DUMP_FILE).tmpl > $(DUMP_FILE)
457 @$(OUTDIR)/ia32.release/d8 --dump-heap-constants >> $(DUMP_FILE)
458
459# Support for the GNU GLOBAL Source Code Tag System.
460gtags.files: $(GYPFILES) $(ENVFILE)
461 @find include src test -name '*.h' -o -name '*.cc' -o -name '*.c' > $@
462
463# We need to manually set the stack limit here, to work around bugs in
464# gmake-3.81 and global-5.7.1 on recent 64-bit Linux systems.
465GPATH GRTAGS GSYMS GTAGS: gtags.files $(shell cat gtags.files 2> /dev/null)
466 @bash -c 'ulimit -s 10240 && GTAGSFORCECPP=yes gtags -i -q -f $<'
467
468gtags.clean:
469 rm -f gtags.files GPATH GRTAGS GSYMS GTAGS
470
471# Dependencies. "builddeps" are dependencies required solely for building,
472# "dependencies" includes also dependencies required for development.
473# Remember to keep these in sync with the DEPS file.
474builddeps:
Ben Murdoch589d6972011-11-30 16:04:58 +0000475 svn checkout --force http://gyp.googlecode.com/svn/trunk build/gyp \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000476 --revision 1831
477 if svn info third_party/icu 2>&1 | grep -q icu46 ; then \
478 svn switch --force \
479 https://src.chromium.org/chrome/trunk/deps/third_party/icu52 \
480 third_party/icu --revision 277999 ; \
481 else \
482 svn checkout --force \
483 https://src.chromium.org/chrome/trunk/deps/third_party/icu52 \
484 third_party/icu --revision 277999 ; \
485 fi
486 svn checkout --force http://googletest.googlecode.com/svn/trunk \
487 testing/gtest --revision 692
488 svn checkout --force http://googlemock.googlecode.com/svn/trunk \
489 testing/gmock --revision 485
490
491dependencies: builddeps
492 # The spec is a copy of the hooks in v8's DEPS file.
493 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''}]"