CompileJavaClasses.gmk 15.4 KB
Newer Older
1
#
2
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.  Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#

default: all

include $(SPEC)
include MakeBase.gmk
include JavaCompilation.gmk

# Setup the java compilers for the JDK build.
include Setup.gmk

35 36 37 38
JARS :=
EXFILES :=
EXCLUDES :=

39 40 41 42 43
##########################################################################################
# Include the corresponding custom file, if present.

-include $(CUSTOM_MAKE_DIR)/CompileJavaClasses.gmk

44 45
##########################################################################################

46 47 48 49 50
EXCLUDES += com/sun/pept \
    com/sun/tools/example/trace \
    com/sun/tools/example/debug/bdi \
    com/sun/tools/example/debug/event \
    com/sun/tools/example/debug/gui
51 52

ifdef OPENJDK
53 54 55 56
  EXCLUDES += sun/dc \
      com/sun/jmx/snmp \
      sun/management/snmp \
      com/sun/script
57 58
endif

59
ifndef OPENJDK
60
  # There exists two versions of these files...
61
  EXFILES += $(JDK_TOPDIR)/src/share/classes/javax/crypto/JarVerifier.java
62 63 64 65 66

  ifeq ($(OPENJDK_TARGET_OS), windows)
    # This gets built on unix platforms implicitly in the old build even though
    # it's excluded in the closed build.
    EXCLUDES += sun/java2d/pisces
67 68
  endif
endif
69

70
ifeq ($(OPENJDK_TARGET_OS), windows)
71 72
    # AccessBridge is compiled separately below.
    EXFILES += AccessBridge.java \
73
        AccessBridgeLoader.java
74
  endif
75

76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
ifneq ($(OPENJDK_TARGET_OS), solaris)
  # Exclude Solaris nio and two security related files in src/share/classes
  EXFILES += SolarisAclFileAttributeView.java \
      SolarisFileStore.java \
      SolarisFileSystem.java \
      SolarisFileSystemProvider.java \
      SolarisNativeDispatcher.java \
      SolarisUserDefinedFileAttributeView.java \
      SolarisWatchService.java \
      SolarisAclFileAttributeView.java \
      SolarisLoginModule.java \
      SolarisSystem.java \
      sun/nio/ch/DevPollArrayWrapper.java \
      sun/nio/ch/DevPollSelectorImpl.java \
      sun/nio/ch/DevPollSelectorProvider.java \
      sun/nio/ch/EventPortSelectorImpl.java \
      sun/nio/ch/EventPortSelectorProvider.java \
      sun/nio/ch/EventPortWrapper.java \
      sun/nio/ch/SolarisAsynchronousChannelProvider.java \
      sun/nio/ch/SolarisEventPort.java \
      sun/tools/attach/SolarisAttachProvider.java \
      sun/tools/attach/SolarisVirtualMachine.java

  EXCLUDES += com/oracle/security
100 101
endif

102
EXFILES += WrapperGenerator.java
103

104 105 106 107
ifneq ($(OPENJDK_TARGET_OS), windows)
  # Exclude Window security related files in src/share/classes
  EXFILES += NTLoginModule.java \
      NTSystem.java
108
else
109 110
  EXFILES += UnixLoginModule.java \
      UnixSystem.java
111 112
endif

113 114 115
ifeq ($(OPENJDK_TARGET_OS), windows)
  # Don't build GTK L&F on Windows
  EXCLUDES += com/sun/java/swing/plaf/gtk
116 117
endif

118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
ifneq ($(OPENJDK_TARGET_OS), linux)
  EXFILES += sun/tools/attach/LinuxAttachProvider.java \
      sun/tools/attach/LinuxVirtualMachine.java \
      sun/nio/ch/EPoll.java \
      sun/nio/ch/EPollArrayWrapper.java \
      sun/nio/ch/EPollPort.java \
      sun/nio/ch/EPollSelectorImpl.java \
      sun/nio/ch/EPollSelectorProvider.java \
      sun/nio/ch/LinuxAsynchronousChannelProvider.java \
      sun/nio/fs/LinuxDosFileAttributeView.java \
      sun/nio/fs/LinuxFileStore.java \
      sun/nio/fs/LinuxFileSystem.java \
      sun/nio/fs/LinuxFileSystemProvider.java \
      sun/nio/fs/MagicFileTypeDetector.java \
      sun/nio/fs/LinuxNativeDispatcher.java \
      sun/nio/fs/LinuxUserDefinedFileAttributeView.java \
      sun/nio/fs/LinuxWatchService.java
135 136
endif

137 138 139 140 141 142 143 144 145 146 147 148 149
ifneq ($(OPENJDK_TARGET_OS), macosx)
  EXFILES += sun/nio/ch/BsdAsynchronousChannelProvider.java \
      sun/nio/ch/KQueue.java \
      sun/nio/ch/KQueuePort.java \
      sun/nio/fs/BsdFileStore.java \
      sun/nio/fs/BsdFileSystem.java \
      sun/nio/fs/BsdFileSystemProvider.java \
      sun/nio/fs/BsdNativeDispatcher.java \
      sun/nio/fs/MacOSXFileSystemProvider.java \
      sun/nio/fs/MacOSXFileSystem.java \
      sun/nio/fs/MacOSXNativeDispatcher.java \
      sun/tools/attach/BsdAttachProvider.java \
      sun/tools/attach/BsdVirtualMachine.java
150 151
endif

152 153 154 155 156 157
ifneq ($(OPENJDK_TARGET_OS),aix)
    EXFILES+=sun/nio/ch/AixAsynchronousChannelProvider.java \
             sun/nio/ch/AixPollPort.java \
             sun/nio/fs/AixFileStore.java \
             sun/nio/fs/AixFileSystem.java \
             sun/nio/fs/AixFileSystemProvider.java \
158 159 160
             sun/nio/fs/AixNativeDispatcher.java \
             sun/tools/attach/AixAttachProvider.java \
             sun/tools/attach/AixVirtualMachine.java
161 162
endif

163 164
# Exclude BreakIterator classes that are just used in compile process to generate
# data files and shouldn't go in the product
165 166
EXFILES += sun/text/resources/BreakIteratorRules.java \
    sun/text/resources/BreakIteratorRules_th.java
167 168 169

# TODO: Add BUILD_HEADLESS_ONLY to configure?
ifdef BUILD_HEADLESS_ONLY
170
  EXCLUDES += sun/applet
171 172 173
endif

ifdef OPENJDK
174
  EXCLUDES += sun/java2d/cmm/kcms
175 176
endif

177
# Used on windows and macosx
178 179
ifeq (, $(filter $(OPENJDK_TARGET_OS), windows macosx))
  EXFILES += sun/awt/AWTCharset.java
180 181
endif

182 183 184 185 186
ifeq ($(OPENJDK_TARGET_OS), macosx)
  # exclude all X11 on Mac, we can't exclude some like below or we'll have compilation errors
  EXCLUDES += sun/awt/X11
else
  # TBD: figure out how to eliminate this long list
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228
  EXFILES += sun/awt/X11/ScreenFormat.java \
      sun/awt/X11/XArc.java \
      sun/awt/X11/XChar2b.java \
      sun/awt/X11/XCharStruct.java \
      sun/awt/X11/XClassHint.java \
      sun/awt/X11/XComposeStatus.java \
      sun/awt/X11/XExtCodes.java \
      sun/awt/X11/XFontProp.java \
      sun/awt/X11/XFontSetExtents.java \
      sun/awt/X11/XFontStruct.java \
      sun/awt/X11/XGCValues.java \
      sun/awt/X11/XHostAddress.java \
      sun/awt/X11/XIMCallback.java \
      sun/awt/X11/XIMHotKeyTrigger.java \
      sun/awt/X11/XIMHotKeyTriggers.java \
      sun/awt/X11/XIMPreeditCaretCallbackStruct.java \
      sun/awt/X11/XIMPreeditDrawCallbackStruct.java \
      sun/awt/X11/XIMPreeditStateNotifyCallbackStruct.java \
      sun/awt/X11/XIMStatusDrawCallbackStruct.java \
      sun/awt/X11/XIMStringConversionCallbackStruct.java \
      sun/awt/X11/XIMStringConversionText.java \
      sun/awt/X11/XIMStyles.java \
      sun/awt/X11/XIMText.java \
      sun/awt/X11/XIMValuesList.java \
      sun/awt/X11/XImage.java \
      sun/awt/X11/XKeyboardControl.java \
      sun/awt/X11/XKeyboardState.java \
      sun/awt/X11/XOMCharSetList.java \
      sun/awt/X11/XOMFontInfo.java \
      sun/awt/X11/XOMOrientation.java \
      sun/awt/X11/XPoint.java \
      sun/awt/X11/XRectangle.java \
      sun/awt/X11/XSegment.java \
      sun/awt/X11/XStandardColormap.java \
      sun/awt/X11/XTextItem.java \
      sun/awt/X11/XTextItem16.java \
      sun/awt/X11/XTextProperty.java \
      sun/awt/X11/XTimeCoord.java \
      sun/awt/X11/XWindowChanges.java \
      sun/awt/X11/XdbeSwapInfo.java \
      sun/awt/X11/XmbTextItem.java \
      sun/awt/X11/XwcTextItem.java
229
endif
230 231

# Exclude another implicitly not included file.
232
EXFILES += sun/util/locale/AsciiUtil.java
233

234
ifeq (, $(filter $(OPENJDK_TARGET_OS), solaris macosx aix))
235
  #
236
  # only solaris, macosx and aix
237 238
  #
  EXFILES += sun/nio/fs/PollingWatchService.java
239 240 241 242
endif

# TODO: Fix when converting NIO
# Exclude *-linux-arm.java and *-linux-ppc.java from closed.
243 244
EXFILES += -linux-arm.java \
    -linux-ppc.java
245

246
ifeq ($(OPENJDK_TARGET_OS), windows)
247 248 249
  EXFILES += sun/nio/ch/AbstractPollSelectorImpl.java \
      sun/nio/ch/PollSelectorProvider.java \
      sun/nio/ch/SimpleAsynchronousFileChannelImpl.java
250 251
endif

252 253
# These files do not appear in the build result of the old build. This
# is because they are generated sources, but the AUTO_JAVA_FILES won't
254
# pick them up since they aren't generated when the source dirs are
255 256
# searched and they aren't referenced by any other classes so they won't
# be picked up by implicit compilation. On a rebuild, they are picked up
257
# and compiled. Exclude them here to produce the same rt.jar as the old
258
# build does when building just once.
259 260 261 262 263 264 265
EXFILES += javax/swing/plaf/nimbus/InternalFrameTitlePanePainter.java \
    javax/swing/plaf/nimbus/OptionPaneMessageAreaPainter.java \
    javax/swing/plaf/nimbus/ScrollBarPainter.java \
    javax/swing/plaf/nimbus/SliderPainter.java \
    javax/swing/plaf/nimbus/SpinnerPainter.java \
    javax/swing/plaf/nimbus/SplitPanePainter.java \
    javax/swing/plaf/nimbus/TabbedPanePainter.java
266

267 268 269 270 271
# Acquire a list of files that should be copied straight over to the classes.
include CopyIntoClasses.gmk
# Now we have COPY_PATTERNS, COPY_FILES and COPY_EXTRA

ifndef OPENJDK
272
  CLOSED_SRC_DIRS := $(JDK_TOPDIR)/src/closed/share/classes \
273
      $(wildcard $(JDK_TOPDIR)/src/closed/$(OPENJDK_TARGET_OS_API_DIR)/classes)
274 275
endif

276
MACOSX_SRC_DIRS :=
277 278 279 280 281 282 283 284 285
ifeq ($(OPENJDK_TARGET_OS), macosx)
  MACOSX_SRC_DIRS += $(JDK_TOPDIR)/src/macosx/classes

  # this files are duplicated in MACOSX_SRC_DIRS
  EXFILES += $(JDK_TOPDIR)/src/solaris/classes/sun/nio/ch/DefaultSelectorProvider.java \
      $(JDK_TOPDIR)/src/solaris/classes/sun/java2d/BackBufferCapsProvider.java \
      $(JDK_TOPDIR)/src/solaris/classes/java/net/DefaultInterface.java \
      $(JDK_TOPDIR)/src/solaris/classes/java/lang/ClassLoaderHelper.java \
      $(JDK_TOPDIR)/src/solaris/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java \
L
Merge  
lana 已提交
286 287 288 289
      $(JDK_TOPDIR)/src/solaris/classes/sun/nio/fs/GnomeFileTypeDetector.java \
      $(JDK_TOPDIR)/src/solaris/classes/sun/nio/ch/sctp/SctpChannelImpl.java \
      $(JDK_TOPDIR)/src/solaris/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java \
      $(JDK_TOPDIR)/src/solaris/classes/sun/nio/ch/sctp/SctpServerChannelImpl.java
290

291 292
endif

293 294 295 296 297 298 299 300 301 302 303 304 305
# The security classes should not end up in the classes directory as that will prevent them
# from working when running the exploded jdk image. Compile them separately to a different
# directory from where the jars can be created.
SECURITY_PKGS := \
    com/oracle/security/ucrypto \
    com/sun/crypto/provider \
    javax/crypto \
    sun/security/ec \
    sun/security/internal \
    sun/security/mscapi \
    sun/security/pkcs11 \
    #

306 307 308
AIX_SRC_DIRS :=
ifeq ($(OPENJDK_TARGET_OS),aix)
     AIX_SRC_DIRS += $(JDK_TOPDIR)/src/aix/classes
309 310 311 312 313

  # these files are duplicated in AIX_SRC_DIRS
  EXFILES += $(JDK_TOPDIR)/src/solaris/classes/sun/nio/ch/sctp/SctpChannelImpl.java \
      $(JDK_TOPDIR)/src/solaris/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java \
      $(JDK_TOPDIR)/src/solaris/classes/sun/nio/ch/sctp/SctpServerChannelImpl.java
314 315
endif

316 317 318
# The exception handling of swing beaninfo
# These resources violates the convention of having code and resources together under
# $(JDK_TOPDIR)/src/.../classes directories
I
ihse 已提交
319
$(JDK_OUTPUTDIR)/classes/javax/swing/beaninfo/images/%.gif: $(JDK_TOPDIR)/make/data/swingbeaninfo/images/%.gif
320
	$(call install-file)
321

322 323 324 325
# The JDK_USER_DEFINED_FILTER is a poor man's incremental build: by specifying
# JDK_FILTER at the make command line, only a subset of the JDK java files will
# be recompiled. If multiple paths are separated by comma, convert that into a
# space separated list.
326 327
JDK_USER_DEFINED_FILTER := $(strip $(subst $(COMMA),$(SPACE), $(JDK_FILTER)))

328 329 330 331 332 333 334 335 336 337 338 339
ifeq ($(ENABLE_SJAVAC),yes)
  # With sjavac enabled, excluded sources are not even considered for linking. 
  # Explicitly add the security sources to sourcepath for linking.
  BUILD_JDK_SOURCEPATH:=$(patsubst %,-i$(SPACE)%.*,$(subst /,.,$(SECURITY_PKGS))) \
      -sourcepath $(JDK_TOPDIR)/src/share/classes
endif

$(eval $(call SetupJavaCompilation,BUILD_JDK,\
    SETUP:=GENERATE_JDKBYTECODE,\
    SRC:=$(JDK_TOPDIR)/src/share/classes \
        $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes \
        $(MACOSX_SRC_DIRS) \
340
        $(AIX_SRC_DIRS) \
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355
        $(JDK_OUTPUTDIR)/gensrc \
        $(JDK_OUTPUTDIR)/gensrc_no_srczip \
        $(CLOSED_SRC_DIRS),\
    INCLUDES:=$(JDK_USER_DEFINED_FILTER),\
    EXCLUDES:=$(EXCLUDES) $(SECURITY_PKGS),\
    EXCLUDE_FILES:=$(EXFILES),\
    BIN:=$(JDK_OUTPUTDIR)/classes,\
    COPY:=$(COPY_PATTERNS),\
    COPY_FILES:=$(COPY_FILES),\
    HEADERS:=$(JDK_OUTPUTDIR)/gensrc_headers,\
    ADD_JAVAC_FLAGS:=$(BUILD_JDK_SOURCEPATH)))

##########################################################################################

$(eval $(call SetupJavaCompilation,BUILD_SECURITY, \
356 357
    SETUP := GENERATE_JDKBYTECODE, \
    SRC := $(JDK_TOPDIR)/src/share/classes \
358 359 360 361
        $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes \
        $(MACOSX_SRC_DIRS) \
        $(CLOSED_SRC_DIRS), \
    INCLUDES := $(SECURITY_PKGS), \
362 363
    EXCLUDES := $(EXCLUDES), \
    EXCLUDE_FILES := $(EXFILES), \
364
    BIN := $(JDK_OUTPUTDIR)/classes_security, \
365
    HEADERS := $(JDK_OUTPUTDIR)/gensrc_headers))
366

367 368
$(BUILD_SECURITY): $(BUILD_JDK)

369 370 371 372 373 374 375 376
##########################################################################################

$(JDK_OUTPUTDIR)/classes/META-INF/services/com.sun.tools.xjc.Plugin:
	$(MKDIR) -p $(@D)
	$(TOUCH) $@

##########################################################################################

377 378

##########################################################################################
379

380 381 382 383 384 385
  ifeq ($(OPENJDK_TARGET_OS), windows)
    ifeq ($(OPENJDK_TARGET_CPU_BITS), 32)
      $(eval $(call SetupJavaCompilation,BUILD_ACCESSBRIDGE_32, \
          SETUP := GENERATE_JDKBYTECODE, \
          JAVAC_FLAGS := -cp $(JDK_OUTPUTDIR)/classes, \
          SRC := $(JDK_OUTPUTDIR)/gensrc_ab/32bit, \
386 387
          BIN := $(JDK_OUTPUTDIR)/classes_ab/32bit, \
          HEADERS := $(JDK_OUTPUTDIR)/gensrc_headers))
388

389
      $(BUILD_ACCESSBRIDGE_32): $(BUILD_JDK)
390

391 392 393 394
      $(eval $(call SetupJavaCompilation,BUILD_ACCESSBRIDGE_LEGACY, \
          SETUP := GENERATE_JDKBYTECODE, \
          JAVAC_FLAGS := -cp $(JDK_OUTPUTDIR)/classes, \
          SRC := $(JDK_OUTPUTDIR)/gensrc_ab/legacy, \
395 396
          BIN := $(JDK_OUTPUTDIR)/classes_ab/legacy, \
          HEADERS := $(JDK_OUTPUTDIR)/gensrc_headers))
397

398
      $(BUILD_ACCESSBRIDGE_LEGACY): $(BUILD_JDK)
399

400
    else
401

402 403 404 405
      $(eval $(call SetupJavaCompilation,BUILD_ACCESSBRIDGE_64, \
          SETUP := GENERATE_JDKBYTECODE, \
          JAVAC_FLAGS := -cp $(JDK_OUTPUTDIR)/classes, \
          SRC := $(JDK_OUTPUTDIR)/gensrc_ab/64bit, \
406 407
          BIN := $(JDK_OUTPUTDIR)/classes_ab/64bit, \
          HEADERS := $(JDK_OUTPUTDIR)/gensrc_headers))
408

409
      $(BUILD_ACCESSBRIDGE_64): $(BUILD_JDK)
410

411 412
    endif
  endif
413 414 415

##########################################################################################

C
Merge  
chegar 已提交
416
all: $(BUILD_JDK) $(BUILD_SECURITY) $(COPY_EXTRA) \
417 418 419
    $(JDK_OUTPUTDIR)/classes/META-INF/services/com.sun.tools.xjc.Plugin \
    $(BUILD_ACCESSBRIDGE_32) $(BUILD_ACCESSBRIDGE_64) \
    $(BUILD_ACCESSBRIDGE_LEGACY)
420 421

.PHONY: all