source: trunk/openjdk/hotspot/make/linux/makefiles/cscope.make

Last change on this file was 278, checked in by dmik, 14 years ago

trunk: Merged in openjdk6 b22 from branches/vendor/oracle.

File size: 5.2 KB
Line 
1#
2# Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4#
5# This code is free software; you can redistribute it and/or modify it
6# under the terms of the GNU General Public License version 2 only, as
7# published by the Free Software Foundation.
8#
9# This code is distributed in the hope that it will be useful, but WITHOUT
10# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12# version 2 for more details (a copy is included in the LICENSE file that
13# accompanied this code).
14#
15# You should have received a copy of the GNU General Public License version
16# 2 along with this work; if not, write to the Free Software Foundation,
17# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18#
19# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20# or visit www.oracle.com if you need additional information or have any
21# questions.
22#
23#
24
25#
26# The cscope.out file is made in the current directory and spans the entire
27# source tree.
28#
29# Things to note:
30# 1. We use relative names for cscope.
31# 2. We *don't* remove the old cscope.out file, because cscope is smart
32# enough to only build what has changed. It can be confused, however,
33# if files are renamed or removed, so it may be necessary to manually
34# remove cscope.out if a lot of reorganization has occurred.
35#
36
37include $(GAMMADIR)/make/scm.make
38
39NAWK = awk
40RM = rm -f
41HG = hg
42CS_TOP = ../..
43
44CSDIRS = $(CS_TOP)/src $(CS_TOP)/build
45CSINCS = $(CSDIRS:%=-I%)
46
47CSCOPE = cscope
48CSCOPE_FLAGS = -b
49
50# Allow .java files to be added from the environment (CSCLASSES=yes).
51ifdef CSCLASSES
52ADDCLASSES= -o -name '*.java'
53endif
54
55# Adding CClassHeaders also pushes the file count of a full workspace up about
56# 200 files (these files also don't exist in a new workspace, and thus will
57# cause the recreation of the database as they get created, which might seem
58# a little confusing). Thus allow these files to be added from the environment
59# (CSHEADERS=yes).
60ifndef CSHEADERS
61RMCCHEADERS= -o -name CClassHeaders
62endif
63
64# Use CS_GENERATED=x to include auto-generated files in the build directories.
65ifdef CS_GENERATED
66CS_ADD_GENERATED = -o -name '*.incl'
67else
68CS_PRUNE_GENERATED = -o -name '${OS}_*_core' -o -name '${OS}_*_compiler?'
69endif
70
71# OS-specific files for other systems are excluded by default. Use CS_OS=yes
72# to include platform-specific files for other platforms.
73ifndef CS_OS
74CS_OS = linux macos solaris win32
75CS_PRUNE_OS = $(patsubst %,-o -name '*%*',$(filter-out ${OS},${CS_OS}))
76endif
77
78# Processor-specific files for other processors are excluded by default. Use
79# CS_CPU=x to include platform-specific files for other platforms.
80ifndef CS_CPU
81CS_CPU = i486 sparc amd64 ia64
82CS_PRUNE_CPU = $(patsubst %,-o -name '*%*',$(filter-out ${SRCARCH},${CS_CPU}))
83endif
84
85# What files should we include? A simple rule might be just those files under
86# SCCS control, however this would miss files we create like the opcodes and
87# CClassHeaders. The following attempts to find everything that is *useful*.
88# (.del files are created by sccsrm, demo directories contain many .java files
89# that probably aren't useful for development, and the pkgarchive may contain
90# duplicates of files within the source hierarchy).
91
92# Directories to exclude.
93CS_PRUNE_STD = $(SCM_DIRS) \
94 -o -name '.del-*' \
95 -o -name '*demo' \
96 -o -name pkgarchive
97
98CS_PRUNE = $(CS_PRUNE_STD) \
99 $(CS_PRUNE_OS) \
100 $(CS_PRUNE_CPU) \
101 $(CS_PRUNE_GENERATED) \
102 $(RMCCHEADERS)
103
104# File names to include.
105CSFILENAMES = -name '*.[ch]pp' \
106 -o -name '*.[Ccshlxy]' \
107 $(CS_ADD_GENERATED) \
108 -o -name '*.il' \
109 -o -name '*.cc' \
110 -o -name '*[Mm]akefile*' \
111 -o -name '*.gmk' \
112 -o -name '*.make' \
113 -o -name '*.ad' \
114 $(ADDCLASSES)
115
116.PRECIOUS: cscope.out
117
118cscope cscope.out: cscope.files FORCE
119 $(CSCOPE) $(CSCOPE_FLAGS)
120
121# The .raw file is reordered here in an attempt to make cscope display the most
122# relevant files first.
123cscope.files: .cscope.files.raw
124 echo "$(CSINCS)" > $@
125 -egrep -v "\.java|\/make\/" $< >> $@
126 -fgrep ".java" $< >> $@
127 -fgrep "/make/" $< >> $@
128
129.cscope.files.raw: .nametable.files
130 -find $(CSDIRS) -type d \( $(CS_PRUNE) \) -prune -o \
131 -type f \( $(CSFILENAMES) \) -print > $@
132
133cscope.clean: nametable.clean
134 -$(RM) cscope.out cscope.files .cscope.files.raw
135
136TAGS: cscope.files FORCE
137 egrep -v '^-|^$$' $< | etags --members -
138
139TAGS.clean: nametable.clean
140 -$(RM) TAGS
141
142# .nametable.files and .nametable.files.tmp are used to determine if any files
143# were added to/deleted from/renamed in the workspace. If not, then there's
144# normally no need to rebuild the cscope database. To force a rebuild of
145# the cscope database: gmake nametable.clean.
146.nametable.files: .nametable.files.tmp
147 ( cmp -s $@ $< ) || ( cp $< $@ )
148 -$(RM) $<
149
150# `hg status' is slightly faster than `hg fstatus'. Both are
151# quite a bit slower on an NFS mounted file system, so this is
152# really geared towards repos on local file systems.
153.nametable.files.tmp:
154 -$(HG) fstatus -acmn > $@
155nametable.clean:
156 -$(RM) .nametable.files .nametable.files.tmp
157
158FORCE:
159
160.PHONY: cscope cscope.clean TAGS.clean nametable.clean FORCE
Note: See TracBrowser for help on using the repository browser.