make/common/shared/Defs-java.gmk

changeset 1
55540e827aef
child 51
9e6c48c2582d
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/make/common/shared/Defs-java.gmk	Sat Dec 01 00:00:00 2007 +0000
     1.3 @@ -0,0 +1,193 @@
     1.4 +#
     1.5 +# Copyright 1995-2007 Sun Microsystems, Inc.  All Rights Reserved.
     1.6 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 +#
     1.8 +# This code is free software; you can redistribute it and/or modify it
     1.9 +# under the terms of the GNU General Public License version 2 only, as
    1.10 +# published by the Free Software Foundation.  Sun designates this
    1.11 +# particular file as subject to the "Classpath" exception as provided
    1.12 +# by Sun in the LICENSE file that accompanied this code.
    1.13 +#
    1.14 +# This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 +# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 +# version 2 for more details (a copy is included in the LICENSE file that
    1.18 +# accompanied this code).
    1.19 +#
    1.20 +# You should have received a copy of the GNU General Public License version
    1.21 +# 2 along with this work; if not, write to the Free Software Foundation,
    1.22 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 +#
    1.24 +# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    1.25 +# CA 95054 USA or visit www.sun.com if you need additional information or
    1.26 +# have any questions.
    1.27 +#
    1.28 +
    1.29 +#
    1.30 +# Common java/javac/jdk variables used by all the Java makefiles.
    1.31 +# This file should not contain rules.
    1.32 +#
    1.33 +
    1.34 +#
    1.35 +# Memory related -J flags that all uses of java tools should use.
    1.36 +#
    1.37 +JAVA_MEM_FLAGS   = -Xmx$(MAX_VM_MEMORY)m
    1.38 +ifeq ($(ARCH), ia64)
    1.39 +  # Special flags for javac on ia64 to work around a VM problem with
    1.40 +  #   bad code generation during inlining (what version had this problem?):
    1.41 +  #   Suspect this may not be needed anymore.
    1.42 +  JAVA_MEM_FLAGS   += -Xms$(MAX_VM_MEMORY)m -XX:-Inline
    1.43 +else
    1.44 +  JAVA_MEM_FLAGS   += -Xms$(MIN_VM_MEMORY)m -XX:PermSize=32m -XX:MaxPermSize=160m
    1.45 +endif
    1.46 +
    1.47 +# 
    1.48 +# All java tools (javac, javah, and javadoc) run faster with certain java
    1.49 +#    options, this macro should be used with all these tools.
    1.50 +#    In particular, the client VM makes these tools run faster when
    1.51 +#    it's available.
    1.52 +#
    1.53 +ADD_CLIENT_VM_OPTION = false
    1.54 +ifeq ($(PLATFORM), solaris)
    1.55 +  ADD_CLIENT_VM_OPTION = true
    1.56 +else
    1.57 +  ifeq ($(ARCH_DATA_MODEL), 32)
    1.58 +    ADD_CLIENT_VM_OPTION = true
    1.59 +  endif
    1.60 +endif
    1.61 +JAVA_JVM_FLAGS =
    1.62 +ifeq ($(ADD_CLIENT_VM_OPTION), true)
    1.63 +  JAVA_JVM_FLAGS += -client
    1.64 +endif
    1.65 +
    1.66 +# Various VM flags
    1.67 +JAVA_TOOLS_FLAGS  = $(JAVA_JVM_FLAGS) $(JAVA_MEM_FLAGS)
    1.68 +
    1.69 +# The VM flags for javac
    1.70 +JAVAC_JVM_FLAGS =
    1.71 +
    1.72 +# 64-bit builds require a larger thread stack size.
    1.73 +ifeq ($(ARCH_DATA_MODEL), 32)
    1.74 +  JAVAC_JVM_FLAGS    += -J-XX:ThreadStackSize=768
    1.75 +else
    1.76 +  JAVAC_JVM_FLAGS    += -J-XX:ThreadStackSize=1536
    1.77 +endif
    1.78 +JAVAC_JVM_FLAGS    += $(JAVA_TOOLS_FLAGS:%=-J%)
    1.79 +
    1.80 +# The jar -J options are special, must be added at the end of the command line
    1.81 +JAR_JFLAGS       = $(JAVA_TOOLS_FLAGS:%=-J%)
    1.82 +
    1.83 +# JAVA_TOOLS_DIR is the default location to find Java tools to run, if
    1.84 +#    langtools is not available.
    1.85 +#    This should be the latest promoted JDK javac.
    1.86 +ifndef JAVA_TOOLS_DIR
    1.87 +  JAVA_TOOLS_DIR = $(JDK_IMPORT_PATH)/bin
    1.88 +endif
    1.89 +
    1.90 +#
    1.91 +# Invoking the Java compiler.   In leaf makefiles, choose as follows:
    1.92 +#  -- Use JAVAC if you want to take full control of what options get
    1.93 +#     passed to javac.
    1.94 +#  -- Use JAVAC_CMD if you want to take the defaults given to you.
    1.95 +#
    1.96 +
    1.97 +ifndef DEBUG_CLASSFILES
    1.98 +  ifeq ($(VARIANT), DBG)
    1.99 +    DEBUG_CLASSFILES = true
   1.100 +  endif
   1.101 +endif
   1.102 +JAVACFLAGS =
   1.103 +ifeq ($(DEBUG_CLASSFILES),true)
   1.104 +  JAVACFLAGS += -g
   1.105 +endif
   1.106 +ifeq ($(COMPILER_WARNINGS_FATAL), true)
   1.107 +  JAVACFLAGS  += -Werror
   1.108 +endif
   1.109 +
   1.110 +# Add the source level (currently all source is 1.5, should this be 1.6?)
   1.111 +LANGUAGE_VERSION = -source 1.5
   1.112 +JAVACFLAGS  += $(LANGUAGE_VERSION)
   1.113 +
   1.114 +# Add the class version we want (currently this is 5, should it be 6 or even 7?)
   1.115 +TARGET_CLASS_VERSION = 5
   1.116 +CLASS_VERSION = -target $(TARGET_CLASS_VERSION)
   1.117 +JAVACFLAGS  += $(CLASS_VERSION)
   1.118 +JAVACFLAGS  += -encoding ascii
   1.119 +JAVACFLAGS  += -classpath $(BOOTDIR)/lib/tools.jar
   1.120 +JAVACFLAGS  += $(OTHER_JAVACFLAGS)
   1.121 +
   1.122 +# Needed for javah
   1.123 +JAVAHFLAGS += -bootclasspath $(CLASSBINDIR)
   1.124 +
   1.125 +# Langtools
   1.126 +ifdef LANGTOOLS_DIST
   1.127 +  JAVAC_JAR   = $(LANGTOOLS_DIST)/bootstrap/lib/javac.jar
   1.128 +  JAVAH_JAR   = $(LANGTOOLS_DIST)/bootstrap/lib/javah.jar
   1.129 +  JAVADOC_JAR = $(LANGTOOLS_DIST)/bootstrap/lib/javadoc.jar
   1.130 +  DOCLETS_JAR = $(LANGTOOLS_DIST)/bootstrap/lib/doclets.jar
   1.131 +  JAVAC_CMD   = $(BOOT_JAVA_CMD) \
   1.132 +		"-Xbootclasspath/p:$(JAVAC_JAR)" \
   1.133 +		-jar $(JAVAC_JAR) $(JAVACFLAGS)
   1.134 +  JAVAH_CMD   = $(BOOT_JAVA_CMD) \
   1.135 +		"-Xbootclasspath/p:$(JAVAH_JAR)$(CLASSPATH_SEPARATOR)$(JAVADOC_JAR)$(CLASSPATH_SEPARATOR)$(JAVAC_JAR)"  \
   1.136 +		-jar $(JAVAH_JAR) $(JAVAHFLAGS)
   1.137 +  JAVADOC_CMD = $(BOOT_JAVA_CMD) \
   1.138 +		"-Xbootclasspath/p:$(JAVADOC_JAR)$(CLASSPATH_SEPARATOR)$(JAVAC_JAR)$(CLASSPATH_SEPARATOR)$(DOCLETS_JAR)" \
   1.139 +		-jar $(JAVADOC_JAR)
   1.140 +else
   1.141 +  # If no explicit tools, use boot tools (add VM flags in this case)
   1.142 +  JAVAC_CMD     = $(JAVA_TOOLS_DIR)/javac $(JAVAC_JVM_FLAGS) \
   1.143 +		  $(JAVACFLAGS)
   1.144 +  JAVAH_CMD     = $(JAVA_TOOLS_DIR)/javah \
   1.145 +		  $(JAVAHFLAGS)
   1.146 +  JAVADOC_CMD   = $(JAVA_TOOLS_DIR)/javadoc $(JAVA_TOOLS_FLAGS:%=-J%)
   1.147 +endif
   1.148 +
   1.149 +# Override of what javac to use (see deploy workspace)
   1.150 +ifdef JAVAC
   1.151 +  JAVAC_CMD     = $(JAVAC)
   1.152 +endif
   1.153 +
   1.154 +#
   1.155 +# The bootstrap java compiler (defined as the javac in the ALT_BOOTDIR jdk).
   1.156 +#   Will be used to compile java code used to build the jdk, e.g. class files
   1.157 +#   created by this compiler will NOT become part of this built jdk, but just
   1.158 +#   used to build this jdk, e.g. run with the java in the ALT_BOOTDIR jdk.
   1.159 +#
   1.160 +# The javac supplied with the LANGTOOLS_DIST should be used to build the
   1.161 +#   classes that will be put into the built jdk. But note that this javac
   1.162 +#   will use the ALT_BOOTDIR java runtime. Any classes created by the
   1.163 +#   LANGTOOLS_DIST javac should not be run during this jdk build and indeed
   1.164 +#   may not even run with the ALT_BOOTDIR jdk because they may be a newer
   1.165 +#   class file version that the ALT_BOOTDIR jdk doesn't understand.
   1.166 +#
   1.167 +# The important observation here is that the built jdk is NOT run during
   1.168 +#   the build. If the built jdk needs to be verified that it can build this
   1.169 +#   same jdk, then it should be supplied to the build process as the ALT_BOOTDIR
   1.170 +#   jdk, and this resulting built jdk should be compared to the first one.
   1.171 +#   (They should be the same). Re-using this built jdk as the ALT_BOOTDIR
   1.172 +#   jdk will be the only way and the recommeneded way to verify the built jdk
   1.173 +#   can bootstrap itself.
   1.174 +#
   1.175 +
   1.176 +# The javac options supplied to the boot javac is limited. This compiler
   1.177 +#   should only be used to build the 'make/tools' sources, which are not
   1.178 +#   class files that end up in the classes directory.
   1.179 +ifeq ($(COMPILER_WARNINGS_FATAL), true)
   1.180 +  BOOT_JAVACFLAGS  += -Werror
   1.181 +endif
   1.182 +BOOT_JAVACFLAGS  += -encoding ascii
   1.183 +
   1.184 +BOOT_JAVA_CMD      = $(BOOTDIR)/bin/java $(JAVA_TOOLS_FLAGS)
   1.185 +BOOT_JAVAC_CMD     = $(BOOTDIR)/bin/javac $(JAVAC_JVM_FLAGS) $(BOOT_JAVACFLAGS)
   1.186 +BOOT_JAR_CMD       = $(BOOTDIR)/bin/jar
   1.187 +BOOT_JARSIGNER_CMD = $(BOOTDIR)/bin/jarsigner
   1.188 +
   1.189 +# Various tools we need to run (FIXUP: Are these the right ones?)
   1.190 +NATIVE2ASCII    = $(BOOTDIR)/bin/native2ascii $(JAVA_TOOLS_FLAGS:%=-J%)
   1.191 +RMIC		= $(BOOTDIR)/bin/rmic $(JAVA_TOOLS_FLAGS:%=-J%)
   1.192 +IDLJ		= $(BOOTDIR)/bin/idlj $(JAVA_TOOLS_FLAGS:%=-J%)
   1.193 +
   1.194 +# Should not be used
   1.195 +JAVA		= /should/not/be/used
   1.196 +

mercurial