hotspot/make/cscope.make
author mduigou
Tue, 10 May 2011 12:14:07 -0700
changeset 9686 0b94537ae69c
parent 9340 713176cf2ca5
child 10565 dc90c239f4ec
permissions -rw-r--r--
Merge
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) 2000, 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
9340
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
    25
# The cscope.out file is generated in the current directory.  The old cscope.out
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
    26
# file is *not* removed because cscope is smart enough to only build what has
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
    27
# changed.  cscope can be confused if files are renamed or removed, so it may be
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
    28
# necessary to remove cscope.out (gmake cscope.clean) if a lot of reorganization
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
    29
# has occurred.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
include $(GAMMADIR)/make/scm.make
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
RM	= rm -f
358
dfccc2e17f8d 6685160: fix cscope build with hg
ysr
parents: 1
diff changeset
    34
HG	= hg
9340
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
    35
CS_TOP	= $(GAMMADIR)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
338
5cf9f61d76f4 6583644: Move all managed/SCCS files out of 'build' into 'make' directory
kamg
parents: 1
diff changeset
    37
CSDIRS	= $(CS_TOP)/src $(CS_TOP)/make
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
CSINCS	= $(CSDIRS:%=-I%)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
CSCOPE		= cscope
9340
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
    41
CSCOPE_OUT	= cscope.out
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
CSCOPE_FLAGS	= -b
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
# Allow .java files to be added from the environment (CSCLASSES=yes).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
ifdef	CSCLASSES
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
ADDCLASSES=	-o -name '*.java'
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
# Adding CClassHeaders also pushes the file count of a full workspace up about
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
# 200 files (these files also don't exist in a new workspace, and thus will
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
# cause the recreation of the database as they get created, which might seem
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
# a little confusing).  Thus allow these files to be added from the environment
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
# (CSHEADERS=yes).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
ifndef	CSHEADERS
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
RMCCHEADERS=	-o -name CClassHeaders
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
9340
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
    58
# Ignore build products.
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
    59
CS_PRUNE_GENERATED	= -o -name '${OSNAME}_*_core' -o \
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
    60
			     -name '${OSNAME}_*_compiler?'
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
    61
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
    62
# O/S-specific files for all systems are included by default.  Set CS_OS to a
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
    63
# space-separated list of identifiers to include only those systems.
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
    64
ifdef	CS_OS
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
    65
CS_PRUNE_OS	= $(patsubst %,-o -name '*%*',\
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
    66
		    $(filter-out ${CS_OS},linux macos solaris windows))
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
9340
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
    69
# CPU-specific files for all processors are included by default.  Set CS_CPU 
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
    70
# space-separated list identifiers to include only those CPUs.
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
    71
ifdef	CS_CPU
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
    72
CS_PRUNE_CPU	= $(patsubst %,-o -name '*%*',\
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
    73
		    $(filter-out ${CS_CPU},arm ppc sparc x86 zero))
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
# What files should we include?  A simple rule might be just those files under
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
# SCCS control, however this would miss files we create like the opcodes and
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
# CClassHeaders.  The following attempts to find everything that is *useful*.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
# (.del files are created by sccsrm, demo directories contain many .java files
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
# that probably aren't useful for development, and the pkgarchive may contain
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
# duplicates of files within the source hierarchy).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
# Directories to exclude.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
CS_PRUNE_STD	= $(SCM_DIRS) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
		  -o -name '.del-*' \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
		  -o -name '*demo' \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
		  -o -name pkgarchive
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
9340
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
    89
# Placeholder for user-defined excludes.
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
    90
CS_PRUNE_EX	=
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
    91
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
CS_PRUNE	= $(CS_PRUNE_STD) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
		  $(CS_PRUNE_OS) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
		  $(CS_PRUNE_CPU) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
		  $(CS_PRUNE_GENERATED) \
9340
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
    96
		  $(CS_PRUNE_EX) \
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
		  $(RMCCHEADERS)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
# File names to include.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
CSFILENAMES	= -name '*.[ch]pp' \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
		  -o -name '*.[Ccshlxy]' \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
		  $(CS_ADD_GENERATED) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
		  -o -name '*.d' \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
		  -o -name '*.il' \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
		  -o -name '*.cc' \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
		  -o -name '*[Mm]akefile*' \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
		  -o -name '*.gmk' \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
		  -o -name '*.make' \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
		  -o -name '*.ad' \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
		  $(ADDCLASSES)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
9340
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
   112
.PHONY:		cscope cscope.clean cscope.scratch TAGS.clean FORCE
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
.PRECIOUS:	cscope.out
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
9340
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
   115
cscope $(CSCOPE_OUT): cscope.files FORCE
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
   116
	$(CSCOPE) -f $(CSCOPE_OUT) $(CSCOPE_FLAGS)
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
   117
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
   118
cscope.clean:
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
   119
	$(QUIETLY) $(RM) $(CSCOPE_OUT) cscope.files
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
   120
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
   121
cscope.scratch:  cscope.clean cscope
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
9340
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
   123
# The raw list is reordered so cscope displays the most relevant files first.
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
   124
cscope.files:
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
   125
	$(QUIETLY)						\
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
   126
	raw=cscope.$$$$;					\
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
   127
	find $(CSDIRS) -type d \( $(CS_PRUNE) \) -prune -o	\
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
   128
	    -type f \( $(CSFILENAMES) \) -print > $$raw;	\
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
   129
	{							\
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
   130
	echo "$(CSINCS)";					\
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
   131
	egrep -v "\.java|/make/" $$raw;				\
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
   132
	fgrep ".java" $$raw;					\
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
   133
	fgrep "/make/" $$raw;					\
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
   134
	} > $@;							\
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
   135
	rm -f $$raw
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
TAGS:  cscope.files FORCE
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
	egrep -v '^-|^$$' $< | etags --members -
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
9340
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
   140
TAGS.clean:
713176cf2ca5 7037250: cscope.make database generation is silently broken
jcoomes
parents: 5547
diff changeset
   141
	$(RM) TAGS