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