Defs-java.gmk revision 1436
0N/A#
594N/A# Copyright 2007-2008 Sun Microsystems, Inc. All Rights Reserved.
0N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A#
0N/A# This code is free software; you can redistribute it and/or modify it
0N/A# under the terms of the GNU General Public License version 2 only, as
0N/A# published by the Free Software Foundation. Sun designates this
0N/A# particular file as subject to the "Classpath" exception as provided
0N/A# by Sun in the LICENSE file that accompanied this code.
0N/A#
0N/A# This code is distributed in the hope that it will be useful, but WITHOUT
0N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A# version 2 for more details (a copy is included in the LICENSE file that
0N/A# accompanied this code).
0N/A#
0N/A# You should have received a copy of the GNU General Public License version
0N/A# 2 along with this work; if not, write to the Free Software Foundation,
0N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A#
0N/A# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
0N/A# CA 95054 USA or visit www.sun.com if you need additional information or
0N/A# have any questions.
0N/A#
0N/A
0N/A#
0N/A# Common java/javac/jdk variables used by all the Java makefiles.
0N/A# This file should not contain rules.
0N/A#
0N/A
0N/A# WARNING: This file is shared with other workspaces.
0N/A# So when it includes other files, it must use JDK_TOPDIR.
0N/A#
0N/A
0N/A#
0N/A# Memory related -J flags that all uses of java tools should use.
0N/A#
0N/AJAVA_MEM_FLAGS = -Xmx$(MAX_VM_MEMORY)m
0N/Aifeq ($(ARCH), ia64)
0N/A # Special flags for javac on ia64 to work around a VM problem with
0N/A # bad code generation during inlining (what version had this problem?):
0N/A # Suspect this may not be needed anymore.
0N/A JAVA_MEM_FLAGS += -Xms$(MAX_VM_MEMORY)m -XX:-Inline
0N/Aelse
0N/A JAVA_MEM_FLAGS += -Xms$(MIN_VM_MEMORY)m -XX:PermSize=32m -XX:MaxPermSize=160m
0N/Aendif
0N/A
0N/A#
0N/A# All java tools (javac, javah, and javadoc) run faster with certain java
0N/A# options, this macro should be used with all these tools.
0N/A# In particular, the client VM makes these tools run faster when
0N/A# it's available.
0N/A#
0N/AADD_CLIENT_VM_OPTION = false
0N/Aifeq ($(PLATFORM), solaris)
0N/A ADD_CLIENT_VM_OPTION = true
0N/Aelse
0N/A ifeq ($(ARCH_DATA_MODEL), 32)
0N/A ADD_CLIENT_VM_OPTION = true
0N/A endif
0N/Aendif
1007N/A
1007N/A# Options for hotspot to turn off printing of options with fastdebug version
1007N/A# and creating the hotspot.log file.
1007N/AJAVA_HOTSPOT_DISABLE_PRINT_VMOPTIONS = \
1007N/A -XX:-PrintVMOptions -XX:+UnlockDiagnosticVMOptions -XX:-LogVMOutput
1007N/A
1007N/A# JVM options
1007N/AJAVA_JVM_FLAGS = $(JAVA_HOTSPOT_DISABLE_PRINT_VMOPTIONS)
1007N/A
0N/Aifeq ($(ADD_CLIENT_VM_OPTION), true)
0N/A JAVA_JVM_FLAGS += -client
0N/Aendif
0N/Aifdef USE_HOTSPOT_INTERPRETER_MODE
0N/A JAVA_JVM_FLAGS += -Xint
0N/Aendif
0N/A
0N/A# Various VM flags
0N/AJAVA_TOOLS_FLAGS = $(JAVA_JVM_FLAGS) $(JAVA_MEM_FLAGS)
0N/A
0N/A# The VM flags for javac
0N/AJAVAC_JVM_FLAGS =
0N/A
0N/A# 64-bit builds require a larger thread stack size.
0N/Aifeq ($(ARCH_DATA_MODEL), 32)
0N/A JAVAC_JVM_FLAGS += -J-XX:ThreadStackSize=768
0N/Aelse
0N/A JAVAC_JVM_FLAGS += -J-XX:ThreadStackSize=1536
0N/Aendif
0N/AJAVAC_JVM_FLAGS += $(JAVA_TOOLS_FLAGS:%=-J%)
0N/A
0N/A# The jar -J options are special, must be added at the end of the command line
0N/AJAR_JFLAGS = $(JAVA_TOOLS_FLAGS:%=-J%)
0N/A
0N/A# JAVA_TOOLS_DIR is the default location to find Java tools to run, if
0N/A# langtools is not available.
0N/A# This should be the latest promoted JDK javac.
0N/Aifndef JAVA_TOOLS_DIR
0N/A JAVA_TOOLS_DIR = $(JDK_IMPORT_PATH)/bin
0N/Aendif
0N/A
0N/A#
0N/A# Invoking the Java compiler. In leaf makefiles, choose as follows:
0N/A# -- Use JAVAC if you want to take full control of what options get
0N/A# passed to javac.
0N/A# -- Use JAVAC_CMD if you want to take the defaults given to you.
0N/A#
0N/A
0N/Aifndef DEBUG_CLASSFILES
0N/A ifeq ($(VARIANT), DBG)
0N/A DEBUG_CLASSFILES = true
0N/A endif
0N/Aendif
0N/AJAVACFLAGS =
0N/Aifeq ($(DEBUG_CLASSFILES),true)
0N/A JAVACFLAGS += -g
0N/Aendif
422N/Aifeq ($(JAVAC_MAX_WARNINGS), true)
422N/A JAVACFLAGS += -Xlint:all
422N/Aendif
422N/Aifeq ($(JAVAC_WARNINGS_FATAL), true)
0N/A JAVACFLAGS += -Werror
0N/Aendif
0N/A
1436N/A# Add the source level
1436N/ASOURCE_LANGUAGE_VERSION = 7
1244N/ALANGUAGE_VERSION = -source $(SOURCE_LANGUAGE_VERSION)
0N/AJAVACFLAGS += $(LANGUAGE_VERSION)
0N/A
1436N/A# Add the class version we want
1436N/ATARGET_CLASS_VERSION = 7
0N/ACLASS_VERSION = -target $(TARGET_CLASS_VERSION)
0N/AJAVACFLAGS += $(CLASS_VERSION)
0N/AJAVACFLAGS += -encoding ascii
0N/AJAVACFLAGS += "-Xbootclasspath:$(CLASSBINDIR)"
0N/AJAVACFLAGS += $(OTHER_JAVACFLAGS)
0N/A
0N/A# Needed for javah
0N/AJAVAHFLAGS += -bootclasspath $(CLASSBINDIR)
0N/A
925N/A# Needed for JAVADOC and BOOT_JAVACFLAGS
925N/ANO_PROPRIETARY_API_WARNINGS = -XDignore.symbol.file=true
925N/A
0N/A# Langtools
0N/Aifdef LANGTOOLS_DIST
0N/A JAVAC_JAR = $(LANGTOOLS_DIST)/bootstrap/lib/javac.jar
0N/A JAVAH_JAR = $(LANGTOOLS_DIST)/bootstrap/lib/javah.jar
0N/A JAVADOC_JAR = $(LANGTOOLS_DIST)/bootstrap/lib/javadoc.jar
0N/A DOCLETS_JAR = $(LANGTOOLS_DIST)/bootstrap/lib/doclets.jar
0N/A JAVAC_CMD = $(BOOT_JAVA_CMD) \
0N/A "-Xbootclasspath/p:$(JAVAC_JAR)" \
0N/A -jar $(JAVAC_JAR) $(JAVACFLAGS)
0N/A JAVAH_CMD = $(BOOT_JAVA_CMD) \
0N/A "-Xbootclasspath/p:$(JAVAH_JAR)$(CLASSPATH_SEPARATOR)$(JAVADOC_JAR)$(CLASSPATH_SEPARATOR)$(JAVAC_JAR)" \
0N/A -jar $(JAVAH_JAR) $(JAVAHFLAGS)
0N/A JAVADOC_CMD = $(BOOT_JAVA_CMD) \
0N/A "-Xbootclasspath/p:$(JAVADOC_JAR)$(CLASSPATH_SEPARATOR)$(JAVAC_JAR)$(CLASSPATH_SEPARATOR)$(DOCLETS_JAR)" \
0N/A -jar $(JAVADOC_JAR)
0N/Aelse
0N/A # If no explicit tools, use boot tools (add VM flags in this case)
0N/A JAVAC_CMD = $(JAVA_TOOLS_DIR)/javac $(JAVAC_JVM_FLAGS) \
0N/A $(JAVACFLAGS)
0N/A JAVAH_CMD = $(JAVA_TOOLS_DIR)/javah \
0N/A $(JAVAHFLAGS)
0N/A JAVADOC_CMD = $(JAVA_TOOLS_DIR)/javadoc $(JAVA_TOOLS_FLAGS:%=-J%)
0N/Aendif
0N/A
0N/A# Override of what javac to use (see deploy workspace)
0N/Aifdef JAVAC
0N/A JAVAC_CMD = $(JAVAC)
0N/Aendif
0N/A
0N/A#
0N/A# The bootstrap java compiler (defined as the javac in the ALT_BOOTDIR jdk).
0N/A# Will be used to compile java code used to build the jdk, e.g. class files
0N/A# created by this compiler will NOT become part of this built jdk, but just
0N/A# used to build this jdk, e.g. run with the java in the ALT_BOOTDIR jdk.
0N/A#
0N/A# The javac supplied with the LANGTOOLS_DIST should be used to build the
0N/A# classes that will be put into the built jdk. But note that this javac
0N/A# will use the ALT_BOOTDIR java runtime. Any classes created by the
0N/A# LANGTOOLS_DIST javac should not be run during this jdk build and indeed
0N/A# may not even run with the ALT_BOOTDIR jdk because they may be a newer
0N/A# class file version that the ALT_BOOTDIR jdk doesn't understand.
0N/A#
0N/A# The important observation here is that the built jdk is NOT run during
0N/A# the build. If the built jdk needs to be verified that it can build this
0N/A# same jdk, then it should be supplied to the build process as the ALT_BOOTDIR
0N/A# jdk, and this resulting built jdk should be compared to the first one.
0N/A# (They should be the same). Re-using this built jdk as the ALT_BOOTDIR
0N/A# jdk will be the only way and the recommeneded way to verify the built jdk
0N/A# can bootstrap itself.
0N/A#
0N/A
0N/A# The javac options supplied to the boot javac is limited. This compiler
0N/A# should only be used to build the 'make/tools' sources, which are not
0N/A# class files that end up in the classes directory.
422N/Aifeq ($(JAVAC_MAX_WARNINGS), true)
422N/A BOOT_JAVACFLAGS += -Xlint:all
422N/Aendif
422N/Aifeq ($(JAVAC_WARNINGS_FATAL), true)
0N/A BOOT_JAVACFLAGS += -Werror
0N/Aendif
0N/ABOOT_JAVACFLAGS += -encoding ascii
459N/ABOOT_JAR_JFLAGS += $(JAR_JFLAGS)
0N/A
925N/ABOOT_JAVACFLAGS += $(NO_PROPRIETARY_API_WARNINGS)
925N/A
0N/ABOOT_JAVA_CMD = $(BOOTDIR)/bin/java $(JAVA_TOOLS_FLAGS)
0N/ABOOT_JAVAC_CMD = $(BOOTDIR)/bin/javac $(JAVAC_JVM_FLAGS) $(BOOT_JAVACFLAGS)
0N/ABOOT_JAR_CMD = $(BOOTDIR)/bin/jar
0N/ABOOT_JARSIGNER_CMD = $(BOOTDIR)/bin/jarsigner
0N/A
0N/A# Various tools we need to run (FIXUP: Are these the right ones?)
0N/ANATIVE2ASCII = $(BOOTDIR)/bin/native2ascii $(JAVA_TOOLS_FLAGS:%=-J%)
0N/ARMIC = $(BOOTDIR)/bin/rmic $(JAVA_TOOLS_FLAGS:%=-J%)
0N/AIDLJ = $(BOOTDIR)/bin/idlj $(JAVA_TOOLS_FLAGS:%=-J%)
0N/A
0N/A# Should not be used
0N/AJAVA = /should/not/be/used
0N/A