[Makefile] Move tags generation to standalone Makefile

After deprecating the top-file Makefile, "make tags" cannot easily be
used any more. Moving the tags-related rules out to a separate Makefile
allows to continue using it using either "make -f tools/Makefile.tags
tags", or including it in your own Makefile.

R=yangguo@chromium.org
CC=ahaas@chromium.org

Bug: v8:7346
Change-Id: Id2a8186c392fbca4d144b166d598c9e930defa37
Reviewed-on: https://chromium-review.googlesource.com/881018
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50889}
This commit is contained in:
Clemens Hammacher 2018-01-23 13:20:25 +01:00 committed by Commit Bot
parent ee2d85a37a
commit ed8efcf4f1
2 changed files with 33 additions and 23 deletions

View File

@ -39,6 +39,8 @@ $(warning See https://github.com/v8/v8/wiki/Building-with-GN)
$(warning Or contact yangguo@chromium.org.)
$(error Expect the Makefile to be removed soon)
include tools/Makefile.tags
# Special build flags. Use them like this: "make library=shared"
# library=shared || component=shared_library
@ -421,7 +423,7 @@ native.clean:
rm -rf $(OUTDIR)/native
find $(OUTDIR) -regex '.*\(host\|target\)\.native\.mk' -delete
clean: $(addsuffix .clean, $(ARCHES) $(ANDROID_ARCHES)) native.clean gtags.clean tags.clean
clean: $(addsuffix .clean, $(ARCHES) $(ANDROID_ARCHES)) native.clean
# GYP file generation targets.
OUT_MAKEFILES = $(addprefix $(OUTDIR)/Makefile.,$(BUILDS))
@ -468,27 +470,5 @@ $(ENVFILE).new:
$(eval CXX_TARGET_ARCH:=$(subst x86_64,x64,$(CXX_TARGET_ARCH)))
@mkdir -p $(OUTDIR); echo "GYPFLAGS=$(GYPFLAGS) -Dtarget_arch=$(CXX_TARGET_ARCH)" > $(ENVFILE).new;
# 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' > $@
# 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.
# 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))
@bash -c 'ulimit -s 10240 && GTAGSFORCECPP=yes gtags -i -q -f $<'
gtags.clean:
rm -f gtags.files GPATH GRTAGS GSYMS GTAGS
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
dependencies builddeps:
$(error Use 'gclient sync' instead)

30
tools/Makefile.tags Normal file
View File

@ -0,0 +1,30 @@
# Copyright 2018 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Variable default definitions. Override them by exporting them in your shell.
V8_DIR ?= $(realpath $(dir $(lastword $(MAKEFILE_LIST)))/..)
# Support for the GNU GLOBAL Source Code Tag System.
$(V8_DIR)/gtags.files: $(wildcard $(addprefix $(V8_DIR)/,$(shell cat $(V8_DIR)/gtags.files 2> /dev/null)))
@(cd $(V8_DIR) && find include src test -name '*.h' -o -name '*.cc' -o -name '*.c') > $@
# 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.
# Using $(wildcard ...) gracefully ignores non-existing files, so that stale
# gtags.files after switching branches don't cause recipe failures.
$(V8_DIR)/GPATH $(V8_DIR)/GRTAGS $(V8_DIR)/GSYMS $(V8_DIR)/GTAGS: $(V8_DIR)/gtags.files $(wildcard $(addprefix $(V8_DIR)/,$(shell cat $(V8_DIR)/gtags.files 2> /dev/null)))
@cd $(V8_DIR) && bash -c 'ulimit -s 10240 && GTAGSFORCECPP=yes gtags -i -q -f $<'
$(V8_DIR)/tags: $(V8_DIR)/gtags.files $(wildcard $(addprefix $(V8_DIR)/,$(shell cat $(V8_DIR)/gtags.files 2> /dev/null)))
@(ctags --version | grep 'Exuberant Ctags' >/dev/null) || \
(echo "Please install Exuberant Ctags (check 'ctags --version')" >&2; false)
@cd $(V8_DIR) && ctags --fields=+l -L gtags.files
tags: $(V8_DIR)/tags
tags.clean:
@rm -f $(addprefix $(V8_DIR), gtags.files GPATH GRTAGS GSYMS GTAGS tags)
clean: tags.clean