Mercurial > hg > graal-compiler
comparison src/share/tools/ProjectCreator/BuildConfig.java @ 2044:06f017f7daa7
Merge.
author | Thomas Wuerthinger <wuerthinger@ssw.jku.at> |
---|---|
date | Fri, 07 Jan 2011 18:18:08 +0100 |
parents | src/share/tools/MakeDeps/BuildConfig.java@2d26b0046e0d src/share/tools/MakeDeps/BuildConfig.java@aa6e219afbf1 |
children | 5d801e6b9a80 |
comparison
equal
deleted
inserted
replaced
1942:00bc9eaf0e24 | 2044:06f017f7daa7 |
---|---|
1 /* | |
2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. | |
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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
20 * or visit www.oracle.com if you need additional information or have any | |
21 * questions. | |
22 * | |
23 */ | |
24 | |
25 import java.io.File; | |
26 import java.util.Enumeration; | |
27 import java.util.Hashtable; | |
28 import java.util.Iterator; | |
29 import java.util.Vector; | |
30 | |
31 class BuildConfig { | |
32 Hashtable vars; | |
33 Vector basicNames, basicPaths; | |
34 String[] context; | |
35 | |
36 static CompilerInterface ci; | |
37 static CompilerInterface getCI() { | |
38 if (ci == null) { | |
39 String comp = (String)getField(null, "CompilerVersion"); | |
40 try { | |
41 ci = (CompilerInterface)Class.forName("CompilerInterface" + comp).newInstance(); | |
42 } catch (Exception cnfe) { | |
43 System.err.println("Cannot find support for compiler " + comp); | |
44 throw new RuntimeException(cnfe.toString()); | |
45 } | |
46 } | |
47 return ci; | |
48 } | |
49 | |
50 protected void initNames(String flavour, String build, String outDll) { | |
51 if (vars == null) vars = new Hashtable(); | |
52 | |
53 String flavourBuild = flavour + "_" + build; | |
54 System.out.println(); | |
55 System.out.println(flavourBuild); | |
56 | |
57 put("Name", getCI().makeCfgName(flavourBuild)); | |
58 put("Flavour", flavour); | |
59 put("Build", build); | |
60 | |
61 // ones mentioned above were needed to expand format | |
62 String buildBase = expandFormat(getFieldString(null, "BuildBase")); | |
63 String sourceBase = getFieldString(null, "SourceBase"); | |
64 String outDir = buildBase; | |
65 | |
66 put("Id", flavourBuild); | |
67 put("OutputDir", outDir); | |
68 put("SourceBase", sourceBase); | |
69 put("BuildBase", buildBase); | |
70 put("OutputDll", outDir + Util.sep + outDll); | |
71 | |
72 context = new String [] {flavourBuild, flavour, build, null}; | |
73 } | |
74 | |
75 protected void init(Vector includes, Vector defines) { | |
76 initDefaultDefines(defines); | |
77 initDefaultCompilerFlags(includes); | |
78 initDefaultLinkerFlags(); | |
79 handleDB(); | |
80 } | |
81 | |
82 | |
83 protected void initDefaultCompilerFlags(Vector includes) { | |
84 Vector compilerFlags = new Vector(); | |
85 | |
86 compilerFlags.addAll(getCI().getBaseCompilerFlags(getV("Define"), | |
87 includes, | |
88 get("OutputDir"))); | |
89 | |
90 put("CompilerFlags", compilerFlags); | |
91 } | |
92 | |
93 protected void initDefaultLinkerFlags() { | |
94 Vector linkerFlags = new Vector(); | |
95 | |
96 linkerFlags.addAll(getCI().getBaseLinkerFlags( get("OutputDir"), get("OutputDll"))); | |
97 | |
98 put("LinkerFlags", linkerFlags); | |
99 } | |
100 | |
101 DirectoryTree getSourceTree(String sourceBase, String startAt) { | |
102 DirectoryTree tree = new DirectoryTree(); | |
103 | |
104 tree.addSubdirToIgnore("Codemgr_wsdata"); | |
105 tree.addSubdirToIgnore("deleted_files"); | |
106 tree.addSubdirToIgnore("SCCS"); | |
107 tree.setVerbose(true); | |
108 if (startAt != null) { | |
109 tree.readDirectory(sourceBase + File.separator + startAt); | |
110 } else { | |
111 tree.readDirectory(sourceBase); | |
112 } | |
113 | |
114 return tree; | |
115 } | |
116 | |
117 | |
118 Vector getPreferredPaths(MacroDefinitions macros) { | |
119 Vector preferredPaths = new Vector(); | |
120 // In the case of multiple files with the same name in | |
121 // different subdirectories, prefer the versions specified in | |
122 // the platform file as the "os_family" and "arch" macros. | |
123 for (Iterator iter = macros.getMacros(); iter.hasNext(); ) { | |
124 Macro macro = (Macro) iter.next(); | |
125 if (macro.name.equals("os_family") || | |
126 macro.name.equals("arch")) { | |
127 preferredPaths.add(macro.contents); | |
128 } | |
129 } | |
130 // Also prefer "opto" over "adlc" for adlcVMDeps.hpp | |
131 preferredPaths.add("opto"); | |
132 | |
133 return preferredPaths; | |
134 } | |
135 | |
136 | |
137 void handleDB() { | |
138 WinGammaPlatform platform = (WinGammaPlatform)getField(null, "PlatformObject"); | |
139 | |
140 File incls = new File(get("OutputDir")+Util.sep+"incls"); | |
141 | |
142 incls.mkdirs(); | |
143 | |
144 MacroDefinitions macros = new MacroDefinitions(); | |
145 try { | |
146 macros.readFrom(getFieldString(null, "Platform"), false); | |
147 } catch (Exception e) { | |
148 throw new RuntimeException(e); | |
149 } | |
150 | |
151 putSpecificField("AllFilesHash", computeAllFiles(platform, macros)); | |
152 } | |
153 | |
154 | |
155 private boolean matchesIgnoredPath(String prefixedName) { | |
156 Vector rv = new Vector(); | |
157 collectRelevantVectors(rv, "IgnorePath"); | |
158 for (Iterator i = rv.iterator(); i.hasNext(); ) { | |
159 String pathPart = (String) i.next(); | |
160 if (prefixedName.contains(Util.normalize(pathPart))) { | |
161 return true; | |
162 } | |
163 } | |
164 return false; | |
165 } | |
166 | |
167 void addAll(Iterator i, Hashtable hash, | |
168 WinGammaPlatform platform, DirectoryTree tree, | |
169 Vector preferredPaths, Vector filesNotFound, Vector filesDuplicate) { | |
170 for (; i.hasNext(); ) { | |
171 String fileName = (String) i.next(); | |
172 if (lookupHashFieldInContext("IgnoreFile", fileName) == null) { | |
173 String prefixedName = platform.envVarPrefixedFileName(fileName, | |
174 0, /* ignored */ | |
175 tree, | |
176 preferredPaths, | |
177 filesNotFound, | |
178 filesDuplicate); | |
179 if (prefixedName != null) { | |
180 prefixedName = Util.normalize(prefixedName); | |
181 if (!matchesIgnoredPath(prefixedName)) { | |
182 addTo(hash, prefixedName, fileName); | |
183 } | |
184 } | |
185 } | |
186 } | |
187 } | |
188 | |
189 void addTo(Hashtable ht, String key, String value) { | |
190 ht.put(expandFormat(key), expandFormat(value)); | |
191 } | |
192 | |
193 Hashtable computeAllFiles(WinGammaPlatform platform, MacroDefinitions macros) { | |
194 Hashtable rv = new Hashtable(); | |
195 DirectoryTree tree = getSourceTree(get("SourceBase"), getFieldString(null, "StartAt")); | |
196 Vector preferredPaths = getPreferredPaths(macros); | |
197 | |
198 // Hold errors until end | |
199 Vector filesNotFound = new Vector(); | |
200 Vector filesDuplicate = new Vector(); | |
201 | |
202 Vector includedFiles = new Vector(); | |
203 | |
204 // find all files | |
205 Vector dirs = getSourceIncludes(); | |
206 for (Iterator i = dirs.iterator(); i.hasNext(); ) { | |
207 String dir = (String)i.next(); | |
208 DirectoryTree subtree = getSourceTree(dir, null); | |
209 for (Iterator fi = subtree.getFileIterator(); fi.hasNext(); ) { | |
210 String name = ((File)fi.next()).getName(); | |
211 includedFiles.add(name); | |
212 } | |
213 } | |
214 addAll(includedFiles.iterator(), rv, | |
215 platform, tree, | |
216 preferredPaths, filesNotFound, filesDuplicate); | |
217 | |
218 Vector addFiles = new Vector(); | |
219 collectRelevantVectors(addFiles, "AdditionalFile"); | |
220 addAll(addFiles.iterator(), rv, | |
221 platform, tree, | |
222 preferredPaths, filesNotFound, filesDuplicate); | |
223 | |
224 collectRelevantHashes(rv, "AdditionalGeneratedFile"); | |
225 | |
226 if ((filesNotFound.size() != 0) || | |
227 (filesDuplicate.size() != 0)) { | |
228 System.err.println("Error: some files were not found or " + | |
229 "appeared in multiple subdirectories of " + | |
230 "directory " + get("SourceBase") + " and could not " + | |
231 "be resolved with the os_family and arch " + | |
232 "macros in the platform file."); | |
233 if (filesNotFound.size() != 0) { | |
234 System.err.println("Files not found:"); | |
235 for (Iterator iter = filesNotFound.iterator(); | |
236 iter.hasNext(); ) { | |
237 System.err.println(" " + (String) iter.next()); | |
238 } | |
239 } | |
240 if (filesDuplicate.size() != 0) { | |
241 System.err.println("Duplicate files:"); | |
242 for (Iterator iter = filesDuplicate.iterator(); | |
243 iter.hasNext(); ) { | |
244 System.err.println(" " + (String) iter.next()); | |
245 } | |
246 } | |
247 throw new RuntimeException(); | |
248 } | |
249 | |
250 return rv; | |
251 } | |
252 | |
253 void initDefaultDefines(Vector defines) { | |
254 Vector sysDefines = new Vector(); | |
255 if( Util.os().equals("Win32")) { | |
256 sysDefines.add("WIN32"); | |
257 sysDefines.add("HOTSPOT_LIB_ARCH=\\\"i386\\\""); | |
258 } else { | |
259 sysDefines.add("_AMD64_"); | |
260 sysDefines.add("AMD64"); | |
261 sysDefines.add("_WIN64"); | |
262 sysDefines.add("_LP64"); | |
263 if (System.getenv("MSC_VER") != null) | |
264 sysDefines.add("MSC_VER=" + System.getenv("MSC_VER")); | |
265 sysDefines.add("HOTSPOT_LIB_ARCH=\\\"amd64\\\""); | |
266 } | |
267 sysDefines.add("_WINDOWS"); | |
268 sysDefines.add("HOTSPOT_BUILD_USER="+System.getProperty("user.name")); | |
269 sysDefines.add("HOTSPOT_BUILD_TARGET=\\\""+get("Build")+"\\\""); | |
270 sysDefines.add("_JNI_IMPLEMENTATION_"); | |
271 | |
272 sysDefines.addAll(defines); | |
273 | |
274 put("Define", sysDefines); | |
275 } | |
276 | |
277 String get(String key) { | |
278 return (String)vars.get(key); | |
279 } | |
280 | |
281 Vector getV(String key) { | |
282 return (Vector)vars.get(key); | |
283 } | |
284 | |
285 Object getO(String key) { | |
286 return vars.get(key); | |
287 } | |
288 | |
289 Hashtable getH(String key) { | |
290 return (Hashtable)vars.get(key); | |
291 } | |
292 | |
293 Object getFieldInContext(String field) { | |
294 for (int i=0; i<context.length; i++) { | |
295 Object rv = getField(context[i], field); | |
296 if (rv != null) { | |
297 return rv; | |
298 } | |
299 } | |
300 return null; | |
301 } | |
302 | |
303 Object lookupHashFieldInContext(String field, String key) { | |
304 for (int i=0; i<context.length; i++) { | |
305 Hashtable ht = (Hashtable)getField(context[i], field); | |
306 if (ht != null) { | |
307 Object rv = ht.get(key); | |
308 if (rv != null) { | |
309 return rv; | |
310 } | |
311 } | |
312 } | |
313 return null; | |
314 } | |
315 | |
316 void put(String key, String value) { | |
317 vars.put(key, value); | |
318 } | |
319 | |
320 void put(String key, Vector vvalue) { | |
321 vars.put(key, vvalue); | |
322 } | |
323 | |
324 void add(String key, Vector vvalue) { | |
325 getV(key).addAll(vvalue); | |
326 } | |
327 | |
328 String flavour() { | |
329 return get("Flavour"); | |
330 } | |
331 | |
332 String build() { | |
333 return get("Build"); | |
334 } | |
335 | |
336 Object getSpecificField(String field) { | |
337 return getField(get("Id"), field); | |
338 } | |
339 | |
340 void putSpecificField(String field, Object value) { | |
341 putField(get("Id"), field, value); | |
342 } | |
343 | |
344 void collectRelevantVectors(Vector rv, String field) { | |
345 for (int i = 0; i < context.length; i++) { | |
346 Vector v = getFieldVector(context[i], field); | |
347 if (v != null) { | |
348 for (Iterator j=v.iterator(); j.hasNext(); ) { | |
349 String val = (String)j.next(); | |
350 rv.add(expandFormat(val)); | |
351 } | |
352 } | |
353 } | |
354 } | |
355 | |
356 void collectRelevantHashes(Hashtable rv, String field) { | |
357 for (int i = 0; i < context.length; i++) { | |
358 Hashtable v = (Hashtable)getField(context[i], field); | |
359 if (v != null) { | |
360 for (Enumeration e=v.keys(); e.hasMoreElements(); ) { | |
361 String key = (String)e.nextElement(); | |
362 String val = (String)v.get(key); | |
363 addTo(rv, key, val); | |
364 } | |
365 } | |
366 } | |
367 } | |
368 | |
369 | |
370 Vector getDefines() { | |
371 Vector rv = new Vector(); | |
372 collectRelevantVectors(rv, "Define"); | |
373 return rv; | |
374 } | |
375 | |
376 Vector getIncludes() { | |
377 Vector rv = new Vector(); | |
378 | |
379 collectRelevantVectors(rv, "AbsoluteInclude"); | |
380 | |
381 rv.addAll(getSourceIncludes()); | |
382 | |
383 return rv; | |
384 } | |
385 | |
386 private Vector getSourceIncludes() { | |
387 Vector rv = new Vector(); | |
388 Vector ri = new Vector(); | |
389 String sourceBase = getFieldString(null, "SourceBase"); | |
390 collectRelevantVectors(ri, "RelativeInclude"); | |
391 for (Iterator i = ri.iterator(); i.hasNext(); ) { | |
392 String f = (String)i.next(); | |
393 rv.add(sourceBase + Util.sep + f); | |
394 } | |
395 return rv; | |
396 } | |
397 | |
398 static Hashtable cfgData = new Hashtable(); | |
399 static Hashtable globalData = new Hashtable(); | |
400 | |
401 static boolean appliesToTieredBuild(String cfg) { | |
402 return (cfg != null && | |
403 (cfg.startsWith("compiler1") || | |
404 cfg.startsWith("compiler2"))); | |
405 } | |
406 | |
407 // Filters out the IgnoreFile and IgnorePaths since they are | |
408 // handled specially for tiered builds. | |
409 static boolean appliesToTieredBuild(String cfg, String key) { | |
410 return (appliesToTieredBuild(cfg))&& (key != null && !key.startsWith("Ignore")); | |
411 } | |
412 | |
413 static String getTieredBuildCfg(String cfg) { | |
414 assert appliesToTieredBuild(cfg) : "illegal configuration " + cfg; | |
415 return "tiered" + cfg.substring(9); | |
416 } | |
417 | |
418 static Object getField(String cfg, String field) { | |
419 if (cfg == null) { | |
420 return globalData.get(field); | |
421 } | |
422 | |
423 Hashtable ht = (Hashtable)cfgData.get(cfg); | |
424 return ht == null ? null : ht.get(field); | |
425 } | |
426 | |
427 static String getFieldString(String cfg, String field) { | |
428 return (String)getField(cfg, field); | |
429 } | |
430 | |
431 static Vector getFieldVector(String cfg, String field) { | |
432 return (Vector)getField(cfg, field); | |
433 } | |
434 | |
435 static void putField(String cfg, String field, Object value) { | |
436 putFieldImpl(cfg, field, value); | |
437 if (appliesToTieredBuild(cfg, field)) { | |
438 putFieldImpl(getTieredBuildCfg(cfg), field, value); | |
439 } | |
440 } | |
441 | |
442 private static void putFieldImpl(String cfg, String field, Object value) { | |
443 if (cfg == null) { | |
444 globalData.put(field, value); | |
445 return; | |
446 } | |
447 | |
448 Hashtable ht = (Hashtable)cfgData.get(cfg); | |
449 if (ht == null) { | |
450 ht = new Hashtable(); | |
451 cfgData.put(cfg, ht); | |
452 } | |
453 | |
454 ht.put(field, value); | |
455 } | |
456 | |
457 static Object getFieldHash(String cfg, String field, String name) { | |
458 Hashtable ht = (Hashtable)getField(cfg, field); | |
459 | |
460 return ht == null ? null : ht.get(name); | |
461 } | |
462 | |
463 static void putFieldHash(String cfg, String field, String name, Object val) { | |
464 putFieldHashImpl(cfg, field, name, val); | |
465 if (appliesToTieredBuild(cfg, field)) { | |
466 putFieldHashImpl(getTieredBuildCfg(cfg), field, name, val); | |
467 } | |
468 } | |
469 | |
470 private static void putFieldHashImpl(String cfg, String field, String name, Object val) { | |
471 Hashtable ht = (Hashtable)getField(cfg, field); | |
472 | |
473 if (ht == null) { | |
474 ht = new Hashtable(); | |
475 putFieldImpl(cfg, field, ht); | |
476 } | |
477 | |
478 ht.put(name, val); | |
479 } | |
480 | |
481 static void addFieldVector(String cfg, String field, String element) { | |
482 addFieldVectorImpl(cfg, field, element); | |
483 if (appliesToTieredBuild(cfg, field)) { | |
484 addFieldVectorImpl(getTieredBuildCfg(cfg), field, element); | |
485 } | |
486 } | |
487 | |
488 private static void addFieldVectorImpl(String cfg, String field, String element) { | |
489 Vector v = (Vector)getField(cfg, field); | |
490 | |
491 if (v == null) { | |
492 v = new Vector(); | |
493 putFieldImpl(cfg, field, v); | |
494 } | |
495 | |
496 v.add(element); | |
497 } | |
498 | |
499 String expandFormat(String format) { | |
500 if (format == null) { | |
501 return null; | |
502 } | |
503 | |
504 if (format.indexOf('%') == -1) { | |
505 return format; | |
506 } | |
507 | |
508 StringBuffer sb = new StringBuffer(); | |
509 int len = format.length(); | |
510 for (int i=0; i<len; i++) { | |
511 char ch = format.charAt(i); | |
512 if (ch == '%') { | |
513 char ch1 = format.charAt(i+1); | |
514 switch (ch1) { | |
515 case '%': | |
516 sb.append(ch1); | |
517 break; | |
518 case 'b': | |
519 sb.append(build()); | |
520 break; | |
521 case 'f': | |
522 sb.append(flavour()); | |
523 break; | |
524 default: | |
525 sb.append(ch); | |
526 sb.append(ch1); | |
527 } | |
528 i++; | |
529 } else { | |
530 sb.append(ch); | |
531 } | |
532 } | |
533 | |
534 return sb.toString(); | |
535 } | |
536 } | |
537 | |
538 abstract class GenericDebugConfig extends BuildConfig { | |
539 abstract String getOptFlag(); | |
540 | |
541 protected void init(Vector includes, Vector defines) { | |
542 defines.add("_DEBUG"); | |
543 defines.add("ASSERT"); | |
544 | |
545 super.init(includes, defines); | |
546 | |
547 getV("CompilerFlags").addAll(getCI().getDebugCompilerFlags(getOptFlag())); | |
548 getV("LinkerFlags").addAll(getCI().getDebugLinkerFlags()); | |
549 } | |
550 } | |
551 | |
552 abstract class GenericDebugNonKernelConfig extends GenericDebugConfig { | |
553 protected void init(Vector includes, Vector defines) { | |
554 super.init(includes, defines); | |
555 getCI().getAdditionalNonKernelLinkerFlags(getV("LinkerFlags")); | |
556 } | |
557 } | |
558 | |
559 class C1DebugConfig extends GenericDebugNonKernelConfig { | |
560 String getOptFlag() { | |
561 return getCI().getNoOptFlag(); | |
562 } | |
563 | |
564 C1DebugConfig() { | |
565 initNames("compiler1", "debug", "jvm.dll"); | |
566 init(getIncludes(), getDefines()); | |
567 } | |
568 } | |
569 | |
570 class C1FastDebugConfig extends GenericDebugNonKernelConfig { | |
571 String getOptFlag() { | |
572 return getCI().getOptFlag(); | |
573 } | |
574 | |
575 C1FastDebugConfig() { | |
576 initNames("compiler1", "fastdebug", "jvm.dll"); | |
577 init(getIncludes(), getDefines()); | |
578 } | |
579 } | |
580 | |
581 class C2DebugConfig extends GenericDebugNonKernelConfig { | |
582 String getOptFlag() { | |
583 return getCI().getNoOptFlag(); | |
584 } | |
585 | |
586 C2DebugConfig() { | |
587 initNames("compiler2", "debug", "jvm.dll"); | |
588 init(getIncludes(), getDefines()); | |
589 } | |
590 } | |
591 | |
592 class C2FastDebugConfig extends GenericDebugNonKernelConfig { | |
593 String getOptFlag() { | |
594 return getCI().getOptFlag(); | |
595 } | |
596 | |
597 C2FastDebugConfig() { | |
598 initNames("compiler2", "fastdebug", "jvm.dll"); | |
599 init(getIncludes(), getDefines()); | |
600 } | |
601 } | |
602 | |
603 class TieredDebugConfig extends GenericDebugNonKernelConfig { | |
604 String getOptFlag() { | |
605 return getCI().getNoOptFlag(); | |
606 } | |
607 | |
608 TieredDebugConfig() { | |
609 initNames("tiered", "debug", "jvm.dll"); | |
610 init(getIncludes(), getDefines()); | |
611 } | |
612 } | |
613 | |
614 class TieredFastDebugConfig extends GenericDebugNonKernelConfig { | |
615 String getOptFlag() { | |
616 return getCI().getOptFlag(); | |
617 } | |
618 | |
619 TieredFastDebugConfig() { | |
620 initNames("tiered", "fastdebug", "jvm.dll"); | |
621 init(getIncludes(), getDefines()); | |
622 } | |
623 } | |
624 | |
625 | |
626 abstract class ProductConfig extends BuildConfig { | |
627 protected void init(Vector includes, Vector defines) { | |
628 defines.add("NDEBUG"); | |
629 defines.add("PRODUCT"); | |
630 | |
631 super.init(includes, defines); | |
632 | |
633 getV("CompilerFlags").addAll(getCI().getProductCompilerFlags()); | |
634 getV("LinkerFlags").addAll(getCI().getProductLinkerFlags()); | |
635 } | |
636 } | |
637 | |
638 class C1ProductConfig extends ProductConfig { | |
639 C1ProductConfig() { | |
640 initNames("compiler1", "product", "jvm.dll"); | |
641 init(getIncludes(), getDefines()); | |
642 } | |
643 } | |
644 | |
645 class C2ProductConfig extends ProductConfig { | |
646 C2ProductConfig() { | |
647 initNames("compiler2", "product", "jvm.dll"); | |
648 init(getIncludes(), getDefines()); | |
649 } | |
650 } | |
651 | |
652 class TieredProductConfig extends ProductConfig { | |
653 TieredProductConfig() { | |
654 initNames("tiered", "product", "jvm.dll"); | |
655 init(getIncludes(), getDefines()); | |
656 } | |
657 } | |
658 | |
659 | |
660 class CoreDebugConfig extends GenericDebugNonKernelConfig { | |
661 String getOptFlag() { | |
662 return getCI().getNoOptFlag(); | |
663 } | |
664 | |
665 CoreDebugConfig() { | |
666 initNames("core", "debug", "jvm.dll"); | |
667 init(getIncludes(), getDefines()); | |
668 } | |
669 } | |
670 | |
671 | |
672 class CoreFastDebugConfig extends GenericDebugNonKernelConfig { | |
673 String getOptFlag() { | |
674 return getCI().getOptFlag(); | |
675 } | |
676 | |
677 CoreFastDebugConfig() { | |
678 initNames("core", "fastdebug", "jvm.dll"); | |
679 init(getIncludes(), getDefines()); | |
680 } | |
681 } | |
682 | |
683 | |
684 class CoreProductConfig extends ProductConfig { | |
685 CoreProductConfig() { | |
686 initNames("core", "product", "jvm.dll"); | |
687 init(getIncludes(), getDefines()); | |
688 } | |
689 } | |
690 | |
691 class KernelDebugConfig extends GenericDebugConfig { | |
692 String getOptFlag() { | |
693 return getCI().getNoOptFlag(); | |
694 } | |
695 | |
696 KernelDebugConfig() { | |
697 initNames("kernel", "debug", "jvm.dll"); | |
698 init(getIncludes(), getDefines()); | |
699 } | |
700 } | |
701 | |
702 | |
703 class KernelFastDebugConfig extends GenericDebugConfig { | |
704 String getOptFlag() { | |
705 return getCI().getOptFlag(); | |
706 } | |
707 | |
708 KernelFastDebugConfig() { | |
709 initNames("kernel", "fastdebug", "jvm.dll"); | |
710 init(getIncludes(), getDefines()); | |
711 } | |
712 } | |
713 | |
714 | |
715 class KernelProductConfig extends ProductConfig { | |
716 KernelProductConfig() { | |
717 initNames("kernel", "product", "jvm.dll"); | |
718 init(getIncludes(), getDefines()); | |
719 } | |
720 } | |
721 abstract class CompilerInterface { | |
722 abstract Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir); | |
723 abstract Vector getBaseLinkerFlags(String outDir, String outDll); | |
724 abstract Vector getDebugCompilerFlags(String opt); | |
725 abstract Vector getDebugLinkerFlags(); | |
726 abstract void getAdditionalNonKernelLinkerFlags(Vector rv); | |
727 abstract Vector getProductCompilerFlags(); | |
728 abstract Vector getProductLinkerFlags(); | |
729 abstract String getOptFlag(); | |
730 abstract String getNoOptFlag(); | |
731 abstract String makeCfgName(String flavourBuild); | |
732 | |
733 void addAttr(Vector receiver, String attr, String value) { | |
734 receiver.add(attr); receiver.add(value); | |
735 } | |
736 void extAttr(Vector receiver, String attr, String value) { | |
737 int attr_pos=receiver.indexOf(attr) ; | |
738 if ( attr_pos == -1) { | |
739 // If attr IS NOT present in the Vector - add it | |
740 receiver.add(attr); receiver.add(value); | |
741 } else { | |
742 // If attr IS present in the Vector - append value to it | |
743 receiver.set(attr_pos+1,receiver.get(attr_pos+1)+value); | |
744 } | |
745 } | |
746 } |