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
36
37# Special build flags. Use them like this: "make library=shared"
38
39# library=shared || component=shared_library
40ifeq ($(library), shared)
41  GYPFLAGS += -Dcomponent=shared_library
42endif
43ifdef component
44  GYPFLAGS += -Dcomponent=$(component)
45endif
46# disassembler=on
47ifeq ($(disassembler), on)
48  GYPFLAGS += -Dv8_enable_disassembler=1
49endif
50# objectprint=on
51ifeq ($(objectprint), on)
52  GYPFLAGS += -Dv8_object_print=1
53endif
54# verifycsa=on
55ifeq ($(verifycsa), on)
56  GYPFLAGS += -Dv8_enable_verify_csa=1
57endif
58# verifyheap=on
59ifeq ($(verifyheap), on)
60  GYPFLAGS += -Dv8_enable_verify_heap=1
61endif
62# tracemaps=on
63ifeq ($(tracemaps), on)
64  GYPFLAGS += -Dv8_trace_maps=1
65endif
66# backtrace=off
67ifeq ($(backtrace), off)
68  GYPFLAGS += -Dv8_enable_backtrace=0
69else
70  GYPFLAGS += -Dv8_enable_backtrace=1
71endif
72# verifypredictable=on
73ifeq ($(verifypredictable), on)
74  GYPFLAGS += -Dv8_enable_verify_predictable=1
75endif
76# snapshot=off
77ifeq ($(snapshot), off)
78  GYPFLAGS += -Dv8_use_snapshot='false'
79endif
80ifeq ($(snapshot), external)
81  GYPFLAGS += -Dv8_use_external_startup_data=1
82endif
83# extrachecks=on/off
84ifeq ($(extrachecks), on)
85  GYPFLAGS += -Ddcheck_always_on=1 -Dv8_enable_handle_zapping=1
86endif
87ifeq ($(extrachecks), off)
88  GYPFLAGS += -Ddcheck_always_on=0 -Dv8_enable_handle_zapping=0
89endif
90# slowdchecks=on/off
91ifeq ($(slowdchecks), on)
92  GYPFLAGS += -Dv8_enable_slow_dchecks=1
93endif
94ifeq ($(slowdchecks), off)
95  GYPFLAGS += -Dv8_enable_slow_dchecks=0
96endif
97# debugsymbols=on
98ifeq ($(debugsymbols), on)
99  GYPFLAGS += -Drelease_extra_cflags=-ggdb3
100endif
101# gdbjit=on/off
102ifeq ($(gdbjit), on)
103  GYPFLAGS += -Dv8_enable_gdbjit=1
104endif
105ifeq ($(gdbjit), off)
106  GYPFLAGS += -Dv8_enable_gdbjit=0
107endif
108# vtunejit=on
109ifeq ($(vtunejit), on)
110  GYPFLAGS += -Dv8_enable_vtunejit=1
111endif
112# unalignedaccess=on
113ifeq ($(unalignedaccess), on)
114  GYPFLAGS += -Dv8_can_use_unaligned_accesses=true
115endif
116# randomseed=12345, disable random seed via randomseed=0
117ifdef randomseed
118  GYPFLAGS += -Dv8_random_seed=$(randomseed)
119endif
120# soname_version=1.2.3
121ifdef soname_version
122  GYPFLAGS += -Dsoname_version=$(soname_version)
123endif
124# werror=no
125ifeq ($(werror), no)
126  GYPFLAGS += -Dwerror=''
127endif
128# strictaliasing=off (workaround for GCC-4.5)
129ifeq ($(strictaliasing), off)
130  GYPFLAGS += -Dv8_no_strict_aliasing=1
131endif
132# regexp=interpreted
133ifeq ($(regexp), interpreted)
134  GYPFLAGS += -Dv8_interpreted_regexp=1
135endif
136# i18nsupport=off
137ifeq ($(i18nsupport), off)
138  GYPFLAGS += -Dv8_enable_i18n_support=0
139  TESTFLAGS += --noi18n
140endif
141# deprecationwarnings=on
142ifeq ($(deprecationwarnings), on)
143  GYPFLAGS += -Dv8_deprecation_warnings=1
144endif
145# vectorstores=on
146ifeq ($(vectorstores), on)
147  GYPFLAGS += -Dv8_vector_stores=1
148endif
149# imminentdeprecationwarnings=on
150ifeq ($(imminentdeprecationwarnings), on)
151  GYPFLAGS += -Dv8_imminent_deprecation_warnings=1
152endif
153# asan=on
154ifeq ($(asan), on)
155  GYPFLAGS += -Dasan=1 -Dclang=1
156  TESTFLAGS += --asan
157  ifeq ($(lsan), on)
158    GYPFLAGS += -Dlsan=1
159  endif
160endif
161ifdef embedscript
162  GYPFLAGS += -Dembed_script=$(embedscript)
163endif
164ifdef warmupscript
165  GYPFLAGS += -Dwarmup_script=$(warmupscript)
166endif
167ifeq ($(goma), on)
168  GYPFLAGS += -Duse_goma=1
169endif
170# v8_os_page_size=0, when 0 or not specified use build OS page size
171ifdef v8_os_page_size
172  ifneq ($(v8_os_page_size), 0)
173    ifneq ($(snapshot), off)
174      GYPFLAGS += -Dv8_os_page_size=$(v8_os_page_size)
175    endif
176  endif
177endif
178# arm specific flags.
179# arm_version=<number | "default">
180ifneq ($(strip $(arm_version)),)
181  GYPFLAGS += -Darm_version=$(arm_version)
182else
183# Deprecated (use arm_version instead): armv7=false/true
184ifeq ($(armv7), false)
185  GYPFLAGS += -Darm_version=6
186else
187ifeq ($(armv7), true)
188  GYPFLAGS += -Darm_version=7
189endif
190endif
191endif
192# hardfp=on/off. Deprecated, use armfloatabi
193ifeq ($(hardfp),on)
194  GYPFLAGS += -Darm_float_abi=hard
195else
196ifeq ($(hardfp),off)
197  GYPFLAGS += -Darm_float_abi=softfp
198endif
199endif
200# fpu: armfpu=xxx
201# xxx: vfp, vfpv3-d16, vfpv3, neon.
202ifeq ($(armfpu),)
203  GYPFLAGS += -Darm_fpu=default
204else
205  GYPFLAGS += -Darm_fpu=$(armfpu)
206endif
207# float abi: armfloatabi=softfp/hard
208ifeq ($(armfloatabi),)
209ifeq ($(hardfp),)
210  GYPFLAGS += -Darm_float_abi=default
211endif
212else
213  GYPFLAGS += -Darm_float_abi=$(armfloatabi)
214endif
215# armthumb=on/off
216ifeq ($(armthumb), off)
217  GYPFLAGS += -Darm_thumb=0
218else
219ifeq ($(armthumb), on)
220  GYPFLAGS += -Darm_thumb=1
221endif
222endif
223# arm_test_noprobe=on
224# With this flag set, by default v8 will only use features implied
225# by the compiler (no probe). This is done by modifying the default
226# values of enable_armv7, enable_vfp3, enable_32dregs and enable_neon.
227# Modifying these flags when launching v8 will enable the probing for
228# the specified values.
229ifeq ($(arm_test_noprobe), on)
230  GYPFLAGS += -Darm_test_noprobe=on
231endif
232# Do not omit the frame pointer, needed for profiling with perf
233ifeq ($(no_omit_framepointer), on)
234  GYPFLAGS += -Drelease_extra_cflags=-fno-omit-frame-pointer
235endif
236
237ifdef android_ndk_root
238  GYPFLAGS += -Dandroid_ndk_root=$(android_ndk_root)
239  export ANDROID_NDK_ROOT = $(android_ndk_root)
240endif
241
242# ----------------- available targets: --------------------
243# - "grokdump": rebuilds heap constants lists used by grokdump
244# - any arch listed in ARCHES (see below)
245# - any mode listed in MODES
246# - every combination <arch>.<mode>, e.g. "ia32.release"
247# - "native": current host's architecture, release mode
248# - any of the above with .check appended, e.g. "ia32.release.check"
249# - "android": cross-compile for Android/ARM
250# - default (no target specified): build all DEFAULT_ARCHES and MODES
251# - "check": build all targets and run all tests
252# - "<arch>.clean" for any <arch> in ARCHES
253# - "clean": clean all ARCHES
254
255# ----------------- internal stuff ------------------------
256
257# Architectures and modes to be compiled. Consider these to be internal
258# variables, don't override them (use the targets instead).
259ARCHES = ia32 x64 arm arm64 mips mipsel mips64 mips64el x87 ppc ppc64 s390 \
260         s390x
261ARCHES32 = ia32 arm mips mipsel x87 ppc s390
262DEFAULT_ARCHES = ia32 x64 arm
263MODES = release debug optdebug
264DEFAULT_MODES = release debug
265ANDROID_ARCHES = android_ia32 android_x64 android_arm android_arm64 \
266		 android_mipsel android_x87
267
268# List of files that trigger Makefile regeneration:
269GYPFILES = third_party/icu/icu.gypi third_party/icu/icu.gyp \
270	   gypfiles/shim_headers.gypi gypfiles/features.gypi \
271           gypfiles/standalone.gypi \
272	   gypfiles/toolchain.gypi gypfiles/all.gyp gypfiles/mac/asan.gyp \
273	   test/cctest/cctest.gyp test/fuzzer/fuzzer.gyp \
274	   test/unittests/unittests.gyp src/v8.gyp \
275	   tools/parser-shell.gyp testing/gmock.gyp testing/gtest.gyp \
276	   buildtools/third_party/libc++abi/libc++abi.gyp \
277	   buildtools/third_party/libc++/libc++.gyp samples/samples.gyp \
278	   src/third_party/vtune/v8vtune.gyp src/d8.gyp
279
280# If vtunejit=on, the v8vtune.gyp will be appended.
281ifeq ($(vtunejit), on)
282  GYPFILES += src/third_party/vtune/v8vtune.gyp
283endif
284# Generates all combinations of ARCHES and MODES, e.g. "ia32.release".
285BUILDS = $(foreach mode,$(MODES),$(addsuffix .$(mode),$(ARCHES)))
286ANDROID_BUILDS = $(foreach mode,$(MODES), \
287                   $(addsuffix .$(mode),$(ANDROID_ARCHES)))
288# Generates corresponding test targets, e.g. "ia32.release.check".
289CHECKS = $(addsuffix .check,$(BUILDS))
290QUICKCHECKS = $(addsuffix .quickcheck,$(BUILDS))
291ANDROID_CHECKS = $(addsuffix .check,$(ANDROID_BUILDS))
292# File where previously used GYPFLAGS are stored.
293ENVFILE = $(OUTDIR)/environment
294
295.PHONY: all check clean builddeps dependencies $(ENVFILE).new native \
296        qc quickcheck $(QUICKCHECKS) turbocheck \
297        $(addsuffix .quickcheck,$(MODES)) $(addsuffix .quickcheck,$(ARCHES)) \
298        $(ARCHES) $(MODES) $(BUILDS) $(CHECKS) $(addsuffix .clean,$(ARCHES)) \
299        $(addsuffix .check,$(MODES)) $(addsuffix .check,$(ARCHES)) \
300        $(ANDROID_ARCHES) $(ANDROID_BUILDS) $(ANDROID_CHECKS)
301
302# Target definitions. "all" is the default.
303all: $(DEFAULT_MODES)
304
305# Special target for the buildbots to use. Depends on $(OUTDIR)/Makefile
306# having been created before.
307buildbot:
308	$(MAKE) -C "$(OUTDIR)" BUILDTYPE=$(BUILDTYPE) \
309	        builddir="$(abspath $(OUTDIR))/$(BUILDTYPE)"
310
311# Compile targets. MODES and ARCHES are convenience targets.
312.SECONDEXPANSION:
313$(MODES): $(addsuffix .$$@,$(DEFAULT_ARCHES))
314
315$(ARCHES): $(addprefix $$@.,$(DEFAULT_MODES))
316
317# Defines how to build a particular target (e.g. ia32.release).
318$(BUILDS): $(OUTDIR)/Makefile.$$@
319	@$(MAKE) -C "$(OUTDIR)" -f Makefile.$@ \
320	         BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \
321	                     python -c "print \
322	                     raw_input().replace('opt', '').capitalize()") \
323	         builddir="$(shell pwd)/$(OUTDIR)/$@"
324
325native: $(OUTDIR)/Makefile.native
326	@$(MAKE) -C "$(OUTDIR)" -f Makefile.native \
327	         BUILDTYPE=Release \
328	         builddir="$(shell pwd)/$(OUTDIR)/$@"
329
330$(ANDROID_ARCHES): $(addprefix $$@.,$(MODES))
331
332$(ANDROID_BUILDS): $(GYPFILES) $(ENVFILE) Makefile.android
333	@$(MAKE) -f Makefile.android $@ \
334	        ARCH="$(basename $@)" \
335	        MODE="$(subst .,,$(suffix $@))" \
336	        OUTDIR="$(OUTDIR)" \
337	        GYPFLAGS="$(GYPFLAGS)"
338
339# Test targets.
340check: all
341	@tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
342	    --arch=$(shell echo $(DEFAULT_ARCHES) | sed -e 's/ /,/g') \
343	    $(TESTFLAGS)
344
345$(addsuffix .check,$(MODES)): $$(basename $$@)
346	@tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
347	    --mode=$(basename $@) $(TESTFLAGS)
348
349$(addsuffix .check,$(ARCHES)): $$(basename $$@)
350	@tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
351	    --arch=$(basename $@) $(TESTFLAGS)
352
353$(CHECKS): $$(basename $$@)
354	@tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
355	    --arch-and-mode=$(basename $@) $(TESTFLAGS)
356
357$(addsuffix .quickcheck,$(MODES)): $$(basename $$@)
358	@tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
359	    --mode=$(basename $@) $(TESTFLAGS) --quickcheck
360
361$(addsuffix .quickcheck,$(ARCHES)): $$(basename $$@)
362	@tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
363	    --arch=$(basename $@) $(TESTFLAGS) --quickcheck
364
365$(QUICKCHECKS): $$(basename $$@)
366	@tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
367	    --arch-and-mode=$(basename $@) $(TESTFLAGS) --quickcheck
368
369$(addsuffix .sync, $(ANDROID_BUILDS)): $$(basename $$@)
370	@tools/android-sync.sh $(basename $@) $(OUTDIR) \
371	                       $(shell pwd) $(ANDROID_V8)
372
373$(addsuffix .check, $(ANDROID_BUILDS)): $$(basename $$@).sync
374	@tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
375	     --arch-and-mode=$(basename $@) \
376	     --timeout=600 \
377	     --command-prefix="tools/android-run.py" $(TESTFLAGS)
378
379$(addsuffix .check, $(ANDROID_ARCHES)): \
380                $(addprefix $$(basename $$@).,$(MODES)).check
381
382native.check: native
383	@tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR)/native \
384	    --arch-and-mode=. $(TESTFLAGS)
385
386SUPERFASTTESTMODES = ia32.release
387FASTTESTMODES = $(SUPERFASTTESTMODES),x64.release,ia32.optdebug,x64.optdebug,arm.optdebug,arm64.release
388FASTCOMPILEMODES = $(FASTTESTMODES),arm64.optdebug
389
390COMMA = ,
391EMPTY =
392SPACE = $(EMPTY) $(EMPTY)
393quickcheck: $(subst $(COMMA),$(SPACE),$(FASTCOMPILEMODES))
394	tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
395	    --arch-and-mode=$(SUPERFASTTESTMODES) $(TESTFLAGS) --quickcheck \
396	    --download-data mozilla webkit
397	tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
398	    --arch-and-mode=$(FASTTESTMODES) $(TESTFLAGS) --quickcheck
399qc: quickcheck
400
401turbocheck: $(subst $(COMMA),$(SPACE),$(FASTCOMPILEMODES))
402	tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
403	    --arch-and-mode=$(SUPERFASTTESTMODES) $(TESTFLAGS) \
404	    --quickcheck --variants=turbofan --download-data mozilla webkit
405	tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
406	    --arch-and-mode=$(FASTTESTMODES) $(TESTFLAGS) \
407	    --quickcheck --variants=turbofan
408tc: turbocheck
409
410# Clean targets. You can clean each architecture individually, or everything.
411$(addsuffix .clean, $(ARCHES) $(ANDROID_ARCHES)):
412	rm -f $(OUTDIR)/Makefile.$(basename $@)*
413	rm -rf $(OUTDIR)/$(basename $@).release
414	rm -rf $(OUTDIR)/$(basename $@).debug
415	rm -rf $(OUTDIR)/$(basename $@).optdebug
416	find $(OUTDIR) -regex '.*\(host\|target\)\.$(basename $@).*\.mk' -delete
417
418native.clean:
419	rm -f $(OUTDIR)/Makefile.native
420	rm -rf $(OUTDIR)/native
421	find $(OUTDIR) -regex '.*\(host\|target\)\.native\.mk' -delete
422
423clean: $(addsuffix .clean, $(ARCHES) $(ANDROID_ARCHES)) native.clean gtags.clean tags.clean
424
425# GYP file generation targets.
426OUT_MAKEFILES = $(addprefix $(OUTDIR)/Makefile.,$(BUILDS))
427$(OUT_MAKEFILES): $(GYPFILES) $(ENVFILE)
428	$(eval CXX_TARGET_ARCH:=$(shell $(CXX) -v 2>&1 | grep ^Target: | \
429	        cut -f 2 -d " " | cut -f 1 -d "-" ))
430	$(eval CXX_TARGET_ARCH:=$(subst aarch64,arm64,$(CXX_TARGET_ARCH)))
431	$(eval CXX_TARGET_ARCH:=$(subst x86_64,x64,$(CXX_TARGET_ARCH)))
432	$(eval CXX_TARGET_ARCH:=$(subst s390x,s390,$(CXX_TARGET_ARCH)))
433	$(eval CXX_TARGET_ARCH:=$(subst powerpc,ppc,$(CXX_TARGET_ARCH)))
434	$(eval CXX_TARGET_ARCH:=$(subst ppc64,ppc,$(CXX_TARGET_ARCH)))
435	$(eval CXX_TARGET_ARCH:=$(subst ppcle,ppc,$(CXX_TARGET_ARCH)))
436	$(eval V8_TARGET_ARCH:=$(subst .,,$(suffix $(basename $@))))
437	PYTHONPATH="$(shell pwd)/tools/generate_shim_headers:$(shell pwd)/gypfiles:$(PYTHONPATH):$(shell pwd)/tools/gyp/pylib:$(PYTHONPATH)" \
438	GYP_GENERATORS=make \
439	tools/gyp/gyp --generator-output="$(OUTDIR)" gypfiles/all.gyp \
440	              -Igypfiles/standalone.gypi --depth=. \
441	              -Dv8_target_arch=$(V8_TARGET_ARCH) \
442	              $(if $(findstring $(CXX_TARGET_ARCH),$(V8_TARGET_ARCH)), \
443	              -Dtarget_arch=$(V8_TARGET_ARCH), \
444	                  $(if $(shell echo $(ARCHES32) | grep $(V8_TARGET_ARCH)), \
445	                  -Dtarget_arch=ia32,)) \
446	              $(if $(findstring optdebug,$@),-Dv8_optimized_debug=1,) \
447	              -S$(suffix $(basename $@))$(suffix $@) $(GYPFLAGS)
448
449$(OUTDIR)/Makefile.native: $(GYPFILES) $(ENVFILE)
450	PYTHONPATH="$(shell pwd)/tools/generate_shim_headers:$(shell pwd)/gypfiles:$(PYTHONPATH):$(shell pwd)/tools/gyp/pylib:$(PYTHONPATH)" \
451	GYP_GENERATORS=make \
452	tools/gyp/gyp --generator-output="$(OUTDIR)" gypfiles/all.gyp \
453	              -Igypfiles/standalone.gypi --depth=. -S.native $(GYPFLAGS)
454
455# Replaces the old with the new environment file if they're different, which
456# will trigger GYP to regenerate Makefiles.
457$(ENVFILE): $(ENVFILE).new
458	@if test -r $(ENVFILE) && cmp $(ENVFILE).new $(ENVFILE) > /dev/null; \
459	    then rm $(ENVFILE).new; \
460	    else mv $(ENVFILE).new $(ENVFILE); fi
461
462# Stores current GYPFLAGS in a file.
463$(ENVFILE).new:
464	$(eval CXX_TARGET_ARCH:=$(shell $(CXX) -v 2>&1 | grep ^Target: | \
465	        cut -f 2 -d " " | cut -f 1 -d "-" ))
466	$(eval CXX_TARGET_ARCH:=$(subst aarch64,arm64,$(CXX_TARGET_ARCH)))
467	$(eval CXX_TARGET_ARCH:=$(subst x86_64,x64,$(CXX_TARGET_ARCH)))
468	@mkdir -p $(OUTDIR); echo "GYPFLAGS=$(GYPFLAGS) -Dtarget_arch=$(CXX_TARGET_ARCH)" > $(ENVFILE).new;
469
470# Heap constants for grokdump.
471DUMP_FILE = tools/v8heapconst.py
472grokdump: ia32.release
473	@cat $(DUMP_FILE).tmpl > $(DUMP_FILE)
474	@$(OUTDIR)/ia32.release/d8 --dump-heap-constants >> $(DUMP_FILE)
475
476# Support for the GNU GLOBAL Source Code Tag System.
477gtags.files: $(GYPFILES) $(ENVFILE)
478	@find include src test -name '*.h' -o -name '*.cc' -o -name '*.c' > $@
479
480# We need to manually set the stack limit here, to work around bugs in
481# gmake-3.81 and global-5.7.1 on recent 64-bit Linux systems.
482# Using $(wildcard ...) gracefully ignores non-existing files, so that stale
483# gtags.files after switching branches don't cause recipe failures.
484GPATH GRTAGS GSYMS GTAGS: gtags.files $(wildcard $(shell cat gtags.files 2> /dev/null))
485	@bash -c 'ulimit -s 10240 && GTAGSFORCECPP=yes gtags -i -q -f $<'
486
487gtags.clean:
488	rm -f gtags.files GPATH GRTAGS GSYMS GTAGS
489
490tags: gtags.files $(wildcard $(shell cat gtags.files 2> /dev/null))
491	@(ctags --version | grep 'Exuberant Ctags' >/dev/null) || \
492		(echo "Please install Exuberant Ctags (check 'ctags --version')" >&2; false)
493	ctags --fields=+l -L $<
494
495tags.clean:
496	rm -r tags
497
498dependencies builddeps:
499	$(error Use 'gclient sync' instead)
500