1 # 2 # Copyright (c) 2007, 2011, 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. Oracle designates this 8 # particular file as subject to the "Classpath" exception as provided 9 # by Oracle in the LICENSE file that accompanied this code. 10 # 11 # This code is distributed in the hope that it will be useful, but WITHOUT 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 # version 2 for more details (a copy is included in the LICENSE file that 15 # accompanied this code). 16 # 17 # You should have received a copy of the GNU General Public License version 18 # 2 along with this work; if not, write to the Free Software Foundation, 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 # 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 # or visit www.oracle.com if you need additional information or have any 23 # questions. 24 # 25 26 # 27 # Common java/javac/jdk variables used by all the Java makefiles. 28 # This file should not contain rules. 29 # 30 31 # WARNING: This file is shared with other workspaces. 32 # So when it includes other files, it must use JDK_TOPDIR. 33 # 34 35 # 36 # Memory related -J flags that all uses of java tools should use. 37 # 38 JAVA_MEM_FLAGS = -Xmx$(MAX_VM_MEMORY)m 39 ifeq ($(ARCH), ia64) 40 # Special flags for javac on ia64 to work around a VM problem with 41 # bad code generation during inlining (what version had this problem?): 42 # Suspect this may not be needed anymore. 43 JAVA_MEM_FLAGS += -Xms$(MAX_VM_MEMORY)m -XX:-Inline 44 else 45 JAVA_MEM_FLAGS += -Xms$(MIN_VM_MEMORY)m -XX:PermSize=32m -XX:MaxPermSize=160m 46 endif 47 48 # 49 # All java tools (javac, javah, and javadoc) run faster with certain java 50 # options, this macro should be used with all these tools. 51 # In particular, the client VM makes these tools run faster when 52 # it's available. 53 # 54 ADD_CLIENT_VM_OPTION = false 55 ifeq ($(PLATFORM), solaris) 56 ADD_CLIENT_VM_OPTION = true 57 else 58 ifeq ($(ARCH_DATA_MODEL), 32) 59 ADD_CLIENT_VM_OPTION = true 60 endif 61 endif 62 63 # Options for hotspot to turn off printing of options with fastdebug version 64 # and creating the hotspot.log file. 65 JAVA_HOTSPOT_DISABLE_PRINT_VMOPTIONS = \ 66 -XX:-PrintVMOptions -XX:+UnlockDiagnosticVMOptions -XX:-LogVMOutput 67 68 # JVM options 69 ifeq ($(PLATFORM), macosx) 70 JAVA_JVM_FLAGS = $(JAVA_HOTSPOT_DISABLE_PRINT_VMOPTIONS) -Djava.awt.headless=true 71 else 72 JAVA_JVM_FLAGS = $(JAVA_HOTSPOT_DISABLE_PRINT_VMOPTIONS) 73 endif 74 75 ifeq ($(ADD_CLIENT_VM_OPTION), true) 76 JAVA_JVM_FLAGS += -client 77 endif 78 ifdef USE_HOTSPOT_INTERPRETER_MODE 79 JAVA_JVM_FLAGS += -Xint 80 endif 81 82 # Various VM flags 83 JAVA_TOOLS_FLAGS = $(JAVA_JVM_FLAGS) $(JAVA_MEM_FLAGS) 84 85 # The VM flags for javac 86 JAVAC_JVM_FLAGS = 87 88 # 64-bit builds require a larger thread stack size. 89 ifeq ($(ARCH_DATA_MODEL), 32) 90 JAVAC_JVM_FLAGS += -J-XX:ThreadStackSize=768 91 else 92 JAVAC_JVM_FLAGS += -J-XX:ThreadStackSize=1536 93 endif 94 JAVAC_JVM_FLAGS += $(JAVA_TOOLS_FLAGS:%=-J%) 95 96 # The jar -J options are special, must be added at the end of the command line 97 JAR_JFLAGS = $(JAVA_TOOLS_FLAGS:%=-J%) 98 99 # JAVA_TOOLS_DIR is the default location to find Java tools to run, if 100 # langtools is not available. 101 # This should be the latest promoted JDK javac. 102 ifndef JAVA_TOOLS_DIR 103 JAVA_TOOLS_DIR = $(JDK_IMPORT_PATH)/bin 104 endif 105 106 # 107 # Invoking the Java compiler. In leaf makefiles, choose as follows: 108 # -- Use JAVAC if you want to take full control of what options get 109 # passed to javac. 110 # -- Use JAVAC_CMD if you want to take the defaults given to you. 111 # 112 113 ifndef DEBUG_CLASSFILES 114 ifeq ($(VARIANT), DBG) 115 DEBUG_CLASSFILES = true 116 endif 117 endif 118 ifeq ($(JAVAC_MAX_WARNINGS), true) 119 JAVAC_LINT_OPTIONS += -Xlint:all 120 endif 121 122 # TODO: Workaround for CR 7063027. Remove -path eventually. 123 JAVAC_LINT_OPTIONS += -Xlint:-path 124 125 SHARED_JAVACFLAGS += $(JAVAC_LINT_OPTIONS) 126 ifeq ($(DEBUG_CLASSFILES),true) 127 SHARED_JAVACFLAGS += -g 128 endif 129 ifeq ($(JAVAC_WARNINGS_FATAL), true) 130 SHARED_JAVACFLAGS += -Werror 131 endif 132 133 134 # 135 # Some licensees do not get the Security Source bundles. We will 136 # fall back on the prebuilt jce.jar so that we can do a best 137 # attempt at building. If sources exist, we always want to 138 # build/use the most recent source instead of an older jce.jar, whether 139 # built implicitly/explicitly. 140 # 141 ifeq ($(wildcard $(SHARE_SRC)/classes/javax/crypto/Cipher.java),) 142 JCEFLAGS = $(CLASSPATH_SEPARATOR)$(LIBDIR)/jce.jar 143 endif 144 145 # Add the source level 146 SOURCE_LANGUAGE_VERSION = 7 147 LANGUAGE_VERSION = -source $(SOURCE_LANGUAGE_VERSION) 148 SHARED_JAVACFLAGS += $(LANGUAGE_VERSION) 149 150 # Add the class version we want 151 TARGET_CLASS_VERSION = 7 152 CLASS_VERSION = -target $(TARGET_CLASS_VERSION) 153 SHARED_JAVACFLAGS += $(CLASS_VERSION) 154 SHARED_JAVACFLAGS += -encoding ascii 155 156 JAVACFLAGS = $(SHARED_JAVACFLAGS) 157 JAVACFLAGS += "-Xbootclasspath:$(CLASSBINDIR)$(JCEFLAGS)" 158 JAVACFLAGS += $(OTHER_JAVACFLAGS) 159 160 # HOST_JAVAC_CMD will use the same javac flags except 161 # the bootclasspath and OTHER_JAVACFLAGS 162 HOST_JAVACFLAGS = $(SHARED_JAVACFLAGS) 163 164 # Needed for javah 165 JAVAHFLAGS += -bootclasspath "$(CLASSBINDIR)$(JCEFLAGS)" 166 JAVAHFLAGS += $(OTHER_JAVAHFLAGS) 167 168 # Needed for javadoc to ensure it builds documentation 169 # against the newly built classes 170 JAVADOCFLAGS += -bootclasspath $(CLASSBINDIR) 171 172 # Needed for JAVADOC and BOOT_JAVACFLAGS 173 NO_PROPRIETARY_API_WARNINGS = -XDignore.symbol.file=true 174 175 # Langtools 176 ifdef LANGTOOLS_DIST 177 JAVAC_JAR = $(LANGTOOLS_DIST)/bootstrap/lib/javac.jar 178 JAVAH_JAR = $(LANGTOOLS_DIST)/bootstrap/lib/javah.jar 179 JAVADOC_JAR = $(LANGTOOLS_DIST)/bootstrap/lib/javadoc.jar 180 DOCLETS_JAR = $(LANGTOOLS_DIST)/bootstrap/lib/doclets.jar 181 JAVAC_CMD = $(BOOT_JAVA_CMD) \ 182 "-Xbootclasspath/p:$(JAVAC_JAR)" \ 183 -jar $(JAVAC_JAR) $(JAVACFLAGS) 184 JAVAH_CMD = $(BOOT_JAVA_CMD) \ 185 "-Xbootclasspath/p:$(JAVAH_JAR)$(CLASSPATH_SEPARATOR)$(JAVAC_JAR)" \ 186 -jar $(JAVAH_JAR) $(JAVAHFLAGS) 187 JAVADOC_CMD = $(BOOT_JAVA_CMD) \ 188 "-Xbootclasspath/p:$(JAVADOC_JAR)$(CLASSPATH_SEPARATOR)$(JAVAC_JAR)$(CLASSPATH_SEPARATOR)$(DOCLETS_JAR)" \ 189 -jar $(JAVADOC_JAR) $(JAVADOCFLAGS) 190 else 191 # If no explicit tools, use boot tools (add VM flags in this case) 192 JAVAC_CMD = $(JAVA_TOOLS_DIR)/javac $(JAVAC_JVM_FLAGS) \ 193 $(JAVACFLAGS) 194 JAVAH_CMD = $(JAVA_TOOLS_DIR)/javah \ 195 $(JAVAHFLAGS) 196 JAVADOC_CMD = $(JAVA_TOOLS_DIR)/javadoc $(JAVA_TOOLS_FLAGS:%=-J%) \ 197 $(JAVADOCFLAGS) 198 endif 199 200 # Override of what javac to use (see deploy workspace) 201 ifdef JAVAC 202 JAVAC_CMD = $(JAVAC) 203 endif 204 205 # 206 # The bootstrap java compiler (defined as the javac in the ALT_BOOTDIR jdk). 207 # Will be used to compile java code used to build the jdk, e.g. class files 208 # created by this compiler will NOT become part of this built jdk, but just 209 # used to build this jdk, e.g. run with the java in the ALT_BOOTDIR jdk. 210 # 211 # The javac supplied with the LANGTOOLS_DIST should be used to build the 212 # classes that will be put into the built jdk. But note that this javac 213 # will use the ALT_BOOTDIR java runtime. Any classes created by the 214 # LANGTOOLS_DIST javac should not be run during this jdk build and indeed 215 # may not even run with the ALT_BOOTDIR jdk because they may be a newer 216 # class file version that the ALT_BOOTDIR jdk doesn't understand. 217 # 218 # The important observation here is that the built jdk is NOT run during 219 # the build. If the built jdk needs to be verified that it can build this 220 # same jdk, then it should be supplied to the build process as the ALT_BOOTDIR 221 # jdk, and this resulting built jdk should be compared to the first one. 222 # (They should be the same). Re-using this built jdk as the ALT_BOOTDIR 223 # jdk will be the only way and the recommeneded way to verify the built jdk 224 # can bootstrap itself. 225 # 226 227 # The javac options supplied to the boot javac is limited. This compiler 228 # should only be used to build the 'make/tools' sources, which are not 229 # class files that end up in the classes directory. 230 BOOT_JAVACFLAGS += $(JAVAC_LINT_OPTIONS) 231 ifeq ($(JAVAC_WARNINGS_FATAL), true) 232 BOOT_JAVACFLAGS += -Werror 233 endif 234 235 BOOT_JAVACFLAGS += -encoding ascii 236 BOOT_JAR_JFLAGS += $(JAR_JFLAGS) 237 238 BOOT_JAVACFLAGS += $(NO_PROPRIETARY_API_WARNINGS) 239 240 BOOT_JAVA_CMD = $(BOOTDIR)/bin/java $(JAVA_TOOLS_FLAGS) 241 BOOT_JAVAC_CMD = $(BOOTDIR)/bin/javac $(JAVAC_JVM_FLAGS) $(BOOT_JAVACFLAGS) 242 BOOT_JAR_CMD = $(BOOTDIR)/bin/jar 243 BOOT_JARSIGNER_CMD = $(BOOTDIR)/bin/jarsigner 244 245 # Various tools we need to run (FIXUP: Are these the right ones?) 246 NATIVE2ASCII = $(BOOTDIR)/bin/native2ascii $(JAVA_TOOLS_FLAGS:%=-J%) 247 RMIC = $(BOOTDIR)/bin/rmic $(JAVA_TOOLS_FLAGS:%=-J%) 248 IDLJ = $(BOOTDIR)/bin/idlj $(JAVA_TOOLS_FLAGS:%=-J%) 249 250 # Should not be used 251 JAVA = /should/not/be/used 252 253 # Commands in the JDK_HOST_PATH that can run on the host system 254 # 255 # Since JDK_HOST_PATH defaults to OUTPUTDIR, need to add 256 # ISA_DIR for sparv9 and amd64 257 JDK_HOST_BINDIR=$(JDK_HOST_PATH)/bin 258 ## Temporarily remove for Modules Solaris 64bit only build 259 #ifndef ALT_JDK_HOST_PATH 260 #JDK_HOST_BINDIR=$(JDK_HOST_PATH)/bin$(ISA_DIR) 261 #endif 262 263 HOST_JAVA_CMD = $(JDK_HOST_BINDIR)/java $(JAVA_TOOLS_FLAGS) 264 HOST_JAVAC_CMD = $(JDK_HOST_BINDIR)/javac $(JAVAC_JVM_FLAGS) $(HOST_JAVACFLAGS) 265 HOST_JMOD_CMD = $(JDK_HOST_BINDIR)/jmod $(JAVA_TOOLS_FLAGS:%=-J%) 266 HOST_JPKG_CMD = $(JDK_HOST_BINDIR)/jpkg $(JAVA_TOOLS_FLAGS:%=-J%) 267 HOST_JSIGN_CMD = $(JDK_HOST_BINDIR)/jsign $(JAVA_TOOLS_FLAGS:%=-J%)