From ed8efcf4f10df4530b21a2769f7e37b9c5d7992c Mon Sep 17 00:00:00 2001 From: Clemens Hammacher Date: Tue, 23 Jan 2018 13:20:25 +0100 Subject: [PATCH] [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 Commit-Queue: Clemens Hammacher Cr-Commit-Position: refs/heads/master@{#50889} --- Makefile | 26 +++----------------------- tools/Makefile.tags | 30 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 23 deletions(-) create mode 100644 tools/Makefile.tags diff --git a/Makefile b/Makefile index dc3e51ea01..3957195e1b 100644 --- a/Makefile +++ b/Makefile @@ -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) diff --git a/tools/Makefile.tags b/tools/Makefile.tags new file mode 100644 index 0000000000..372824dad7 --- /dev/null +++ b/tools/Makefile.tags @@ -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