Makefile revision 537ba893e2530051ec7f296e769fdd37bb4ae4a0
1# Copyright 2012 the V8 project authors. All rights reserved.
2# Redistribution and use in source and binary forms, with or without
3# modification, are permitted provided that the following conditions are
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.
30OUTDIR ?= out
31TESTJOBS ?=
32GYPFLAGS ?=
33TESTFLAGS ?=
34ANDROID_NDK_HOST_ARCH ?=
35ANDROID_V8 ?= /data/local/tmp/v8
36NACL_SDK_ROOT ?=
37
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
47# disassembler=on
48ifeq ($(disassembler), on)
49  GYPFLAGS += -Dv8_enable_disassembler=1
50endif
51# objectprint=on
52ifeq ($(objectprint), on)
53  GYPFLAGS += -Dv8_object_print=1
54endif
55# verifyheap=on
56ifeq ($(verifyheap), on)
57  GYPFLAGS += -Dv8_enable_verify_heap=1
58endif
59# tracemaps=on
60ifeq ($(tracemaps), on)
61  GYPFLAGS += -Dv8_trace_maps=1
62endif
63# 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
73# snapshot=off
74ifeq ($(snapshot), off)
75  GYPFLAGS += -Dv8_use_snapshot='false'
76endif
77ifeq ($(snapshot), external)
78  GYPFLAGS += -Dv8_use_external_startup_data=1
79endif
80# extrachecks=on/off
81ifeq ($(extrachecks), on)
82  GYPFLAGS += -Ddcheck_always_on=1 -Dv8_enable_handle_zapping=1
83endif
84ifeq ($(extrachecks), off)
85  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
97endif
98# gdbjit=on/off
99ifeq ($(gdbjit), on)
100  GYPFLAGS += -Dv8_enable_gdbjit=1
101endif
102ifeq ($(gdbjit), off)
103  GYPFLAGS += -Dv8_enable_gdbjit=0
104endif
105# vtunejit=on
106ifeq ($(vtunejit), on)
107  GYPFLAGS += -Dv8_enable_vtunejit=1
108endif
109# 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)
116endif
117# soname_version=1.2.3
118ifdef soname_version
119  GYPFLAGS += -Dsoname_version=$(soname_version)
120endif
121# 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
133# 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
142# deprecationwarnings=on
143ifeq ($(deprecationwarnings), on)
144  GYPFLAGS += -Dv8_deprecation_warnings=1
145endif
146# 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
157  TESTFLAGS += --asan
158  ifeq ($(lsan), on)
159    GYPFLAGS += -Dlsan=1
160  endif
161endif
162ifdef embedscript
163  GYPFLAGS += -Dembed_script=$(embedscript)
164endif
165ifdef warmupscript
166  GYPFLAGS += -Dwarmup_script=$(warmupscript)
167endif
168ifeq ($(goma), on)
169  GYPFLAGS += -Duse_goma=1
170endif
171# 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
225# 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
229
230ifdef android_ndk_root
231  GYPFLAGS += -Dandroid_ndk_root=$(android_ndk_root)
232  export ANDROID_NDK_ROOT = $(android_ndk_root)
233endif
234
235# ----------------- available targets: --------------------
236# - "grokdump": rebuilds heap constants lists used by grokdump
237# - any arch listed in ARCHES (see below)
238# - any mode listed in MODES
239# - every combination <arch>.<mode>, e.g. "ia32.release"
240# - "native": current host's architecture, release mode
241# - any of the above with .check appended, e.g. "ia32.release.check"
242# - "android": cross-compile for Android/ARM
243# - "nacl" : cross-compile for Native Client (ia32 and x64)
244# - default (no target specified): build all DEFAULT_ARCHES and MODES
245# - "check": build all targets and run all tests
246# - "<arch>.clean" for any <arch> in ARCHES
247# - "clean": clean all ARCHES
248
249# ----------------- internal stuff ------------------------
250
251# Architectures and modes to be compiled. Consider these to be internal
252# variables, don't override them (use the targets instead).
253ARCHES = ia32 x64 x32 arm arm64 mips mipsel mips64 mips64el x87 ppc ppc64 \
254		 s390 s390x
255DEFAULT_ARCHES = ia32 x64 arm
256MODES = release debug optdebug
257DEFAULT_MODES = release debug
258ANDROID_ARCHES = android_ia32 android_x64 android_arm android_arm64 \
259		 android_mipsel android_x87
260NACL_ARCHES = nacl_ia32 nacl_x64
261
262# List of files that trigger Makefile regeneration:
263GYPFILES = third_party/icu/icu.gypi third_party/icu/icu.gyp \
264	   gypfiles/shim_headers.gypi gypfiles/features.gypi \
265           gypfiles/standalone.gypi \
266	   gypfiles/toolchain.gypi gypfiles/all.gyp gypfiles/mac/asan.gyp \
267	   test/cctest/cctest.gyp test/fuzzer/fuzzer.gyp \
268	   test/unittests/unittests.gyp src/v8.gyp \
269	   tools/parser-shell.gyp testing/gmock.gyp testing/gtest.gyp \
270	   buildtools/third_party/libc++abi/libc++abi.gyp \
271	   buildtools/third_party/libc++/libc++.gyp samples/samples.gyp \
272	   src/third_party/vtune/v8vtune.gyp src/d8.gyp
273
274# If vtunejit=on, the v8vtune.gyp will be appended.
275ifeq ($(vtunejit), on)
276  GYPFILES += src/third_party/vtune/v8vtune.gyp
277endif
278# Generates all combinations of ARCHES and MODES, e.g. "ia32.release".
279BUILDS = $(foreach mode,$(MODES),$(addsuffix .$(mode),$(ARCHES)))
280ANDROID_BUILDS = $(foreach mode,$(MODES), \
281                   $(addsuffix .$(mode),$(ANDROID_ARCHES)))
282NACL_BUILDS = $(foreach mode,$(MODES), \
283                   $(addsuffix .$(mode),$(NACL_ARCHES)))
284# Generates corresponding test targets, e.g. "ia32.release.check".
285CHECKS = $(addsuffix .check,$(BUILDS))
286QUICKCHECKS = $(addsuffix .quickcheck,$(BUILDS))
287ANDROID_CHECKS = $(addsuffix .check,$(ANDROID_BUILDS))
288NACL_CHECKS = $(addsuffix .check,$(NACL_BUILDS))
289# File where previously used GYPFLAGS are stored.
290ENVFILE = $(OUTDIR)/environment
291
292.PHONY: all check clean builddeps dependencies $(ENVFILE).new native \
293        qc quickcheck $(QUICKCHECKS) turbocheck \
294        $(addsuffix .quickcheck,$(MODES)) $(addsuffix .quickcheck,$(ARCHES)) \
295        $(ARCHES) $(MODES) $(BUILDS) $(CHECKS) $(addsuffix .clean,$(ARCHES)) \
296        $(addsuffix .check,$(MODES)) $(addsuffix .check,$(ARCHES)) \
297        $(ANDROID_ARCHES) $(ANDROID_BUILDS) $(ANDROID_CHECKS) \
298        $(NACL_ARCHES) $(NACL_BUILDS) $(NACL_CHECKS) \
299        must-set-NACL_SDK_ROOT
300
301# Target definitions. "all" is the default.
302all: $(DEFAULT_MODES)
303
304# Special target for the buildbots to use. Depends on $(OUTDIR)/Makefile
305# having been created before.
306buildbot:
307	$(MAKE) -C "$(OUTDIR)" BUILDTYPE=$(BUILDTYPE) \
308	        builddir="$(abspath $(OUTDIR))/$(BUILDTYPE)"
309
310# Compile targets. MODES and ARCHES are convenience targets.
311.SECONDEXPANSION:
312$(MODES): $(addsuffix .$$@,$(DEFAULT_ARCHES))
313
314$(ARCHES): $(addprefix $$@.,$(DEFAULT_MODES))
315
316# Defines how to build a particular target (e.g. ia32.release).
317$(BUILDS): $(OUTDIR)/Makefile.$$@
318	@$(MAKE) -C "$(OUTDIR)" -f Makefile.$@ \
319	         BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \
320	                     python -c "print \
321	                     raw_input().replace('opt', '').capitalize()") \
322	         builddir="$(shell pwd)/$(OUTDIR)/$@"
323
324native: $(OUTDIR)/Makefile.native
325	@$(MAKE) -C "$(OUTDIR)" -f Makefile.native \
326	         BUILDTYPE=Release \
327	         builddir="$(shell pwd)/$(OUTDIR)/$@"
328
329$(ANDROID_ARCHES): $(addprefix $$@.,$(MODES))
330
331$(ANDROID_BUILDS): $(GYPFILES) $(ENVFILE) Makefile.android
332	@$(MAKE) -f Makefile.android $@ \
333	        ARCH="$(basename $@)" \
334	        MODE="$(subst .,,$(suffix $@))" \
335	        OUTDIR="$(OUTDIR)" \
336	        GYPFLAGS="$(GYPFLAGS)"
337
338$(NACL_ARCHES): $(addprefix $$@.,$(MODES))
339
340$(NACL_BUILDS): $(GYPFILES) $(ENVFILE) \
341		   Makefile.nacl must-set-NACL_SDK_ROOT
342	@$(MAKE) -f Makefile.nacl $@ \
343	        ARCH="$(basename $@)" \
344	        MODE="$(subst .,,$(suffix $@))" \
345	        OUTDIR="$(OUTDIR)" \
346	        GYPFLAGS="$(GYPFLAGS)"
347
348# Test targets.
349check: all
350	@tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
351	    --arch=$(shell echo $(DEFAULT_ARCHES) | sed -e 's/ /,/g') \
352	    $(TESTFLAGS)
353
354$(addsuffix .check,$(MODES)): $$(basename $$@)
355	@tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
356	    --mode=$(basename $@) $(TESTFLAGS)
357
358$(addsuffix .check,$(ARCHES)): $$(basename $$@)
359	@tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
360	    --arch=$(basename $@) $(TESTFLAGS)
361
362$(CHECKS): $$(basename $$@)
363	@tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
364	    --arch-and-mode=$(basename $@) $(TESTFLAGS)
365
366$(addsuffix .quickcheck,$(MODES)): $$(basename $$@)
367	@tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
368	    --mode=$(basename $@) $(TESTFLAGS) --quickcheck
369
370$(addsuffix .quickcheck,$(ARCHES)): $$(basename $$@)
371	@tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
372	    --arch=$(basename $@) $(TESTFLAGS) --quickcheck
373
374$(QUICKCHECKS): $$(basename $$@)
375	@tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
376	    --arch-and-mode=$(basename $@) $(TESTFLAGS) --quickcheck
377
378$(addsuffix .sync, $(ANDROID_BUILDS)): $$(basename $$@)
379	@tools/android-sync.sh $(basename $@) $(OUTDIR) \
380	                       $(shell pwd) $(ANDROID_V8)
381
382$(addsuffix .check, $(ANDROID_BUILDS)): $$(basename $$@).sync
383	@tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
384	     --arch-and-mode=$(basename $@) \
385	     --timeout=600 \
386	     --command-prefix="tools/android-run.py" $(TESTFLAGS)
387
388$(addsuffix .check, $(ANDROID_ARCHES)): \
389                $(addprefix $$(basename $$@).,$(MODES)).check
390
391$(addsuffix .check, $(NACL_BUILDS)): $$(basename $$@)
392	@tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
393	     --arch-and-mode=$(basename $@) \
394	     --timeout=600 --nopresubmit --noi18n \
395	     --command-prefix="tools/nacl-run.py"
396
397$(addsuffix .check, $(NACL_ARCHES)): \
398                $(addprefix $$(basename $$@).,$(MODES)).check
399
400native.check: native
401	@tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR)/native \
402	    --arch-and-mode=. $(TESTFLAGS)
403
404SUPERFASTTESTMODES = ia32.release
405FASTTESTMODES = $(SUPERFASTTESTMODES),x64.release,ia32.optdebug,x64.optdebug,arm.optdebug,arm64.release
406FASTCOMPILEMODES = $(FASTTESTMODES),arm64.optdebug
407
408COMMA = ,
409EMPTY =
410SPACE = $(EMPTY) $(EMPTY)
411quickcheck: $(subst $(COMMA),$(SPACE),$(FASTCOMPILEMODES))
412	tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
413	    --arch-and-mode=$(SUPERFASTTESTMODES) $(TESTFLAGS) --quickcheck \
414	    --download-data mozilla webkit
415	tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
416	    --arch-and-mode=$(FASTTESTMODES) $(TESTFLAGS) --quickcheck
417qc: quickcheck
418
419turbocheck: $(subst $(COMMA),$(SPACE),$(FASTCOMPILEMODES))
420	tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
421	    --arch-and-mode=$(SUPERFASTTESTMODES) $(TESTFLAGS) \
422	    --quickcheck --variants=turbofan --download-data mozilla webkit
423	tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
424	    --arch-and-mode=$(FASTTESTMODES) $(TESTFLAGS) \
425	    --quickcheck --variants=turbofan
426tc: turbocheck
427
428# Clean targets. You can clean each architecture individually, or everything.
429$(addsuffix .clean, $(ARCHES) $(ANDROID_ARCHES) $(NACL_ARCHES)):
430	rm -f $(OUTDIR)/Makefile.$(basename $@)*
431	rm -rf $(OUTDIR)/$(basename $@).release
432	rm -rf $(OUTDIR)/$(basename $@).debug
433	rm -rf $(OUTDIR)/$(basename $@).optdebug
434	find $(OUTDIR) -regex '.*\(host\|target\)\.$(basename $@).*\.mk' -delete
435
436native.clean:
437	rm -f $(OUTDIR)/Makefile.native
438	rm -rf $(OUTDIR)/native
439	find $(OUTDIR) -regex '.*\(host\|target\)\.native\.mk' -delete
440
441clean: $(addsuffix .clean, $(ARCHES) $(ANDROID_ARCHES) $(NACL_ARCHES)) native.clean gtags.clean tags.clean
442
443# GYP file generation targets.
444OUT_MAKEFILES = $(addprefix $(OUTDIR)/Makefile.,$(BUILDS))
445$(OUT_MAKEFILES): $(GYPFILES) $(ENVFILE)
446	$(eval CXX_TARGET_ARCH:=$(shell $(CXX) -v 2>&1 | grep ^Target: | \
447	        cut -f 2 -d " " | cut -f 1 -d "-" ))
448	$(eval CXX_TARGET_ARCH:=$(subst aarch64,arm64,$(CXX_TARGET_ARCH)))
449	$(eval CXX_TARGET_ARCH:=$(subst x86_64,x64,$(CXX_TARGET_ARCH)))
450	$(eval V8_TARGET_ARCH:=$(subst .,,$(suffix $(basename $@))))
451	PYTHONPATH="$(shell pwd)/tools/generate_shim_headers:$(shell pwd)/gypfiles:$(PYTHONPATH):$(shell pwd)/tools/gyp/pylib:$(PYTHONPATH)" \
452	GYP_GENERATORS=make \
453	tools/gyp/gyp --generator-output="$(OUTDIR)" gypfiles/all.gyp \
454	              -Igypfiles/standalone.gypi --depth=. \
455	              -Dv8_target_arch=$(V8_TARGET_ARCH) \
456	              $(if $(findstring $(CXX_TARGET_ARCH),$(V8_TARGET_ARCH)), \
457	              -Dtarget_arch=$(V8_TARGET_ARCH),) \
458	              $(if $(findstring optdebug,$@),-Dv8_optimized_debug=1,) \
459	              -S$(suffix $(basename $@))$(suffix $@) $(GYPFLAGS)
460
461$(OUTDIR)/Makefile.native: $(GYPFILES) $(ENVFILE)
462	PYTHONPATH="$(shell pwd)/tools/generate_shim_headers:$(shell pwd)/build:$(PYTHONPATH):$(shell pwd)/tools/gyp/pylib:$(PYTHONPATH)" \
463	GYP_GENERATORS=make \
464	tools/gyp/gyp --generator-output="$(OUTDIR)" gypfiles/all.gyp \
465	              -Igypfiles/standalone.gypi --depth=. -S.native $(GYPFLAGS)
466
467# Note that NACL_SDK_ROOT must be set to point to an appropriate
468# Native Client SDK before using this makefile. You can download
469# an SDK here:
470#   https://developers.google.com/native-client/sdk/download
471# The path indicated by NACL_SDK_ROOT will typically end with
472# a folder for a pepper version such as "pepper_25" that should
473# have "tools" and "toolchain" subdirectories.
474must-set-NACL_SDK_ROOT:
475ifndef NACL_SDK_ROOT
476	  $(error NACL_SDK_ROOT must be set)
477endif
478
479# Replaces the old with the new environment file if they're different, which
480# will trigger GYP to regenerate Makefiles.
481$(ENVFILE): $(ENVFILE).new
482	@if test -r $(ENVFILE) && cmp $(ENVFILE).new $(ENVFILE) > /dev/null; \
483	    then rm $(ENVFILE).new; \
484	    else mv $(ENVFILE).new $(ENVFILE); fi
485
486# Stores current GYPFLAGS in a file.
487$(ENVFILE).new:
488	$(eval CXX_TARGET_ARCH:=$(shell $(CXX) -v 2>&1 | grep ^Target: | \
489	        cut -f 2 -d " " | cut -f 1 -d "-" ))
490	$(eval CXX_TARGET_ARCH:=$(subst aarch64,arm64,$(CXX_TARGET_ARCH)))
491	$(eval CXX_TARGET_ARCH:=$(subst x86_64,x64,$(CXX_TARGET_ARCH)))
492	@mkdir -p $(OUTDIR); echo "GYPFLAGS=$(GYPFLAGS) -Dtarget_arch=$(CXX_TARGET_ARCH)" > $(ENVFILE).new;
493
494# Heap constants for grokdump.
495DUMP_FILE = tools/v8heapconst.py
496grokdump: ia32.release
497	@cat $(DUMP_FILE).tmpl > $(DUMP_FILE)
498	@$(OUTDIR)/ia32.release/d8 --dump-heap-constants >> $(DUMP_FILE)
499
500# Support for the GNU GLOBAL Source Code Tag System.
501gtags.files: $(GYPFILES) $(ENVFILE)
502	@find include src test -name '*.h' -o -name '*.cc' -o -name '*.c' > $@
503
504# We need to manually set the stack limit here, to work around bugs in
505# gmake-3.81 and global-5.7.1 on recent 64-bit Linux systems.
506# Using $(wildcard ...) gracefully ignores non-existing files, so that stale
507# gtags.files after switching branches don't cause recipe failures.
508GPATH GRTAGS GSYMS GTAGS: gtags.files $(wildcard $(shell cat gtags.files 2> /dev/null))
509	@bash -c 'ulimit -s 10240 && GTAGSFORCECPP=yes gtags -i -q -f $<'
510
511gtags.clean:
512	rm -f gtags.files GPATH GRTAGS GSYMS GTAGS
513
514tags: gtags.files $(wildcard $(shell cat gtags.files 2> /dev/null))
515	@(ctags --version | grep 'Exuberant Ctags' >/dev/null) || \
516		(echo "Please install Exuberant Ctags (check 'ctags --version')" >&2; false)
517	ctags --fields=+l -L $<
518
519tags.clean:
520	rm -r tags
521
522dependencies builddeps:
523	$(error Use 'gclient sync' instead)
524