Mercurial > hg > graal-compiler
comparison src/share/tools/ProjectCreator/BuildConfig.java @ 2273:2ab52cda08e5
Merge with OpenJDK.
author | Thomas Wuerthinger <thomas.wuerthinger@gmail.com> |
---|---|
date | Thu, 03 Mar 2011 19:25:53 +0100 |
parents | 5d801e6b9a80 15d6977f04b0 |
children | 344264424174 |
comparison
equal
deleted
inserted
replaced
2219:0a14ff0a8cc4 | 2273:2ab52cda08e5 |
---|---|
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 = sourceBase + Util.sep + "java"; | 66 String outDir = sourceBase + Util.sep + "java"; |
65 if (Util.os().equals("x64")) { | 67 if (!platformName.equals("Win32")) { |
66 outDir += "64"; | 68 outDir += "64"; |
67 } | 69 } |
68 if (!build.equals("product")) { | 70 if (!build.equals("product")) { |
69 outDir += Util.sep + "fastdebug"; | 71 outDir += Util.sep + "fastdebug"; |
70 } | 72 } |
104 } | 106 } |
105 | 107 |
106 protected void initDefaultLinkerFlags() { | 108 protected void initDefaultLinkerFlags() { |
107 Vector linkerFlags = new Vector(); | 109 Vector linkerFlags = new Vector(); |
108 | 110 |
109 linkerFlags.addAll(getCI().getBaseLinkerFlags( get("OutputDir"), get("OutputDll"))); | 111 linkerFlags.addAll(getCI().getBaseLinkerFlags( get("OutputDir"), get("OutputDll"), get("PlatformName"))); |
110 | 112 |
111 put("LinkerFlags", linkerFlags); | 113 put("LinkerFlags", linkerFlags); |
112 } | 114 } |
113 | 115 |
114 DirectoryTree getSourceTree(String sourceBase, String startAt) { | 116 DirectoryTree getSourceTree(String sourceBase, String startAt) { |
126 | 128 |
127 return tree; | 129 return tree; |
128 } | 130 } |
129 | 131 |
130 | 132 |
131 Vector getPreferredPaths(MacroDefinitions macros) { | 133 Vector getPreferredPaths() { |
132 Vector preferredPaths = new Vector(); | 134 Vector preferredPaths = new Vector(); |
135 | |
133 // In the case of multiple files with the same name in | 136 // In the case of multiple files with the same name in |
134 // different subdirectories, prefer the versions specified in | 137 // different subdirectories, prefer these versions |
135 // the platform file as the "os_family" and "arch" macros. | 138 preferredPaths.add("windows"); |
136 for (Iterator iter = macros.getMacros(); iter.hasNext(); ) { | 139 preferredPaths.add("x86"); |
137 Macro macro = (Macro) iter.next(); | 140 preferredPaths.add("closed"); |
138 if (macro.name.equals("os_family") || | 141 |
139 macro.name.equals("arch")) { | |
140 preferredPaths.add(macro.contents); | |
141 } | |
142 } | |
143 // Also prefer "opto" over "adlc" for adlcVMDeps.hpp | 142 // Also prefer "opto" over "adlc" for adlcVMDeps.hpp |
144 preferredPaths.add("opto"); | 143 preferredPaths.add("opto"); |
145 | 144 |
146 return preferredPaths; | 145 return preferredPaths; |
147 } | 146 } |
148 | 147 |
149 | 148 |
150 void handleDB() { | 149 void handleDB() { |
151 WinGammaPlatform platform = (WinGammaPlatform)getField(null, "PlatformObject"); | 150 WinGammaPlatform platform = (WinGammaPlatform)getField(null, "PlatformObject"); |
152 | 151 |
153 File incls = new File(get("OutputDir")+Util.sep+"incls"); | 152 putSpecificField("AllFilesHash", computeAllFiles(platform)); |
154 | |
155 incls.mkdirs(); | |
156 | |
157 MacroDefinitions macros = new MacroDefinitions(); | |
158 try { | |
159 macros.readFrom(getFieldString(null, "Platform"), false); | |
160 } catch (Exception e) { | |
161 throw new RuntimeException(e); | |
162 } | |
163 | |
164 putSpecificField("AllFilesHash", computeAllFiles(platform, macros)); | |
165 } | 153 } |
166 | 154 |
167 | 155 |
168 private boolean matchesIgnoredPath(String prefixedName) { | 156 private boolean matchesIgnoredPath(String prefixedName) { |
169 Vector rv = new Vector(); | 157 Vector rv = new Vector(); |
201 | 189 |
202 void addTo(Hashtable ht, String key, String value) { | 190 void addTo(Hashtable ht, String key, String value) { |
203 ht.put(expandFormat(key), expandFormat(value)); | 191 ht.put(expandFormat(key), expandFormat(value)); |
204 } | 192 } |
205 | 193 |
206 Hashtable computeAllFiles(WinGammaPlatform platform, MacroDefinitions macros) { | 194 Hashtable computeAllFiles(WinGammaPlatform platform) { |
207 Hashtable rv = new Hashtable(); | 195 Hashtable rv = new Hashtable(); |
208 DirectoryTree tree = getSourceTree(get("SourceBase"), getFieldString(null, "StartAt")); | 196 DirectoryTree tree = getSourceTree(get("SourceBase"), getFieldString(null, "StartAt")); |
209 Vector preferredPaths = getPreferredPaths(macros); | 197 Vector preferredPaths = getPreferredPaths(); |
210 | 198 |
211 // Hold errors until end | 199 // Hold errors until end |
212 Vector filesNotFound = new Vector(); | 200 Vector filesNotFound = new Vector(); |
213 Vector filesDuplicate = new Vector(); | 201 Vector filesDuplicate = new Vector(); |
214 | 202 |
239 if ((filesNotFound.size() != 0) || | 227 if ((filesNotFound.size() != 0) || |
240 (filesDuplicate.size() != 0)) { | 228 (filesDuplicate.size() != 0)) { |
241 System.err.println("Error: some files were not found or " + | 229 System.err.println("Error: some files were not found or " + |
242 "appeared in multiple subdirectories of " + | 230 "appeared in multiple subdirectories of " + |
243 "directory " + get("SourceBase") + " and could not " + | 231 "directory " + get("SourceBase") + " and could not " + |
244 "be resolved with the os_family and arch " + | 232 "be resolved with os_family and arch."); |
245 "macros in the platform file."); | |
246 if (filesNotFound.size() != 0) { | 233 if (filesNotFound.size() != 0) { |
247 System.err.println("Files not found:"); | 234 System.err.println("Files not found:"); |
248 for (Iterator iter = filesNotFound.iterator(); | 235 for (Iterator iter = filesNotFound.iterator(); |
249 iter.hasNext(); ) { | 236 iter.hasNext(); ) { |
250 System.err.println(" " + (String) iter.next()); | 237 System.err.println(" " + (String) iter.next()); |
264 } | 251 } |
265 | 252 |
266 void initDefaultDefines(Vector defines) { | 253 void initDefaultDefines(Vector defines) { |
267 Vector sysDefines = new Vector(); | 254 Vector sysDefines = new Vector(); |
268 | 255 |
269 if( Util.os().equals("Win32")) { | 256 if( vars.get("PlatformName").equals("Win32")) { |
270 sysDefines.add("WIN32"); | 257 sysDefines.add("WIN32"); |
271 sysDefines.add("HOTSPOT_LIB_ARCH=\\\"i386\\\""); | |
272 } else { | 258 } else { |
273 sysDefines.add("_AMD64_"); | 259 sysDefines.add("_AMD64_"); |
274 sysDefines.add("AMD64"); | 260 sysDefines.add("AMD64"); |
275 sysDefines.add("_WIN64"); | 261 sysDefines.add("_WIN64"); |
276 sysDefines.add("_LP64"); | 262 sysDefines.add("_LP64"); |
281 | 267 |
282 sysDefines.add("_WINDOWS"); | 268 sysDefines.add("_WINDOWS"); |
283 sysDefines.add("HOTSPOT_BUILD_USER=\\\""+System.getProperty("user.name")+"\\\""); | 269 sysDefines.add("HOTSPOT_BUILD_USER=\\\""+System.getProperty("user.name")+"\\\""); |
284 sysDefines.add("HOTSPOT_BUILD_TARGET=\\\""+get("Build")+"\\\""); | 270 sysDefines.add("HOTSPOT_BUILD_TARGET=\\\""+get("Build")+"\\\""); |
285 sysDefines.add("_JNI_IMPLEMENTATION_"); | 271 sysDefines.add("_JNI_IMPLEMENTATION_"); |
286 sysDefines.add("HOTSPOT_LIB_ARCH=\\\"i386\\\""); | 272 if (vars.get("PlatformName").equals("Win32")) { |
273 sysDefines.add("HOTSPOT_LIB_ARCH=\\\"i386\\\""); | |
274 } else { | |
275 sysDefines.add("HOTSPOT_LIB_ARCH=\\\"amd64\\\""); | |
276 } | |
287 | 277 |
288 sysDefines.addAll(defines); | 278 sysDefines.addAll(defines); |
289 | 279 |
290 put("Define", sysDefines); | 280 put("Define", sysDefines); |
291 } | 281 } |
741 init(getIncludes(), getDefines()); | 731 init(getIncludes(), getDefines()); |
742 } | 732 } |
743 } | 733 } |
744 abstract class CompilerInterface { | 734 abstract class CompilerInterface { |
745 abstract Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir); | 735 abstract Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir); |
746 abstract Vector getBaseLinkerFlags(String outDir, String outDll); | 736 abstract Vector getBaseLinkerFlags(String outDir, String outDll, String platformName); |
747 abstract Vector getDebugCompilerFlags(String opt); | 737 abstract Vector getDebugCompilerFlags(String opt); |
748 abstract Vector getDebugLinkerFlags(); | 738 abstract Vector getDebugLinkerFlags(); |
749 abstract void getAdditionalNonKernelLinkerFlags(Vector rv); | 739 abstract void getAdditionalNonKernelLinkerFlags(Vector rv); |
750 abstract Vector getProductCompilerFlags(); | 740 abstract Vector getProductCompilerFlags(); |
751 abstract Vector getProductLinkerFlags(); | 741 abstract Vector getProductLinkerFlags(); |
752 abstract String getOptFlag(); | 742 abstract String getOptFlag(); |
753 abstract String getNoOptFlag(); | 743 abstract String getNoOptFlag(); |
754 abstract String makeCfgName(String flavourBuild); | 744 abstract String makeCfgName(String flavourBuild, String platformName); |
755 | 745 |
756 void addAttr(Vector receiver, String attr, String value) { | 746 void addAttr(Vector receiver, String attr, String value) { |
757 receiver.add(attr); receiver.add(value); | 747 receiver.add(attr); receiver.add(value); |
758 } | 748 } |
759 void extAttr(Vector receiver, String attr, String value) { | 749 void extAttr(Vector receiver, String attr, String value) { |