build/solaris/makefiles/cscope.make

changeset 435
a61af66fc99e
child 546
7747916a0945
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/build/solaris/makefiles/cscope.make	Sat Dec 01 00:00:00 2007 +0000
     1.3 @@ -0,0 +1,157 @@
     1.4 +#
     1.5 +# Copyright 2000-2007 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    1.23 +# CA 95054 USA or visit www.sun.com if you need additional information or
    1.24 +# have any questions.
    1.25 +#  
    1.26 +#
    1.27 +
    1.28 +#
    1.29 +# The cscope.out file is made in the current directory and spans the entire
    1.30 +# source tree.
    1.31 +#
    1.32 +# Things to note:
    1.33 +#	1. We use relative names for cscope.
    1.34 +#	2. We *don't* remove the old cscope.out file, because cscope is smart
    1.35 +#	   enough to only build what has changed.  It can be confused, however,
    1.36 +#	   if files are renamed or removed, so it may be necessary to manually
    1.37 +#	   remove cscope.out if a lot of reorganization has occurred.
    1.38 +#
    1.39 +
    1.40 +include $(GAMMADIR)/make/scm.make
    1.41 +
    1.42 +NAWK	= /usr/xpg4/bin/awk
    1.43 +RM	= rm -f
    1.44 +CS_TOP	= ../..
    1.45 +
    1.46 +CSDIRS	= $(CS_TOP)/src $(CS_TOP)/build
    1.47 +CSINCS	= $(CSDIRS:%=-I%)
    1.48 +
    1.49 +CSCOPE		= cscope
    1.50 +CSCOPE_FLAGS	= -b
    1.51 +
    1.52 +# Allow .java files to be added from the environment (CSCLASSES=yes).
    1.53 +ifdef	CSCLASSES
    1.54 +ADDCLASSES=	-o -name '*.java'
    1.55 +endif
    1.56 +
    1.57 +# Adding CClassHeaders also pushes the file count of a full workspace up about
    1.58 +# 200 files (these files also don't exist in a new workspace, and thus will
    1.59 +# cause the recreation of the database as they get created, which might seem
    1.60 +# a little confusing).  Thus allow these files to be added from the environment
    1.61 +# (CSHEADERS=yes).
    1.62 +ifndef	CSHEADERS
    1.63 +RMCCHEADERS=	-o -name CClassHeaders
    1.64 +endif
    1.65 +
    1.66 +# Use CS_GENERATED=x to include auto-generated files in the build directories.
    1.67 +ifdef	CS_GENERATED
    1.68 +CS_ADD_GENERATED	= -o -name '*.incl'
    1.69 +else
    1.70 +CS_PRUNE_GENERATED	= -o -name '${OS}_*_core' -o -name '${OS}_*_compiler?'
    1.71 +endif
    1.72 +
    1.73 +# OS-specific files for other systems are excluded by default.  Use CS_OS=yes
    1.74 +# to include platform-specific files for other platforms.
    1.75 +ifndef	CS_OS
    1.76 +CS_OS		= linux macos solaris win32
    1.77 +CS_PRUNE_OS	= $(patsubst %,-o -name '*%*',$(filter-out ${OS},${CS_OS}))
    1.78 +endif
    1.79 +
    1.80 +# Processor-specific files for other processors are excluded by default.  Use
    1.81 +# CS_CPU=x to include platform-specific files for other platforms.
    1.82 +ifndef	CS_CPU
    1.83 +CS_CPU		= i486 sparc amd64 ia64
    1.84 +CS_PRUNE_CPU	= $(patsubst %,-o -name '*%*',$(filter-out ${SRCARCH},${CS_CPU}))
    1.85 +endif
    1.86 +
    1.87 +# What files should we include?  A simple rule might be just those files under
    1.88 +# SCCS control, however this would miss files we create like the opcodes and
    1.89 +# CClassHeaders.  The following attempts to find everything that is *useful*.
    1.90 +# (.del files are created by sccsrm, demo directories contain many .java files
    1.91 +# that probably aren't useful for development, and the pkgarchive may contain
    1.92 +# duplicates of files within the source hierarchy).
    1.93 +
    1.94 +# Directories to exclude.
    1.95 +CS_PRUNE_STD	= $(SCM_DIRS) \
    1.96 +		  -o -name '.del-*' \
    1.97 +		  -o -name '*demo' \
    1.98 +		  -o -name pkgarchive
    1.99 +
   1.100 +CS_PRUNE	= $(CS_PRUNE_STD) \
   1.101 +		  $(CS_PRUNE_OS) \
   1.102 +		  $(CS_PRUNE_CPU) \
   1.103 +		  $(CS_PRUNE_GENERATED) \
   1.104 +		  $(RMCCHEADERS)
   1.105 +
   1.106 +# File names to include.
   1.107 +CSFILENAMES	= -name '*.[ch]pp' \
   1.108 +		  -o -name '*.[Ccshlxy]' \
   1.109 +		  $(CS_ADD_GENERATED) \
   1.110 +		  -o -name '*.d' \
   1.111 +		  -o -name '*.il' \
   1.112 +		  -o -name '*.cc' \
   1.113 +		  -o -name '*[Mm]akefile*' \
   1.114 +		  -o -name '*.gmk' \
   1.115 +		  -o -name '*.make' \
   1.116 +		  -o -name '*.ad' \
   1.117 +		  $(ADDCLASSES)
   1.118 +
   1.119 +.PRECIOUS:	cscope.out
   1.120 +
   1.121 +cscope cscope.out: cscope.files FORCE
   1.122 +	$(CSCOPE) $(CSCOPE_FLAGS)
   1.123 +
   1.124 +# The .raw file is reordered here in an attempt to make cscope display the most
   1.125 +# relevant files first.
   1.126 +cscope.files: .cscope.files.raw
   1.127 +	echo "$(CSINCS)" > $@
   1.128 +	-egrep -v "\.java|\/build\/"	$< >> $@
   1.129 +	-fgrep ".java"			$< >> $@
   1.130 +	-fgrep "/build/"		$< >> $@
   1.131 +
   1.132 +.cscope.files.raw:  .nametable.files
   1.133 +	-find $(CSDIRS) -type d \( $(CS_PRUNE) \) -prune -o \
   1.134 +	    -type f \( $(CSFILENAMES) \) -print > $@
   1.135 +
   1.136 +cscope.clean:  nametable.clean
   1.137 +	-$(RM) cscope.out cscope.files .cscope.files.raw
   1.138 +
   1.139 +TAGS:  cscope.files FORCE
   1.140 +	egrep -v '^-|^$$' $< | etags --members -
   1.141 +
   1.142 +TAGS.clean:  nametable.clean
   1.143 +	-$(RM) TAGS
   1.144 +
   1.145 +# .nametable.files and .nametable.files.tmp are used to determine if any files
   1.146 +# were added to/deleted from/renamed in the workspace.  If not, then there's
   1.147 +# normally no need to run find.  To force a 'find':  gmake nametable.clean.
   1.148 +.nametable.files:  .nametable.files.tmp
   1.149 +	cmp -s $@ $< || cp $< $@
   1.150 +
   1.151 +.nametable.files.tmp:  $(CS_TOP)/Codemgr_wsdata/nametable
   1.152 +	$(NAWK) \
   1.153 +	'{ if (sub("( [a-z0-9]{2,8}){4}$$", "")) print $$0; }' $< > $@
   1.154 +
   1.155 +nametable.clean:
   1.156 +	-$(RM) .nametable.files .nametable.files.tmp
   1.157 +
   1.158 +FORCE:
   1.159 +
   1.160 +.PHONY:		cscope cscope.clean TAGS.clean nametable.clean FORCE

mercurial