make/common/shared/Defs-java.gmk

changeset 1
55540e827aef
child 51
9e6c48c2582d
equal deleted inserted replaced
-1:000000000000 1:55540e827aef
1 #
2 # Copyright 1995-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 #
32 # Memory related -J flags that all uses of java tools should use.
33 #
34 JAVA_MEM_FLAGS = -Xmx$(MAX_VM_MEMORY)m
35 ifeq ($(ARCH), ia64)
36 # Special flags for javac on ia64 to work around a VM problem with
37 # bad code generation during inlining (what version had this problem?):
38 # Suspect this may not be needed anymore.
39 JAVA_MEM_FLAGS += -Xms$(MAX_VM_MEMORY)m -XX:-Inline
40 else
41 JAVA_MEM_FLAGS += -Xms$(MIN_VM_MEMORY)m -XX:PermSize=32m -XX:MaxPermSize=160m
42 endif
43
44 #
45 # All java tools (javac, javah, and javadoc) run faster with certain java
46 # options, this macro should be used with all these tools.
47 # In particular, the client VM makes these tools run faster when
48 # it's available.
49 #
50 ADD_CLIENT_VM_OPTION = false
51 ifeq ($(PLATFORM), solaris)
52 ADD_CLIENT_VM_OPTION = true
53 else
54 ifeq ($(ARCH_DATA_MODEL), 32)
55 ADD_CLIENT_VM_OPTION = true
56 endif
57 endif
58 JAVA_JVM_FLAGS =
59 ifeq ($(ADD_CLIENT_VM_OPTION), true)
60 JAVA_JVM_FLAGS += -client
61 endif
62
63 # Various VM flags
64 JAVA_TOOLS_FLAGS = $(JAVA_JVM_FLAGS) $(JAVA_MEM_FLAGS)
65
66 # The VM flags for javac
67 JAVAC_JVM_FLAGS =
68
69 # 64-bit builds require a larger thread stack size.
70 ifeq ($(ARCH_DATA_MODEL), 32)
71 JAVAC_JVM_FLAGS += -J-XX:ThreadStackSize=768
72 else
73 JAVAC_JVM_FLAGS += -J-XX:ThreadStackSize=1536
74 endif
75 JAVAC_JVM_FLAGS += $(JAVA_TOOLS_FLAGS:%=-J%)
76
77 # The jar -J options are special, must be added at the end of the command line
78 JAR_JFLAGS = $(JAVA_TOOLS_FLAGS:%=-J%)
79
80 # JAVA_TOOLS_DIR is the default location to find Java tools to run, if
81 # langtools is not available.
82 # This should be the latest promoted JDK javac.
83 ifndef JAVA_TOOLS_DIR
84 JAVA_TOOLS_DIR = $(JDK_IMPORT_PATH)/bin
85 endif
86
87 #
88 # Invoking the Java compiler. In leaf makefiles, choose as follows:
89 # -- Use JAVAC if you want to take full control of what options get
90 # passed to javac.
91 # -- Use JAVAC_CMD if you want to take the defaults given to you.
92 #
93
94 ifndef DEBUG_CLASSFILES
95 ifeq ($(VARIANT), DBG)
96 DEBUG_CLASSFILES = true
97 endif
98 endif
99 JAVACFLAGS =
100 ifeq ($(DEBUG_CLASSFILES),true)
101 JAVACFLAGS += -g
102 endif
103 ifeq ($(COMPILER_WARNINGS_FATAL), true)
104 JAVACFLAGS += -Werror
105 endif
106
107 # Add the source level (currently all source is 1.5, should this be 1.6?)
108 LANGUAGE_VERSION = -source 1.5
109 JAVACFLAGS += $(LANGUAGE_VERSION)
110
111 # Add the class version we want (currently this is 5, should it be 6 or even 7?)
112 TARGET_CLASS_VERSION = 5
113 CLASS_VERSION = -target $(TARGET_CLASS_VERSION)
114 JAVACFLAGS += $(CLASS_VERSION)
115 JAVACFLAGS += -encoding ascii
116 JAVACFLAGS += -classpath $(BOOTDIR)/lib/tools.jar
117 JAVACFLAGS += $(OTHER_JAVACFLAGS)
118
119 # Needed for javah
120 JAVAHFLAGS += -bootclasspath $(CLASSBINDIR)
121
122 # Langtools
123 ifdef LANGTOOLS_DIST
124 JAVAC_JAR = $(LANGTOOLS_DIST)/bootstrap/lib/javac.jar
125 JAVAH_JAR = $(LANGTOOLS_DIST)/bootstrap/lib/javah.jar
126 JAVADOC_JAR = $(LANGTOOLS_DIST)/bootstrap/lib/javadoc.jar
127 DOCLETS_JAR = $(LANGTOOLS_DIST)/bootstrap/lib/doclets.jar
128 JAVAC_CMD = $(BOOT_JAVA_CMD) \
129 "-Xbootclasspath/p:$(JAVAC_JAR)" \
130 -jar $(JAVAC_JAR) $(JAVACFLAGS)
131 JAVAH_CMD = $(BOOT_JAVA_CMD) \
132 "-Xbootclasspath/p:$(JAVAH_JAR)$(CLASSPATH_SEPARATOR)$(JAVADOC_JAR)$(CLASSPATH_SEPARATOR)$(JAVAC_JAR)" \
133 -jar $(JAVAH_JAR) $(JAVAHFLAGS)
134 JAVADOC_CMD = $(BOOT_JAVA_CMD) \
135 "-Xbootclasspath/p:$(JAVADOC_JAR)$(CLASSPATH_SEPARATOR)$(JAVAC_JAR)$(CLASSPATH_SEPARATOR)$(DOCLETS_JAR)" \
136 -jar $(JAVADOC_JAR)
137 else
138 # If no explicit tools, use boot tools (add VM flags in this case)
139 JAVAC_CMD = $(JAVA_TOOLS_DIR)/javac $(JAVAC_JVM_FLAGS) \
140 $(JAVACFLAGS)
141 JAVAH_CMD = $(JAVA_TOOLS_DIR)/javah \
142 $(JAVAHFLAGS)
143 JAVADOC_CMD = $(JAVA_TOOLS_DIR)/javadoc $(JAVA_TOOLS_FLAGS:%=-J%)
144 endif
145
146 # Override of what javac to use (see deploy workspace)
147 ifdef JAVAC
148 JAVAC_CMD = $(JAVAC)
149 endif
150
151 #
152 # The bootstrap java compiler (defined as the javac in the ALT_BOOTDIR jdk).
153 # Will be used to compile java code used to build the jdk, e.g. class files
154 # created by this compiler will NOT become part of this built jdk, but just
155 # used to build this jdk, e.g. run with the java in the ALT_BOOTDIR jdk.
156 #
157 # The javac supplied with the LANGTOOLS_DIST should be used to build the
158 # classes that will be put into the built jdk. But note that this javac
159 # will use the ALT_BOOTDIR java runtime. Any classes created by the
160 # LANGTOOLS_DIST javac should not be run during this jdk build and indeed
161 # may not even run with the ALT_BOOTDIR jdk because they may be a newer
162 # class file version that the ALT_BOOTDIR jdk doesn't understand.
163 #
164 # The important observation here is that the built jdk is NOT run during
165 # the build. If the built jdk needs to be verified that it can build this
166 # same jdk, then it should be supplied to the build process as the ALT_BOOTDIR
167 # jdk, and this resulting built jdk should be compared to the first one.
168 # (They should be the same). Re-using this built jdk as the ALT_BOOTDIR
169 # jdk will be the only way and the recommeneded way to verify the built jdk
170 # can bootstrap itself.
171 #
172
173 # The javac options supplied to the boot javac is limited. This compiler
174 # should only be used to build the 'make/tools' sources, which are not
175 # class files that end up in the classes directory.
176 ifeq ($(COMPILER_WARNINGS_FATAL), true)
177 BOOT_JAVACFLAGS += -Werror
178 endif
179 BOOT_JAVACFLAGS += -encoding ascii
180
181 BOOT_JAVA_CMD = $(BOOTDIR)/bin/java $(JAVA_TOOLS_FLAGS)
182 BOOT_JAVAC_CMD = $(BOOTDIR)/bin/javac $(JAVAC_JVM_FLAGS) $(BOOT_JAVACFLAGS)
183 BOOT_JAR_CMD = $(BOOTDIR)/bin/jar
184 BOOT_JARSIGNER_CMD = $(BOOTDIR)/bin/jarsigner
185
186 # Various tools we need to run (FIXUP: Are these the right ones?)
187 NATIVE2ASCII = $(BOOTDIR)/bin/native2ascii $(JAVA_TOOLS_FLAGS:%=-J%)
188 RMIC = $(BOOTDIR)/bin/rmic $(JAVA_TOOLS_FLAGS:%=-J%)
189 IDLJ = $(BOOTDIR)/bin/idlj $(JAVA_TOOLS_FLAGS:%=-J%)
190
191 # Should not be used
192 JAVA = /should/not/be/used
193

mercurial