CompileJavaClasses.gmk 14.8 KB
Newer Older
1 2 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
#
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# 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 39 40 41
JARS :=
EXFILES :=
EXCLUDES :=

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

EXCLUDES +=	com/sun/pept \
42 43 44
		com/sun/tools/example/trace\
		com/sun/tools/example/debug/bdi\
		com/sun/tools/example/debug/event\
45
		com/sun/tools/example/debug/gui
46 47

ifdef OPENJDK
48 49
    EXCLUDES+=	sun/dc \
		com/sun/jmx/snmp \
50 51 52 53
		sun/management/snmp \
		com/sun/script
endif

54 55 56
ifndef OPENJDK
   # There exists two versions of this file...
   EXFILES := $(JDK_TOPDIR)/src/share/classes/javax/crypto/JarVerifier.java
57 58 59 60 61

   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
62 63 64

      # AccessBridge is compiled separately below.
      EXFILES += AccessBridge.java \
65
		 AccessBridgeLoader.java \
66 67 68
		 com/sun/java/accessibility/util/java/awt/ChoiceTranslator.java
      # This seems to never be built
      EXCLUDES += com/sun/java/accessibility/extensions
69 70
   endif

71 72
endif

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

   EXCLUDES += com/oracle/security
97 98
endif

99 100
# In the old build, this isn't excluded on macosx, even though it probably
# should be.
101
ifneq ($(OPENJDK_TARGET_OS),macosx)
102 103
	EXFILES+=WrapperGenerator.java
endif
104

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

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

119
ifneq ($(OPENJDK_TARGET_OS),linux)
120
    EXFILES+=sun/tools/attach/LinuxAttachProvider.java \
O
ohair 已提交
121 122 123 124 125 126 127 128 129 130 131
	     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 \
132
	     sun/nio/fs/MagicFileTypeDetector.java \
O
ohair 已提交
133 134 135
	     sun/nio/fs/LinuxNativeDispatcher.java \
	     sun/nio/fs/LinuxUserDefinedFileAttributeView.java \
	     sun/nio/fs/LinuxWatchService.java
136 137
endif

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

# Exclude BreakIterator classes that are just used in compile process to generate
# data files and shouldn't go in the product
EXFILES+=sun/text/resources/BreakIteratorRules.java \
156
	 sun/text/resources/BreakIteratorRules_th.java
157 158 159 160 161 162 163 164 165 166

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

ifdef OPENJDK
    EXCLUDES+=sun/java2d/cmm/kcms
endif

167
# Used on windows and macosx
168
ifeq (,$(filter $(OPENJDK_TARGET_OS), windows macosx))
169 170 171
    EXFILES+=sun/awt/AWTCharset.java
endif

172
ifneq ($(OPENJDK_TARGET_OS), macosx)
O
ohair 已提交
173 174 175 176 177 178 179 180 181 182 183 184 185 186 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
    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
215
endif
216 217 218 219

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

220
ifeq (,$(filter $(OPENJDK_TARGET_OS), solaris macosx))
221 222 223
#
# only solaris and macosx
#
224 225 226 227 228 229 230 231
    EXFILES+=sun/nio/fs/PollingWatchService.java
endif

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

232
ifeq ($(OPENJDK_TARGET_OS), windows)
233 234
    EXFILES+=sun/nio/ch/AbstractPollSelectorImpl.java \
        sun/nio/ch/PollSelectorProvider.java \
E
erikj 已提交
235
	sun/nio/ch/SimpleAsynchronousFileChannelImpl.java
236 237
endif

238 239 240 241 242 243 244
# 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
# pick them up since they aren't generated when the source dirs are 
# 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
# and compiled. Exclude them here to produce the same rt.jar as the old 
# build does when building just once.
O
ohair 已提交
245
EXFILES+=javax/swing/plaf/nimbus/InternalFrameTitlePanePainter.java \
246 247 248 249 250 251
	 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
252

253 254 255 256 257
# 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
258 259
    CLOSED_SRC_DIRS:=$(JDK_TOPDIR)/src/closed/share/classes \
		     $(JDK_TOPDIR)/src/closed/$(OPENJDK_TARGET_OS_API_DIR)/classes
260 261
endif

262
MACOSX_SRC_DIRS :=
263
ifeq ($(OPENJDK_TARGET_OS),macosx)
264 265 266 267 268 269
     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 \
270
               $(JDK_TOPDIR)/src/solaris/classes/java/lang/ClassLoaderHelper.java \
271 272
               $(JDK_TOPDIR)/src/solaris/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java \
               $(JDK_TOPDIR)/src/solaris/classes/sun/nio/fs/GnomeFileTypeDetector.java
273 274 275 276 277 278

     # JObjC.jar contains 1.5 byte-code...so skip it here :-(
     # MACOSX_SRC_DIRS += $(JDK_TOPDIR)/src/macosx/native/jobjc/src
     # EXCLUDES+= tests/java/com/apple/jobjc

     EXCLUDES+= com/apple/jobjc
279 280 281 282 283 284
endif

# The exception handling of swing beaninfo
# These resources violates the convention of having code and resources together under
# $(JDK_TOPDIR)/src/.../classes directories
$(JDK_OUTPUTDIR)/classes/javax/swing/beaninfo/images/%.gif: $(JDK_TOPDIR)/make/tools/swing-beans/beaninfo/images/%.gif
285
	$(call install-file)
286

287 288 289 290 291 292
# 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.
JDK_USER_DEFINED_FILTER:=$(strip $(subst $(COMMA),$(SPACE),$(JDK_FILTER)))

293 294 295
$(eval $(call SetupJavaCompilation,BUILD_JDK,\
                SETUP:=GENERATE_JDKBYTECODE,\
		SRC:=$(JDK_TOPDIR)/src/share/classes \
296
		     $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes \
297
		     $(MACOSX_SRC_DIRS) \
298
		     $(JDK_OUTPUTDIR)/gensrc \
299
		     $(JDK_OUTPUTDIR)/gensrc_no_srczip \
300
		     $(CLOSED_SRC_DIRS),\
301
		INCLUDES:=$(JDK_USER_DEFINED_FILTER),\
302 303
		EXCLUDES:=$(EXCLUDES),\
		EXCLUDE_FILES:=$(EXFILES),\
304
		BIN:=$(JDK_OUTPUTDIR)/classes,\
305 306 307 308
		COPY:=$(COPY_PATTERNS),\
		COPY_FILES:=$(COPY_FILES),\
		HEADERS:=$(JDK_OUTPUTDIR)/gensrc_headers))

309 310
##########################################################################################

311 312
ifndef OPENJDK

313
    $(eval $(call SetupJavaCompilation,BUILD_ALTCLASSES,\
314 315
		SETUP:=GENERATE_JDKBYTECODE,\
		SRC:=$(JDK_TOPDIR)/src/closed/share/altclasses, \
316
		BIN:=$(JDK_OUTPUTDIR)/altclasses_classes))
317

318
    $(BUILD_ALTCLASSES): $(BUILD_JDK)
319 320 321 322 323 324 325 326 327 328 329

endif

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

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

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

330 331 332 333 334 335 336 337
ifeq ($(OPENJDK_TARGET_OS),macosx)
#
# JObjC.jar is compiled with BOOT_JAVAC which (may) not support the "-h" flag.
#   so we first compile classes with BOOT_JAVAC and then with JDK_JAVAC :-(
#
$(eval $(call SetupJavaCompiler,GENERATE_15BYTECODE,\
     JAVAC:=$(JAVAC),\
     FLAGS:=-source 1.5 -target 1.5 -g -bootclasspath $(BOOT_RTJAR) -cp $(JDK_OUTPUTDIR)/../langtools/dist/lib/classes.jar $(DISABLE_WARNINGS),\
338 339
     SERVER_DIR:=$(SJAVAC_SERVER_DIR),\
     SERVER_JVM:=$(SJAVAC_SERVER_JAVA)))
340

341
$(eval $(call SetupJavaCompilation,BUILD_JOBJC,\
342
		SETUP:=GENERATE_15BYTECODE,\
343
		DISABLE_SJAVAC:=true,\
344 345
		SRC:=$(JDK_TOPDIR)/src/macosx/native/jobjc/src/core/java \
		     $(JDK_TOPDIR)/src/macosx/native/jobjc/src/runtime-additions/java \
346
		     $(JDK_OUTPUTDIR)/gensrc_jobjc/src, \
347 348 349 350 351 352
		INCLUDES := com/apple/jobjc,\
                EXCLUDES := tests/java/com/apple/jobjc,\
		BIN:=$(JDK_OUTPUTDIR)/jobjc_classes,\
		JAR:=$(JDK_OUTPUTDIR)/lib/JObjC.jar, \
		JARINDEX := true))

353
$(BUILD_JOBJC) : $(BUILD_JDK)
354

355
$(eval $(call SetupJavaCompilation,BUILD_JOBJC_HEADERS,\
356 357 358
		SETUP:=GENERATE_JDKBYTECODE,\
		SRC:=$(JDK_TOPDIR)/src/macosx/native/jobjc/src/core/java \
		     $(JDK_TOPDIR)/src/macosx/native/jobjc/src/runtime-additions/java \
359
		     $(JDK_OUTPUTDIR)/gensrc_jobjc/src, \
360 361 362
		INCLUDES := com/apple/jobjc,\
                EXCLUDES := tests/java/com/apple/jobjc,\
		BIN:=$(JDK_OUTPUTDIR)/jobjc_classes_headers,\
363
		HEADERS:=$(JDK_OUTPUTDIR)/gensrc_headers_jobjc))
364

365
$(BUILD_JOBJC_HEADERS) : $(BUILD_JDK)
366 367 368 369

endif

##########################################################################################
370

371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401
ifndef OPENJDK
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,\
		BIN:=$(JDK_OUTPUTDIR)/classes_ab/32bit))

    $(BUILD_ACCESSBRIDGE_32): $(BUILD_JDK)

    $(eval $(call SetupJavaCompilation,BUILD_ACCESSBRIDGE_LEGACY,\
		SETUP:=GENERATE_JDKBYTECODE,\
		JAVAC_FLAGS:=-cp $(JDK_OUTPUTDIR)/classes,\
		SRC:=$(JDK_OUTPUTDIR)/gensrc_ab/legacy,\
		BIN:=$(JDK_OUTPUTDIR)/classes_ab/legacy))

    $(BUILD_ACCESSBRIDGE_LEGACY): $(BUILD_JDK)

else

    $(eval $(call SetupJavaCompilation,BUILD_ACCESSBRIDGE_64,\
		SETUP:=GENERATE_JDKBYTECODE,\
		JAVAC_FLAGS:=-cp $(JDK_OUTPUTDIR)/classes,\
		SRC:=$(JDK_OUTPUTDIR)/gensrc_ab/64bit,\
		BIN:=$(JDK_OUTPUTDIR)/classes_ab/64bit))

    $(BUILD_ACCESSBRIDGE_64): $(BUILD_JDK)

endif
endif
402 403 404 405
endif

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

406
all: $(BUILD_JDK) $(BUILD_ALTCLASSES) $(BUILD_JOBJC) $(BUILD_JOBJC_HEADERS) $(COPY_EXTRA) \
E
Merge  
erikj 已提交
407
	$(JDK_OUTPUTDIR)/classes/META-INF/services/com.sun.tools.xjc.Plugin \
408 409
	$(BUILD_ACCESSBRIDGE_32) $(BUILD_ACCESSBRIDGE_64) \
	$(BUILD_ACCESSBRIDGE_LEGACY)
410 411

.PHONY: all