build/solaris/makefiles/cscope.make

Sat, 01 Dec 2007 00:00:00 +0000

author
duke
date
Sat, 01 Dec 2007 00:00:00 +0000
changeset 435
a61af66fc99e
child 546
7747916a0945
permissions
-rw-r--r--

Initial load

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

mercurial