Makefile 17 KB
Newer Older
1
# Copyright 2012 the V8 project authors. All rights reserved.
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
#     * Redistributions of source code must retain the above copyright
#       notice, this list of conditions and the following disclaimer.
#     * Redistributions in binary form must reproduce the above
#       copyright notice, this list of conditions and the following
#       disclaimer in the documentation and/or other materials provided
#       with the distribution.
#     * Neither the name of Google Inc. nor the names of its
#       contributors may be used to endorse or promote products derived
#       from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


# Variable default definitions. Override them by exporting them in your shell.
OUTDIR ?= out
31
TESTJOBS ?=
32
GYPFLAGS ?=
33
TESTFLAGS ?=
34
ANDROID_NDK_HOST_ARCH ?=
35
ANDROID_V8 ?= /data/local/tmp/v8
36 37 38 39 40 41 42 43 44 45 46 47 48 49

# Special build flags. Use them like this: "make library=shared"

# library=shared || component=shared_library
ifeq ($(library), shared)
  GYPFLAGS += -Dcomponent=shared_library
endif
ifdef component
  GYPFLAGS += -Dcomponent=$(component)
endif
# disassembler=on
ifeq ($(disassembler), on)
  GYPFLAGS += -Dv8_enable_disassembler=1
endif
50 51 52 53
# objectprint=on
ifeq ($(objectprint), on)
  GYPFLAGS += -Dv8_object_print=1
endif
54 55 56 57
# verifyheap=on
ifeq ($(verifyheap), on)
  GYPFLAGS += -Dv8_enable_verify_heap=1
endif
58 59 60 61
# tracemaps=on
ifeq ($(tracemaps), on)
  GYPFLAGS += -Dv8_trace_maps=1
endif
62 63 64 65 66 67
# backtrace=off
ifeq ($(backtrace), off)
  GYPFLAGS += -Dv8_enable_backtrace=0
else
  GYPFLAGS += -Dv8_enable_backtrace=1
endif
68 69 70 71
# verifypredictable=on
ifeq ($(verifypredictable), on)
  GYPFLAGS += -Dv8_enable_verify_predictable=1
endif
72 73 74 75
# snapshot=off
ifeq ($(snapshot), off)
  GYPFLAGS += -Dv8_use_snapshot='false'
endif
76 77 78
ifeq ($(snapshot), external)
  GYPFLAGS += -Dv8_use_external_startup_data=1
endif
79 80
# extrachecks=on/off
ifeq ($(extrachecks), on)
jochen's avatar
jochen committed
81
  GYPFLAGS += -Ddcheck_always_on=1 -Dv8_enable_handle_zapping=1
82 83
endif
ifeq ($(extrachecks), off)
jochen's avatar
jochen committed
84
  GYPFLAGS += -Ddcheck_always_on=0 -Dv8_enable_handle_zapping=0
85
endif
86 87 88 89 90 91 92
# slowdchecks=on/off
ifeq ($(slowdchecks), on)
  GYPFLAGS += -Dv8_enable_slow_dchecks=1
endif
ifeq ($(slowdchecks), off)
  GYPFLAGS += -Dv8_enable_slow_dchecks=0
endif
93 94 95 96
# debugsymbols=on
ifeq ($(debugsymbols), on)
  GYPFLAGS += -Drelease_extra_cflags=-ggdb3
endif
97
# gdbjit=on/off
98 99 100
ifeq ($(gdbjit), on)
  GYPFLAGS += -Dv8_enable_gdbjit=1
endif
101 102 103
ifeq ($(gdbjit), off)
  GYPFLAGS += -Dv8_enable_gdbjit=0
endif
104 105 106 107
# vtunejit=on
ifeq ($(vtunejit), on)
  GYPFLAGS += -Dv8_enable_vtunejit=1
endif
108 109 110 111
# unalignedaccess=on
ifeq ($(unalignedaccess), on)
  GYPFLAGS += -Dv8_can_use_unaligned_accesses=true
endif
112 113 114 115
# randomseed=12345, disable random seed via randomseed=0
ifdef randomseed
  GYPFLAGS += -Dv8_random_seed=$(randomseed)
endif
116 117 118 119
# soname_version=1.2.3
ifdef soname_version
  GYPFLAGS += -Dsoname_version=$(soname_version)
endif
120 121 122 123
# werror=no
ifeq ($(werror), no)
  GYPFLAGS += -Dwerror=''
endif
124 125 126 127
# strictaliasing=off (workaround for GCC-4.5)
ifeq ($(strictaliasing), off)
  GYPFLAGS += -Dv8_no_strict_aliasing=1
endif
128 129 130 131
# regexp=interpreted
ifeq ($(regexp), interpreted)
  GYPFLAGS += -Dv8_interpreted_regexp=1
endif
132 133 134 135
# i18nsupport=off
ifeq ($(i18nsupport), off)
  GYPFLAGS += -Dv8_enable_i18n_support=0
  TESTFLAGS += --noi18n
136
endif
137
# deprecationwarnings=on
138 139
ifeq ($(deprecationwarnings), on)
  GYPFLAGS += -Dv8_deprecation_warnings=1
140
endif
141 142 143 144
# vectorstores=on
ifeq ($(vectorstores), on)
  GYPFLAGS += -Dv8_vector_stores=1
endif
145 146 147 148
# imminentdeprecationwarnings=on
ifeq ($(imminentdeprecationwarnings), on)
  GYPFLAGS += -Dv8_imminent_deprecation_warnings=1
endif
149 150 151
# asan=on
ifeq ($(asan), on)
  GYPFLAGS += -Dasan=1 -Dclang=1
152 153 154 155
  TESTFLAGS += --asan
  ifeq ($(lsan), on)
    GYPFLAGS += -Dlsan=1
  endif
156
endif
157 158 159
ifdef embedscript
  GYPFLAGS += -Dembed_script=$(embedscript)
endif
160 161 162
ifdef warmupscript
  GYPFLAGS += -Dwarmup_script=$(warmupscript)
endif
163 164 165
ifeq ($(goma), on)
  GYPFLAGS += -Duse_goma=1
endif
166
# arm specific flags.
167 168 169 170 171
# arm_version=<number | "default">
ifneq ($(strip $(arm_version)),)
  GYPFLAGS += -Darm_version=$(arm_version)
else
# Deprecated (use arm_version instead): armv7=false/true
172
ifeq ($(armv7), false)
173
  GYPFLAGS += -Darm_version=6
174 175
else
ifeq ($(armv7), true)
176 177
  GYPFLAGS += -Darm_version=7
endif
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
endif
endif
# hardfp=on/off. Deprecated, use armfloatabi
ifeq ($(hardfp),on)
  GYPFLAGS += -Darm_float_abi=hard
else
ifeq ($(hardfp),off)
  GYPFLAGS += -Darm_float_abi=softfp
endif
endif
# fpu: armfpu=xxx
# xxx: vfp, vfpv3-d16, vfpv3, neon.
ifeq ($(armfpu),)
  GYPFLAGS += -Darm_fpu=default
else
  GYPFLAGS += -Darm_fpu=$(armfpu)
endif
# float abi: armfloatabi=softfp/hard
ifeq ($(armfloatabi),)
ifeq ($(hardfp),)
  GYPFLAGS += -Darm_float_abi=default
endif
else
  GYPFLAGS += -Darm_float_abi=$(armfloatabi)
endif
# armthumb=on/off
ifeq ($(armthumb), off)
  GYPFLAGS += -Darm_thumb=0
else
ifeq ($(armthumb), on)
  GYPFLAGS += -Darm_thumb=1
endif
endif
211
# arm_test_noprobe=on
212 213
# With this flag set, by default v8 will only use features implied
# by the compiler (no probe). This is done by modifying the default
214
# values of enable_armv7, enable_vfp3, enable_32dregs and enable_neon.
215 216
# Modifying these flags when launching v8 will enable the probing for
# the specified values.
217 218
ifeq ($(arm_test_noprobe), on)
  GYPFLAGS += -Darm_test_noprobe=on
219
endif
220 221 222 223
# Do not omit the frame pointer, needed for profiling with perf
ifeq ($(no_omit_framepointer), on)
  GYPFLAGS += -Drelease_extra_cflags=-fno-omit-frame-pointer
endif
224

225 226 227 228 229
ifdef android_ndk_root
  GYPFLAGS += -Dandroid_ndk_root=$(android_ndk_root)
  export ANDROID_NDK_ROOT = $(android_ndk_root)
endif

230
# ----------------- available targets: --------------------
231
# - "grokdump": rebuilds heap constants lists used by grokdump
232 233 234
# - any arch listed in ARCHES (see below)
# - any mode listed in MODES
# - every combination <arch>.<mode>, e.g. "ia32.release"
235
# - "native": current host's architecture, release mode
236
# - any of the above with .check appended, e.g. "ia32.release.check"
237
# - "android": cross-compile for Android/ARM
238
# - default (no target specified): build all DEFAULT_ARCHES and MODES
239 240 241 242 243 244 245 246
# - "check": build all targets and run all tests
# - "<arch>.clean" for any <arch> in ARCHES
# - "clean": clean all ARCHES

# ----------------- internal stuff ------------------------

# Architectures and modes to be compiled. Consider these to be internal
# variables, don't override them (use the targets instead).
247 248 249
ARCHES = ia32 x64 arm arm64 mips mipsel mips64 mips64el x87 ppc ppc64 s390 \
         s390x
ARCHES32 = ia32 arm mips mipsel x87 ppc s390
250
DEFAULT_ARCHES = ia32 x64 arm
251 252
MODES = release debug optdebug
DEFAULT_MODES = release debug
253 254
ANDROID_ARCHES = android_ia32 android_x64 android_arm android_arm64 \
		 android_mipsel android_x87
255 256

# List of files that trigger Makefile regeneration:
257
GYPFILES = third_party/icu/icu.gypi third_party/icu/icu.gyp \
258 259 260
	   gypfiles/shim_headers.gypi gypfiles/features.gypi \
           gypfiles/standalone.gypi \
	   gypfiles/toolchain.gypi gypfiles/all.gyp gypfiles/mac/asan.gyp \
261
	   test/cctest/cctest.gyp test/fuzzer/fuzzer.gyp \
262
	   test/unittests/unittests.gyp src/v8.gyp \
263 264 265 266
	   tools/parser-shell.gyp testing/gmock.gyp testing/gtest.gyp \
	   buildtools/third_party/libc++abi/libc++abi.gyp \
	   buildtools/third_party/libc++/libc++.gyp samples/samples.gyp \
	   src/third_party/vtune/v8vtune.gyp src/d8.gyp
267

268 269 270 271
# If vtunejit=on, the v8vtune.gyp will be appended.
ifeq ($(vtunejit), on)
  GYPFILES += src/third_party/vtune/v8vtune.gyp
endif
272 273
# Generates all combinations of ARCHES and MODES, e.g. "ia32.release".
BUILDS = $(foreach mode,$(MODES),$(addsuffix .$(mode),$(ARCHES)))
274 275
ANDROID_BUILDS = $(foreach mode,$(MODES), \
                   $(addsuffix .$(mode),$(ANDROID_ARCHES)))
276
# Generates corresponding test targets, e.g. "ia32.release.check".
277
CHECKS = $(addsuffix .check,$(BUILDS))
278
QUICKCHECKS = $(addsuffix .quickcheck,$(BUILDS))
279
ANDROID_CHECKS = $(addsuffix .check,$(ANDROID_BUILDS))
280 281
# File where previously used GYPFLAGS are stored.
ENVFILE = $(OUTDIR)/environment
282

283
.PHONY: all check clean builddeps dependencies $(ENVFILE).new native \
284
        qc quickcheck $(QUICKCHECKS) turbocheck \
285
        $(addsuffix .quickcheck,$(MODES)) $(addsuffix .quickcheck,$(ARCHES)) \
286
        $(ARCHES) $(MODES) $(BUILDS) $(CHECKS) $(addsuffix .clean,$(ARCHES)) \
287
        $(addsuffix .check,$(MODES)) $(addsuffix .check,$(ARCHES)) \
yangguo's avatar
yangguo committed
288
        $(ANDROID_ARCHES) $(ANDROID_BUILDS) $(ANDROID_CHECKS)
289

290
# Target definitions. "all" is the default.
291
all: $(DEFAULT_MODES)
292

293 294
# Special target for the buildbots to use. Depends on $(OUTDIR)/Makefile
# having been created before.
295
buildbot:
296 297 298
	$(MAKE) -C "$(OUTDIR)" BUILDTYPE=$(BUILDTYPE) \
	        builddir="$(abspath $(OUTDIR))/$(BUILDTYPE)"

299 300
# Compile targets. MODES and ARCHES are convenience targets.
.SECONDEXPANSION:
301
$(MODES): $(addsuffix .$$@,$(DEFAULT_ARCHES))
302

303
$(ARCHES): $(addprefix $$@.,$(DEFAULT_MODES))
304

305
# Defines how to build a particular target (e.g. ia32.release).
306
$(BUILDS): $(OUTDIR)/Makefile.$$@
307
	@$(MAKE) -C "$(OUTDIR)" -f Makefile.$@ \
308
	         BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \
309 310
	                     python -c "print \
	                     raw_input().replace('opt', '').capitalize()") \
311 312
	         builddir="$(shell pwd)/$(OUTDIR)/$@"

313
native: $(OUTDIR)/Makefile.native
314
	@$(MAKE) -C "$(OUTDIR)" -f Makefile.native \
315
	         BUILDTYPE=Release \
316 317
	         builddir="$(shell pwd)/$(OUTDIR)/$@"

318
$(ANDROID_ARCHES): $(addprefix $$@.,$(MODES))
319

320
$(ANDROID_BUILDS): $(GYPFILES) $(ENVFILE) Makefile.android
321 322 323 324 325
	@$(MAKE) -f Makefile.android $@ \
	        ARCH="$(basename $@)" \
	        MODE="$(subst .,,$(suffix $@))" \
	        OUTDIR="$(OUTDIR)" \
	        GYPFLAGS="$(GYPFLAGS)"
326

327 328
# Test targets.
check: all
329
	@tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
330
	    --arch=$(shell echo $(DEFAULT_ARCHES) | sed -e 's/ /,/g') \
331
	    $(TESTFLAGS)
332

333
$(addsuffix .check,$(MODES)): $$(basename $$@)
334
	@tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
335
	    --mode=$(basename $@) $(TESTFLAGS)
336 337

$(addsuffix .check,$(ARCHES)): $$(basename $$@)
338
	@tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
339
	    --arch=$(basename $@) $(TESTFLAGS)
340 341

$(CHECKS): $$(basename $$@)
342
	@tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
343
	    --arch-and-mode=$(basename $@) $(TESTFLAGS)
344

345 346 347 348 349 350 351 352 353 354 355 356
$(addsuffix .quickcheck,$(MODES)): $$(basename $$@)
	@tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
	    --mode=$(basename $@) $(TESTFLAGS) --quickcheck

$(addsuffix .quickcheck,$(ARCHES)): $$(basename $$@)
	@tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
	    --arch=$(basename $@) $(TESTFLAGS) --quickcheck

$(QUICKCHECKS): $$(basename $$@)
	@tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
	    --arch-and-mode=$(basename $@) $(TESTFLAGS) --quickcheck

357
$(addsuffix .sync, $(ANDROID_BUILDS)): $$(basename $$@)
358 359 360
	@tools/android-sync.sh $(basename $@) $(OUTDIR) \
	                       $(shell pwd) $(ANDROID_V8)

361
$(addsuffix .check, $(ANDROID_BUILDS)): $$(basename $$@).sync
362
	@tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
363
	     --arch-and-mode=$(basename $@) \
364
	     --timeout=600 \
365
	     --command-prefix="tools/android-run.py" $(TESTFLAGS)
366

367 368
$(addsuffix .check, $(ANDROID_ARCHES)): \
                $(addprefix $$(basename $$@).,$(MODES)).check
369

370
native.check: native
371
	@tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR)/native \
372
	    --arch-and-mode=. $(TESTFLAGS)
373

374
SUPERFASTTESTMODES = ia32.release
375 376
FASTTESTMODES = $(SUPERFASTTESTMODES),x64.release,ia32.optdebug,x64.optdebug,arm.optdebug,arm64.release
FASTCOMPILEMODES = $(FASTTESTMODES),arm64.optdebug
377

378 379 380
COMMA = ,
EMPTY =
SPACE = $(EMPTY) $(EMPTY)
381
quickcheck: $(subst $(COMMA),$(SPACE),$(FASTCOMPILEMODES))
382 383 384
	tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
	    --arch-and-mode=$(SUPERFASTTESTMODES) $(TESTFLAGS) --quickcheck \
	    --download-data mozilla webkit
385 386
	tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
	    --arch-and-mode=$(FASTTESTMODES) $(TESTFLAGS) --quickcheck
387 388
qc: quickcheck

389 390 391 392 393 394 395 396 397
turbocheck: $(subst $(COMMA),$(SPACE),$(FASTCOMPILEMODES))
	tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
	    --arch-and-mode=$(SUPERFASTTESTMODES) $(TESTFLAGS) \
	    --quickcheck --variants=turbofan --download-data mozilla webkit
	tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
	    --arch-and-mode=$(FASTTESTMODES) $(TESTFLAGS) \
	    --quickcheck --variants=turbofan
tc: turbocheck

398
# Clean targets. You can clean each architecture individually, or everything.
yangguo's avatar
yangguo committed
399
$(addsuffix .clean, $(ARCHES) $(ANDROID_ARCHES)):
400
	rm -f $(OUTDIR)/Makefile.$(basename $@)*
401 402
	rm -rf $(OUTDIR)/$(basename $@).release
	rm -rf $(OUTDIR)/$(basename $@).debug
403
	rm -rf $(OUTDIR)/$(basename $@).optdebug
404
	find $(OUTDIR) -regex '.*\(host\|target\)\.$(basename $@).*\.mk' -delete
405

406
native.clean:
407
	rm -f $(OUTDIR)/Makefile.native
408
	rm -rf $(OUTDIR)/native
409
	find $(OUTDIR) -regex '.*\(host\|target\)\.native\.mk' -delete
410

yangguo's avatar
yangguo committed
411
clean: $(addsuffix .clean, $(ARCHES) $(ANDROID_ARCHES)) native.clean gtags.clean tags.clean
412 413

# GYP file generation targets.
414
OUT_MAKEFILES = $(addprefix $(OUTDIR)/Makefile.,$(BUILDS))
415
$(OUT_MAKEFILES): $(GYPFILES) $(ENVFILE)
416 417
	$(eval CXX_TARGET_ARCH:=$(shell $(CXX) -v 2>&1 | grep ^Target: | \
	        cut -f 2 -d " " | cut -f 1 -d "-" ))
418
	$(eval CXX_TARGET_ARCH:=$(subst aarch64,arm64,$(CXX_TARGET_ARCH)))
419
	$(eval CXX_TARGET_ARCH:=$(subst x86_64,x64,$(CXX_TARGET_ARCH)))
420 421 422 423
	$(eval CXX_TARGET_ARCH:=$(subst s390x,s390,$(CXX_TARGET_ARCH)))
	$(eval CXX_TARGET_ARCH:=$(subst powerpc,ppc,$(CXX_TARGET_ARCH)))
	$(eval CXX_TARGET_ARCH:=$(subst ppc64,ppc,$(CXX_TARGET_ARCH)))
	$(eval CXX_TARGET_ARCH:=$(subst ppcle,ppc,$(CXX_TARGET_ARCH)))
424
	$(eval V8_TARGET_ARCH:=$(subst .,,$(suffix $(basename $@))))
425
	PYTHONPATH="$(shell pwd)/tools/generate_shim_headers:$(shell pwd)/gypfiles:$(PYTHONPATH):$(shell pwd)/tools/gyp/pylib:$(PYTHONPATH)" \
426
	GYP_GENERATORS=make \
427 428
	tools/gyp/gyp --generator-output="$(OUTDIR)" gypfiles/all.gyp \
	              -Igypfiles/standalone.gypi --depth=. \
429
	              -Dv8_target_arch=$(V8_TARGET_ARCH) \
430
	              $(if $(findstring $(CXX_TARGET_ARCH),$(V8_TARGET_ARCH)), \
431 432 433
	              -Dtarget_arch=$(V8_TARGET_ARCH), \
	                  $(if $(shell echo $(ARCHES32) | grep $(V8_TARGET_ARCH)), \
	                  -Dtarget_arch=ia32,)) \
434
	              $(if $(findstring optdebug,$@),-Dv8_optimized_debug=1,) \
435
	              -S$(suffix $(basename $@))$(suffix $@) $(GYPFLAGS)
436

437
$(OUTDIR)/Makefile.native: $(GYPFILES) $(ENVFILE)
438
	PYTHONPATH="$(shell pwd)/tools/generate_shim_headers:$(shell pwd)/gypfiles:$(PYTHONPATH):$(shell pwd)/tools/gyp/pylib:$(PYTHONPATH)" \
439
	GYP_GENERATORS=make \
440 441
	tools/gyp/gyp --generator-output="$(OUTDIR)" gypfiles/all.gyp \
	              -Igypfiles/standalone.gypi --depth=. -S.native $(GYPFLAGS)
442

443 444 445
# Replaces the old with the new environment file if they're different, which
# will trigger GYP to regenerate Makefiles.
$(ENVFILE): $(ENVFILE).new
446
	@if test -r $(ENVFILE) && cmp $(ENVFILE).new $(ENVFILE) > /dev/null; \
447 448 449 450 451
	    then rm $(ENVFILE).new; \
	    else mv $(ENVFILE).new $(ENVFILE); fi

# Stores current GYPFLAGS in a file.
$(ENVFILE).new:
452 453 454
	$(eval CXX_TARGET_ARCH:=$(shell $(CXX) -v 2>&1 | grep ^Target: | \
	        cut -f 2 -d " " | cut -f 1 -d "-" ))
	$(eval CXX_TARGET_ARCH:=$(subst aarch64,arm64,$(CXX_TARGET_ARCH)))
455
	$(eval CXX_TARGET_ARCH:=$(subst x86_64,x64,$(CXX_TARGET_ARCH)))
456
	@mkdir -p $(OUTDIR); echo "GYPFLAGS=$(GYPFLAGS) -Dtarget_arch=$(CXX_TARGET_ARCH)" > $(ENVFILE).new;
457

458 459 460 461 462 463
# Heap constants for grokdump.
DUMP_FILE = tools/v8heapconst.py
grokdump: ia32.release
	@cat $(DUMP_FILE).tmpl > $(DUMP_FILE)
	@$(OUTDIR)/ia32.release/d8 --dump-heap-constants >> $(DUMP_FILE)

464 465 466 467
# Support for the GNU GLOBAL Source Code Tag System.
gtags.files: $(GYPFILES) $(ENVFILE)
	@find include src test -name '*.h' -o -name '*.cc' -o -name '*.c' > $@

468 469
# We need to manually set the stack limit here, to work around bugs in
# gmake-3.81 and global-5.7.1 on recent 64-bit Linux systems.
470 471 472
# Using $(wildcard ...) gracefully ignores non-existing files, so that stale
# gtags.files after switching branches don't cause recipe failures.
GPATH GRTAGS GSYMS GTAGS: gtags.files $(wildcard $(shell cat gtags.files 2> /dev/null))
473
	@bash -c 'ulimit -s 10240 && GTAGSFORCECPP=yes gtags -i -q -f $<'
474 475

gtags.clean:
476
	rm -f gtags.files GPATH GRTAGS GSYMS GTAGS
477

478 479 480 481 482 483 484 485
tags: gtags.files $(wildcard $(shell cat gtags.files 2> /dev/null))
	@(ctags --version | grep 'Exuberant Ctags' >/dev/null) || \
		(echo "Please install Exuberant Ctags (check 'ctags --version')" >&2; false)
	ctags --fields=+l -L $<

tags.clean:
	rm -r tags

486 487
dependencies builddeps:
	$(error Use 'gclient sync' instead)