Home | History | Annotate | Download | only in v8
      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.
     30 OUTDIR ?= out
     31 TESTJOBS ?=
     32 GYPFLAGS ?=
     33 TESTFLAGS ?=
     34 ANDROID_NDK_HOST_ARCH ?=
     35 ANDROID_V8 ?= /data/local/tmp/v8
     36 
     37 # Special build flags. Use them like this: "make library=shared"
     38 
     39 # library=shared || component=shared_library
     40 ifeq ($(library), shared)
     41   GYPFLAGS += -Dcomponent=shared_library
     42 endif
     43 ifdef component
     44   GYPFLAGS += -Dcomponent=$(component)
     45 endif
     46 # disassembler=on
     47 ifeq ($(disassembler), on)
     48   GYPFLAGS += -Dv8_enable_disassembler=1
     49 endif
     50 # objectprint=on
     51 ifeq ($(objectprint), on)
     52   GYPFLAGS += -Dv8_object_print=1
     53 endif
     54 # verifycsa=on
     55 ifeq ($(verifycsa), on)
     56   GYPFLAGS += -Dv8_enable_verify_csa=1
     57 endif
     58 # verifyheap=on
     59 ifeq ($(verifyheap), on)
     60   GYPFLAGS += -Dv8_enable_verify_heap=1
     61 endif
     62 # tracemaps=on
     63 ifeq ($(tracemaps), on)
     64   GYPFLAGS += -Dv8_trace_maps=1
     65 endif
     66 # backtrace=off
     67 ifeq ($(backtrace), off)
     68   GYPFLAGS += -Dv8_enable_backtrace=0
     69 else
     70   GYPFLAGS += -Dv8_enable_backtrace=1
     71 endif
     72 # verifypredictable=on
     73 ifeq ($(verifypredictable), on)
     74   GYPFLAGS += -Dv8_enable_verify_predictable=1
     75 endif
     76 # snapshot=off
     77 ifeq ($(snapshot), off)
     78   GYPFLAGS += -Dv8_use_snapshot='false'
     79 endif
     80 ifeq ($(snapshot), external)
     81   GYPFLAGS += -Dv8_use_external_startup_data=1
     82 endif
     83 # extrachecks=on/off
     84 ifeq ($(extrachecks), on)
     85   GYPFLAGS += -Ddcheck_always_on=1 -Dv8_enable_handle_zapping=1
     86 endif
     87 ifeq ($(extrachecks), off)
     88   GYPFLAGS += -Ddcheck_always_on=0 -Dv8_enable_handle_zapping=0
     89 endif
     90 # slowdchecks=on/off
     91 ifeq ($(slowdchecks), on)
     92   GYPFLAGS += -Dv8_enable_slow_dchecks=1
     93 endif
     94 ifeq ($(slowdchecks), off)
     95   GYPFLAGS += -Dv8_enable_slow_dchecks=0
     96 endif
     97 # debugsymbols=on
     98 ifeq ($(debugsymbols), on)
     99   GYPFLAGS += -Drelease_extra_cflags=-ggdb3
    100 endif
    101 # gdbjit=on/off
    102 ifeq ($(gdbjit), on)
    103   GYPFLAGS += -Dv8_enable_gdbjit=1
    104 endif
    105 ifeq ($(gdbjit), off)
    106   GYPFLAGS += -Dv8_enable_gdbjit=0
    107 endif
    108 # vtunejit=on
    109 ifeq ($(vtunejit), on)
    110   GYPFLAGS += -Dv8_enable_vtunejit=1
    111 endif
    112 # unalignedaccess=on
    113 ifeq ($(unalignedaccess), on)
    114   GYPFLAGS += -Dv8_can_use_unaligned_accesses=true
    115 endif
    116 # randomseed=12345, disable random seed via randomseed=0
    117 ifdef randomseed
    118   GYPFLAGS += -Dv8_random_seed=$(randomseed)
    119 endif
    120 # soname_version=1.2.3
    121 ifdef soname_version
    122   GYPFLAGS += -Dsoname_version=$(soname_version)
    123 endif
    124 # werror=no
    125 ifeq ($(werror), no)
    126   GYPFLAGS += -Dwerror=''
    127 endif
    128 # strictaliasing=off (workaround for GCC-4.5)
    129 ifeq ($(strictaliasing), off)
    130   GYPFLAGS += -Dv8_no_strict_aliasing=1
    131 endif
    132 # regexp=interpreted
    133 ifeq ($(regexp), interpreted)
    134   GYPFLAGS += -Dv8_interpreted_regexp=1
    135 endif
    136 # i18nsupport=off
    137 ifeq ($(i18nsupport), off)
    138   GYPFLAGS += -Dv8_enable_i18n_support=0
    139   TESTFLAGS += --noi18n
    140 endif
    141 # deprecationwarnings=on
    142 ifeq ($(deprecationwarnings), on)
    143   GYPFLAGS += -Dv8_deprecation_warnings=1
    144 endif
    145 # vectorstores=on
    146 ifeq ($(vectorstores), on)
    147   GYPFLAGS += -Dv8_vector_stores=1
    148 endif
    149 # imminentdeprecationwarnings=on
    150 ifeq ($(imminentdeprecationwarnings), on)
    151   GYPFLAGS += -Dv8_imminent_deprecation_warnings=1
    152 endif
    153 # asan=on
    154 ifeq ($(asan), on)
    155   GYPFLAGS += -Dasan=1 -Dclang=1
    156   TESTFLAGS += --asan
    157   ifeq ($(lsan), on)
    158     GYPFLAGS += -Dlsan=1
    159   endif
    160 endif
    161 ifdef embedscript
    162   GYPFLAGS += -Dembed_script=$(embedscript)
    163 endif
    164 ifdef warmupscript
    165   GYPFLAGS += -Dwarmup_script=$(warmupscript)
    166 endif
    167 ifeq ($(goma), on)
    168   GYPFLAGS += -Duse_goma=1
    169 endif
    170 # v8_os_page_size=0, when 0 or not specified use build OS page size
    171 ifdef 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
    177 endif
    178 # arm specific flags.
    179 # arm_version=<number | "default">
    180 ifneq ($(strip $(arm_version)),)
    181   GYPFLAGS += -Darm_version=$(arm_version)
    182 else
    183 # Deprecated (use arm_version instead): armv7=false/true
    184 ifeq ($(armv7), false)
    185   GYPFLAGS += -Darm_version=6
    186 else
    187 ifeq ($(armv7), true)
    188   GYPFLAGS += -Darm_version=7
    189 endif
    190 endif
    191 endif
    192 # hardfp=on/off. Deprecated, use armfloatabi
    193 ifeq ($(hardfp),on)
    194   GYPFLAGS += -Darm_float_abi=hard
    195 else
    196 ifeq ($(hardfp),off)
    197   GYPFLAGS += -Darm_float_abi=softfp
    198 endif
    199 endif
    200 # fpu: armfpu=xxx
    201 # xxx: vfp, vfpv3-d16, vfpv3, neon.
    202 ifeq ($(armfpu),)
    203   GYPFLAGS += -Darm_fpu=default
    204 else
    205   GYPFLAGS += -Darm_fpu=$(armfpu)
    206 endif
    207 # float abi: armfloatabi=softfp/hard
    208 ifeq ($(armfloatabi),)
    209 ifeq ($(hardfp),)
    210   GYPFLAGS += -Darm_float_abi=default
    211 endif
    212 else
    213   GYPFLAGS += -Darm_float_abi=$(armfloatabi)
    214 endif
    215 # armthumb=on/off
    216 ifeq ($(armthumb), off)
    217   GYPFLAGS += -Darm_thumb=0
    218 else
    219 ifeq ($(armthumb), on)
    220   GYPFLAGS += -Darm_thumb=1
    221 endif
    222 endif
    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.
    229 ifeq ($(arm_test_noprobe), on)
    230   GYPFLAGS += -Darm_test_noprobe=on
    231 endif
    232 # Do not omit the frame pointer, needed for profiling with perf
    233 ifeq ($(no_omit_framepointer), on)
    234   GYPFLAGS += -Drelease_extra_cflags=-fno-omit-frame-pointer
    235 endif
    236 
    237 ifdef android_ndk_root
    238   GYPFLAGS += -Dandroid_ndk_root=$(android_ndk_root)
    239   export ANDROID_NDK_ROOT = $(android_ndk_root)
    240 endif
    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).
    259 ARCHES = ia32 x64 arm arm64 mips mipsel mips64 mips64el x87 ppc ppc64 s390 \
    260          s390x
    261 ARCHES32 = ia32 arm mips mipsel x87 ppc s390
    262 DEFAULT_ARCHES = ia32 x64 arm
    263 MODES = release debug optdebug
    264 DEFAULT_MODES = release debug
    265 ANDROID_ARCHES = android_ia32 android_x64 android_arm android_arm64 \
    266 		 android_mipsel android_x87
    267 
    268 # List of files that trigger Makefile regeneration:
    269 GYPFILES = 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.
    281 ifeq ($(vtunejit), on)
    282   GYPFILES += src/third_party/vtune/v8vtune.gyp
    283 endif
    284 # Generates all combinations of ARCHES and MODES, e.g. "ia32.release".
    285 BUILDS = $(foreach mode,$(MODES),$(addsuffix .$(mode),$(ARCHES)))
    286 ANDROID_BUILDS = $(foreach mode,$(MODES), \
    287                    $(addsuffix .$(mode),$(ANDROID_ARCHES)))
    288 # Generates corresponding test targets, e.g. "ia32.release.check".
    289 CHECKS = $(addsuffix .check,$(BUILDS))
    290 QUICKCHECKS = $(addsuffix .quickcheck,$(BUILDS))
    291 ANDROID_CHECKS = $(addsuffix .check,$(ANDROID_BUILDS))
    292 # File where previously used GYPFLAGS are stored.
    293 ENVFILE = $(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.
    303 all: $(DEFAULT_MODES)
    304 
    305 # Special target for the buildbots to use. Depends on $(OUTDIR)/Makefile
    306 # having been created before.
    307 buildbot:
    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 
    325 native: $(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.
    340 check: 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 
    382 native.check: native
    383 	@tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR)/native \
    384 	    --arch-and-mode=. $(TESTFLAGS)
    385 
    386 SUPERFASTTESTMODES = ia32.release
    387 FASTTESTMODES = $(SUPERFASTTESTMODES),x64.release,ia32.optdebug,x64.optdebug,arm.optdebug,arm64.release
    388 FASTCOMPILEMODES = $(FASTTESTMODES),arm64.optdebug
    389 
    390 COMMA = ,
    391 EMPTY =
    392 SPACE = $(EMPTY) $(EMPTY)
    393 quickcheck: $(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
    399 qc: quickcheck
    400 
    401 turbocheck: $(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
    408 tc: 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 
    418 native.clean:
    419 	rm -f $(OUTDIR)/Makefile.native
    420 	rm -rf $(OUTDIR)/native
    421 	find $(OUTDIR) -regex '.*\(host\|target\)\.native\.mk' -delete
    422 
    423 clean: $(addsuffix .clean, $(ARCHES) $(ANDROID_ARCHES)) native.clean gtags.clean tags.clean
    424 
    425 # GYP file generation targets.
    426 OUT_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.
    471 DUMP_FILE = tools/v8heapconst.py
    472 grokdump: 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.
    477 gtags.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.
    484 GPATH 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 
    487 gtags.clean:
    488 	rm -f gtags.files GPATH GRTAGS GSYMS GTAGS
    489 
    490 tags: 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 
    495 tags.clean:
    496 	rm -r tags
    497 
    498 dependencies builddeps:
    499 	$(error Use 'gclient sync' instead)
    500