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