1 /* |
1 /* |
2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
49 |
49 |
50 protected void initNames(String flavour, String build, String outDll) { |
50 protected void initNames(String flavour, String build, String outDll) { |
51 if (vars == null) vars = new Hashtable(); |
51 if (vars == null) vars = new Hashtable(); |
52 |
52 |
53 String flavourBuild = flavour + "_" + build; |
53 String flavourBuild = flavour + "_" + build; |
|
54 String platformName = getFieldString(null, "PlatformName"); |
54 System.out.println(); |
55 System.out.println(); |
55 System.out.println(flavourBuild); |
56 System.out.println(flavourBuild); |
56 |
57 |
57 put("Name", getCI().makeCfgName(flavourBuild)); |
58 put("Name", getCI().makeCfgName(flavourBuild, platformName)); |
58 put("Flavour", flavour); |
59 put("Flavour", flavour); |
59 put("Build", build); |
60 put("Build", build); |
|
61 put("PlatformName", platformName); |
60 |
62 |
61 // ones mentioned above were needed to expand format |
63 // ones mentioned above were needed to expand format |
62 String buildBase = expandFormat(getFieldString(null, "BuildBase")); |
64 String buildBase = expandFormat(getFieldString(null, "BuildBase")); |
63 String sourceBase = getFieldString(null, "SourceBase"); |
65 String sourceBase = getFieldString(null, "SourceBase"); |
64 String outDir = buildBase; |
66 String outDir = buildBase; |
91 } |
93 } |
92 |
94 |
93 protected void initDefaultLinkerFlags() { |
95 protected void initDefaultLinkerFlags() { |
94 Vector linkerFlags = new Vector(); |
96 Vector linkerFlags = new Vector(); |
95 |
97 |
96 linkerFlags.addAll(getCI().getBaseLinkerFlags( get("OutputDir"), get("OutputDll"))); |
98 linkerFlags.addAll(getCI().getBaseLinkerFlags( get("OutputDir"), get("OutputDll"), get("PlatformName"))); |
97 |
99 |
98 put("LinkerFlags", linkerFlags); |
100 put("LinkerFlags", linkerFlags); |
99 } |
101 } |
100 |
102 |
101 DirectoryTree getSourceTree(String sourceBase, String startAt) { |
103 DirectoryTree getSourceTree(String sourceBase, String startAt) { |
113 |
115 |
114 return tree; |
116 return tree; |
115 } |
117 } |
116 |
118 |
117 |
119 |
118 Vector getPreferredPaths(MacroDefinitions macros) { |
120 Vector getPreferredPaths() { |
119 Vector preferredPaths = new Vector(); |
121 Vector preferredPaths = new Vector(); |
|
122 |
120 // In the case of multiple files with the same name in |
123 // In the case of multiple files with the same name in |
121 // different subdirectories, prefer the versions specified in |
124 // different subdirectories, prefer these versions |
122 // the platform file as the "os_family" and "arch" macros. |
125 preferredPaths.add("windows"); |
123 for (Iterator iter = macros.getMacros(); iter.hasNext(); ) { |
126 preferredPaths.add("x86"); |
124 Macro macro = (Macro) iter.next(); |
127 preferredPaths.add("closed"); |
125 if (macro.name.equals("os_family") || |
128 |
126 macro.name.equals("arch")) { |
|
127 preferredPaths.add(macro.contents); |
|
128 } |
|
129 } |
|
130 // Also prefer "opto" over "adlc" for adlcVMDeps.hpp |
129 // Also prefer "opto" over "adlc" for adlcVMDeps.hpp |
131 preferredPaths.add("opto"); |
130 preferredPaths.add("opto"); |
132 |
131 |
133 return preferredPaths; |
132 return preferredPaths; |
134 } |
133 } |
135 |
134 |
136 |
135 |
137 void handleDB() { |
136 void handleDB() { |
138 WinGammaPlatform platform = (WinGammaPlatform)getField(null, "PlatformObject"); |
137 WinGammaPlatform platform = (WinGammaPlatform)getField(null, "PlatformObject"); |
139 |
138 |
140 File incls = new File(get("OutputDir")+Util.sep+"incls"); |
139 putSpecificField("AllFilesHash", computeAllFiles(platform)); |
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 } |
140 } |
153 |
141 |
154 |
142 |
155 private boolean matchesIgnoredPath(String prefixedName) { |
143 private boolean matchesIgnoredPath(String prefixedName) { |
156 Vector rv = new Vector(); |
144 Vector rv = new Vector(); |
188 |
176 |
189 void addTo(Hashtable ht, String key, String value) { |
177 void addTo(Hashtable ht, String key, String value) { |
190 ht.put(expandFormat(key), expandFormat(value)); |
178 ht.put(expandFormat(key), expandFormat(value)); |
191 } |
179 } |
192 |
180 |
193 Hashtable computeAllFiles(WinGammaPlatform platform, MacroDefinitions macros) { |
181 Hashtable computeAllFiles(WinGammaPlatform platform) { |
194 Hashtable rv = new Hashtable(); |
182 Hashtable rv = new Hashtable(); |
195 DirectoryTree tree = getSourceTree(get("SourceBase"), getFieldString(null, "StartAt")); |
183 DirectoryTree tree = getSourceTree(get("SourceBase"), getFieldString(null, "StartAt")); |
196 Vector preferredPaths = getPreferredPaths(macros); |
184 Vector preferredPaths = getPreferredPaths(); |
197 |
185 |
198 // Hold errors until end |
186 // Hold errors until end |
199 Vector filesNotFound = new Vector(); |
187 Vector filesNotFound = new Vector(); |
200 Vector filesDuplicate = new Vector(); |
188 Vector filesDuplicate = new Vector(); |
201 |
189 |
226 if ((filesNotFound.size() != 0) || |
214 if ((filesNotFound.size() != 0) || |
227 (filesDuplicate.size() != 0)) { |
215 (filesDuplicate.size() != 0)) { |
228 System.err.println("Error: some files were not found or " + |
216 System.err.println("Error: some files were not found or " + |
229 "appeared in multiple subdirectories of " + |
217 "appeared in multiple subdirectories of " + |
230 "directory " + get("SourceBase") + " and could not " + |
218 "directory " + get("SourceBase") + " and could not " + |
231 "be resolved with the os_family and arch " + |
219 "be resolved with os_family and arch."); |
232 "macros in the platform file."); |
|
233 if (filesNotFound.size() != 0) { |
220 if (filesNotFound.size() != 0) { |
234 System.err.println("Files not found:"); |
221 System.err.println("Files not found:"); |
235 for (Iterator iter = filesNotFound.iterator(); |
222 for (Iterator iter = filesNotFound.iterator(); |
236 iter.hasNext(); ) { |
223 iter.hasNext(); ) { |
237 System.err.println(" " + (String) iter.next()); |
224 System.err.println(" " + (String) iter.next()); |
252 |
239 |
253 void initDefaultDefines(Vector defines) { |
240 void initDefaultDefines(Vector defines) { |
254 Vector sysDefines = new Vector(); |
241 Vector sysDefines = new Vector(); |
255 sysDefines.add("WIN32"); |
242 sysDefines.add("WIN32"); |
256 sysDefines.add("_WINDOWS"); |
243 sysDefines.add("_WINDOWS"); |
257 sysDefines.add("HOTSPOT_BUILD_USER="+System.getProperty("user.name")); |
244 sysDefines.add("HOTSPOT_BUILD_USER=\\\""+System.getProperty("user.name")+"\\\""); |
258 sysDefines.add("HOTSPOT_BUILD_TARGET=\\\""+get("Build")+"\\\""); |
245 sysDefines.add("HOTSPOT_BUILD_TARGET=\\\""+get("Build")+"\\\""); |
259 sysDefines.add("_JNI_IMPLEMENTATION_"); |
246 sysDefines.add("_JNI_IMPLEMENTATION_"); |
260 sysDefines.add("HOTSPOT_LIB_ARCH=\\\"i386\\\""); |
247 if (vars.get("PlatformName").equals("Win32")) { |
|
248 sysDefines.add("HOTSPOT_LIB_ARCH=\\\"i386\\\""); |
|
249 } else { |
|
250 sysDefines.add("HOTSPOT_LIB_ARCH=\\\"amd64\\\""); |
|
251 } |
261 |
252 |
262 sysDefines.addAll(defines); |
253 sysDefines.addAll(defines); |
263 |
254 |
264 put("Define", sysDefines); |
255 put("Define", sysDefines); |
265 } |
256 } |
708 init(getIncludes(), getDefines()); |
699 init(getIncludes(), getDefines()); |
709 } |
700 } |
710 } |
701 } |
711 abstract class CompilerInterface { |
702 abstract class CompilerInterface { |
712 abstract Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir); |
703 abstract Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir); |
713 abstract Vector getBaseLinkerFlags(String outDir, String outDll); |
704 abstract Vector getBaseLinkerFlags(String outDir, String outDll, String platformName); |
714 abstract Vector getDebugCompilerFlags(String opt); |
705 abstract Vector getDebugCompilerFlags(String opt); |
715 abstract Vector getDebugLinkerFlags(); |
706 abstract Vector getDebugLinkerFlags(); |
716 abstract void getAdditionalNonKernelLinkerFlags(Vector rv); |
707 abstract void getAdditionalNonKernelLinkerFlags(Vector rv); |
717 abstract Vector getProductCompilerFlags(); |
708 abstract Vector getProductCompilerFlags(); |
718 abstract Vector getProductLinkerFlags(); |
709 abstract Vector getProductLinkerFlags(); |
719 abstract String getOptFlag(); |
710 abstract String getOptFlag(); |
720 abstract String getNoOptFlag(); |
711 abstract String getNoOptFlag(); |
721 abstract String makeCfgName(String flavourBuild); |
712 abstract String makeCfgName(String flavourBuild, String platformName); |
722 |
713 |
723 void addAttr(Vector receiver, String attr, String value) { |
714 void addAttr(Vector receiver, String attr, String value) { |
724 receiver.add(attr); receiver.add(value); |
715 receiver.add(attr); receiver.add(value); |
725 } |
716 } |
726 void extAttr(Vector receiver, String attr, String value) { |
717 void extAttr(Vector receiver, String attr, String value) { |