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