src/share/tools/MakeDeps/Platform.java

Fri, 27 Feb 2009 13:27:09 -0800

author
twisti
date
Fri, 27 Feb 2009 13:27:09 -0800
changeset 1040
98cb887364d3
parent 435
a61af66fc99e
child 1907
c18cbe5936b8
permissions
-rw-r--r--

6810672: Comment typos
Summary: I have collected some typos I have found while looking at the code.
Reviewed-by: kvn, never

duke@435 1 /*
duke@435 2 * Copyright 1999-2005 Sun Microsystems, Inc. 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 *
duke@435 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@435 20 * CA 95054 USA or visit www.sun.com if you need additional information or
duke@435 21 * have any questions.
duke@435 22 *
duke@435 23 */
duke@435 24
duke@435 25 /** Defines what must be specified for each platform. This class must
duke@435 26 have a no-arg constructor. */
duke@435 27
duke@435 28 import java.io.*;
duke@435 29
duke@435 30 public abstract class Platform {
duke@435 31 /** file name templates capture naming conventions */
duke@435 32 protected FileName dummyFileTemplate =
duke@435 33 new FileName(this, "", "", "", "", "", "");
duke@435 34
duke@435 35 // The next three must be instantiated in subclasses' constructors
duke@435 36
duke@435 37 /** An incl file is produced per .c file and contains all the
duke@435 38 includes it needs */
duke@435 39 protected FileName inclFileTemplate;
duke@435 40
duke@435 41 /** A GI (grand-include) file has any file used more than N times
duke@435 42 for precompiled headers */
duke@435 43 protected FileName giFileTemplate;
duke@435 44
duke@435 45 /** A GD (grand-dependencies) file that tells Unix make all the
duke@435 46 .o's needed for linking and the include dependencies */
duke@435 47 protected FileName gdFileTemplate;
duke@435 48
duke@435 49 // Accessors
duke@435 50 public FileName getInclFileTemplate() {
duke@435 51 return inclFileTemplate;
duke@435 52 }
duke@435 53
duke@435 54 public FileName getGIFileTemplate() {
duke@435 55 return giFileTemplate;
duke@435 56 }
duke@435 57
duke@435 58 public FileName getGDFileTemplate() {
duke@435 59 return gdFileTemplate;
duke@435 60 }
duke@435 61
duke@435 62 // an incl file is the file included by each.c file that includes
duke@435 63 // all needed header files
duke@435 64
duke@435 65 public abstract void setupFileTemplates();
duke@435 66 public abstract String[] outerSuffixes();
duke@435 67
duke@435 68 /** empty file name -> no grand include file */
duke@435 69 public boolean haveGrandInclude() {
duke@435 70 return (giFileTemplate.nameOfList().length() > 0);
duke@435 71 }
duke@435 72
duke@435 73 public boolean writeDeps() {
duke@435 74 return (gdFileTemplate.nameOfList().length() > 0);
duke@435 75 }
duke@435 76
duke@435 77 /** <p> A gi file is the grand-include file. It includes in one
duke@435 78 file any file that is included more than a certain number of
duke@435 79 times. </p>
duke@435 80
duke@435 81 <p> It is used for precompiled header files. </p>
duke@435 82
duke@435 83 <p> It has a source name, that is the file that this program
duke@435 84 generates, and a compiled name; that is the file that is
duke@435 85 included by other files. </p>
duke@435 86
duke@435 87 <p> Some platforms have this program actually explictly
duke@435 88 include the preprocessed gi file-- see includeGIInEachIncl().
duke@435 89 </p>
duke@435 90
duke@435 91 <p> Also, some platforms need a pragma in the GI file. </p> */
duke@435 92 public boolean includeGIInEachIncl() {
duke@435 93 return false;
duke@435 94 }
duke@435 95
duke@435 96 /** For some platforms, e.g. Solaris, include the grand-include
duke@435 97 dependencies in the makefile. For others, e.g. Windows, do
duke@435 98 not. */
duke@435 99 public boolean includeGIDependencies() {
duke@435 100 return false;
duke@435 101 }
duke@435 102
duke@435 103 /** Should C/C++ source file be dependent on a file included
duke@435 104 into the grand-include file. */
duke@435 105 public boolean writeDependenciesOnHFilesFromGI() {
duke@435 106 return false;
duke@435 107 }
duke@435 108
duke@435 109 /** Default implementation does nothing */
duke@435 110 public void writeGIPragma(PrintWriter out) {
duke@435 111 }
duke@435 112
duke@435 113 /** A line with a filename and the noGrandInclude string means
duke@435 114 that this file cannot use the precompiled header. */
duke@435 115 public String noGrandInclude() {
duke@435 116 return "no_precompiled_headers";
duke@435 117 }
duke@435 118
duke@435 119 /** A line with a filename and the
duke@435 120 generatePlatformDependentInclude means that an include file
duke@435 121 for the header file must be generated. This file generated include
duke@435 122 file is directly included by the non-platform dependent include file
duke@435 123 (e.g os.hpp includes _os_pd.hpp.incl. So while we notice files that
duke@435 124 are directly dependent on non-platform dependent files from the database
duke@435 125 we must infer the dependence on platform specific files to generate correct
duke@435 126 dependences on the platform specific files. */
duke@435 127 public String generatePlatformDependentInclude() {
duke@435 128 return "generate_platform_dependent_include";
duke@435 129 }
duke@435 130
duke@435 131 /** Prefix and suffix strings for emitting Makefile rules */
duke@435 132 public abstract String objFileSuffix();
duke@435 133 public abstract String asmFileSuffix();
duke@435 134 public abstract String dependentPrefix();
duke@435 135
duke@435 136 // Exit routines:
duke@435 137
duke@435 138 /** Abort means an internal error */
duke@435 139 public void abort() {
duke@435 140 throw new RuntimeException("Internal error");
duke@435 141 }
duke@435 142
duke@435 143 /** fatalError is used by clients to stop the system */
duke@435 144 public void fatalError(String msg) {
duke@435 145 System.err.println(msg);
duke@435 146 System.exit(1);
duke@435 147 }
duke@435 148
duke@435 149 /** Default implementation performs case-sensitive comparison */
duke@435 150 public boolean fileNameStringEquality(String s1, String s2) {
duke@435 151 return s1.equals(s2);
duke@435 152 }
duke@435 153
duke@435 154 public void fileNamePortabilityCheck(String name) {
duke@435 155 if (Character.isUpperCase(name.charAt(0))) {
duke@435 156 fatalError("Error: for the sake of portability we have chosen\n" +
duke@435 157 "to avoid files starting with an uppercase letter.\n" +
duke@435 158 "Please rename " + name + ".");
duke@435 159 }
duke@435 160 }
duke@435 161
duke@435 162 public void fileNamePortabilityCheck(String name, String matchingName) {
duke@435 163 if (!name.equals(matchingName)) {
duke@435 164 fatalError("Error: file " + name + " also appears as " +
duke@435 165 matchingName + ". Case must be consistent for " +
duke@435 166 "portability.");
duke@435 167 }
duke@435 168 }
duke@435 169
duke@435 170 /** max is 31 on mac, so warn */
duke@435 171 public int fileNameLengthLimit() {
duke@435 172 return 45;
duke@435 173 }
duke@435 174
duke@435 175 public int defaultGrandIncludeThreshold() {
duke@435 176 return 30;
duke@435 177 }
duke@435 178
duke@435 179 /** Not very general, but this is a way to get platform-specific
duke@435 180 files to be written. Default implementation does nothing. */
duke@435 181 public void writePlatformSpecificFiles(Database previousDB,
duke@435 182 Database currentDB, String[] args)
duke@435 183 throws IllegalArgumentException, IOException {
duke@435 184 }
duke@435 185 }

mercurial