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