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