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