2796N/A#
2796N/A# Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
2796N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2796N/A#
2796N/A# This code is free software; you can redistribute it and/or modify it
2796N/A# under the terms of the GNU General Public License version 2 only, as
2796N/A# published by the Free Software Foundation.
2796N/A#
2796N/A# This code is distributed in the hope that it will be useful, but WITHOUT
2796N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2796N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2796N/A# version 2 for more details (a copy is included in the LICENSE file that
2796N/A# accompanied this code).
2796N/A#
2796N/A# You should have received a copy of the GNU General Public License version
2796N/A# 2 along with this work; if not, write to the Free Software Foundation,
2796N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2796N/A#
2796N/A# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2796N/A# or visit www.oracle.com if you need additional information or have any
2796N/A# questions.
2796N/A#
2796N/A#
2796N/A
2796N/A#
2796N/A# The cscope.out file is made in the current directory and spans the entire
2796N/A# source tree.
2796N/A#
2796N/A# Things to note:
2796N/A# 1. We use relative names for cscope.
2796N/A# 2. We *don't* remove the old cscope.out file, because cscope is smart
2796N/A# enough to only build what has changed. It can be confused, however,
2796N/A# if files are renamed or removed, so it may be necessary to manually
2796N/A# remove cscope.out if a lot of reorganization has occurred.
2796N/A#
2796N/A
2796N/Ainclude $(GAMMADIR)/make/scm.make
2796N/A
2796N/ANAWK = awk
2796N/ARM = rm -f
2796N/AHG = hg
2796N/ACS_TOP = ../..
2796N/A
2796N/ACSDIRS = $(CS_TOP)/src $(CS_TOP)/build
2796N/ACSINCS = $(CSDIRS:%=-I%)
2796N/A
2796N/ACSCOPE = cscope
2796N/ACSCOPE_FLAGS = -b
2796N/A
2796N/A# Allow .java files to be added from the environment (CSCLASSES=yes).
2796N/Aifdef CSCLASSES
2796N/AADDCLASSES= -o -name '*.java'
2796N/Aendif
2796N/A
2796N/A# Adding CClassHeaders also pushes the file count of a full workspace up about
2796N/A# 200 files (these files also don't exist in a new workspace, and thus will
2796N/A# cause the recreation of the database as they get created, which might seem
2796N/A# a little confusing). Thus allow these files to be added from the environment
2796N/A# (CSHEADERS=yes).
2796N/Aifndef CSHEADERS
2796N/ARMCCHEADERS= -o -name CClassHeaders
2796N/Aendif
2796N/A
2796N/A# Use CS_GENERATED=x to include auto-generated files in the build directories.
2796N/Aifdef CS_GENERATED
2796N/ACS_ADD_GENERATED = -o -name '*.incl'
2796N/Aelse
2796N/ACS_PRUNE_GENERATED = -o -name '${OS}_*_core' -o -name '${OS}_*_compiler?'
2796N/Aendif
2796N/A
2796N/A# OS-specific files for other systems are excluded by default. Use CS_OS=yes
2796N/A# to include platform-specific files for other platforms.
2796N/Aifndef CS_OS
2796N/ACS_OS = linux macos solaris win32 bsd
2796N/ACS_PRUNE_OS = $(patsubst %,-o -name '*%*',$(filter-out ${OS},${CS_OS}))
2796N/Aendif
2796N/A
2796N/A# Processor-specific files for other processors are excluded by default. Use
2796N/A# CS_CPU=x to include platform-specific files for other platforms.
2796N/Aifndef CS_CPU
2796N/ACS_CPU = i486 sparc amd64 ia64
2796N/ACS_PRUNE_CPU = $(patsubst %,-o -name '*%*',$(filter-out ${SRCARCH},${CS_CPU}))
2796N/Aendif
2796N/A
2796N/A# What files should we include? A simple rule might be just those files under
2796N/A# SCCS control, however this would miss files we create like the opcodes and
2796N/A# CClassHeaders. The following attempts to find everything that is *useful*.
2796N/A# (.del files are created by sccsrm, demo directories contain many .java files
2796N/A# that probably aren't useful for development, and the pkgarchive may contain
2796N/A# duplicates of files within the source hierarchy).
2796N/A
2796N/A# Directories to exclude.
2796N/ACS_PRUNE_STD = $(SCM_DIRS) \
2796N/A -o -name '.del-*' \
2796N/A -o -name '*demo' \
2796N/A -o -name pkgarchive
2796N/A
2796N/ACS_PRUNE = $(CS_PRUNE_STD) \
2796N/A $(CS_PRUNE_OS) \
2796N/A $(CS_PRUNE_CPU) \
2796N/A $(CS_PRUNE_GENERATED) \
2796N/A $(RMCCHEADERS)
2796N/A
2796N/A# File names to include.
2796N/ACSFILENAMES = -name '*.[ch]pp' \
2796N/A -o -name '*.[Ccshlxy]' \
2796N/A $(CS_ADD_GENERATED) \
2796N/A -o -name '*.il' \
2796N/A -o -name '*.cc' \
2796N/A -o -name '*[Mm]akefile*' \
2796N/A -o -name '*.gmk' \
2796N/A -o -name '*.make' \
2796N/A -o -name '*.ad' \
2796N/A $(ADDCLASSES)
2796N/A
2796N/A.PRECIOUS: cscope.out
2796N/A
2796N/Acscope cscope.out: cscope.files FORCE
2796N/A $(CSCOPE) $(CSCOPE_FLAGS)
2796N/A
2796N/A# The .raw file is reordered here in an attempt to make cscope display the most
2796N/A# relevant files first.
2796N/Acscope.files: .cscope.files.raw
2796N/A echo "$(CSINCS)" > $@
2796N/A -egrep -v "\.java|\/make\/" $< >> $@
2796N/A -fgrep ".java" $< >> $@
2796N/A -fgrep "/make/" $< >> $@
2796N/A
2796N/A.cscope.files.raw: .nametable.files
2796N/A -find $(CSDIRS) -type d \( $(CS_PRUNE) \) -prune -o \
2796N/A -type f \( $(CSFILENAMES) \) -print > $@
2796N/A
2796N/Acscope.clean: nametable.clean
2796N/A -$(RM) cscope.out cscope.files .cscope.files.raw
2796N/A
2796N/ATAGS: cscope.files FORCE
2796N/A egrep -v '^-|^$$' $< | etags --members -
2796N/A
2796N/ATAGS.clean: nametable.clean
2796N/A -$(RM) TAGS
2796N/A
2796N/A# .nametable.files and .nametable.files.tmp are used to determine if any files
2796N/A# were added to/deleted from/renamed in the workspace. If not, then there's
2796N/A# normally no need to rebuild the cscope database. To force a rebuild of
2796N/A# the cscope database: gmake nametable.clean.
2796N/A.nametable.files: .nametable.files.tmp
2796N/A ( cmp -s $@ $< ) || ( cp $< $@ )
2796N/A -$(RM) $<
2796N/A
2796N/A# `hg status' is slightly faster than `hg fstatus'. Both are
2796N/A# quite a bit slower on an NFS mounted file system, so this is
2796N/A# really geared towards repos on local file systems.
2796N/A.nametable.files.tmp:
2796N/A -$(HG) fstatus -acmn > $@
2796N/Anametable.clean:
2796N/A -$(RM) .nametable.files .nametable.files.tmp
2796N/A
2796N/AFORCE:
2796N/A
2796N/A.PHONY: cscope cscope.clean TAGS.clean nametable.clean FORCE