|
1 # |
|
2 # Copyright 2000-2007 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
20 # CA 95054 USA or visit www.sun.com if you need additional information or |
|
21 # have any 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 |
|
37 include $(GAMMADIR)/make/scm.make |
|
38 |
|
39 NAWK = /usr/xpg4/bin/awk |
|
40 RM = rm -f |
|
41 CS_TOP = ../.. |
|
42 |
|
43 CSDIRS = $(CS_TOP)/src $(CS_TOP)/make |
|
44 CSINCS = $(CSDIRS:%=-I%) |
|
45 |
|
46 CSCOPE = cscope |
|
47 CSCOPE_FLAGS = -b |
|
48 |
|
49 # Allow .java files to be added from the environment (CSCLASSES=yes). |
|
50 ifdef CSCLASSES |
|
51 ADDCLASSES= -o -name '*.java' |
|
52 endif |
|
53 |
|
54 # Adding CClassHeaders also pushes the file count of a full workspace up about |
|
55 # 200 files (these files also don't exist in a new workspace, and thus will |
|
56 # cause the recreation of the database as they get created, which might seem |
|
57 # a little confusing). Thus allow these files to be added from the environment |
|
58 # (CSHEADERS=yes). |
|
59 ifndef CSHEADERS |
|
60 RMCCHEADERS= -o -name CClassHeaders |
|
61 endif |
|
62 |
|
63 # Use CS_GENERATED=x to include auto-generated files in the make directories. |
|
64 ifdef CS_GENERATED |
|
65 CS_ADD_GENERATED = -o -name '*.incl' |
|
66 else |
|
67 CS_PRUNE_GENERATED = -o -name '${OS}_*_core' -o -name '${OS}_*_compiler?' |
|
68 endif |
|
69 |
|
70 # OS-specific files for other systems are excluded by default. Use CS_OS=yes |
|
71 # to include platform-specific files for other platforms. |
|
72 ifndef CS_OS |
|
73 CS_OS = linux macos solaris win32 |
|
74 CS_PRUNE_OS = $(patsubst %,-o -name '*%*',$(filter-out ${OS},${CS_OS})) |
|
75 endif |
|
76 |
|
77 # Processor-specific files for other processors are excluded by default. Use |
|
78 # CS_CPU=x to include platform-specific files for other platforms. |
|
79 ifndef CS_CPU |
|
80 CS_CPU = i486 sparc amd64 ia64 |
|
81 CS_PRUNE_CPU = $(patsubst %,-o -name '*%*',$(filter-out ${SRCARCH},${CS_CPU})) |
|
82 endif |
|
83 |
|
84 # What files should we include? A simple rule might be just those files under |
|
85 # SCCS control, however this would miss files we create like the opcodes and |
|
86 # CClassHeaders. The following attempts to find everything that is *useful*. |
|
87 # (.del files are created by sccsrm, demo directories contain many .java files |
|
88 # that probably aren't useful for development, and the pkgarchive may contain |
|
89 # duplicates of files within the source hierarchy). |
|
90 |
|
91 # Directories to exclude. |
|
92 CS_PRUNE_STD = $(SCM_DIRS) \ |
|
93 -o -name '.del-*' \ |
|
94 -o -name '*demo' \ |
|
95 -o -name pkgarchive |
|
96 |
|
97 CS_PRUNE = $(CS_PRUNE_STD) \ |
|
98 $(CS_PRUNE_OS) \ |
|
99 $(CS_PRUNE_CPU) \ |
|
100 $(CS_PRUNE_GENERATED) \ |
|
101 $(RMCCHEADERS) |
|
102 |
|
103 # File names to include. |
|
104 CSFILENAMES = -name '*.[ch]pp' \ |
|
105 -o -name '*.[Ccshlxy]' \ |
|
106 $(CS_ADD_GENERATED) \ |
|
107 -o -name '*.d' \ |
|
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 |
|
118 cscope 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. |
|
123 cscope.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 |
|
133 cscope.clean: nametable.clean |
|
134 -$(RM) cscope.out cscope.files .cscope.files.raw |
|
135 |
|
136 TAGS: cscope.files FORCE |
|
137 egrep -v '^-|^$$' $< | etags --members - |
|
138 |
|
139 TAGS.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 run find. To force a 'find': gmake nametable.clean. |
|
145 .nametable.files: .nametable.files.tmp |
|
146 cmp -s $@ $< || cp $< $@ |
|
147 |
|
148 .nametable.files.tmp: $(CS_TOP)/Codemgr_wsdata/nametable |
|
149 $(NAWK) \ |
|
150 '{ if (sub("( [a-z0-9]{2,8}){4}$$", "")) print $$0; }' $< > $@ |
|
151 |
|
152 nametable.clean: |
|
153 -$(RM) .nametable.files .nametable.files.tmp |
|
154 |
|
155 FORCE: |
|
156 |
|
157 .PHONY: cscope cscope.clean TAGS.clean nametable.clean FORCE |