|
1 # |
|
2 # Copyright (c) 2000, 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 # The cscope.out file is generated in the current directory. The old cscope.out |
|
26 # file is *not* removed because cscope is smart enough to only build what has |
|
27 # changed. cscope can be confused if files are renamed or removed, so it may be |
|
28 # necessary to remove cscope.out (gmake cscope.clean) if a lot of reorganization |
|
29 # has occurred. |
|
30 |
|
31 include $(GAMMADIR)/make/scm.make |
|
32 |
|
33 RM = rm -f |
|
34 HG = hg |
|
35 CS_TOP = $(GAMMADIR) |
|
36 |
|
37 CSDIRS = $(CS_TOP)/src $(CS_TOP)/make |
|
38 CSINCS = $(CSDIRS:%=-I%) |
|
39 |
|
40 CSCOPE = cscope |
|
41 CSCOPE_OUT = cscope.out |
|
42 CSCOPE_FLAGS = -b |
|
43 |
|
44 # Allow .java files to be added from the environment (CSCLASSES=yes). |
|
45 ifdef CSCLASSES |
|
46 ADDCLASSES= -o -name '*.java' |
|
47 endif |
|
48 |
|
49 # Adding CClassHeaders also pushes the file count of a full workspace up about |
|
50 # 200 files (these files also don't exist in a new workspace, and thus will |
|
51 # cause the recreation of the database as they get created, which might seem |
|
52 # a little confusing). Thus allow these files to be added from the environment |
|
53 # (CSHEADERS=yes). |
|
54 ifndef CSHEADERS |
|
55 RMCCHEADERS= -o -name CClassHeaders |
|
56 endif |
|
57 |
|
58 # Ignore build products. |
|
59 CS_PRUNE_GENERATED = -o -name '${OSNAME}_*_core' -o \ |
|
60 -name '${OSNAME}_*_compiler?' |
|
61 |
|
62 # O/S-specific files for all systems are included by default. Set CS_OS to a |
|
63 # space-separated list of identifiers to include only those systems. |
|
64 ifdef CS_OS |
|
65 CS_PRUNE_OS = $(patsubst %,-o -name '*%*',\ |
|
66 $(filter-out ${CS_OS},linux macos solaris windows)) |
|
67 endif |
|
68 |
|
69 # CPU-specific files for all processors are included by default. Set CS_CPU |
|
70 # space-separated list identifiers to include only those CPUs. |
|
71 ifdef CS_CPU |
|
72 CS_PRUNE_CPU = $(patsubst %,-o -name '*%*',\ |
|
73 $(filter-out ${CS_CPU},arm ppc sparc x86 zero)) |
|
74 endif |
|
75 |
|
76 # What files should we include? A simple rule might be just those files under |
|
77 # SCCS control, however this would miss files we create like the opcodes and |
|
78 # CClassHeaders. The following attempts to find everything that is *useful*. |
|
79 # (.del files are created by sccsrm, demo directories contain many .java files |
|
80 # that probably aren't useful for development, and the pkgarchive may contain |
|
81 # duplicates of files within the source hierarchy). |
|
82 |
|
83 # Directories to exclude. |
|
84 CS_PRUNE_STD = $(SCM_DIRS) \ |
|
85 -o -name '.del-*' \ |
|
86 -o -name '*demo' \ |
|
87 -o -name pkgarchive |
|
88 |
|
89 # Placeholder for user-defined excludes. |
|
90 CS_PRUNE_EX = |
|
91 |
|
92 CS_PRUNE = $(CS_PRUNE_STD) \ |
|
93 $(CS_PRUNE_OS) \ |
|
94 $(CS_PRUNE_CPU) \ |
|
95 $(CS_PRUNE_GENERATED) \ |
|
96 $(CS_PRUNE_EX) \ |
|
97 $(RMCCHEADERS) |
|
98 |
|
99 # File names to include. |
|
100 CSFILENAMES = -name '*.[ch]pp' \ |
|
101 -o -name '*.[Ccshlxy]' \ |
|
102 $(CS_ADD_GENERATED) \ |
|
103 -o -name '*.d' \ |
|
104 -o -name '*.il' \ |
|
105 -o -name '*.cc' \ |
|
106 -o -name '*[Mm]akefile*' \ |
|
107 -o -name '*.gmk' \ |
|
108 -o -name '*.make' \ |
|
109 -o -name '*.ad' \ |
|
110 $(ADDCLASSES) |
|
111 |
|
112 .PHONY: cscope cscope.clean cscope.scratch TAGS.clean FORCE |
|
113 .PRECIOUS: cscope.out |
|
114 |
|
115 cscope $(CSCOPE_OUT): cscope.files FORCE |
|
116 $(CSCOPE) -f $(CSCOPE_OUT) $(CSCOPE_FLAGS) |
|
117 |
|
118 cscope.clean: |
|
119 $(QUIETLY) $(RM) $(CSCOPE_OUT) cscope.files |
|
120 |
|
121 cscope.scratch: cscope.clean cscope |
|
122 |
|
123 # The raw list is reordered so cscope displays the most relevant files first. |
|
124 cscope.files: |
|
125 $(QUIETLY) \ |
|
126 raw=cscope.$$$$; \ |
|
127 find $(CSDIRS) -type d \( $(CS_PRUNE) \) -prune -o \ |
|
128 -type f \( $(CSFILENAMES) \) -print > $$raw; \ |
|
129 { \ |
|
130 echo "$(CSINCS)"; \ |
|
131 egrep -v "\.java|/make/" $$raw; \ |
|
132 fgrep ".java" $$raw; \ |
|
133 fgrep "/make/" $$raw; \ |
|
134 } > $@; \ |
|
135 rm -f $$raw |
|
136 |
|
137 TAGS: cscope.files FORCE |
|
138 egrep -v '^-|^$$' $< | etags --members - |
|
139 |
|
140 TAGS.clean: |
|
141 $(RM) TAGS |