corba/make/common/shared/Defs-java.gmk
author duke
Sat, 01 Dec 2007 00:00:00 +0000
changeset 4 02bb8761fcce
child 2194 b1b06d37c64d
permissions -rw-r--r--
Initial load
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4
02bb8761fcce Initial load
duke
parents:
diff changeset
     1
#
02bb8761fcce Initial load
duke
parents:
diff changeset
     2
# Copyright 1995-2007 Sun Microsystems, Inc.  All Rights Reserved.
02bb8761fcce Initial load
duke
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
02bb8761fcce Initial load
duke
parents:
diff changeset
     4
#
02bb8761fcce Initial load
duke
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
02bb8761fcce Initial load
duke
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
02bb8761fcce Initial load
duke
parents:
diff changeset
     7
# published by the Free Software Foundation.  Sun designates this
02bb8761fcce Initial load
duke
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
02bb8761fcce Initial load
duke
parents:
diff changeset
     9
# by Sun in the LICENSE file that accompanied this code.
02bb8761fcce Initial load
duke
parents:
diff changeset
    10
#
02bb8761fcce Initial load
duke
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
02bb8761fcce Initial load
duke
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
02bb8761fcce Initial load
duke
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
02bb8761fcce Initial load
duke
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
02bb8761fcce Initial load
duke
parents:
diff changeset
    15
# accompanied this code).
02bb8761fcce Initial load
duke
parents:
diff changeset
    16
#
02bb8761fcce Initial load
duke
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
02bb8761fcce Initial load
duke
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
02bb8761fcce Initial load
duke
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
02bb8761fcce Initial load
duke
parents:
diff changeset
    20
#
02bb8761fcce Initial load
duke
parents:
diff changeset
    21
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
02bb8761fcce Initial load
duke
parents:
diff changeset
    22
# CA 95054 USA or visit www.sun.com if you need additional information or
02bb8761fcce Initial load
duke
parents:
diff changeset
    23
# have any questions.
02bb8761fcce Initial load
duke
parents:
diff changeset
    24
#
02bb8761fcce Initial load
duke
parents:
diff changeset
    25
02bb8761fcce Initial load
duke
parents:
diff changeset
    26
#
02bb8761fcce Initial load
duke
parents:
diff changeset
    27
# Common java/javac/jdk variables used by all the Java makefiles.
02bb8761fcce Initial load
duke
parents:
diff changeset
    28
# This file should not contain rules.
02bb8761fcce Initial load
duke
parents:
diff changeset
    29
#
02bb8761fcce Initial load
duke
parents:
diff changeset
    30
02bb8761fcce Initial load
duke
parents:
diff changeset
    31
#
02bb8761fcce Initial load
duke
parents:
diff changeset
    32
# Memory related -J flags that all uses of java tools should use.
02bb8761fcce Initial load
duke
parents:
diff changeset
    33
#
02bb8761fcce Initial load
duke
parents:
diff changeset
    34
JAVA_MEM_FLAGS   = -Xmx$(MAX_VM_MEMORY)m
02bb8761fcce Initial load
duke
parents:
diff changeset
    35
ifeq ($(ARCH), ia64)
02bb8761fcce Initial load
duke
parents:
diff changeset
    36
  # Special flags for javac on ia64 to work around a VM problem with
02bb8761fcce Initial load
duke
parents:
diff changeset
    37
  #   bad code generation during inlining (what version had this problem?):
02bb8761fcce Initial load
duke
parents:
diff changeset
    38
  #   Suspect this may not be needed anymore.
02bb8761fcce Initial load
duke
parents:
diff changeset
    39
  JAVA_MEM_FLAGS   += -Xms$(MAX_VM_MEMORY)m -XX:-Inline
02bb8761fcce Initial load
duke
parents:
diff changeset
    40
else
02bb8761fcce Initial load
duke
parents:
diff changeset
    41
  JAVA_MEM_FLAGS   += -Xms$(MIN_VM_MEMORY)m -XX:PermSize=32m -XX:MaxPermSize=160m
02bb8761fcce Initial load
duke
parents:
diff changeset
    42
endif
02bb8761fcce Initial load
duke
parents:
diff changeset
    43
02bb8761fcce Initial load
duke
parents:
diff changeset
    44
# 
02bb8761fcce Initial load
duke
parents:
diff changeset
    45
# All java tools (javac, javah, and javadoc) run faster with certain java
02bb8761fcce Initial load
duke
parents:
diff changeset
    46
#    options, this macro should be used with all these tools.
02bb8761fcce Initial load
duke
parents:
diff changeset
    47
#    In particular, the client VM makes these tools run faster when
02bb8761fcce Initial load
duke
parents:
diff changeset
    48
#    it's available.
02bb8761fcce Initial load
duke
parents:
diff changeset
    49
#
02bb8761fcce Initial load
duke
parents:
diff changeset
    50
ADD_CLIENT_VM_OPTION = false
02bb8761fcce Initial load
duke
parents:
diff changeset
    51
ifeq ($(PLATFORM), solaris)
02bb8761fcce Initial load
duke
parents:
diff changeset
    52
  ADD_CLIENT_VM_OPTION = true
02bb8761fcce Initial load
duke
parents:
diff changeset
    53
else
02bb8761fcce Initial load
duke
parents:
diff changeset
    54
  ifeq ($(ARCH_DATA_MODEL), 32)
02bb8761fcce Initial load
duke
parents:
diff changeset
    55
    ADD_CLIENT_VM_OPTION = true
02bb8761fcce Initial load
duke
parents:
diff changeset
    56
  endif
02bb8761fcce Initial load
duke
parents:
diff changeset
    57
endif
02bb8761fcce Initial load
duke
parents:
diff changeset
    58
JAVA_JVM_FLAGS =
02bb8761fcce Initial load
duke
parents:
diff changeset
    59
ifeq ($(ADD_CLIENT_VM_OPTION), true)
02bb8761fcce Initial load
duke
parents:
diff changeset
    60
  JAVA_JVM_FLAGS += -client
02bb8761fcce Initial load
duke
parents:
diff changeset
    61
endif
02bb8761fcce Initial load
duke
parents:
diff changeset
    62
02bb8761fcce Initial load
duke
parents:
diff changeset
    63
# Various VM flags
02bb8761fcce Initial load
duke
parents:
diff changeset
    64
JAVA_TOOLS_FLAGS  = $(JAVA_JVM_FLAGS) $(JAVA_MEM_FLAGS)
02bb8761fcce Initial load
duke
parents:
diff changeset
    65
02bb8761fcce Initial load
duke
parents:
diff changeset
    66
# The VM flags for javac
02bb8761fcce Initial load
duke
parents:
diff changeset
    67
JAVAC_JVM_FLAGS =
02bb8761fcce Initial load
duke
parents:
diff changeset
    68
02bb8761fcce Initial load
duke
parents:
diff changeset
    69
# 64-bit builds require a larger thread stack size.
02bb8761fcce Initial load
duke
parents:
diff changeset
    70
ifeq ($(ARCH_DATA_MODEL), 32)
02bb8761fcce Initial load
duke
parents:
diff changeset
    71
  JAVAC_JVM_FLAGS    += -J-XX:ThreadStackSize=768
02bb8761fcce Initial load
duke
parents:
diff changeset
    72
else
02bb8761fcce Initial load
duke
parents:
diff changeset
    73
  JAVAC_JVM_FLAGS    += -J-XX:ThreadStackSize=1536
02bb8761fcce Initial load
duke
parents:
diff changeset
    74
endif
02bb8761fcce Initial load
duke
parents:
diff changeset
    75
JAVAC_JVM_FLAGS    += $(JAVA_TOOLS_FLAGS:%=-J%)
02bb8761fcce Initial load
duke
parents:
diff changeset
    76
02bb8761fcce Initial load
duke
parents:
diff changeset
    77
# The jar -J options are special, must be added at the end of the command line
02bb8761fcce Initial load
duke
parents:
diff changeset
    78
JAR_JFLAGS       = $(JAVA_TOOLS_FLAGS:%=-J%)
02bb8761fcce Initial load
duke
parents:
diff changeset
    79
02bb8761fcce Initial load
duke
parents:
diff changeset
    80
# JAVA_TOOLS_DIR is the default location to find Java tools to run, if
02bb8761fcce Initial load
duke
parents:
diff changeset
    81
#    langtools is not available.
02bb8761fcce Initial load
duke
parents:
diff changeset
    82
#    This should be the latest promoted JDK javac.
02bb8761fcce Initial load
duke
parents:
diff changeset
    83
ifndef JAVA_TOOLS_DIR
02bb8761fcce Initial load
duke
parents:
diff changeset
    84
  JAVA_TOOLS_DIR = $(JDK_IMPORT_PATH)/bin
02bb8761fcce Initial load
duke
parents:
diff changeset
    85
endif
02bb8761fcce Initial load
duke
parents:
diff changeset
    86
02bb8761fcce Initial load
duke
parents:
diff changeset
    87
#
02bb8761fcce Initial load
duke
parents:
diff changeset
    88
# Invoking the Java compiler.   In leaf makefiles, choose as follows:
02bb8761fcce Initial load
duke
parents:
diff changeset
    89
#  -- Use JAVAC if you want to take full control of what options get
02bb8761fcce Initial load
duke
parents:
diff changeset
    90
#     passed to javac.
02bb8761fcce Initial load
duke
parents:
diff changeset
    91
#  -- Use JAVAC_CMD if you want to take the defaults given to you.
02bb8761fcce Initial load
duke
parents:
diff changeset
    92
#
02bb8761fcce Initial load
duke
parents:
diff changeset
    93
02bb8761fcce Initial load
duke
parents:
diff changeset
    94
ifndef DEBUG_CLASSFILES
02bb8761fcce Initial load
duke
parents:
diff changeset
    95
  ifeq ($(VARIANT), DBG)
02bb8761fcce Initial load
duke
parents:
diff changeset
    96
    DEBUG_CLASSFILES = true
02bb8761fcce Initial load
duke
parents:
diff changeset
    97
  endif
02bb8761fcce Initial load
duke
parents:
diff changeset
    98
endif
02bb8761fcce Initial load
duke
parents:
diff changeset
    99
JAVACFLAGS =
02bb8761fcce Initial load
duke
parents:
diff changeset
   100
ifeq ($(DEBUG_CLASSFILES),true)
02bb8761fcce Initial load
duke
parents:
diff changeset
   101
  JAVACFLAGS += -g
02bb8761fcce Initial load
duke
parents:
diff changeset
   102
endif
02bb8761fcce Initial load
duke
parents:
diff changeset
   103
ifeq ($(COMPILER_WARNINGS_FATAL), true)
02bb8761fcce Initial load
duke
parents:
diff changeset
   104
  JAVACFLAGS  += -Werror
02bb8761fcce Initial load
duke
parents:
diff changeset
   105
endif
02bb8761fcce Initial load
duke
parents:
diff changeset
   106
02bb8761fcce Initial load
duke
parents:
diff changeset
   107
# Add the source level (currently all source is 1.5, should this be 1.6?)
02bb8761fcce Initial load
duke
parents:
diff changeset
   108
LANGUAGE_VERSION = -source 1.5
02bb8761fcce Initial load
duke
parents:
diff changeset
   109
JAVACFLAGS  += $(LANGUAGE_VERSION)
02bb8761fcce Initial load
duke
parents:
diff changeset
   110
02bb8761fcce Initial load
duke
parents:
diff changeset
   111
# Add the class version we want (currently this is 5, should it be 6 or even 7?)
02bb8761fcce Initial load
duke
parents:
diff changeset
   112
TARGET_CLASS_VERSION = 5
02bb8761fcce Initial load
duke
parents:
diff changeset
   113
CLASS_VERSION = -target $(TARGET_CLASS_VERSION)
02bb8761fcce Initial load
duke
parents:
diff changeset
   114
JAVACFLAGS  += $(CLASS_VERSION)
02bb8761fcce Initial load
duke
parents:
diff changeset
   115
JAVACFLAGS  += -encoding ascii
02bb8761fcce Initial load
duke
parents:
diff changeset
   116
JAVACFLAGS  += -classpath $(BOOTDIR)/lib/tools.jar
02bb8761fcce Initial load
duke
parents:
diff changeset
   117
JAVACFLAGS  += $(OTHER_JAVACFLAGS)
02bb8761fcce Initial load
duke
parents:
diff changeset
   118
02bb8761fcce Initial load
duke
parents:
diff changeset
   119
# Needed for javah
02bb8761fcce Initial load
duke
parents:
diff changeset
   120
JAVAHFLAGS += -bootclasspath $(CLASSBINDIR)
02bb8761fcce Initial load
duke
parents:
diff changeset
   121
02bb8761fcce Initial load
duke
parents:
diff changeset
   122
# Langtools
02bb8761fcce Initial load
duke
parents:
diff changeset
   123
ifdef LANGTOOLS_DIST
02bb8761fcce Initial load
duke
parents:
diff changeset
   124
  JAVAC_JAR   = $(LANGTOOLS_DIST)/bootstrap/lib/javac.jar
02bb8761fcce Initial load
duke
parents:
diff changeset
   125
  JAVAH_JAR   = $(LANGTOOLS_DIST)/bootstrap/lib/javah.jar
02bb8761fcce Initial load
duke
parents:
diff changeset
   126
  JAVADOC_JAR = $(LANGTOOLS_DIST)/bootstrap/lib/javadoc.jar
02bb8761fcce Initial load
duke
parents:
diff changeset
   127
  DOCLETS_JAR = $(LANGTOOLS_DIST)/bootstrap/lib/doclets.jar
02bb8761fcce Initial load
duke
parents:
diff changeset
   128
  JAVAC_CMD   = $(BOOT_JAVA_CMD) \
02bb8761fcce Initial load
duke
parents:
diff changeset
   129
		"-Xbootclasspath/p:$(JAVAC_JAR)" \
02bb8761fcce Initial load
duke
parents:
diff changeset
   130
		-jar $(JAVAC_JAR) $(JAVACFLAGS)
02bb8761fcce Initial load
duke
parents:
diff changeset
   131
  JAVAH_CMD   = $(BOOT_JAVA_CMD) \
02bb8761fcce Initial load
duke
parents:
diff changeset
   132
		"-Xbootclasspath/p:$(JAVAH_JAR)$(CLASSPATH_SEPARATOR)$(JAVADOC_JAR)$(CLASSPATH_SEPARATOR)$(JAVAC_JAR)"  \
02bb8761fcce Initial load
duke
parents:
diff changeset
   133
		-jar $(JAVAH_JAR) $(JAVAHFLAGS)
02bb8761fcce Initial load
duke
parents:
diff changeset
   134
  JAVADOC_CMD = $(BOOT_JAVA_CMD) \
02bb8761fcce Initial load
duke
parents:
diff changeset
   135
		"-Xbootclasspath/p:$(JAVADOC_JAR)$(CLASSPATH_SEPARATOR)$(JAVAC_JAR)$(CLASSPATH_SEPARATOR)$(DOCLETS_JAR)" \
02bb8761fcce Initial load
duke
parents:
diff changeset
   136
		-jar $(JAVADOC_JAR)
02bb8761fcce Initial load
duke
parents:
diff changeset
   137
else
02bb8761fcce Initial load
duke
parents:
diff changeset
   138
  # If no explicit tools, use boot tools (add VM flags in this case)
02bb8761fcce Initial load
duke
parents:
diff changeset
   139
  JAVAC_CMD     = $(JAVA_TOOLS_DIR)/javac $(JAVAC_JVM_FLAGS) \
02bb8761fcce Initial load
duke
parents:
diff changeset
   140
		  $(JAVACFLAGS)
02bb8761fcce Initial load
duke
parents:
diff changeset
   141
  JAVAH_CMD     = $(JAVA_TOOLS_DIR)/javah \
02bb8761fcce Initial load
duke
parents:
diff changeset
   142
		  $(JAVAHFLAGS)
02bb8761fcce Initial load
duke
parents:
diff changeset
   143
  JAVADOC_CMD   = $(JAVA_TOOLS_DIR)/javadoc $(JAVA_TOOLS_FLAGS:%=-J%)
02bb8761fcce Initial load
duke
parents:
diff changeset
   144
endif
02bb8761fcce Initial load
duke
parents:
diff changeset
   145
02bb8761fcce Initial load
duke
parents:
diff changeset
   146
# Override of what javac to use (see deploy workspace)
02bb8761fcce Initial load
duke
parents:
diff changeset
   147
ifdef JAVAC
02bb8761fcce Initial load
duke
parents:
diff changeset
   148
  JAVAC_CMD     = $(JAVAC)
02bb8761fcce Initial load
duke
parents:
diff changeset
   149
endif
02bb8761fcce Initial load
duke
parents:
diff changeset
   150
02bb8761fcce Initial load
duke
parents:
diff changeset
   151
#
02bb8761fcce Initial load
duke
parents:
diff changeset
   152
# The bootstrap java compiler (defined as the javac in the ALT_BOOTDIR jdk).
02bb8761fcce Initial load
duke
parents:
diff changeset
   153
#   Will be used to compile java code used to build the jdk, e.g. class files
02bb8761fcce Initial load
duke
parents:
diff changeset
   154
#   created by this compiler will NOT become part of this built jdk, but just
02bb8761fcce Initial load
duke
parents:
diff changeset
   155
#   used to build this jdk, e.g. run with the java in the ALT_BOOTDIR jdk.
02bb8761fcce Initial load
duke
parents:
diff changeset
   156
#
02bb8761fcce Initial load
duke
parents:
diff changeset
   157
# The javac supplied with the LANGTOOLS_DIST should be used to build the
02bb8761fcce Initial load
duke
parents:
diff changeset
   158
#   classes that will be put into the built jdk. But note that this javac
02bb8761fcce Initial load
duke
parents:
diff changeset
   159
#   will use the ALT_BOOTDIR java runtime. Any classes created by the
02bb8761fcce Initial load
duke
parents:
diff changeset
   160
#   LANGTOOLS_DIST javac should not be run during this jdk build and indeed
02bb8761fcce Initial load
duke
parents:
diff changeset
   161
#   may not even run with the ALT_BOOTDIR jdk because they may be a newer
02bb8761fcce Initial load
duke
parents:
diff changeset
   162
#   class file version that the ALT_BOOTDIR jdk doesn't understand.
02bb8761fcce Initial load
duke
parents:
diff changeset
   163
#
02bb8761fcce Initial load
duke
parents:
diff changeset
   164
# The important observation here is that the built jdk is NOT run during
02bb8761fcce Initial load
duke
parents:
diff changeset
   165
#   the build. If the built jdk needs to be verified that it can build this
02bb8761fcce Initial load
duke
parents:
diff changeset
   166
#   same jdk, then it should be supplied to the build process as the ALT_BOOTDIR
02bb8761fcce Initial load
duke
parents:
diff changeset
   167
#   jdk, and this resulting built jdk should be compared to the first one.
02bb8761fcce Initial load
duke
parents:
diff changeset
   168
#   (They should be the same). Re-using this built jdk as the ALT_BOOTDIR
02bb8761fcce Initial load
duke
parents:
diff changeset
   169
#   jdk will be the only way and the recommeneded way to verify the built jdk
02bb8761fcce Initial load
duke
parents:
diff changeset
   170
#   can bootstrap itself.
02bb8761fcce Initial load
duke
parents:
diff changeset
   171
#
02bb8761fcce Initial load
duke
parents:
diff changeset
   172
02bb8761fcce Initial load
duke
parents:
diff changeset
   173
# The javac options supplied to the boot javac is limited. This compiler
02bb8761fcce Initial load
duke
parents:
diff changeset
   174
#   should only be used to build the 'make/tools' sources, which are not
02bb8761fcce Initial load
duke
parents:
diff changeset
   175
#   class files that end up in the classes directory.
02bb8761fcce Initial load
duke
parents:
diff changeset
   176
ifeq ($(COMPILER_WARNINGS_FATAL), true)
02bb8761fcce Initial load
duke
parents:
diff changeset
   177
  BOOT_JAVACFLAGS  += -Werror
02bb8761fcce Initial load
duke
parents:
diff changeset
   178
endif
02bb8761fcce Initial load
duke
parents:
diff changeset
   179
BOOT_JAVACFLAGS  += -encoding ascii
02bb8761fcce Initial load
duke
parents:
diff changeset
   180
02bb8761fcce Initial load
duke
parents:
diff changeset
   181
BOOT_JAVA_CMD      = $(BOOTDIR)/bin/java $(JAVA_TOOLS_FLAGS)
02bb8761fcce Initial load
duke
parents:
diff changeset
   182
BOOT_JAVAC_CMD     = $(BOOTDIR)/bin/javac $(JAVAC_JVM_FLAGS) $(BOOT_JAVACFLAGS)
02bb8761fcce Initial load
duke
parents:
diff changeset
   183
BOOT_JAR_CMD       = $(BOOTDIR)/bin/jar
02bb8761fcce Initial load
duke
parents:
diff changeset
   184
BOOT_JARSIGNER_CMD = $(BOOTDIR)/bin/jarsigner
02bb8761fcce Initial load
duke
parents:
diff changeset
   185
02bb8761fcce Initial load
duke
parents:
diff changeset
   186
# Various tools we need to run (FIXUP: Are these the right ones?)
02bb8761fcce Initial load
duke
parents:
diff changeset
   187
NATIVE2ASCII    = $(BOOTDIR)/bin/native2ascii $(JAVA_TOOLS_FLAGS:%=-J%)
02bb8761fcce Initial load
duke
parents:
diff changeset
   188
RMIC		= $(BOOTDIR)/bin/rmic $(JAVA_TOOLS_FLAGS:%=-J%)
02bb8761fcce Initial load
duke
parents:
diff changeset
   189
IDLJ		= $(BOOTDIR)/bin/idlj $(JAVA_TOOLS_FLAGS:%=-J%)
02bb8761fcce Initial load
duke
parents:
diff changeset
   190
02bb8761fcce Initial load
duke
parents:
diff changeset
   191
# Should not be used
02bb8761fcce Initial load
duke
parents:
diff changeset
   192
JAVA		= /should/not/be/used
02bb8761fcce Initial load
duke
parents:
diff changeset
   193