annotate make/common/Cscope.gmk @ 0:37a05a11f281

Initial load
author duke
date Sat, 01 Dec 2007 00:00:00 +0000
parents
children 00cd9dc3c2b5
rev   line source
duke@0 1 #
duke@0 2 # Copyright 1998-2007 Sun Microsystems, Inc. All Rights Reserved.
duke@0 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@0 4 #
duke@0 5 # This code is free software; you can redistribute it and/or modify it
duke@0 6 # under the terms of the GNU General Public License version 2 only, as
duke@0 7 # published by the Free Software Foundation. Sun designates this
duke@0 8 # particular file as subject to the "Classpath" exception as provided
duke@0 9 # by Sun in the LICENSE file that accompanied this code.
duke@0 10 #
duke@0 11 # This code is distributed in the hope that it will be useful, but WITHOUT
duke@0 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@0 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@0 14 # version 2 for more details (a copy is included in the LICENSE file that
duke@0 15 # accompanied this code).
duke@0 16 #
duke@0 17 # You should have received a copy of the GNU General Public License version
duke@0 18 # 2 along with this work; if not, write to the Free Software Foundation,
duke@0 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@0 20 #
duke@0 21 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@0 22 # CA 95054 USA or visit www.sun.com if you need additional information or
duke@0 23 # have any questions.
duke@0 24 #
duke@0 25
duke@0 26 #
duke@0 27 # The cscope.out file is made in the current directory and spans the entire
duke@0 28 # source tree.
duke@0 29 #
duke@0 30 # Things to note:
duke@0 31 # 1. We use relative names for cscope.
duke@0 32 # 2. We *don't* remove the old cscope.out file, because cscope is smart
duke@0 33 # enough to only build what has changed. It can be confused, however,
duke@0 34 # if files are renamed or removed, so it may be necessary to manually
duke@0 35 # remove cscope.out if a lot of reorganization has occurred.
duke@0 36 #
duke@0 37 CSDIRS = $(JDK_TOPDIR)/src $(JDK_TOPDIR)/build
duke@0 38 CSINCS = $(CSDIRS:%=-I%)
duke@0 39
duke@0 40 #
duke@0 41 # Set CSFLAGS env variable to -b when using fast cscope to build the fast
duke@0 42 # (but large) cscope data bases.
duke@0 43 #
duke@0 44 CSCOPE = cscope-fast
duke@0 45 ifeq ($(CSCOPE), cscope-fast)
duke@0 46 CSFLAGS = -b
duke@0 47 endif
duke@0 48
duke@0 49 #
duke@0 50 # Adding .java files pushes the file count of a full workspace up about 2500
duke@0 51 # files, which slows database lookup. Thus allow these files to be added from
duke@0 52 # the environment (CSCLASSES=yes).
duke@0 53 #
duke@0 54 ifdef CSCLASSES
duke@0 55 ADDCLASSES= -o -name '*.java'
duke@0 56 endif
duke@0 57
duke@0 58 #
duke@0 59 # Adding CClassHeaders also pushes the file count of a full workspace up about
duke@0 60 # 200 files (these files also don't exist in a new workspace, and thus will
duke@0 61 # cause the recreation of the database as they get created, which might seem
duke@0 62 # A little confusing). Thus allow these files to be added from the environment
duke@0 63 # (CSHEADERS=yes).
duke@0 64 #
duke@0 65 ifndef CSHEADERS
duke@0 66 RMCCHEADERS= -o -name CClassHeaders
duke@0 67 endif
duke@0 68
duke@0 69
duke@0 70 .PRECIOUS: cscope.out
duke@0 71
duke@0 72 cscope.out: cscope.files FRC
duke@0 73 $(CSCOPE) $(CSFLAGS)
duke@0 74
duke@0 75 #
duke@0 76 # What files should we include? A simple rule might be just those files under
duke@0 77 # SCM control, however this would miss files we create like the opcodes and
duke@0 78 # CClassHeaders. The following attempts to find everything that is *useful*.
duke@0 79 # (.del files are created by sccsrm, demo directories contain many .java files
duke@0 80 # that probably aren't useful for development, and the pkgarchive may contain
duke@0 81 # duplicates of files within the source hierarchy). The ordering of the .raw
duke@0 82 # file is an attempt to make cscope display the most relevant files first.
duke@0 83 #
duke@0 84 cscope.files: FRC
duke@0 85 @-$(RM) cscope.files cscope.files.raw
duke@0 86 echo "$(CSINCS)" > cscope.files
duke@0 87 -find $(CSDIRS) $(SCM_DIRS_prune) -o -type d \( -name '.del-*' -o \
duke@0 88 -name '*demo' -o -name pkgarchive $(RMCCHEADERS) \) -prune -o \
duke@0 89 -type f \( -name '*.[Ccshlxy]' -o -name '*.il' -o -name '*.cc' -o \
duke@0 90 -name 'Makefile*' -o -name GNUmakefile -o -name '*.gmk' -o \
duke@0 91 -name '*.cpp' $(ADDCLASSES) \) -print > cscope.files.raw
duke@0 92 -egrep -v "\.java|\/build\/" cscope.files.raw >> cscope.files
duke@0 93 -fgrep ".java" cscope.files.raw >> cscope.files
duke@0 94 -fgrep "/build/" cscope.files.raw >> cscope.files
duke@0 95 @-$(RM) cscope.files.raw
duke@0 96
duke@0 97 cscope.clean:
duke@0 98 -$(RM) cscope.files cscope.files.raw cscope.out
duke@0 99
duke@0 100 FRC: