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