blob: 3dba49289670f4030153f0e6eff0e7ce0f3f88fb [file] [log] [blame]
duke6e45e102007-12-01 00:00:00 +00001#
coffeysc7038ff2012-05-10 10:45:04 +01002# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
duke6e45e102007-12-01 00:00:00 +00003# 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
ohair2283b9d2010-05-25 15:58:33 -07007# published by the Free Software Foundation. Oracle designates this
duke6e45e102007-12-01 00:00:00 +00008# particular file as subject to the "Classpath" exception as provided
ohair2283b9d2010-05-25 15:58:33 -07009# by Oracle in the LICENSE file that accompanied this code.
duke6e45e102007-12-01 00:00:00 +000010#
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#
ohair2283b9d2010-05-25 15:58:33 -070021# 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.
duke6e45e102007-12-01 00:00:00 +000024#
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#
38JAVA_MEM_FLAGS = -Xmx$(MAX_VM_MEMORY)m
39ifeq ($(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
44else
45 JAVA_MEM_FLAGS += -Xms$(MIN_VM_MEMORY)m -XX:PermSize=32m -XX:MaxPermSize=160m
46endif
47
wetmore0b4d7dc2011-02-23 22:54:47 -080048#
duke6e45e102007-12-01 00:00:00 +000049# 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#
54ADD_CLIENT_VM_OPTION = false
55ifeq ($(PLATFORM), solaris)
56 ADD_CLIENT_VM_OPTION = true
57else
58 ifeq ($(ARCH_DATA_MODEL), 32)
59 ADD_CLIENT_VM_OPTION = true
60 endif
61endif
ohairbeeb2ab2009-03-31 16:11:09 -070062
63# Options for hotspot to turn off printing of options with fastdebug version
64# and creating the hotspot.log file.
65JAVA_HOTSPOT_DISABLE_PRINT_VMOPTIONS = \
66 -XX:-PrintVMOptions -XX:+UnlockDiagnosticVMOptions -XX:-LogVMOutput
67
68# JVM options
michaelm5ac8c152012-03-06 20:34:38 +000069ifeq ($(PLATFORM), macosx)
70 JAVA_JVM_FLAGS = $(JAVA_HOTSPOT_DISABLE_PRINT_VMOPTIONS) -Djava.awt.headless=true
71else
72 JAVA_JVM_FLAGS = $(JAVA_HOTSPOT_DISABLE_PRINT_VMOPTIONS)
73endif
ohairbeeb2ab2009-03-31 16:11:09 -070074
duke6e45e102007-12-01 00:00:00 +000075ifeq ($(ADD_CLIENT_VM_OPTION), true)
76 JAVA_JVM_FLAGS += -client
77endif
78ifdef USE_HOTSPOT_INTERPRETER_MODE
79 JAVA_JVM_FLAGS += -Xint
80endif
81
82# Various VM flags
83JAVA_TOOLS_FLAGS = $(JAVA_JVM_FLAGS) $(JAVA_MEM_FLAGS)
84
85# The VM flags for javac
86JAVAC_JVM_FLAGS =
87
88# 64-bit builds require a larger thread stack size.
89ifeq ($(ARCH_DATA_MODEL), 32)
90 JAVAC_JVM_FLAGS += -J-XX:ThreadStackSize=768
91else
92 JAVAC_JVM_FLAGS += -J-XX:ThreadStackSize=1536
93endif
94JAVAC_JVM_FLAGS += $(JAVA_TOOLS_FLAGS:%=-J%)
95
96# The jar -J options are special, must be added at the end of the command line
97JAR_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.
102ifndef JAVA_TOOLS_DIR
103 JAVA_TOOLS_DIR = $(JDK_IMPORT_PATH)/bin
104endif
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
113ifndef DEBUG_CLASSFILES
114 ifeq ($(VARIANT), DBG)
115 DEBUG_CLASSFILES = true
116 endif
117endif
118JAVACFLAGS =
119ifeq ($(DEBUG_CLASSFILES),true)
120 JAVACFLAGS += -g
121endif
ohairab4f1212008-07-27 18:42:57 -0700122ifeq ($(JAVAC_MAX_WARNINGS), true)
ksrinie1db03b2011-07-08 10:25:57 -0700123 JAVAC_LINT_OPTIONS += -Xlint:all
ohairab4f1212008-07-27 18:42:57 -0700124endif
125ifeq ($(JAVAC_WARNINGS_FATAL), true)
duke6e45e102007-12-01 00:00:00 +0000126 JAVACFLAGS += -Werror
127endif
128
ksrinie1db03b2011-07-08 10:25:57 -0700129# TODO: Workaround for CR 7063027. Remove -path eventually.
130JAVAC_LINT_OPTIONS += -Xlint:-path
131
132JAVACFLAGS += $(JAVAC_LINT_OPTIONS)
133
wetmore0b4d7dc2011-02-23 22:54:47 -0800134#
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#
141ifeq ($(wildcard $(SHARE_SRC)/classes/javax/crypto/Cipher.java),)
coffeysc7038ff2012-05-10 10:45:04 +0100142 JCE_PATH = $(CLASSPATH_SEPARATOR)$(LIBDIR)/jce.jar
wetmore0b4d7dc2011-02-23 22:54:47 -0800143endif
144
jjg84511fd2009-07-27 15:19:55 -0700145# Add the source level
146SOURCE_LANGUAGE_VERSION = 7
jjg92637bb2009-05-20 13:55:50 -0700147LANGUAGE_VERSION = -source $(SOURCE_LANGUAGE_VERSION)
duke6e45e102007-12-01 00:00:00 +0000148JAVACFLAGS += $(LANGUAGE_VERSION)
149
jjg84511fd2009-07-27 15:19:55 -0700150# Add the class version we want
151TARGET_CLASS_VERSION = 7
duke6e45e102007-12-01 00:00:00 +0000152CLASS_VERSION = -target $(TARGET_CLASS_VERSION)
153JAVACFLAGS += $(CLASS_VERSION)
154JAVACFLAGS += -encoding ascii
coffeysc7038ff2012-05-10 10:45:04 +0100155JAVACFLAGS += "-Xbootclasspath:$(CLASSBINDIR)$(JCE_PATH)"
duke6e45e102007-12-01 00:00:00 +0000156JAVACFLAGS += $(OTHER_JAVACFLAGS)
157
158# Needed for javah
coffeysc7038ff2012-05-10 10:45:04 +0100159JAVAHFLAGS += -bootclasspath "$(CLASSBINDIR)$(JCE_PATH)"
duke6e45e102007-12-01 00:00:00 +0000160
andrew8f72ed72010-01-29 02:38:22 +0000161# Needed for javadoc to ensure it builds documentation
162# against the newly built classes
coffeys2a147292012-08-16 10:48:43 +0100163JAVADOCFLAGS += -bootclasspath "$(CLASSBINDIR)$(JCE_PATH)"
andrew8f72ed72010-01-29 02:38:22 +0000164
jjg8dd29a52009-02-26 18:51:57 -0800165# Needed for JAVADOC and BOOT_JAVACFLAGS
166NO_PROPRIETARY_API_WARNINGS = -XDignore.symbol.file=true
167
duke6e45e102007-12-01 00:00:00 +0000168# Langtools
169ifdef LANGTOOLS_DIST
170 JAVAC_JAR = $(LANGTOOLS_DIST)/bootstrap/lib/javac.jar
171 JAVAH_JAR = $(LANGTOOLS_DIST)/bootstrap/lib/javah.jar
172 JAVADOC_JAR = $(LANGTOOLS_DIST)/bootstrap/lib/javadoc.jar
173 DOCLETS_JAR = $(LANGTOOLS_DIST)/bootstrap/lib/doclets.jar
174 JAVAC_CMD = $(BOOT_JAVA_CMD) \
175 "-Xbootclasspath/p:$(JAVAC_JAR)" \
176 -jar $(JAVAC_JAR) $(JAVACFLAGS)
177 JAVAH_CMD = $(BOOT_JAVA_CMD) \
jjgb2d91b42011-01-06 14:32:00 -0800178 "-Xbootclasspath/p:$(JAVAH_JAR)$(CLASSPATH_SEPARATOR)$(JAVAC_JAR)" \
duke6e45e102007-12-01 00:00:00 +0000179 -jar $(JAVAH_JAR) $(JAVAHFLAGS)
180 JAVADOC_CMD = $(BOOT_JAVA_CMD) \
181 "-Xbootclasspath/p:$(JAVADOC_JAR)$(CLASSPATH_SEPARATOR)$(JAVAC_JAR)$(CLASSPATH_SEPARATOR)$(DOCLETS_JAR)" \
andrew8f72ed72010-01-29 02:38:22 +0000182 -jar $(JAVADOC_JAR) $(JAVADOCFLAGS)
duke6e45e102007-12-01 00:00:00 +0000183else
184 # If no explicit tools, use boot tools (add VM flags in this case)
185 JAVAC_CMD = $(JAVA_TOOLS_DIR)/javac $(JAVAC_JVM_FLAGS) \
186 $(JAVACFLAGS)
187 JAVAH_CMD = $(JAVA_TOOLS_DIR)/javah \
188 $(JAVAHFLAGS)
andrew8f72ed72010-01-29 02:38:22 +0000189 JAVADOC_CMD = $(JAVA_TOOLS_DIR)/javadoc $(JAVA_TOOLS_FLAGS:%=-J%) \
190 $(JAVADOCFLAGS)
duke6e45e102007-12-01 00:00:00 +0000191endif
192
193# Override of what javac to use (see deploy workspace)
194ifdef JAVAC
195 JAVAC_CMD = $(JAVAC)
196endif
197
198#
199# The bootstrap java compiler (defined as the javac in the ALT_BOOTDIR jdk).
200# Will be used to compile java code used to build the jdk, e.g. class files
201# created by this compiler will NOT become part of this built jdk, but just
202# used to build this jdk, e.g. run with the java in the ALT_BOOTDIR jdk.
203#
204# The javac supplied with the LANGTOOLS_DIST should be used to build the
205# classes that will be put into the built jdk. But note that this javac
206# will use the ALT_BOOTDIR java runtime. Any classes created by the
207# LANGTOOLS_DIST javac should not be run during this jdk build and indeed
208# may not even run with the ALT_BOOTDIR jdk because they may be a newer
209# class file version that the ALT_BOOTDIR jdk doesn't understand.
210#
211# The important observation here is that the built jdk is NOT run during
212# the build. If the built jdk needs to be verified that it can build this
213# same jdk, then it should be supplied to the build process as the ALT_BOOTDIR
214# jdk, and this resulting built jdk should be compared to the first one.
215# (They should be the same). Re-using this built jdk as the ALT_BOOTDIR
216# jdk will be the only way and the recommeneded way to verify the built jdk
217# can bootstrap itself.
218#
219
220# The javac options supplied to the boot javac is limited. This compiler
221# should only be used to build the 'make/tools' sources, which are not
222# class files that end up in the classes directory.
ksrinie1db03b2011-07-08 10:25:57 -0700223BOOT_JAVACFLAGS += $(JAVAC_LINT_OPTIONS)
ohairab4f1212008-07-27 18:42:57 -0700224ifeq ($(JAVAC_WARNINGS_FATAL), true)
duke6e45e102007-12-01 00:00:00 +0000225 BOOT_JAVACFLAGS += -Werror
226endif
andrewf0b06d82009-08-18 19:50:12 +0100227
jjge79c5122011-06-30 16:50:34 -0700228BOOT_JAVACFLAGS += -encoding ascii
ohaireb0a9eb2008-08-06 15:02:15 -0700229BOOT_JAR_JFLAGS += $(JAR_JFLAGS)
duke6e45e102007-12-01 00:00:00 +0000230
jjg8dd29a52009-02-26 18:51:57 -0800231BOOT_JAVACFLAGS += $(NO_PROPRIETARY_API_WARNINGS)
232
duke6e45e102007-12-01 00:00:00 +0000233BOOT_JAVA_CMD = $(BOOTDIR)/bin/java $(JAVA_TOOLS_FLAGS)
234BOOT_JAVAC_CMD = $(BOOTDIR)/bin/javac $(JAVAC_JVM_FLAGS) $(BOOT_JAVACFLAGS)
235BOOT_JAR_CMD = $(BOOTDIR)/bin/jar
236BOOT_JARSIGNER_CMD = $(BOOTDIR)/bin/jarsigner
237
238# Various tools we need to run (FIXUP: Are these the right ones?)
239NATIVE2ASCII = $(BOOTDIR)/bin/native2ascii $(JAVA_TOOLS_FLAGS:%=-J%)
240RMIC = $(BOOTDIR)/bin/rmic $(JAVA_TOOLS_FLAGS:%=-J%)
241IDLJ = $(BOOTDIR)/bin/idlj $(JAVA_TOOLS_FLAGS:%=-J%)
242
243# Should not be used
244JAVA = /should/not/be/used
245