make/common/shared/Defs-java.gmk

Thu, 26 Feb 2009 18:32:46 -0800

author
jjg
date
Thu, 26 Feb 2009 18:32:46 -0800
changeset 52
db35452e8965
parent 51
9e6c48c2582d
child 98
a12ea7c7b497
child 100
2a160e4e0d06
permissions
-rw-r--r--

6810915: Sun proprietary warnings in JDK build
Reviewed-by: ohair

duke@1 1 #
duke@1 2 # Copyright 1995-2007 Sun Microsystems, Inc. All Rights Reserved.
duke@1 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@1 4 #
duke@1 5 # This code is free software; you can redistribute it and/or modify it
duke@1 6 # under the terms of the GNU General Public License version 2 only, as
duke@1 7 # published by the Free Software Foundation. Sun designates this
duke@1 8 # particular file as subject to the "Classpath" exception as provided
duke@1 9 # by Sun in the LICENSE file that accompanied this code.
duke@1 10 #
duke@1 11 # This code is distributed in the hope that it will be useful, but WITHOUT
duke@1 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@1 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@1 14 # version 2 for more details (a copy is included in the LICENSE file that
duke@1 15 # accompanied this code).
duke@1 16 #
duke@1 17 # You should have received a copy of the GNU General Public License version
duke@1 18 # 2 along with this work; if not, write to the Free Software Foundation,
duke@1 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@1 20 #
duke@1 21 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@1 22 # CA 95054 USA or visit www.sun.com if you need additional information or
duke@1 23 # have any questions.
duke@1 24 #
duke@1 25
duke@1 26 #
duke@1 27 # Common java/javac/jdk variables used by all the Java makefiles.
duke@1 28 # This file should not contain rules.
duke@1 29 #
duke@1 30
duke@1 31 #
duke@1 32 # Memory related -J flags that all uses of java tools should use.
duke@1 33 #
duke@1 34 JAVA_MEM_FLAGS = -Xmx$(MAX_VM_MEMORY)m
duke@1 35 ifeq ($(ARCH), ia64)
duke@1 36 # Special flags for javac on ia64 to work around a VM problem with
duke@1 37 # bad code generation during inlining (what version had this problem?):
duke@1 38 # Suspect this may not be needed anymore.
duke@1 39 JAVA_MEM_FLAGS += -Xms$(MAX_VM_MEMORY)m -XX:-Inline
duke@1 40 else
duke@1 41 JAVA_MEM_FLAGS += -Xms$(MIN_VM_MEMORY)m -XX:PermSize=32m -XX:MaxPermSize=160m
duke@1 42 endif
duke@1 43
duke@1 44 #
duke@1 45 # All java tools (javac, javah, and javadoc) run faster with certain java
duke@1 46 # options, this macro should be used with all these tools.
duke@1 47 # In particular, the client VM makes these tools run faster when
duke@1 48 # it's available.
duke@1 49 #
duke@1 50 ADD_CLIENT_VM_OPTION = false
duke@1 51 ifeq ($(PLATFORM), solaris)
duke@1 52 ADD_CLIENT_VM_OPTION = true
duke@1 53 else
duke@1 54 ifeq ($(ARCH_DATA_MODEL), 32)
duke@1 55 ADD_CLIENT_VM_OPTION = true
duke@1 56 endif
duke@1 57 endif
duke@1 58 JAVA_JVM_FLAGS =
duke@1 59 ifeq ($(ADD_CLIENT_VM_OPTION), true)
duke@1 60 JAVA_JVM_FLAGS += -client
duke@1 61 endif
duke@1 62
duke@1 63 # Various VM flags
duke@1 64 JAVA_TOOLS_FLAGS = $(JAVA_JVM_FLAGS) $(JAVA_MEM_FLAGS)
duke@1 65
duke@1 66 # The VM flags for javac
duke@1 67 JAVAC_JVM_FLAGS =
duke@1 68
duke@1 69 # 64-bit builds require a larger thread stack size.
duke@1 70 ifeq ($(ARCH_DATA_MODEL), 32)
duke@1 71 JAVAC_JVM_FLAGS += -J-XX:ThreadStackSize=768
duke@1 72 else
duke@1 73 JAVAC_JVM_FLAGS += -J-XX:ThreadStackSize=1536
duke@1 74 endif
duke@1 75 JAVAC_JVM_FLAGS += $(JAVA_TOOLS_FLAGS:%=-J%)
duke@1 76
duke@1 77 # The jar -J options are special, must be added at the end of the command line
duke@1 78 JAR_JFLAGS = $(JAVA_TOOLS_FLAGS:%=-J%)
duke@1 79
duke@1 80 # JAVA_TOOLS_DIR is the default location to find Java tools to run, if
duke@1 81 # langtools is not available.
duke@1 82 # This should be the latest promoted JDK javac.
duke@1 83 ifndef JAVA_TOOLS_DIR
duke@1 84 JAVA_TOOLS_DIR = $(JDK_IMPORT_PATH)/bin
duke@1 85 endif
duke@1 86
duke@1 87 #
duke@1 88 # Invoking the Java compiler. In leaf makefiles, choose as follows:
duke@1 89 # -- Use JAVAC if you want to take full control of what options get
duke@1 90 # passed to javac.
duke@1 91 # -- Use JAVAC_CMD if you want to take the defaults given to you.
duke@1 92 #
duke@1 93
duke@1 94 ifndef DEBUG_CLASSFILES
duke@1 95 ifeq ($(VARIANT), DBG)
duke@1 96 DEBUG_CLASSFILES = true
duke@1 97 endif
duke@1 98 endif
duke@1 99 JAVACFLAGS =
duke@1 100 ifeq ($(DEBUG_CLASSFILES),true)
duke@1 101 JAVACFLAGS += -g
duke@1 102 endif
duke@1 103 ifeq ($(COMPILER_WARNINGS_FATAL), true)
duke@1 104 JAVACFLAGS += -Werror
duke@1 105 endif
duke@1 106
jjg@52 107 NO_PROPRIETARY_API_WARNINGS = -XDignore.symbol.file=true
jjg@52 108 JAVACFLAGS += $(NO_PROPRIETARY_API_WARNINGS)
jjg@52 109
duke@1 110 # Add the source level (currently all source is 1.5, should this be 1.6?)
duke@1 111 LANGUAGE_VERSION = -source 1.5
duke@1 112 JAVACFLAGS += $(LANGUAGE_VERSION)
duke@1 113
duke@1 114 # Add the class version we want (currently this is 5, should it be 6 or even 7?)
duke@1 115 TARGET_CLASS_VERSION = 5
duke@1 116 CLASS_VERSION = -target $(TARGET_CLASS_VERSION)
duke@1 117 JAVACFLAGS += $(CLASS_VERSION)
duke@1 118 JAVACFLAGS += -encoding ascii
duke@1 119 JAVACFLAGS += -classpath $(BOOTDIR)/lib/tools.jar
duke@1 120 JAVACFLAGS += $(OTHER_JAVACFLAGS)
duke@1 121
duke@1 122 # Needed for javah
jjg@51 123 JAVAHFLAGS += -classpath $(CLASSBINDIR)
duke@1 124
duke@1 125 # Langtools
duke@1 126 ifdef LANGTOOLS_DIST
duke@1 127 JAVAC_JAR = $(LANGTOOLS_DIST)/bootstrap/lib/javac.jar
duke@1 128 JAVAH_JAR = $(LANGTOOLS_DIST)/bootstrap/lib/javah.jar
duke@1 129 JAVADOC_JAR = $(LANGTOOLS_DIST)/bootstrap/lib/javadoc.jar
duke@1 130 DOCLETS_JAR = $(LANGTOOLS_DIST)/bootstrap/lib/doclets.jar
duke@1 131 JAVAC_CMD = $(BOOT_JAVA_CMD) \
duke@1 132 "-Xbootclasspath/p:$(JAVAC_JAR)" \
duke@1 133 -jar $(JAVAC_JAR) $(JAVACFLAGS)
duke@1 134 JAVAH_CMD = $(BOOT_JAVA_CMD) \
duke@1 135 "-Xbootclasspath/p:$(JAVAH_JAR)$(CLASSPATH_SEPARATOR)$(JAVADOC_JAR)$(CLASSPATH_SEPARATOR)$(JAVAC_JAR)" \
duke@1 136 -jar $(JAVAH_JAR) $(JAVAHFLAGS)
duke@1 137 JAVADOC_CMD = $(BOOT_JAVA_CMD) \
duke@1 138 "-Xbootclasspath/p:$(JAVADOC_JAR)$(CLASSPATH_SEPARATOR)$(JAVAC_JAR)$(CLASSPATH_SEPARATOR)$(DOCLETS_JAR)" \
duke@1 139 -jar $(JAVADOC_JAR)
duke@1 140 else
duke@1 141 # If no explicit tools, use boot tools (add VM flags in this case)
duke@1 142 JAVAC_CMD = $(JAVA_TOOLS_DIR)/javac $(JAVAC_JVM_FLAGS) \
duke@1 143 $(JAVACFLAGS)
duke@1 144 JAVAH_CMD = $(JAVA_TOOLS_DIR)/javah \
duke@1 145 $(JAVAHFLAGS)
duke@1 146 JAVADOC_CMD = $(JAVA_TOOLS_DIR)/javadoc $(JAVA_TOOLS_FLAGS:%=-J%)
duke@1 147 endif
duke@1 148
duke@1 149 # Override of what javac to use (see deploy workspace)
duke@1 150 ifdef JAVAC
duke@1 151 JAVAC_CMD = $(JAVAC)
duke@1 152 endif
duke@1 153
duke@1 154 #
duke@1 155 # The bootstrap java compiler (defined as the javac in the ALT_BOOTDIR jdk).
duke@1 156 # Will be used to compile java code used to build the jdk, e.g. class files
duke@1 157 # created by this compiler will NOT become part of this built jdk, but just
duke@1 158 # used to build this jdk, e.g. run with the java in the ALT_BOOTDIR jdk.
duke@1 159 #
duke@1 160 # The javac supplied with the LANGTOOLS_DIST should be used to build the
duke@1 161 # classes that will be put into the built jdk. But note that this javac
duke@1 162 # will use the ALT_BOOTDIR java runtime. Any classes created by the
duke@1 163 # LANGTOOLS_DIST javac should not be run during this jdk build and indeed
duke@1 164 # may not even run with the ALT_BOOTDIR jdk because they may be a newer
duke@1 165 # class file version that the ALT_BOOTDIR jdk doesn't understand.
duke@1 166 #
duke@1 167 # The important observation here is that the built jdk is NOT run during
duke@1 168 # the build. If the built jdk needs to be verified that it can build this
duke@1 169 # same jdk, then it should be supplied to the build process as the ALT_BOOTDIR
duke@1 170 # jdk, and this resulting built jdk should be compared to the first one.
duke@1 171 # (They should be the same). Re-using this built jdk as the ALT_BOOTDIR
duke@1 172 # jdk will be the only way and the recommeneded way to verify the built jdk
duke@1 173 # can bootstrap itself.
duke@1 174 #
duke@1 175
duke@1 176 # The javac options supplied to the boot javac is limited. This compiler
duke@1 177 # should only be used to build the 'make/tools' sources, which are not
duke@1 178 # class files that end up in the classes directory.
duke@1 179 ifeq ($(COMPILER_WARNINGS_FATAL), true)
duke@1 180 BOOT_JAVACFLAGS += -Werror
duke@1 181 endif
duke@1 182 BOOT_JAVACFLAGS += -encoding ascii
duke@1 183
duke@1 184 BOOT_JAVA_CMD = $(BOOTDIR)/bin/java $(JAVA_TOOLS_FLAGS)
duke@1 185 BOOT_JAVAC_CMD = $(BOOTDIR)/bin/javac $(JAVAC_JVM_FLAGS) $(BOOT_JAVACFLAGS)
duke@1 186 BOOT_JAR_CMD = $(BOOTDIR)/bin/jar
duke@1 187 BOOT_JARSIGNER_CMD = $(BOOTDIR)/bin/jarsigner
duke@1 188
duke@1 189 # Various tools we need to run (FIXUP: Are these the right ones?)
duke@1 190 NATIVE2ASCII = $(BOOTDIR)/bin/native2ascii $(JAVA_TOOLS_FLAGS:%=-J%)
duke@1 191 RMIC = $(BOOTDIR)/bin/rmic $(JAVA_TOOLS_FLAGS:%=-J%)
duke@1 192 IDLJ = $(BOOTDIR)/bin/idlj $(JAVA_TOOLS_FLAGS:%=-J%)
duke@1 193
duke@1 194 # Should not be used
duke@1 195 JAVA = /should/not/be/used
duke@1 196

mercurial