make/cscope.make

changeset 0
f90c822e73f8
child 6876
710a3c8b516e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/make/cscope.make	Wed Apr 27 01:25:04 2016 +0800
     1.3 @@ -0,0 +1,141 @@
     1.4 +#
     1.5 +# Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
     1.6 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 +#
     1.8 +# This code is free software; you can redistribute it and/or modify it
     1.9 +# under the terms of the GNU General Public License version 2 only, as
    1.10 +# published by the Free Software Foundation.
    1.11 +#
    1.12 +# This code is distributed in the hope that it will be useful, but WITHOUT
    1.13 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.14 +# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.15 +# version 2 for more details (a copy is included in the LICENSE file that
    1.16 +# accompanied this code).
    1.17 +#
    1.18 +# You should have received a copy of the GNU General Public License version
    1.19 +# 2 along with this work; if not, write to the Free Software Foundation,
    1.20 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.21 +#
    1.22 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.23 +# or visit www.oracle.com if you need additional information or have any
    1.24 +# questions.
    1.25 +#  
    1.26 +#
    1.27 +
    1.28 +# The cscope.out file is generated in the current directory.  The old cscope.out
    1.29 +# file is *not* removed because cscope is smart enough to only build what has
    1.30 +# changed.  cscope can be confused if files are renamed or removed, so it may be
    1.31 +# necessary to remove cscope.out (gmake cscope.clean) if a lot of reorganization
    1.32 +# has occurred.
    1.33 +
    1.34 +include $(GAMMADIR)/make/scm.make
    1.35 +
    1.36 +RM	= rm -f
    1.37 +HG	= hg
    1.38 +CS_TOP	= $(GAMMADIR)
    1.39 +
    1.40 +CSDIRS	= $(CS_TOP)/src $(CS_TOP)/make
    1.41 +CSINCS	= $(CSDIRS:%=-I%)
    1.42 +
    1.43 +CSCOPE		= cscope
    1.44 +CSCOPE_OUT	= cscope.out
    1.45 +CSCOPE_FLAGS	= -b
    1.46 +
    1.47 +# Allow .java files to be added from the environment (CSCLASSES=yes).
    1.48 +ifdef	CSCLASSES
    1.49 +ADDCLASSES=	-o -name '*.java'
    1.50 +endif
    1.51 +
    1.52 +# Adding CClassHeaders also pushes the file count of a full workspace up about
    1.53 +# 200 files (these files also don't exist in a new workspace, and thus will
    1.54 +# cause the recreation of the database as they get created, which might seem
    1.55 +# a little confusing).  Thus allow these files to be added from the environment
    1.56 +# (CSHEADERS=yes).
    1.57 +ifndef	CSHEADERS
    1.58 +RMCCHEADERS=	-o -name CClassHeaders
    1.59 +endif
    1.60 +
    1.61 +# Ignore build products.
    1.62 +CS_PRUNE_GENERATED	= -o -name '${OSNAME}_*_core' -o \
    1.63 +			     -name '${OSNAME}_*_compiler?'
    1.64 +
    1.65 +# O/S-specific files for all systems are included by default.  Set CS_OS to a
    1.66 +# space-separated list of identifiers to include only those systems.
    1.67 +ifdef	CS_OS
    1.68 +CS_PRUNE_OS	= $(patsubst %,-o -name '*%*',\
    1.69 +		    $(filter-out ${CS_OS},bsd linux macos solaris windows))
    1.70 +endif
    1.71 +
    1.72 +# CPU-specific files for all processors are included by default.  Set CS_CPU 
    1.73 +# space-separated list identifiers to include only those CPUs.
    1.74 +ifdef	CS_CPU
    1.75 +CS_PRUNE_CPU	= $(patsubst %,-o -name '*%*',\
    1.76 +		    $(filter-out ${CS_CPU},arm ppc sparc x86 zero))
    1.77 +endif
    1.78 +
    1.79 +# What files should we include?  A simple rule might be just those files under
    1.80 +# SCCS control, however this would miss files we create like the opcodes and
    1.81 +# CClassHeaders.  The following attempts to find everything that is *useful*.
    1.82 +# (.del files are created by sccsrm, demo directories contain many .java files
    1.83 +# that probably aren't useful for development, and the pkgarchive may contain
    1.84 +# duplicates of files within the source hierarchy).
    1.85 +
    1.86 +# Directories to exclude.
    1.87 +CS_PRUNE_STD	= $(SCM_DIRS) \
    1.88 +		  -o -name '.del-*' \
    1.89 +		  -o -name '*demo' \
    1.90 +		  -o -name pkgarchive
    1.91 +
    1.92 +# Placeholder for user-defined excludes.
    1.93 +CS_PRUNE_EX	=
    1.94 +
    1.95 +CS_PRUNE	= $(CS_PRUNE_STD) \
    1.96 +		  $(CS_PRUNE_OS) \
    1.97 +		  $(CS_PRUNE_CPU) \
    1.98 +		  $(CS_PRUNE_GENERATED) \
    1.99 +		  $(CS_PRUNE_EX) \
   1.100 +		  $(RMCCHEADERS)
   1.101 +
   1.102 +# File names to include.
   1.103 +CSFILENAMES	= -name '*.[ch]pp' \
   1.104 +		  -o -name '*.[Ccshlxy]' \
   1.105 +		  $(CS_ADD_GENERATED) \
   1.106 +		  -o -name '*.d' \
   1.107 +		  -o -name '*.il' \
   1.108 +		  -o -name '*.cc' \
   1.109 +		  -o -name '*[Mm]akefile*' \
   1.110 +		  -o -name '*.gmk' \
   1.111 +		  -o -name '*.make' \
   1.112 +		  -o -name '*.ad' \
   1.113 +		  $(ADDCLASSES)
   1.114 +
   1.115 +.PHONY:		cscope cscope.clean cscope.scratch TAGS.clean FORCE
   1.116 +.PRECIOUS:	cscope.out
   1.117 +
   1.118 +cscope $(CSCOPE_OUT): cscope.files FORCE
   1.119 +	$(CSCOPE) -f $(CSCOPE_OUT) $(CSCOPE_FLAGS)
   1.120 +
   1.121 +cscope.clean:
   1.122 +	$(QUIETLY) $(RM) $(CSCOPE_OUT) cscope.files
   1.123 +
   1.124 +cscope.scratch:  cscope.clean cscope
   1.125 +
   1.126 +# The raw list is reordered so cscope displays the most relevant files first.
   1.127 +cscope.files:
   1.128 +	$(QUIETLY)						\
   1.129 +	raw=cscope.$$$$;					\
   1.130 +	find $(CSDIRS) -type d \( $(CS_PRUNE) \) -prune -o	\
   1.131 +	    -type f \( $(CSFILENAMES) \) -print > $$raw;	\
   1.132 +	{							\
   1.133 +	echo "$(CSINCS)";					\
   1.134 +	egrep -v "\.java|/make/" $$raw;				\
   1.135 +	fgrep ".java" $$raw;					\
   1.136 +	fgrep "/make/" $$raw;					\
   1.137 +	} > $@;							\
   1.138 +	rm -f $$raw
   1.139 +
   1.140 +TAGS:  cscope.files FORCE
   1.141 +	egrep -v '^-|^$$' $< | etags --members -
   1.142 +
   1.143 +TAGS.clean:
   1.144 +	$(RM) TAGS

mercurial