hotspot/make/solaris/makefiles/cscope.make
changeset 9654 2fc5ecbea1ce
parent 9653 6a1eff16874d
parent 9644 04f88d98efe3
child 9655 e19b80de8a7f
equal deleted inserted replaced
9653:6a1eff16874d 9654:2fc5ecbea1ce
     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 #
       
    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 HG	= hg
       
    42 CS_TOP	= ../..
       
    43 
       
    44 CSDIRS	= $(CS_TOP)/src $(CS_TOP)/make
       
    45 CSINCS	= $(CSDIRS:%=-I%)
       
    46 
       
    47 CSCOPE		= cscope
       
    48 CSCOPE_FLAGS	= -b
       
    49 
       
    50 # Allow .java files to be added from the environment (CSCLASSES=yes).
       
    51 ifdef	CSCLASSES
       
    52 ADDCLASSES=	-o -name '*.java'
       
    53 endif
       
    54 
       
    55 # Adding CClassHeaders also pushes the file count of a full workspace up about
       
    56 # 200 files (these files also don't exist in a new workspace, and thus will
       
    57 # cause the recreation of the database as they get created, which might seem
       
    58 # a little confusing).  Thus allow these files to be added from the environment
       
    59 # (CSHEADERS=yes).
       
    60 ifndef	CSHEADERS
       
    61 RMCCHEADERS=	-o -name CClassHeaders
       
    62 endif
       
    63 
       
    64 # Use CS_GENERATED=x to include auto-generated files in the make directories.
       
    65 ifdef	CS_GENERATED
       
    66 CS_ADD_GENERATED	= -o -name '*.incl'
       
    67 else
       
    68 CS_PRUNE_GENERATED	= -o -name '${OS}_*_core' -o -name '${OS}_*_compiler?'
       
    69 endif
       
    70 
       
    71 # OS-specific files for other systems are excluded by default.  Use CS_OS=yes
       
    72 # to include platform-specific files for other platforms.
       
    73 ifndef	CS_OS
       
    74 CS_OS		= linux macos solaris win32
       
    75 CS_PRUNE_OS	= $(patsubst %,-o -name '*%*',$(filter-out ${OS},${CS_OS}))
       
    76 endif
       
    77 
       
    78 # Processor-specific files for other processors are excluded by default.  Use
       
    79 # CS_CPU=x to include platform-specific files for other platforms.
       
    80 ifndef	CS_CPU
       
    81 CS_CPU		= i486 sparc amd64 ia64
       
    82 CS_PRUNE_CPU	= $(patsubst %,-o -name '*%*',$(filter-out ${SRCARCH},${CS_CPU}))
       
    83 endif
       
    84 
       
    85 # What files should we include?  A simple rule might be just those files under
       
    86 # SCCS control, however this would miss files we create like the opcodes and
       
    87 # CClassHeaders.  The following attempts to find everything that is *useful*.
       
    88 # (.del files are created by sccsrm, demo directories contain many .java files
       
    89 # that probably aren't useful for development, and the pkgarchive may contain
       
    90 # duplicates of files within the source hierarchy).
       
    91 
       
    92 # Directories to exclude.
       
    93 CS_PRUNE_STD	= $(SCM_DIRS) \
       
    94 		  -o -name '.del-*' \
       
    95 		  -o -name '*demo' \
       
    96 		  -o -name pkgarchive
       
    97 
       
    98 CS_PRUNE	= $(CS_PRUNE_STD) \
       
    99 		  $(CS_PRUNE_OS) \
       
   100 		  $(CS_PRUNE_CPU) \
       
   101 		  $(CS_PRUNE_GENERATED) \
       
   102 		  $(RMCCHEADERS)
       
   103 
       
   104 # File names to include.
       
   105 CSFILENAMES	= -name '*.[ch]pp' \
       
   106 		  -o -name '*.[Ccshlxy]' \
       
   107 		  $(CS_ADD_GENERATED) \
       
   108 		  -o -name '*.d' \
       
   109 		  -o -name '*.il' \
       
   110 		  -o -name '*.cc' \
       
   111 		  -o -name '*[Mm]akefile*' \
       
   112 		  -o -name '*.gmk' \
       
   113 		  -o -name '*.make' \
       
   114 		  -o -name '*.ad' \
       
   115 		  $(ADDCLASSES)
       
   116 
       
   117 .PRECIOUS:	cscope.out
       
   118 
       
   119 cscope cscope.out: cscope.files FORCE
       
   120 	$(CSCOPE) $(CSCOPE_FLAGS)
       
   121 
       
   122 # The .raw file is reordered here in an attempt to make cscope display the most
       
   123 # relevant files first.
       
   124 cscope.files: .cscope.files.raw
       
   125 	echo "$(CSINCS)" > $@
       
   126 	-egrep -v "\.java|\/make\/"	$< >> $@
       
   127 	-fgrep ".java"			$< >> $@
       
   128 	-fgrep "/make/"		$< >> $@
       
   129 
       
   130 .cscope.files.raw:  .nametable.files
       
   131 	-find $(CSDIRS) -type d \( $(CS_PRUNE) \) -prune -o \
       
   132 	    -type f \( $(CSFILENAMES) \) -print > $@
       
   133 
       
   134 cscope.clean:  nametable.clean
       
   135 	-$(RM) cscope.out cscope.files .cscope.files.raw
       
   136 
       
   137 TAGS:  cscope.files FORCE
       
   138 	egrep -v '^-|^$$' $< | etags --members -
       
   139 
       
   140 TAGS.clean:  nametable.clean
       
   141 	-$(RM) TAGS
       
   142 
       
   143 # .nametable.files and .nametable.files.tmp are used to determine if any files
       
   144 # were added to/deleted from/renamed in the workspace.  If not, then there's
       
   145 # normally no need to rebuild the cscope database. To force a rebuild of
       
   146 # the cscope database: gmake nametable.clean.
       
   147 .nametable.files:  .nametable.files.tmp
       
   148 	( cmp -s $@ $< ) || ( cp $< $@ )
       
   149 	-$(RM) $<
       
   150 
       
   151 # `hg status' is slightly faster than `hg fstatus'. Both are
       
   152 # quite a bit slower on an NFS mounted file system, so this is
       
   153 # really geared towards repos on local file systems.
       
   154 .nametable.files.tmp:
       
   155 	-$(HG) fstatus -acmn > $@
       
   156 
       
   157 nametable.clean:
       
   158 	-$(RM) .nametable.files .nametable.files.tmp
       
   159 
       
   160 FORCE:
       
   161 
       
   162 .PHONY:		cscope cscope.clean TAGS.clean nametable.clean FORCE