annotate src/share/tools/MakeDeps/BuildConfig.java @ 1408:0ba67bb5392c

added c1x build directory, added MSVC Win64 project support
author lstadler
date Wed, 12 May 2010 15:01:05 +0200
parents bd02caa94611
children 2d26b0046e0d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
844
bd02caa94611 6862919: Update copyright year
xdono
parents: 720
diff changeset
2 * Copyright 2005-2009 Sun Microsystems, Inc. All Rights Reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
a61af66fc99e Initial load
duke
parents:
diff changeset
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
a61af66fc99e Initial load
duke
parents:
diff changeset
20 * CA 95054 USA or visit www.sun.com if you need additional information or
a61af66fc99e Initial load
duke
parents:
diff changeset
21 * have any questions.
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 import java.util.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
26 import java.io.File;
a61af66fc99e Initial load
duke
parents:
diff changeset
27
a61af66fc99e Initial load
duke
parents:
diff changeset
28 class BuildConfig {
a61af66fc99e Initial load
duke
parents:
diff changeset
29 Hashtable vars;
a61af66fc99e Initial load
duke
parents:
diff changeset
30 Vector basicNames, basicPaths;
a61af66fc99e Initial load
duke
parents:
diff changeset
31 String[] context;
a61af66fc99e Initial load
duke
parents:
diff changeset
32
a61af66fc99e Initial load
duke
parents:
diff changeset
33 static CompilerInterface ci;
a61af66fc99e Initial load
duke
parents:
diff changeset
34 static CompilerInterface getCI() {
a61af66fc99e Initial load
duke
parents:
diff changeset
35 if (ci == null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
36 String comp = (String)getField(null, "CompilerVersion");
a61af66fc99e Initial load
duke
parents:
diff changeset
37 try {
a61af66fc99e Initial load
duke
parents:
diff changeset
38 ci = (CompilerInterface)Class.forName("CompilerInterface" + comp).newInstance();
a61af66fc99e Initial load
duke
parents:
diff changeset
39 } catch (Exception cnfe) {
a61af66fc99e Initial load
duke
parents:
diff changeset
40 System.err.println("Cannot find support for compiler " + comp);
a61af66fc99e Initial load
duke
parents:
diff changeset
41 throw new RuntimeException(cnfe.toString());
a61af66fc99e Initial load
duke
parents:
diff changeset
42 }
a61af66fc99e Initial load
duke
parents:
diff changeset
43 }
a61af66fc99e Initial load
duke
parents:
diff changeset
44 return ci;
a61af66fc99e Initial load
duke
parents:
diff changeset
45 }
a61af66fc99e Initial load
duke
parents:
diff changeset
46
a61af66fc99e Initial load
duke
parents:
diff changeset
47 protected void initNames(String flavour, String build, String outDll) {
a61af66fc99e Initial load
duke
parents:
diff changeset
48 if (vars == null) vars = new Hashtable();
a61af66fc99e Initial load
duke
parents:
diff changeset
49
a61af66fc99e Initial load
duke
parents:
diff changeset
50 String flavourBuild = flavour + "_" + build;
a61af66fc99e Initial load
duke
parents:
diff changeset
51 put("Name", getCI().makeCfgName(flavourBuild));
a61af66fc99e Initial load
duke
parents:
diff changeset
52 put("Flavour", flavour);
a61af66fc99e Initial load
duke
parents:
diff changeset
53 put("Build", build);
a61af66fc99e Initial load
duke
parents:
diff changeset
54
a61af66fc99e Initial load
duke
parents:
diff changeset
55 // ones mentioned above were needed to expand format
a61af66fc99e Initial load
duke
parents:
diff changeset
56 String buildBase = expandFormat(getFieldString(null, "BuildBase"));
a61af66fc99e Initial load
duke
parents:
diff changeset
57 String jdkDir = getFieldString(null, "JdkTargetRoot");
a61af66fc99e Initial load
duke
parents:
diff changeset
58 String sourceBase = getFieldString(null, "SourceBase");
a61af66fc99e Initial load
duke
parents:
diff changeset
59 String outDir = buildBase;
a61af66fc99e Initial load
duke
parents:
diff changeset
60
a61af66fc99e Initial load
duke
parents:
diff changeset
61 put("Id", flavourBuild);
a61af66fc99e Initial load
duke
parents:
diff changeset
62 put("OutputDir", outDir);
a61af66fc99e Initial load
duke
parents:
diff changeset
63 put("SourceBase", sourceBase);
a61af66fc99e Initial load
duke
parents:
diff changeset
64 put("BuildBase", buildBase);
a61af66fc99e Initial load
duke
parents:
diff changeset
65 put("OutputDll", jdkDir + Util.sep + outDll);
a61af66fc99e Initial load
duke
parents:
diff changeset
66
a61af66fc99e Initial load
duke
parents:
diff changeset
67 context = new String [] {flavourBuild, flavour, build, null};
a61af66fc99e Initial load
duke
parents:
diff changeset
68 }
a61af66fc99e Initial load
duke
parents:
diff changeset
69
a61af66fc99e Initial load
duke
parents:
diff changeset
70 protected void init(Vector includes, Vector defines) {
a61af66fc99e Initial load
duke
parents:
diff changeset
71 initDefaultDefines(defines);
a61af66fc99e Initial load
duke
parents:
diff changeset
72 initDefaultCompilerFlags(includes);
a61af66fc99e Initial load
duke
parents:
diff changeset
73 initDefaultLinkerFlags();
a61af66fc99e Initial load
duke
parents:
diff changeset
74 handleDB((String)getFieldInContext("IncludeDB"));
a61af66fc99e Initial load
duke
parents:
diff changeset
75 }
a61af66fc99e Initial load
duke
parents:
diff changeset
76
a61af66fc99e Initial load
duke
parents:
diff changeset
77
a61af66fc99e Initial load
duke
parents:
diff changeset
78 protected void initDefaultCompilerFlags(Vector includes) {
a61af66fc99e Initial load
duke
parents:
diff changeset
79 Vector compilerFlags = new Vector();
a61af66fc99e Initial load
duke
parents:
diff changeset
80
a61af66fc99e Initial load
duke
parents:
diff changeset
81 compilerFlags.addAll(getCI().getBaseCompilerFlags(getV("Define"),
a61af66fc99e Initial load
duke
parents:
diff changeset
82 includes,
a61af66fc99e Initial load
duke
parents:
diff changeset
83 get("OutputDir")));
a61af66fc99e Initial load
duke
parents:
diff changeset
84
a61af66fc99e Initial load
duke
parents:
diff changeset
85 put("CompilerFlags", compilerFlags);
a61af66fc99e Initial load
duke
parents:
diff changeset
86 }
a61af66fc99e Initial load
duke
parents:
diff changeset
87
a61af66fc99e Initial load
duke
parents:
diff changeset
88 protected void initDefaultLinkerFlags() {
a61af66fc99e Initial load
duke
parents:
diff changeset
89 Vector linkerFlags = new Vector();
a61af66fc99e Initial load
duke
parents:
diff changeset
90
a61af66fc99e Initial load
duke
parents:
diff changeset
91 linkerFlags.addAll(getCI().getBaseLinkerFlags( get("OutputDir"), get("OutputDll")));
a61af66fc99e Initial load
duke
parents:
diff changeset
92
a61af66fc99e Initial load
duke
parents:
diff changeset
93 put("LinkerFlags", linkerFlags);
a61af66fc99e Initial load
duke
parents:
diff changeset
94 }
a61af66fc99e Initial load
duke
parents:
diff changeset
95
a61af66fc99e Initial load
duke
parents:
diff changeset
96 DirectoryTree getSourceTree(String sourceBase, String startAt) {
a61af66fc99e Initial load
duke
parents:
diff changeset
97 DirectoryTree tree = new DirectoryTree();
a61af66fc99e Initial load
duke
parents:
diff changeset
98
a61af66fc99e Initial load
duke
parents:
diff changeset
99 tree.addSubdirToIgnore("Codemgr_wsdata");
a61af66fc99e Initial load
duke
parents:
diff changeset
100 tree.addSubdirToIgnore("deleted_files");
a61af66fc99e Initial load
duke
parents:
diff changeset
101 tree.addSubdirToIgnore("SCCS");
a61af66fc99e Initial load
duke
parents:
diff changeset
102 tree.setVerbose(true);
a61af66fc99e Initial load
duke
parents:
diff changeset
103 if (startAt != null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
104 tree.readDirectory(sourceBase + File.separator + startAt);
a61af66fc99e Initial load
duke
parents:
diff changeset
105 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
106 tree.readDirectory(sourceBase);
a61af66fc99e Initial load
duke
parents:
diff changeset
107 }
a61af66fc99e Initial load
duke
parents:
diff changeset
108
a61af66fc99e Initial load
duke
parents:
diff changeset
109 return tree;
a61af66fc99e Initial load
duke
parents:
diff changeset
110 }
a61af66fc99e Initial load
duke
parents:
diff changeset
111
a61af66fc99e Initial load
duke
parents:
diff changeset
112
a61af66fc99e Initial load
duke
parents:
diff changeset
113 Vector getPreferredPaths(Database currentDB) {
a61af66fc99e Initial load
duke
parents:
diff changeset
114 Vector preferredPaths = new Vector();
a61af66fc99e Initial load
duke
parents:
diff changeset
115 // In the case of multiple files with the same name in
a61af66fc99e Initial load
duke
parents:
diff changeset
116 // different subdirectories, prefer the versions specified in
a61af66fc99e Initial load
duke
parents:
diff changeset
117 // the platform file as the "os_family" and "arch" macros.
a61af66fc99e Initial load
duke
parents:
diff changeset
118 for (Iterator iter = currentDB.getMacros(); iter.hasNext(); ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
119 Macro macro = (Macro) iter.next();
a61af66fc99e Initial load
duke
parents:
diff changeset
120 if (macro.name.equals("os_family") ||
a61af66fc99e Initial load
duke
parents:
diff changeset
121 macro.name.equals("arch")) {
a61af66fc99e Initial load
duke
parents:
diff changeset
122 preferredPaths.add(macro.contents);
a61af66fc99e Initial load
duke
parents:
diff changeset
123 }
a61af66fc99e Initial load
duke
parents:
diff changeset
124 }
a61af66fc99e Initial load
duke
parents:
diff changeset
125 // Also prefer "opto" over "adlc" for adlcVMDeps.hpp
a61af66fc99e Initial load
duke
parents:
diff changeset
126 preferredPaths.add("opto");
a61af66fc99e Initial load
duke
parents:
diff changeset
127
a61af66fc99e Initial load
duke
parents:
diff changeset
128 return preferredPaths;
a61af66fc99e Initial load
duke
parents:
diff changeset
129 }
a61af66fc99e Initial load
duke
parents:
diff changeset
130
a61af66fc99e Initial load
duke
parents:
diff changeset
131
a61af66fc99e Initial load
duke
parents:
diff changeset
132 void handleDB(String dbFile) {
a61af66fc99e Initial load
duke
parents:
diff changeset
133 WinGammaPlatform platform = (WinGammaPlatform)getField(null, "PlatformObject");
a61af66fc99e Initial load
duke
parents:
diff changeset
134 Database db = new Database(platform, platform.defaultGrandIncludeThreshold());
a61af66fc99e Initial load
duke
parents:
diff changeset
135
a61af66fc99e Initial load
duke
parents:
diff changeset
136 try {
a61af66fc99e Initial load
duke
parents:
diff changeset
137 File incls = new File(get("OutputDir")+Util.sep+"incls");
a61af66fc99e Initial load
duke
parents:
diff changeset
138 FileName oldInclTempl = platform.getInclFileTemplate();
a61af66fc99e Initial load
duke
parents:
diff changeset
139 FileName oldGITempl = platform.getGIFileTemplate();
a61af66fc99e Initial load
duke
parents:
diff changeset
140 FileName oldGDTempl = platform.getGDFileTemplate();
a61af66fc99e Initial load
duke
parents:
diff changeset
141
a61af66fc99e Initial load
duke
parents:
diff changeset
142 platform.setInclFileTemplate(new FileName(platform, incls.getPath()+Util.sep,
a61af66fc99e Initial load
duke
parents:
diff changeset
143 "_", "", ".incl", "", ""));
a61af66fc99e Initial load
duke
parents:
diff changeset
144 platform.setGIFileTemplate(new FileName(platform, incls.getPath()+Util.sep,
a61af66fc99e Initial load
duke
parents:
diff changeset
145 "", "_precompiled", ".incl", "", ""));
a61af66fc99e Initial load
duke
parents:
diff changeset
146
a61af66fc99e Initial load
duke
parents:
diff changeset
147 incls.mkdirs();
a61af66fc99e Initial load
duke
parents:
diff changeset
148
a61af66fc99e Initial load
duke
parents:
diff changeset
149 db.get(getFieldString(null, "Platform"), dbFile);
a61af66fc99e Initial load
duke
parents:
diff changeset
150 db.compute();
a61af66fc99e Initial load
duke
parents:
diff changeset
151
a61af66fc99e Initial load
duke
parents:
diff changeset
152 db.put();
a61af66fc99e Initial load
duke
parents:
diff changeset
153
a61af66fc99e Initial load
duke
parents:
diff changeset
154 //platform.setInclFileTemplate(oldInclTempl);
a61af66fc99e Initial load
duke
parents:
diff changeset
155 //platform.setGIFileTemplate(oldInclTempl);
a61af66fc99e Initial load
duke
parents:
diff changeset
156 } catch (Exception e) {
a61af66fc99e Initial load
duke
parents:
diff changeset
157 e.printStackTrace();
a61af66fc99e Initial load
duke
parents:
diff changeset
158 throw new RuntimeException("cannot do db: "+e);
a61af66fc99e Initial load
duke
parents:
diff changeset
159 }
a61af66fc99e Initial load
duke
parents:
diff changeset
160
a61af66fc99e Initial load
duke
parents:
diff changeset
161 putSpecificField("AllFilesHash", computeAllFiles(platform, db));
a61af66fc99e Initial load
duke
parents:
diff changeset
162 }
a61af66fc99e Initial load
duke
parents:
diff changeset
163
a61af66fc99e Initial load
duke
parents:
diff changeset
164
a61af66fc99e Initial load
duke
parents:
diff changeset
165 void addAll(Iterator i, Hashtable hash,
a61af66fc99e Initial load
duke
parents:
diff changeset
166 WinGammaPlatform platform, DirectoryTree tree,
a61af66fc99e Initial load
duke
parents:
diff changeset
167 Vector preferredPaths, Vector filesNotFound, Vector filesDuplicate) {
a61af66fc99e Initial load
duke
parents:
diff changeset
168 for (; i.hasNext(); ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
169 String fileName = (String) i.next();
a61af66fc99e Initial load
duke
parents:
diff changeset
170 if (lookupHashFieldInContext("IgnoreFile", fileName) == null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
171 String prefixedName = platform.envVarPrefixedFileName(fileName,
a61af66fc99e Initial load
duke
parents:
diff changeset
172 0, /* ignored */
a61af66fc99e Initial load
duke
parents:
diff changeset
173 tree,
a61af66fc99e Initial load
duke
parents:
diff changeset
174 preferredPaths,
a61af66fc99e Initial load
duke
parents:
diff changeset
175 filesNotFound,
a61af66fc99e Initial load
duke
parents:
diff changeset
176 filesDuplicate);
a61af66fc99e Initial load
duke
parents:
diff changeset
177 if (prefixedName != null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
178 addTo(hash, Util.normalize(prefixedName), fileName);
a61af66fc99e Initial load
duke
parents:
diff changeset
179 }
a61af66fc99e Initial load
duke
parents:
diff changeset
180 }
a61af66fc99e Initial load
duke
parents:
diff changeset
181 }
a61af66fc99e Initial load
duke
parents:
diff changeset
182 }
a61af66fc99e Initial load
duke
parents:
diff changeset
183
a61af66fc99e Initial load
duke
parents:
diff changeset
184 void addTo(Hashtable ht, String key, String value) {
a61af66fc99e Initial load
duke
parents:
diff changeset
185 ht.put(expandFormat(key), expandFormat(value));
a61af66fc99e Initial load
duke
parents:
diff changeset
186 }
a61af66fc99e Initial load
duke
parents:
diff changeset
187
a61af66fc99e Initial load
duke
parents:
diff changeset
188 Hashtable computeAllFiles(WinGammaPlatform platform, Database db) {
a61af66fc99e Initial load
duke
parents:
diff changeset
189 Hashtable rv = new Hashtable();
a61af66fc99e Initial load
duke
parents:
diff changeset
190 DirectoryTree tree = getSourceTree(get("SourceBase"), getFieldString(null, "StartAt"));
a61af66fc99e Initial load
duke
parents:
diff changeset
191 Vector preferredPaths = getPreferredPaths(db);
a61af66fc99e Initial load
duke
parents:
diff changeset
192
a61af66fc99e Initial load
duke
parents:
diff changeset
193 // Hold errors until end
a61af66fc99e Initial load
duke
parents:
diff changeset
194 Vector filesNotFound = new Vector();
a61af66fc99e Initial load
duke
parents:
diff changeset
195 Vector filesDuplicate = new Vector();
a61af66fc99e Initial load
duke
parents:
diff changeset
196
a61af66fc99e Initial load
duke
parents:
diff changeset
197
a61af66fc99e Initial load
duke
parents:
diff changeset
198 // find all files
a61af66fc99e Initial load
duke
parents:
diff changeset
199 Vector dbFiles = new Vector();
a61af66fc99e Initial load
duke
parents:
diff changeset
200 for (Iterator i=db.getAllFiles().iterator(); i.hasNext(); ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
201 FileList fl = (FileList) i.next();
a61af66fc99e Initial load
duke
parents:
diff changeset
202 dbFiles.add(fl.getName());
a61af66fc99e Initial load
duke
parents:
diff changeset
203 }
a61af66fc99e Initial load
duke
parents:
diff changeset
204 addAll(dbFiles.iterator(), rv,
a61af66fc99e Initial load
duke
parents:
diff changeset
205 platform, tree,
a61af66fc99e Initial load
duke
parents:
diff changeset
206 preferredPaths, filesNotFound, filesDuplicate);
a61af66fc99e Initial load
duke
parents:
diff changeset
207
a61af66fc99e Initial load
duke
parents:
diff changeset
208 Vector addFiles = new Vector();
a61af66fc99e Initial load
duke
parents:
diff changeset
209 collectRelevantVectors(addFiles, "AdditionalFile");
a61af66fc99e Initial load
duke
parents:
diff changeset
210 addAll(addFiles.iterator(), rv,
a61af66fc99e Initial load
duke
parents:
diff changeset
211 platform, tree,
a61af66fc99e Initial load
duke
parents:
diff changeset
212 preferredPaths, filesNotFound, filesDuplicate);
a61af66fc99e Initial load
duke
parents:
diff changeset
213
a61af66fc99e Initial load
duke
parents:
diff changeset
214 collectRelevantHashes(rv, "AdditionalGeneratedFile");
a61af66fc99e Initial load
duke
parents:
diff changeset
215
a61af66fc99e Initial load
duke
parents:
diff changeset
216 if ((filesNotFound.size() != 0) ||
a61af66fc99e Initial load
duke
parents:
diff changeset
217 (filesDuplicate.size() != 0)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
218 System.err.println("Error: some files were not found or " +
a61af66fc99e Initial load
duke
parents:
diff changeset
219 "appeared in multiple subdirectories of " +
a61af66fc99e Initial load
duke
parents:
diff changeset
220 "directory " + get("SourceBase") + " and could not " +
a61af66fc99e Initial load
duke
parents:
diff changeset
221 "be resolved with the os_family and arch " +
a61af66fc99e Initial load
duke
parents:
diff changeset
222 "macros in the platform file.");
a61af66fc99e Initial load
duke
parents:
diff changeset
223 if (filesNotFound.size() != 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
224 System.err.println("Files not found:");
a61af66fc99e Initial load
duke
parents:
diff changeset
225 for (Iterator iter = filesNotFound.iterator();
a61af66fc99e Initial load
duke
parents:
diff changeset
226 iter.hasNext(); ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
227 System.err.println(" " + (String) iter.next());
a61af66fc99e Initial load
duke
parents:
diff changeset
228 }
a61af66fc99e Initial load
duke
parents:
diff changeset
229 }
a61af66fc99e Initial load
duke
parents:
diff changeset
230 if (filesDuplicate.size() != 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
231 System.err.println("Duplicate files:");
a61af66fc99e Initial load
duke
parents:
diff changeset
232 for (Iterator iter = filesDuplicate.iterator();
a61af66fc99e Initial load
duke
parents:
diff changeset
233 iter.hasNext(); ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
234 System.err.println(" " + (String) iter.next());
a61af66fc99e Initial load
duke
parents:
diff changeset
235 }
a61af66fc99e Initial load
duke
parents:
diff changeset
236 }
a61af66fc99e Initial load
duke
parents:
diff changeset
237 throw new RuntimeException();
a61af66fc99e Initial load
duke
parents:
diff changeset
238 }
a61af66fc99e Initial load
duke
parents:
diff changeset
239
a61af66fc99e Initial load
duke
parents:
diff changeset
240 return rv;
a61af66fc99e Initial load
duke
parents:
diff changeset
241 }
a61af66fc99e Initial load
duke
parents:
diff changeset
242
a61af66fc99e Initial load
duke
parents:
diff changeset
243 void initDefaultDefines(Vector defines) {
a61af66fc99e Initial load
duke
parents:
diff changeset
244 Vector sysDefines = new Vector();
1408
0ba67bb5392c added c1x build directory, added MSVC Win64 project support
lstadler
parents: 844
diff changeset
245 if( Util.os().equals("Win32")) {
0ba67bb5392c added c1x build directory, added MSVC Win64 project support
lstadler
parents: 844
diff changeset
246 sysDefines.add("WIN32");
0ba67bb5392c added c1x build directory, added MSVC Win64 project support
lstadler
parents: 844
diff changeset
247 sysDefines.add("HOTSPOT_LIB_ARCH=\\\"i386\\\"");
0ba67bb5392c added c1x build directory, added MSVC Win64 project support
lstadler
parents: 844
diff changeset
248 } else {
0ba67bb5392c added c1x build directory, added MSVC Win64 project support
lstadler
parents: 844
diff changeset
249 sysDefines.add("_AMD64_");
0ba67bb5392c added c1x build directory, added MSVC Win64 project support
lstadler
parents: 844
diff changeset
250 sysDefines.add("AMD64");
0ba67bb5392c added c1x build directory, added MSVC Win64 project support
lstadler
parents: 844
diff changeset
251 sysDefines.add("_WIN64");
0ba67bb5392c added c1x build directory, added MSVC Win64 project support
lstadler
parents: 844
diff changeset
252 sysDefines.add("_LP64");
0ba67bb5392c added c1x build directory, added MSVC Win64 project support
lstadler
parents: 844
diff changeset
253 if (System.getenv("MSC_VER") != null)
0ba67bb5392c added c1x build directory, added MSVC Win64 project support
lstadler
parents: 844
diff changeset
254 sysDefines.add("MSC_VER=" + System.getenv("MSC_VER"));
0ba67bb5392c added c1x build directory, added MSVC Win64 project support
lstadler
parents: 844
diff changeset
255 sysDefines.add("HOTSPOT_LIB_ARCH=\\\"amd64\\\"");
0ba67bb5392c added c1x build directory, added MSVC Win64 project support
lstadler
parents: 844
diff changeset
256 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
257 sysDefines.add("_WINDOWS");
a61af66fc99e Initial load
duke
parents:
diff changeset
258 sysDefines.add("HOTSPOT_BUILD_USER="+System.getProperty("user.name"));
a61af66fc99e Initial load
duke
parents:
diff changeset
259 sysDefines.add("HOTSPOT_BUILD_TARGET=\\\""+get("Build")+"\\\"");
a61af66fc99e Initial load
duke
parents:
diff changeset
260 sysDefines.add("_JNI_IMPLEMENTATION_");
a61af66fc99e Initial load
duke
parents:
diff changeset
261
a61af66fc99e Initial load
duke
parents:
diff changeset
262 sysDefines.addAll(defines);
a61af66fc99e Initial load
duke
parents:
diff changeset
263
a61af66fc99e Initial load
duke
parents:
diff changeset
264 put("Define", sysDefines);
a61af66fc99e Initial load
duke
parents:
diff changeset
265 }
a61af66fc99e Initial load
duke
parents:
diff changeset
266
a61af66fc99e Initial load
duke
parents:
diff changeset
267 String get(String key) {
a61af66fc99e Initial load
duke
parents:
diff changeset
268 return (String)vars.get(key);
a61af66fc99e Initial load
duke
parents:
diff changeset
269 }
a61af66fc99e Initial load
duke
parents:
diff changeset
270
a61af66fc99e Initial load
duke
parents:
diff changeset
271 Vector getV(String key) {
a61af66fc99e Initial load
duke
parents:
diff changeset
272 return (Vector)vars.get(key);
a61af66fc99e Initial load
duke
parents:
diff changeset
273 }
a61af66fc99e Initial load
duke
parents:
diff changeset
274
a61af66fc99e Initial load
duke
parents:
diff changeset
275 Object getO(String key) {
a61af66fc99e Initial load
duke
parents:
diff changeset
276 return vars.get(key);
a61af66fc99e Initial load
duke
parents:
diff changeset
277 }
a61af66fc99e Initial load
duke
parents:
diff changeset
278
a61af66fc99e Initial load
duke
parents:
diff changeset
279 Hashtable getH(String key) {
a61af66fc99e Initial load
duke
parents:
diff changeset
280 return (Hashtable)vars.get(key);
a61af66fc99e Initial load
duke
parents:
diff changeset
281 }
a61af66fc99e Initial load
duke
parents:
diff changeset
282
a61af66fc99e Initial load
duke
parents:
diff changeset
283 Object getFieldInContext(String field) {
a61af66fc99e Initial load
duke
parents:
diff changeset
284 for (int i=0; i<context.length; i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
285 Object rv = getField(context[i], field);
a61af66fc99e Initial load
duke
parents:
diff changeset
286 if (rv != null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
287 return rv;
a61af66fc99e Initial load
duke
parents:
diff changeset
288 }
a61af66fc99e Initial load
duke
parents:
diff changeset
289 }
a61af66fc99e Initial load
duke
parents:
diff changeset
290 return null;
a61af66fc99e Initial load
duke
parents:
diff changeset
291 }
a61af66fc99e Initial load
duke
parents:
diff changeset
292
a61af66fc99e Initial load
duke
parents:
diff changeset
293 Object lookupHashFieldInContext(String field, String key) {
a61af66fc99e Initial load
duke
parents:
diff changeset
294 for (int i=0; i<context.length; i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
295 Hashtable ht = (Hashtable)getField(context[i], field);
a61af66fc99e Initial load
duke
parents:
diff changeset
296 if (ht != null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
297 Object rv = ht.get(key);
a61af66fc99e Initial load
duke
parents:
diff changeset
298 if (rv != null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
299 return rv;
a61af66fc99e Initial load
duke
parents:
diff changeset
300 }
a61af66fc99e Initial load
duke
parents:
diff changeset
301 }
a61af66fc99e Initial load
duke
parents:
diff changeset
302 }
a61af66fc99e Initial load
duke
parents:
diff changeset
303 return null;
a61af66fc99e Initial load
duke
parents:
diff changeset
304 }
a61af66fc99e Initial load
duke
parents:
diff changeset
305
a61af66fc99e Initial load
duke
parents:
diff changeset
306 void put(String key, String value) {
a61af66fc99e Initial load
duke
parents:
diff changeset
307 vars.put(key, value);
a61af66fc99e Initial load
duke
parents:
diff changeset
308 }
a61af66fc99e Initial load
duke
parents:
diff changeset
309
a61af66fc99e Initial load
duke
parents:
diff changeset
310 void put(String key, Vector vvalue) {
a61af66fc99e Initial load
duke
parents:
diff changeset
311 vars.put(key, vvalue);
a61af66fc99e Initial load
duke
parents:
diff changeset
312 }
a61af66fc99e Initial load
duke
parents:
diff changeset
313
a61af66fc99e Initial load
duke
parents:
diff changeset
314 void add(String key, Vector vvalue) {
a61af66fc99e Initial load
duke
parents:
diff changeset
315 getV(key).addAll(vvalue);
a61af66fc99e Initial load
duke
parents:
diff changeset
316 }
a61af66fc99e Initial load
duke
parents:
diff changeset
317
a61af66fc99e Initial load
duke
parents:
diff changeset
318 String flavour() {
a61af66fc99e Initial load
duke
parents:
diff changeset
319 return get("Flavour");
a61af66fc99e Initial load
duke
parents:
diff changeset
320 }
a61af66fc99e Initial load
duke
parents:
diff changeset
321
a61af66fc99e Initial load
duke
parents:
diff changeset
322 String build() {
a61af66fc99e Initial load
duke
parents:
diff changeset
323 return get("Build");
a61af66fc99e Initial load
duke
parents:
diff changeset
324 }
a61af66fc99e Initial load
duke
parents:
diff changeset
325
a61af66fc99e Initial load
duke
parents:
diff changeset
326 Object getSpecificField(String field) {
a61af66fc99e Initial load
duke
parents:
diff changeset
327 return getField(get("Id"), field);
a61af66fc99e Initial load
duke
parents:
diff changeset
328 }
a61af66fc99e Initial load
duke
parents:
diff changeset
329
a61af66fc99e Initial load
duke
parents:
diff changeset
330 void putSpecificField(String field, Object value) {
a61af66fc99e Initial load
duke
parents:
diff changeset
331 putField(get("Id"), field, value);
a61af66fc99e Initial load
duke
parents:
diff changeset
332 }
a61af66fc99e Initial load
duke
parents:
diff changeset
333
a61af66fc99e Initial load
duke
parents:
diff changeset
334 void collectRelevantVectors(Vector rv, String field) {
a61af66fc99e Initial load
duke
parents:
diff changeset
335 for (int i = 0; i < context.length; i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
336 Vector v = getFieldVector(context[i], field);
a61af66fc99e Initial load
duke
parents:
diff changeset
337 if (v != null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
338 for (Iterator j=v.iterator(); j.hasNext(); ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
339 String val = (String)j.next();
a61af66fc99e Initial load
duke
parents:
diff changeset
340 rv.add(expandFormat(val));
a61af66fc99e Initial load
duke
parents:
diff changeset
341 }
a61af66fc99e Initial load
duke
parents:
diff changeset
342 }
a61af66fc99e Initial load
duke
parents:
diff changeset
343 }
a61af66fc99e Initial load
duke
parents:
diff changeset
344 }
a61af66fc99e Initial load
duke
parents:
diff changeset
345
a61af66fc99e Initial load
duke
parents:
diff changeset
346 void collectRelevantHashes(Hashtable rv, String field) {
a61af66fc99e Initial load
duke
parents:
diff changeset
347 for (int i = 0; i < context.length; i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
348 Hashtable v = (Hashtable)getField(context[i], field);
a61af66fc99e Initial load
duke
parents:
diff changeset
349 if (v != null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
350 for (Enumeration e=v.keys(); e.hasMoreElements(); ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
351 String key = (String)e.nextElement();
a61af66fc99e Initial load
duke
parents:
diff changeset
352 String val = (String)v.get(key);
a61af66fc99e Initial load
duke
parents:
diff changeset
353 addTo(rv, key, val);
a61af66fc99e Initial load
duke
parents:
diff changeset
354 }
a61af66fc99e Initial load
duke
parents:
diff changeset
355 }
a61af66fc99e Initial load
duke
parents:
diff changeset
356 }
a61af66fc99e Initial load
duke
parents:
diff changeset
357 }
a61af66fc99e Initial load
duke
parents:
diff changeset
358
a61af66fc99e Initial load
duke
parents:
diff changeset
359
a61af66fc99e Initial load
duke
parents:
diff changeset
360 Vector getDefines() {
a61af66fc99e Initial load
duke
parents:
diff changeset
361 Vector rv = new Vector();
a61af66fc99e Initial load
duke
parents:
diff changeset
362 collectRelevantVectors(rv, "Define");
a61af66fc99e Initial load
duke
parents:
diff changeset
363 return rv;
a61af66fc99e Initial load
duke
parents:
diff changeset
364 }
a61af66fc99e Initial load
duke
parents:
diff changeset
365
a61af66fc99e Initial load
duke
parents:
diff changeset
366 Vector getIncludes() {
a61af66fc99e Initial load
duke
parents:
diff changeset
367 Vector rv = new Vector();
a61af66fc99e Initial load
duke
parents:
diff changeset
368
a61af66fc99e Initial load
duke
parents:
diff changeset
369 // for generated includes
a61af66fc99e Initial load
duke
parents:
diff changeset
370 rv.add(get("OutputDir"));
a61af66fc99e Initial load
duke
parents:
diff changeset
371
a61af66fc99e Initial load
duke
parents:
diff changeset
372 collectRelevantVectors(rv, "AbsoluteInclude");
a61af66fc99e Initial load
duke
parents:
diff changeset
373
a61af66fc99e Initial load
duke
parents:
diff changeset
374 Vector ri = new Vector();
a61af66fc99e Initial load
duke
parents:
diff changeset
375 String sourceBase = getFieldString(null, "SourceBase");
a61af66fc99e Initial load
duke
parents:
diff changeset
376 collectRelevantVectors(ri, "RelativeInclude");
a61af66fc99e Initial load
duke
parents:
diff changeset
377 for (Iterator i = ri.iterator(); i.hasNext(); ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
378 String f = (String)i.next();
a61af66fc99e Initial load
duke
parents:
diff changeset
379 rv.add(sourceBase + Util.sep + f);
a61af66fc99e Initial load
duke
parents:
diff changeset
380 }
a61af66fc99e Initial load
duke
parents:
diff changeset
381
a61af66fc99e Initial load
duke
parents:
diff changeset
382 return rv;
a61af66fc99e Initial load
duke
parents:
diff changeset
383 }
a61af66fc99e Initial load
duke
parents:
diff changeset
384
a61af66fc99e Initial load
duke
parents:
diff changeset
385 static Hashtable cfgData = new Hashtable();
a61af66fc99e Initial load
duke
parents:
diff changeset
386 static Hashtable globalData = new Hashtable();
a61af66fc99e Initial load
duke
parents:
diff changeset
387
a61af66fc99e Initial load
duke
parents:
diff changeset
388 static boolean appliesToTieredBuild(String cfg) {
a61af66fc99e Initial load
duke
parents:
diff changeset
389 return (cfg != null &&
a61af66fc99e Initial load
duke
parents:
diff changeset
390 (cfg.startsWith("compiler1") ||
a61af66fc99e Initial load
duke
parents:
diff changeset
391 cfg.startsWith("compiler2")));
a61af66fc99e Initial load
duke
parents:
diff changeset
392 }
a61af66fc99e Initial load
duke
parents:
diff changeset
393
a61af66fc99e Initial load
duke
parents:
diff changeset
394 // Filters out the IncludeDB statement, which is the only command-
a61af66fc99e Initial load
duke
parents:
diff changeset
395 // line argument we explicitly specialize for the tiered build
a61af66fc99e Initial load
duke
parents:
diff changeset
396 static boolean appliesToTieredBuild(String cfg, String key) {
a61af66fc99e Initial load
duke
parents:
diff changeset
397 return (appliesToTieredBuild(cfg) &&
a61af66fc99e Initial load
duke
parents:
diff changeset
398 (key != null &&
a61af66fc99e Initial load
duke
parents:
diff changeset
399 !key.equals("IncludeDB")));
a61af66fc99e Initial load
duke
parents:
diff changeset
400 }
a61af66fc99e Initial load
duke
parents:
diff changeset
401
a61af66fc99e Initial load
duke
parents:
diff changeset
402 static String getTieredBuildCfg(String cfg) {
a61af66fc99e Initial load
duke
parents:
diff changeset
403 assert appliesToTieredBuild(cfg) : "illegal configuration " + cfg;
a61af66fc99e Initial load
duke
parents:
diff changeset
404 return "tiered" + cfg.substring(9);
a61af66fc99e Initial load
duke
parents:
diff changeset
405 }
a61af66fc99e Initial load
duke
parents:
diff changeset
406
a61af66fc99e Initial load
duke
parents:
diff changeset
407 static Object getField(String cfg, String field) {
a61af66fc99e Initial load
duke
parents:
diff changeset
408 if (cfg == null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
409 return globalData.get(field);
a61af66fc99e Initial load
duke
parents:
diff changeset
410 }
a61af66fc99e Initial load
duke
parents:
diff changeset
411
a61af66fc99e Initial load
duke
parents:
diff changeset
412 Hashtable ht = (Hashtable)cfgData.get(cfg);
a61af66fc99e Initial load
duke
parents:
diff changeset
413 return ht == null ? null : ht.get(field);
a61af66fc99e Initial load
duke
parents:
diff changeset
414 }
a61af66fc99e Initial load
duke
parents:
diff changeset
415
a61af66fc99e Initial load
duke
parents:
diff changeset
416 static String getFieldString(String cfg, String field) {
a61af66fc99e Initial load
duke
parents:
diff changeset
417 return (String)getField(cfg, field);
a61af66fc99e Initial load
duke
parents:
diff changeset
418 }
a61af66fc99e Initial load
duke
parents:
diff changeset
419
a61af66fc99e Initial load
duke
parents:
diff changeset
420 static Vector getFieldVector(String cfg, String field) {
a61af66fc99e Initial load
duke
parents:
diff changeset
421 return (Vector)getField(cfg, field);
a61af66fc99e Initial load
duke
parents:
diff changeset
422 }
a61af66fc99e Initial load
duke
parents:
diff changeset
423
a61af66fc99e Initial load
duke
parents:
diff changeset
424 static void putField(String cfg, String field, Object value) {
a61af66fc99e Initial load
duke
parents:
diff changeset
425 putFieldImpl(cfg, field, value);
a61af66fc99e Initial load
duke
parents:
diff changeset
426 if (appliesToTieredBuild(cfg, field)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
427 putFieldImpl(getTieredBuildCfg(cfg), field, value);
a61af66fc99e Initial load
duke
parents:
diff changeset
428 }
a61af66fc99e Initial load
duke
parents:
diff changeset
429 }
a61af66fc99e Initial load
duke
parents:
diff changeset
430
a61af66fc99e Initial load
duke
parents:
diff changeset
431 private static void putFieldImpl(String cfg, String field, Object value) {
a61af66fc99e Initial load
duke
parents:
diff changeset
432 if (cfg == null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
433 globalData.put(field, value);
a61af66fc99e Initial load
duke
parents:
diff changeset
434 return;
a61af66fc99e Initial load
duke
parents:
diff changeset
435 }
a61af66fc99e Initial load
duke
parents:
diff changeset
436
a61af66fc99e Initial load
duke
parents:
diff changeset
437 Hashtable ht = (Hashtable)cfgData.get(cfg);
a61af66fc99e Initial load
duke
parents:
diff changeset
438 if (ht == null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
439 ht = new Hashtable();
a61af66fc99e Initial load
duke
parents:
diff changeset
440 cfgData.put(cfg, ht);
a61af66fc99e Initial load
duke
parents:
diff changeset
441 }
a61af66fc99e Initial load
duke
parents:
diff changeset
442
a61af66fc99e Initial load
duke
parents:
diff changeset
443 ht.put(field, value);
a61af66fc99e Initial load
duke
parents:
diff changeset
444 }
a61af66fc99e Initial load
duke
parents:
diff changeset
445
a61af66fc99e Initial load
duke
parents:
diff changeset
446 static Object getFieldHash(String cfg, String field, String name) {
a61af66fc99e Initial load
duke
parents:
diff changeset
447 Hashtable ht = (Hashtable)getField(cfg, field);
a61af66fc99e Initial load
duke
parents:
diff changeset
448
a61af66fc99e Initial load
duke
parents:
diff changeset
449 return ht == null ? null : ht.get(name);
a61af66fc99e Initial load
duke
parents:
diff changeset
450 }
a61af66fc99e Initial load
duke
parents:
diff changeset
451
a61af66fc99e Initial load
duke
parents:
diff changeset
452 static void putFieldHash(String cfg, String field, String name, Object val) {
a61af66fc99e Initial load
duke
parents:
diff changeset
453 putFieldHashImpl(cfg, field, name, val);
a61af66fc99e Initial load
duke
parents:
diff changeset
454 if (appliesToTieredBuild(cfg)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
455 putFieldHashImpl(getTieredBuildCfg(cfg), field, name, val);
a61af66fc99e Initial load
duke
parents:
diff changeset
456 }
a61af66fc99e Initial load
duke
parents:
diff changeset
457 }
a61af66fc99e Initial load
duke
parents:
diff changeset
458
a61af66fc99e Initial load
duke
parents:
diff changeset
459 private static void putFieldHashImpl(String cfg, String field, String name, Object val) {
a61af66fc99e Initial load
duke
parents:
diff changeset
460 Hashtable ht = (Hashtable)getField(cfg, field);
a61af66fc99e Initial load
duke
parents:
diff changeset
461
a61af66fc99e Initial load
duke
parents:
diff changeset
462 if (ht == null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
463 ht = new Hashtable();
a61af66fc99e Initial load
duke
parents:
diff changeset
464 putFieldImpl(cfg, field, ht);
a61af66fc99e Initial load
duke
parents:
diff changeset
465 }
a61af66fc99e Initial load
duke
parents:
diff changeset
466
a61af66fc99e Initial load
duke
parents:
diff changeset
467 ht.put(name, val);
a61af66fc99e Initial load
duke
parents:
diff changeset
468 }
a61af66fc99e Initial load
duke
parents:
diff changeset
469
a61af66fc99e Initial load
duke
parents:
diff changeset
470 static void addFieldVector(String cfg, String field, String element) {
a61af66fc99e Initial load
duke
parents:
diff changeset
471 addFieldVectorImpl(cfg, field, element);
a61af66fc99e Initial load
duke
parents:
diff changeset
472 if (appliesToTieredBuild(cfg)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
473 addFieldVectorImpl(getTieredBuildCfg(cfg), field, element);
a61af66fc99e Initial load
duke
parents:
diff changeset
474 }
a61af66fc99e Initial load
duke
parents:
diff changeset
475 }
a61af66fc99e Initial load
duke
parents:
diff changeset
476
a61af66fc99e Initial load
duke
parents:
diff changeset
477 private static void addFieldVectorImpl(String cfg, String field, String element) {
a61af66fc99e Initial load
duke
parents:
diff changeset
478 Vector v = (Vector)getField(cfg, field);
a61af66fc99e Initial load
duke
parents:
diff changeset
479
a61af66fc99e Initial load
duke
parents:
diff changeset
480 if (v == null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
481 v = new Vector();
a61af66fc99e Initial load
duke
parents:
diff changeset
482 putFieldImpl(cfg, field, v);
a61af66fc99e Initial load
duke
parents:
diff changeset
483 }
a61af66fc99e Initial load
duke
parents:
diff changeset
484
a61af66fc99e Initial load
duke
parents:
diff changeset
485 v.add(element);
a61af66fc99e Initial load
duke
parents:
diff changeset
486 }
a61af66fc99e Initial load
duke
parents:
diff changeset
487
a61af66fc99e Initial load
duke
parents:
diff changeset
488 String expandFormat(String format) {
a61af66fc99e Initial load
duke
parents:
diff changeset
489 if (format == null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
490 return null;
a61af66fc99e Initial load
duke
parents:
diff changeset
491 }
a61af66fc99e Initial load
duke
parents:
diff changeset
492
a61af66fc99e Initial load
duke
parents:
diff changeset
493 if (format.indexOf('%') == -1) {
a61af66fc99e Initial load
duke
parents:
diff changeset
494 return format;
a61af66fc99e Initial load
duke
parents:
diff changeset
495 }
a61af66fc99e Initial load
duke
parents:
diff changeset
496
a61af66fc99e Initial load
duke
parents:
diff changeset
497 StringBuffer sb = new StringBuffer();
a61af66fc99e Initial load
duke
parents:
diff changeset
498 int len = format.length();
a61af66fc99e Initial load
duke
parents:
diff changeset
499 for (int i=0; i<len; i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
500 char ch = format.charAt(i);
a61af66fc99e Initial load
duke
parents:
diff changeset
501 if (ch == '%') {
a61af66fc99e Initial load
duke
parents:
diff changeset
502 char ch1 = format.charAt(i+1);
a61af66fc99e Initial load
duke
parents:
diff changeset
503 switch (ch1) {
a61af66fc99e Initial load
duke
parents:
diff changeset
504 case '%':
a61af66fc99e Initial load
duke
parents:
diff changeset
505 sb.append(ch1);
a61af66fc99e Initial load
duke
parents:
diff changeset
506 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
507 case 'b':
a61af66fc99e Initial load
duke
parents:
diff changeset
508 sb.append(build());
a61af66fc99e Initial load
duke
parents:
diff changeset
509 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
510 case 'f':
a61af66fc99e Initial load
duke
parents:
diff changeset
511 sb.append(flavour());
a61af66fc99e Initial load
duke
parents:
diff changeset
512 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
513 default:
a61af66fc99e Initial load
duke
parents:
diff changeset
514 sb.append(ch);
a61af66fc99e Initial load
duke
parents:
diff changeset
515 sb.append(ch1);
a61af66fc99e Initial load
duke
parents:
diff changeset
516 }
a61af66fc99e Initial load
duke
parents:
diff changeset
517 i++;
a61af66fc99e Initial load
duke
parents:
diff changeset
518 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
519 sb.append(ch);
a61af66fc99e Initial load
duke
parents:
diff changeset
520 }
a61af66fc99e Initial load
duke
parents:
diff changeset
521 }
a61af66fc99e Initial load
duke
parents:
diff changeset
522
a61af66fc99e Initial load
duke
parents:
diff changeset
523 return sb.toString();
a61af66fc99e Initial load
duke
parents:
diff changeset
524 }
a61af66fc99e Initial load
duke
parents:
diff changeset
525 }
a61af66fc99e Initial load
duke
parents:
diff changeset
526
a61af66fc99e Initial load
duke
parents:
diff changeset
527 abstract class GenericDebugConfig extends BuildConfig {
a61af66fc99e Initial load
duke
parents:
diff changeset
528 abstract String getOptFlag();
a61af66fc99e Initial load
duke
parents:
diff changeset
529
a61af66fc99e Initial load
duke
parents:
diff changeset
530 protected void init(Vector includes, Vector defines) {
a61af66fc99e Initial load
duke
parents:
diff changeset
531 defines.add("_DEBUG");
a61af66fc99e Initial load
duke
parents:
diff changeset
532 defines.add("ASSERT");
a61af66fc99e Initial load
duke
parents:
diff changeset
533
a61af66fc99e Initial load
duke
parents:
diff changeset
534 super.init(includes, defines);
a61af66fc99e Initial load
duke
parents:
diff changeset
535
a61af66fc99e Initial load
duke
parents:
diff changeset
536 getV("CompilerFlags").addAll(getCI().getDebugCompilerFlags(getOptFlag()));
a61af66fc99e Initial load
duke
parents:
diff changeset
537 getV("LinkerFlags").addAll(getCI().getDebugLinkerFlags());
a61af66fc99e Initial load
duke
parents:
diff changeset
538 }
a61af66fc99e Initial load
duke
parents:
diff changeset
539 }
a61af66fc99e Initial load
duke
parents:
diff changeset
540
a61af66fc99e Initial load
duke
parents:
diff changeset
541 class C1DebugConfig extends GenericDebugConfig {
a61af66fc99e Initial load
duke
parents:
diff changeset
542 String getOptFlag() {
a61af66fc99e Initial load
duke
parents:
diff changeset
543 return getCI().getNoOptFlag();
a61af66fc99e Initial load
duke
parents:
diff changeset
544 }
a61af66fc99e Initial load
duke
parents:
diff changeset
545
a61af66fc99e Initial load
duke
parents:
diff changeset
546 C1DebugConfig() {
a61af66fc99e Initial load
duke
parents:
diff changeset
547 initNames("compiler1", "debug", "fastdebug\\jre\\bin\\client\\jvm.dll");
a61af66fc99e Initial load
duke
parents:
diff changeset
548 init(getIncludes(), getDefines());
a61af66fc99e Initial load
duke
parents:
diff changeset
549 }
a61af66fc99e Initial load
duke
parents:
diff changeset
550 }
a61af66fc99e Initial load
duke
parents:
diff changeset
551
a61af66fc99e Initial load
duke
parents:
diff changeset
552 class C1FastDebugConfig extends GenericDebugConfig {
a61af66fc99e Initial load
duke
parents:
diff changeset
553 String getOptFlag() {
a61af66fc99e Initial load
duke
parents:
diff changeset
554 return getCI().getOptFlag();
a61af66fc99e Initial load
duke
parents:
diff changeset
555 }
a61af66fc99e Initial load
duke
parents:
diff changeset
556
a61af66fc99e Initial load
duke
parents:
diff changeset
557 C1FastDebugConfig() {
a61af66fc99e Initial load
duke
parents:
diff changeset
558 initNames("compiler1", "fastdebug", "fastdebug\\jre\\bin\\client\\jvm.dll");
a61af66fc99e Initial load
duke
parents:
diff changeset
559 init(getIncludes(), getDefines());
a61af66fc99e Initial load
duke
parents:
diff changeset
560 }
a61af66fc99e Initial load
duke
parents:
diff changeset
561 }
a61af66fc99e Initial load
duke
parents:
diff changeset
562
a61af66fc99e Initial load
duke
parents:
diff changeset
563 class C2DebugConfig extends GenericDebugConfig {
a61af66fc99e Initial load
duke
parents:
diff changeset
564 String getOptFlag() {
a61af66fc99e Initial load
duke
parents:
diff changeset
565 return getCI().getNoOptFlag();
a61af66fc99e Initial load
duke
parents:
diff changeset
566 }
a61af66fc99e Initial load
duke
parents:
diff changeset
567
a61af66fc99e Initial load
duke
parents:
diff changeset
568 C2DebugConfig() {
a61af66fc99e Initial load
duke
parents:
diff changeset
569 initNames("compiler2", "debug", "fastdebug\\jre\\bin\\server\\jvm.dll");
a61af66fc99e Initial load
duke
parents:
diff changeset
570 init(getIncludes(), getDefines());
a61af66fc99e Initial load
duke
parents:
diff changeset
571 }
a61af66fc99e Initial load
duke
parents:
diff changeset
572 }
a61af66fc99e Initial load
duke
parents:
diff changeset
573
a61af66fc99e Initial load
duke
parents:
diff changeset
574 class C2FastDebugConfig extends GenericDebugConfig {
a61af66fc99e Initial load
duke
parents:
diff changeset
575 String getOptFlag() {
a61af66fc99e Initial load
duke
parents:
diff changeset
576 return getCI().getOptFlag();
a61af66fc99e Initial load
duke
parents:
diff changeset
577 }
a61af66fc99e Initial load
duke
parents:
diff changeset
578
a61af66fc99e Initial load
duke
parents:
diff changeset
579 C2FastDebugConfig() {
a61af66fc99e Initial load
duke
parents:
diff changeset
580 initNames("compiler2", "fastdebug", "fastdebug\\jre\\bin\\server\\jvm.dll");
a61af66fc99e Initial load
duke
parents:
diff changeset
581 init(getIncludes(), getDefines());
a61af66fc99e Initial load
duke
parents:
diff changeset
582 }
a61af66fc99e Initial load
duke
parents:
diff changeset
583 }
a61af66fc99e Initial load
duke
parents:
diff changeset
584
a61af66fc99e Initial load
duke
parents:
diff changeset
585 class TieredDebugConfig extends GenericDebugConfig {
a61af66fc99e Initial load
duke
parents:
diff changeset
586 String getOptFlag() {
a61af66fc99e Initial load
duke
parents:
diff changeset
587 return getCI().getNoOptFlag();
a61af66fc99e Initial load
duke
parents:
diff changeset
588 }
a61af66fc99e Initial load
duke
parents:
diff changeset
589
a61af66fc99e Initial load
duke
parents:
diff changeset
590 TieredDebugConfig() {
a61af66fc99e Initial load
duke
parents:
diff changeset
591 initNames("tiered", "debug", "fastdebug\\jre\\bin\\server\\jvm.dll");
a61af66fc99e Initial load
duke
parents:
diff changeset
592 init(getIncludes(), getDefines());
a61af66fc99e Initial load
duke
parents:
diff changeset
593 }
a61af66fc99e Initial load
duke
parents:
diff changeset
594 }
a61af66fc99e Initial load
duke
parents:
diff changeset
595
a61af66fc99e Initial load
duke
parents:
diff changeset
596 class TieredFastDebugConfig extends GenericDebugConfig {
a61af66fc99e Initial load
duke
parents:
diff changeset
597 String getOptFlag() {
a61af66fc99e Initial load
duke
parents:
diff changeset
598 return getCI().getOptFlag();
a61af66fc99e Initial load
duke
parents:
diff changeset
599 }
a61af66fc99e Initial load
duke
parents:
diff changeset
600
a61af66fc99e Initial load
duke
parents:
diff changeset
601 TieredFastDebugConfig() {
a61af66fc99e Initial load
duke
parents:
diff changeset
602 initNames("tiered", "fastdebug", "fastdebug\\jre\\bin\\server\\jvm.dll");
a61af66fc99e Initial load
duke
parents:
diff changeset
603 init(getIncludes(), getDefines());
a61af66fc99e Initial load
duke
parents:
diff changeset
604 }
a61af66fc99e Initial load
duke
parents:
diff changeset
605 }
a61af66fc99e Initial load
duke
parents:
diff changeset
606
a61af66fc99e Initial load
duke
parents:
diff changeset
607
a61af66fc99e Initial load
duke
parents:
diff changeset
608 abstract class ProductConfig extends BuildConfig {
a61af66fc99e Initial load
duke
parents:
diff changeset
609 protected void init(Vector includes, Vector defines) {
a61af66fc99e Initial load
duke
parents:
diff changeset
610 defines.add("NDEBUG");
a61af66fc99e Initial load
duke
parents:
diff changeset
611 defines.add("PRODUCT");
a61af66fc99e Initial load
duke
parents:
diff changeset
612
a61af66fc99e Initial load
duke
parents:
diff changeset
613 super.init(includes, defines);
a61af66fc99e Initial load
duke
parents:
diff changeset
614
a61af66fc99e Initial load
duke
parents:
diff changeset
615 getV("CompilerFlags").addAll(getCI().getProductCompilerFlags());
a61af66fc99e Initial load
duke
parents:
diff changeset
616 getV("LinkerFlags").addAll(getCI().getProductLinkerFlags());
a61af66fc99e Initial load
duke
parents:
diff changeset
617 }
a61af66fc99e Initial load
duke
parents:
diff changeset
618 }
a61af66fc99e Initial load
duke
parents:
diff changeset
619
a61af66fc99e Initial load
duke
parents:
diff changeset
620 class C1ProductConfig extends ProductConfig {
a61af66fc99e Initial load
duke
parents:
diff changeset
621 C1ProductConfig() {
a61af66fc99e Initial load
duke
parents:
diff changeset
622 initNames("compiler1", "product", "jre\\bin\\client\\jvm.dll");
a61af66fc99e Initial load
duke
parents:
diff changeset
623 init(getIncludes(), getDefines());
a61af66fc99e Initial load
duke
parents:
diff changeset
624 }
a61af66fc99e Initial load
duke
parents:
diff changeset
625 }
a61af66fc99e Initial load
duke
parents:
diff changeset
626
a61af66fc99e Initial load
duke
parents:
diff changeset
627 class C2ProductConfig extends ProductConfig {
a61af66fc99e Initial load
duke
parents:
diff changeset
628 C2ProductConfig() {
a61af66fc99e Initial load
duke
parents:
diff changeset
629 initNames("compiler2", "product", "jre\\bin\\server\\jvm.dll");
a61af66fc99e Initial load
duke
parents:
diff changeset
630 init(getIncludes(), getDefines());
a61af66fc99e Initial load
duke
parents:
diff changeset
631 }
a61af66fc99e Initial load
duke
parents:
diff changeset
632 }
a61af66fc99e Initial load
duke
parents:
diff changeset
633
a61af66fc99e Initial load
duke
parents:
diff changeset
634 class TieredProductConfig extends ProductConfig {
a61af66fc99e Initial load
duke
parents:
diff changeset
635 TieredProductConfig() {
a61af66fc99e Initial load
duke
parents:
diff changeset
636 initNames("tiered", "product", "jre\\bin\\server\\jvm.dll");
a61af66fc99e Initial load
duke
parents:
diff changeset
637 init(getIncludes(), getDefines());
a61af66fc99e Initial load
duke
parents:
diff changeset
638 }
a61af66fc99e Initial load
duke
parents:
diff changeset
639 }
a61af66fc99e Initial load
duke
parents:
diff changeset
640
a61af66fc99e Initial load
duke
parents:
diff changeset
641
a61af66fc99e Initial load
duke
parents:
diff changeset
642 class CoreDebugConfig extends GenericDebugConfig {
a61af66fc99e Initial load
duke
parents:
diff changeset
643 String getOptFlag() {
a61af66fc99e Initial load
duke
parents:
diff changeset
644 return getCI().getNoOptFlag();
a61af66fc99e Initial load
duke
parents:
diff changeset
645 }
a61af66fc99e Initial load
duke
parents:
diff changeset
646
a61af66fc99e Initial load
duke
parents:
diff changeset
647 CoreDebugConfig() {
a61af66fc99e Initial load
duke
parents:
diff changeset
648 initNames("core", "debug", "fastdebug\\jre\\bin\\core\\jvm.dll");
a61af66fc99e Initial load
duke
parents:
diff changeset
649 init(getIncludes(), getDefines());
a61af66fc99e Initial load
duke
parents:
diff changeset
650 }
a61af66fc99e Initial load
duke
parents:
diff changeset
651 }
a61af66fc99e Initial load
duke
parents:
diff changeset
652
a61af66fc99e Initial load
duke
parents:
diff changeset
653
a61af66fc99e Initial load
duke
parents:
diff changeset
654 class CoreFastDebugConfig extends GenericDebugConfig {
a61af66fc99e Initial load
duke
parents:
diff changeset
655 String getOptFlag() {
a61af66fc99e Initial load
duke
parents:
diff changeset
656 return getCI().getOptFlag();
a61af66fc99e Initial load
duke
parents:
diff changeset
657 }
a61af66fc99e Initial load
duke
parents:
diff changeset
658
a61af66fc99e Initial load
duke
parents:
diff changeset
659 CoreFastDebugConfig() {
a61af66fc99e Initial load
duke
parents:
diff changeset
660 initNames("core", "fastdebug", "fastdebug\\jre\\bin\\core\\jvm.dll");
a61af66fc99e Initial load
duke
parents:
diff changeset
661 init(getIncludes(), getDefines());
a61af66fc99e Initial load
duke
parents:
diff changeset
662 }
a61af66fc99e Initial load
duke
parents:
diff changeset
663 }
a61af66fc99e Initial load
duke
parents:
diff changeset
664
a61af66fc99e Initial load
duke
parents:
diff changeset
665
a61af66fc99e Initial load
duke
parents:
diff changeset
666 class CoreProductConfig extends ProductConfig {
a61af66fc99e Initial load
duke
parents:
diff changeset
667 CoreProductConfig() {
a61af66fc99e Initial load
duke
parents:
diff changeset
668 initNames("core", "product", "jre\\bin\\core\\jvm.dll");
a61af66fc99e Initial load
duke
parents:
diff changeset
669 init(getIncludes(), getDefines());
a61af66fc99e Initial load
duke
parents:
diff changeset
670 }
a61af66fc99e Initial load
duke
parents:
diff changeset
671 }
a61af66fc99e Initial load
duke
parents:
diff changeset
672
a61af66fc99e Initial load
duke
parents:
diff changeset
673 class KernelDebugConfig extends GenericDebugConfig {
a61af66fc99e Initial load
duke
parents:
diff changeset
674 String getOptFlag() {
a61af66fc99e Initial load
duke
parents:
diff changeset
675 return getCI().getNoOptFlag();
a61af66fc99e Initial load
duke
parents:
diff changeset
676 }
a61af66fc99e Initial load
duke
parents:
diff changeset
677
a61af66fc99e Initial load
duke
parents:
diff changeset
678 KernelDebugConfig() {
a61af66fc99e Initial load
duke
parents:
diff changeset
679 initNames("kernel", "debug", "fastdebug\\jre\\bin\\kernel\\jvm.dll");
a61af66fc99e Initial load
duke
parents:
diff changeset
680 init(getIncludes(), getDefines());
a61af66fc99e Initial load
duke
parents:
diff changeset
681 }
a61af66fc99e Initial load
duke
parents:
diff changeset
682 }
a61af66fc99e Initial load
duke
parents:
diff changeset
683
a61af66fc99e Initial load
duke
parents:
diff changeset
684
a61af66fc99e Initial load
duke
parents:
diff changeset
685 class KernelFastDebugConfig extends GenericDebugConfig {
a61af66fc99e Initial load
duke
parents:
diff changeset
686 String getOptFlag() {
a61af66fc99e Initial load
duke
parents:
diff changeset
687 return getCI().getOptFlag();
a61af66fc99e Initial load
duke
parents:
diff changeset
688 }
a61af66fc99e Initial load
duke
parents:
diff changeset
689
a61af66fc99e Initial load
duke
parents:
diff changeset
690 KernelFastDebugConfig() {
a61af66fc99e Initial load
duke
parents:
diff changeset
691 initNames("kernel", "fastdebug", "fastdebug\\jre\\bin\\kernel\\jvm.dll");
a61af66fc99e Initial load
duke
parents:
diff changeset
692 init(getIncludes(), getDefines());
a61af66fc99e Initial load
duke
parents:
diff changeset
693 }
a61af66fc99e Initial load
duke
parents:
diff changeset
694 }
a61af66fc99e Initial load
duke
parents:
diff changeset
695
a61af66fc99e Initial load
duke
parents:
diff changeset
696
a61af66fc99e Initial load
duke
parents:
diff changeset
697 class KernelProductConfig extends ProductConfig {
a61af66fc99e Initial load
duke
parents:
diff changeset
698 KernelProductConfig() {
a61af66fc99e Initial load
duke
parents:
diff changeset
699 initNames("kernel", "product", "jre\\bin\\kernel\\jvm.dll");
a61af66fc99e Initial load
duke
parents:
diff changeset
700 init(getIncludes(), getDefines());
a61af66fc99e Initial load
duke
parents:
diff changeset
701 }
a61af66fc99e Initial load
duke
parents:
diff changeset
702 }
a61af66fc99e Initial load
duke
parents:
diff changeset
703 abstract class CompilerInterface {
a61af66fc99e Initial load
duke
parents:
diff changeset
704 abstract Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir);
a61af66fc99e Initial load
duke
parents:
diff changeset
705 abstract Vector getBaseLinkerFlags(String outDir, String outDll);
a61af66fc99e Initial load
duke
parents:
diff changeset
706 abstract Vector getDebugCompilerFlags(String opt);
a61af66fc99e Initial load
duke
parents:
diff changeset
707 abstract Vector getDebugLinkerFlags();
a61af66fc99e Initial load
duke
parents:
diff changeset
708 abstract Vector getProductCompilerFlags();
a61af66fc99e Initial load
duke
parents:
diff changeset
709 abstract Vector getProductLinkerFlags();
a61af66fc99e Initial load
duke
parents:
diff changeset
710 abstract String getOptFlag();
a61af66fc99e Initial load
duke
parents:
diff changeset
711 abstract String getNoOptFlag();
a61af66fc99e Initial load
duke
parents:
diff changeset
712 abstract String makeCfgName(String flavourBuild);
a61af66fc99e Initial load
duke
parents:
diff changeset
713
a61af66fc99e Initial load
duke
parents:
diff changeset
714 void addAttr(Vector receiver, String attr, String value) {
a61af66fc99e Initial load
duke
parents:
diff changeset
715 receiver.add(attr); receiver.add(value);
a61af66fc99e Initial load
duke
parents:
diff changeset
716 }
a61af66fc99e Initial load
duke
parents:
diff changeset
717 }