blob: f6484f4924b895e7c86298ffe68e1df7b836459d [file] [log] [blame]
duke6e45e102007-12-01 00:00:00 +00001#
2# Copyright 2007 Sun Microsystems, Inc. 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. Sun designates this
8# particular file as subject to the "Classpath" exception as provided
9# by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22# CA 95054 USA or visit www.sun.com if you need additional information or
23# have any 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#
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
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#
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
62JAVA_JVM_FLAGS =
63ifeq ($(ADD_CLIENT_VM_OPTION), true)
64 JAVA_JVM_FLAGS += -client
65endif
66ifdef USE_HOTSPOT_INTERPRETER_MODE
67 JAVA_JVM_FLAGS += -Xint
68endif
69
70# Various VM flags
71JAVA_TOOLS_FLAGS = $(JAVA_JVM_FLAGS) $(JAVA_MEM_FLAGS)
72
73# The VM flags for javac
74JAVAC_JVM_FLAGS =
75
76# 64-bit builds require a larger thread stack size.
77ifeq ($(ARCH_DATA_MODEL), 32)
78 JAVAC_JVM_FLAGS += -J-XX:ThreadStackSize=768
79else
80 JAVAC_JVM_FLAGS += -J-XX:ThreadStackSize=1536
81endif
82JAVAC_JVM_FLAGS += $(JAVA_TOOLS_FLAGS:%=-J%)
83
84# The jar -J options are special, must be added at the end of the command line
85JAR_JFLAGS = $(JAVA_TOOLS_FLAGS:%=-J%)
86
87# JAVA_TOOLS_DIR is the default location to find Java tools to run, if
88# langtools is not available.
89# This should be the latest promoted JDK javac.
90ifndef JAVA_TOOLS_DIR
91 JAVA_TOOLS_DIR = $(JDK_IMPORT_PATH)/bin
92endif
93
94#
95# Invoking the Java compiler. In leaf makefiles, choose as follows:
96# -- Use JAVAC if you want to take full control of what options get
97# passed to javac.
98# -- Use JAVAC_CMD if you want to take the defaults given to you.
99#
100
101ifndef DEBUG_CLASSFILES
102 ifeq ($(VARIANT), DBG)
103 DEBUG_CLASSFILES = true
104 endif
105endif
106JAVACFLAGS =
107ifeq ($(DEBUG_CLASSFILES),true)
108 JAVACFLAGS += -g
109endif
ohairab4f1212008-07-27 18:42:57 -0700110ifeq ($(JAVAC_MAX_WARNINGS), true)
111 JAVACFLAGS += -Xlint:all
112endif
113ifeq ($(JAVAC_WARNINGS_FATAL), true)
duke6e45e102007-12-01 00:00:00 +0000114 JAVACFLAGS += -Werror
115endif
116
117# Add the source level (currently all source is 1.5, should this be 1.6?)
118LANGUAGE_VERSION = -source 1.5
119JAVACFLAGS += $(LANGUAGE_VERSION)
120
121# Add the class version we want (currently this is 5, should it be 6 or even 7?)
122TARGET_CLASS_VERSION = 5
123CLASS_VERSION = -target $(TARGET_CLASS_VERSION)
124JAVACFLAGS += $(CLASS_VERSION)
125JAVACFLAGS += -encoding ascii
126JAVACFLAGS += "-Xbootclasspath:$(CLASSBINDIR)"
127JAVACFLAGS += $(OTHER_JAVACFLAGS)
128
129# Needed for javah
130JAVAHFLAGS += -bootclasspath $(CLASSBINDIR)
131
132# Langtools
133ifdef LANGTOOLS_DIST
134 JAVAC_JAR = $(LANGTOOLS_DIST)/bootstrap/lib/javac.jar
135 JAVAH_JAR = $(LANGTOOLS_DIST)/bootstrap/lib/javah.jar
136 JAVADOC_JAR = $(LANGTOOLS_DIST)/bootstrap/lib/javadoc.jar
137 DOCLETS_JAR = $(LANGTOOLS_DIST)/bootstrap/lib/doclets.jar
138 JAVAC_CMD = $(BOOT_JAVA_CMD) \
139 "-Xbootclasspath/p:$(JAVAC_JAR)" \
140 -jar $(JAVAC_JAR) $(JAVACFLAGS)
141 JAVAH_CMD = $(BOOT_JAVA_CMD) \
142 "-Xbootclasspath/p:$(JAVAH_JAR)$(CLASSPATH_SEPARATOR)$(JAVADOC_JAR)$(CLASSPATH_SEPARATOR)$(JAVAC_JAR)" \
143 -jar $(JAVAH_JAR) $(JAVAHFLAGS)
144 JAVADOC_CMD = $(BOOT_JAVA_CMD) \
145 "-Xbootclasspath/p:$(JAVADOC_JAR)$(CLASSPATH_SEPARATOR)$(JAVAC_JAR)$(CLASSPATH_SEPARATOR)$(DOCLETS_JAR)" \
146 -jar $(JAVADOC_JAR)
147else
148 # If no explicit tools, use boot tools (add VM flags in this case)
149 JAVAC_CMD = $(JAVA_TOOLS_DIR)/javac $(JAVAC_JVM_FLAGS) \
150 $(JAVACFLAGS)
151 JAVAH_CMD = $(JAVA_TOOLS_DIR)/javah \
152 $(JAVAHFLAGS)
153 JAVADOC_CMD = $(JAVA_TOOLS_DIR)/javadoc $(JAVA_TOOLS_FLAGS:%=-J%)
154endif
155
156# Override of what javac to use (see deploy workspace)
157ifdef JAVAC
158 JAVAC_CMD = $(JAVAC)
159endif
160
161#
162# The bootstrap java compiler (defined as the javac in the ALT_BOOTDIR jdk).
163# Will be used to compile java code used to build the jdk, e.g. class files
164# created by this compiler will NOT become part of this built jdk, but just
165# used to build this jdk, e.g. run with the java in the ALT_BOOTDIR jdk.
166#
167# The javac supplied with the LANGTOOLS_DIST should be used to build the
168# classes that will be put into the built jdk. But note that this javac
169# will use the ALT_BOOTDIR java runtime. Any classes created by the
170# LANGTOOLS_DIST javac should not be run during this jdk build and indeed
171# may not even run with the ALT_BOOTDIR jdk because they may be a newer
172# class file version that the ALT_BOOTDIR jdk doesn't understand.
173#
174# The important observation here is that the built jdk is NOT run during
175# the build. If the built jdk needs to be verified that it can build this
176# same jdk, then it should be supplied to the build process as the ALT_BOOTDIR
177# jdk, and this resulting built jdk should be compared to the first one.
178# (They should be the same). Re-using this built jdk as the ALT_BOOTDIR
179# jdk will be the only way and the recommeneded way to verify the built jdk
180# can bootstrap itself.
181#
182
183# The javac options supplied to the boot javac is limited. This compiler
184# should only be used to build the 'make/tools' sources, which are not
185# class files that end up in the classes directory.
ohairab4f1212008-07-27 18:42:57 -0700186ifeq ($(JAVAC_MAX_WARNINGS), true)
187 BOOT_JAVACFLAGS += -Xlint:all
188endif
189ifeq ($(JAVAC_WARNINGS_FATAL), true)
duke6e45e102007-12-01 00:00:00 +0000190 BOOT_JAVACFLAGS += -Werror
191endif
192BOOT_JAVACFLAGS += -encoding ascii
ohaireb0a9eb2008-08-06 15:02:15 -0700193BOOT_JAR_JFLAGS += $(JAR_JFLAGS)
duke6e45e102007-12-01 00:00:00 +0000194
195BOOT_JAVA_CMD = $(BOOTDIR)/bin/java $(JAVA_TOOLS_FLAGS)
196BOOT_JAVAC_CMD = $(BOOTDIR)/bin/javac $(JAVAC_JVM_FLAGS) $(BOOT_JAVACFLAGS)
197BOOT_JAR_CMD = $(BOOTDIR)/bin/jar
198BOOT_JARSIGNER_CMD = $(BOOTDIR)/bin/jarsigner
199
200# Various tools we need to run (FIXUP: Are these the right ones?)
201NATIVE2ASCII = $(BOOTDIR)/bin/native2ascii $(JAVA_TOOLS_FLAGS:%=-J%)
202RMIC = $(BOOTDIR)/bin/rmic $(JAVA_TOOLS_FLAGS:%=-J%)
203IDLJ = $(BOOTDIR)/bin/idlj $(JAVA_TOOLS_FLAGS:%=-J%)
204
205# Should not be used
206JAVA = /should/not/be/used
207