diff 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
line wrap: on
line diff
--- a/src/share/tools/ProjectCreator/BuildConfig.java	Thu Feb 24 13:41:58 2011 +0100
+++ b/src/share/tools/ProjectCreator/BuildConfig.java	Thu Mar 03 19:25:53 2011 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,18 +51,20 @@
         if (vars == null) vars = new Hashtable();
 
         String flavourBuild =  flavour + "_" + build;
+        String platformName = getFieldString(null, "PlatformName");
         System.out.println();
         System.out.println(flavourBuild);
 
-        put("Name", getCI().makeCfgName(flavourBuild));
+        put("Name", getCI().makeCfgName(flavourBuild, platformName));
         put("Flavour", flavour);
         put("Build", build);
+        put("PlatformName", platformName);
 
         // ones mentioned above were needed to expand format
         String buildBase = expandFormat(getFieldString(null, "BuildBase"));
         String sourceBase = getFieldString(null, "SourceBase");
         String outDir = sourceBase + Util.sep + "java";
-	if (Util.os().equals("x64")) {
+	if (!platformName.equals("Win32")) {
 		outDir += "64";
 	}
 	if (!build.equals("product")) {
@@ -106,7 +108,7 @@
     protected void initDefaultLinkerFlags() {
         Vector linkerFlags = new Vector();
 
-        linkerFlags.addAll(getCI().getBaseLinkerFlags( get("OutputDir"), get("OutputDll")));
+        linkerFlags.addAll(getCI().getBaseLinkerFlags( get("OutputDir"), get("OutputDll"), get("PlatformName")));
 
         put("LinkerFlags", linkerFlags);
     }
@@ -128,18 +130,15 @@
     }
 
 
-    Vector getPreferredPaths(MacroDefinitions macros) {
+    Vector getPreferredPaths() {
         Vector preferredPaths = new Vector();
+
         // In the case of multiple files with the same name in
-        // different subdirectories, prefer the versions specified in
-        // the platform file as the "os_family" and "arch" macros.
-        for (Iterator iter = macros.getMacros(); iter.hasNext(); ) {
-            Macro macro = (Macro) iter.next();
-            if (macro.name.equals("os_family") ||
-                macro.name.equals("arch")) {
-                preferredPaths.add(macro.contents);
-            }
-        }
+        // different subdirectories, prefer these versions
+        preferredPaths.add("windows");
+        preferredPaths.add("x86");
+        preferredPaths.add("closed");
+
         // Also prefer "opto" over "adlc" for adlcVMDeps.hpp
         preferredPaths.add("opto");
 
@@ -150,18 +149,7 @@
     void handleDB() {
         WinGammaPlatform platform = (WinGammaPlatform)getField(null, "PlatformObject");
 
-        File incls = new File(get("OutputDir")+Util.sep+"incls");
-
-        incls.mkdirs();
-
-        MacroDefinitions macros = new MacroDefinitions();
-        try {
-            macros.readFrom(getFieldString(null, "Platform"), false);
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
-
-        putSpecificField("AllFilesHash", computeAllFiles(platform, macros));
+        putSpecificField("AllFilesHash", computeAllFiles(platform));
     }
 
 
@@ -203,10 +191,10 @@
         ht.put(expandFormat(key), expandFormat(value));
     }
 
-    Hashtable computeAllFiles(WinGammaPlatform platform, MacroDefinitions macros) {
+    Hashtable computeAllFiles(WinGammaPlatform platform) {
         Hashtable rv = new Hashtable();
         DirectoryTree tree = getSourceTree(get("SourceBase"), getFieldString(null, "StartAt"));
-        Vector preferredPaths = getPreferredPaths(macros);
+        Vector preferredPaths = getPreferredPaths();
 
         // Hold errors until end
         Vector filesNotFound = new Vector();
@@ -241,8 +229,7 @@
             System.err.println("Error: some files were not found or " +
                                "appeared in multiple subdirectories of " +
                                "directory " + get("SourceBase") + " and could not " +
-                               "be resolved with the os_family and arch " +
-                               "macros in the platform file.");
+                               "be resolved with os_family and arch.");
             if (filesNotFound.size() != 0) {
                 System.err.println("Files not found:");
                 for (Iterator iter = filesNotFound.iterator();
@@ -266,9 +253,8 @@
     void initDefaultDefines(Vector defines) {
         Vector sysDefines = new Vector();
 
-        if( Util.os().equals("Win32")) {
+        if( vars.get("PlatformName").equals("Win32")) {
             sysDefines.add("WIN32");
-            sysDefines.add("HOTSPOT_LIB_ARCH=\\\"i386\\\"");
         } else {
             sysDefines.add("_AMD64_");
             sysDefines.add("AMD64");
@@ -283,7 +269,11 @@
         sysDefines.add("HOTSPOT_BUILD_USER=\\\""+System.getProperty("user.name")+"\\\"");
         sysDefines.add("HOTSPOT_BUILD_TARGET=\\\""+get("Build")+"\\\"");
         sysDefines.add("_JNI_IMPLEMENTATION_");
-        sysDefines.add("HOTSPOT_LIB_ARCH=\\\"i386\\\"");
+        if (vars.get("PlatformName").equals("Win32")) {
+            sysDefines.add("HOTSPOT_LIB_ARCH=\\\"i386\\\"");
+        } else {
+            sysDefines.add("HOTSPOT_LIB_ARCH=\\\"amd64\\\"");
+        }
 
         sysDefines.addAll(defines);
 
@@ -743,7 +733,7 @@
 }
 abstract class CompilerInterface {
     abstract Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir);
-    abstract Vector getBaseLinkerFlags(String outDir, String outDll);
+    abstract Vector getBaseLinkerFlags(String outDir, String outDll, String platformName);
     abstract Vector getDebugCompilerFlags(String opt);
     abstract Vector getDebugLinkerFlags();
     abstract void   getAdditionalNonKernelLinkerFlags(Vector rv);
@@ -751,7 +741,7 @@
     abstract Vector getProductLinkerFlags();
     abstract String getOptFlag();
     abstract String getNoOptFlag();
-    abstract String makeCfgName(String flavourBuild);
+    abstract String makeCfgName(String flavourBuild, String platformName);
 
     void addAttr(Vector receiver, String attr, String value) {
         receiver.add(attr); receiver.add(value);