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