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