CompileJavaClasses.gmk 14.6 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 45 46 47 48
		com/sun/tools/example/trace\
		com/sun/tools/example/debug/bdi\
		com/sun/tools/example/debug/event\
		com/sun/tools/example/debug/gui \
		com/oracle/security

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

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

   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
   endif

65 66
endif

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

91 92
# In the old build, this isn't excluded on macosx, even though it probably
# should be.
93
ifneq ($(OPENJDK_TARGET_OS),macosx)
94 95
	EXFILES+=WrapperGenerator.java
endif
96

97
ifneq ($(OPENJDK_TARGET_OS),windows)
98 99 100
    # Exclude Window security related files in src/share/classes
    EXFILES+=NTLoginModule.java \
             NTSystem.java
101 102 103
else
    EXFILES+=UnixLoginModule.java \
	     UnixSystem.java
104 105
endif

106
ifeq ($(OPENJDK_TARGET_OS),windows)
107
    # Don't build GTK L&F on Windows
108
    EXCLUDES+=com/sun/java/swing/plaf/gtk
109 110
endif

111
ifneq ($(OPENJDK_TARGET_OS),linux)
112
    EXFILES+=sun/tools/attach/LinuxAttachProvider.java \
O
ohair 已提交
113 114 115 116 117 118 119 120 121 122 123
	     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 \
124
	     sun/nio/fs/MagicFileTypeDetector.java \
O
ohair 已提交
125 126 127
	     sun/nio/fs/LinuxNativeDispatcher.java \
	     sun/nio/fs/LinuxUserDefinedFileAttributeView.java \
	     sun/nio/fs/LinuxWatchService.java
128 129
endif

130
ifneq ($(OPENJDK_TARGET_OS),macosx)
O
ohair 已提交
131 132 133 134
    EXFILES+=sun/nio/ch/BsdAsynchronousChannelProvider.java \
             sun/nio/ch/KQueue.java \
             sun/nio/ch/KQueuePort.java \
             sun/nio/fs/BsdFileStore.java \
135 136 137
	     sun/nio/fs/BsdFileSystem.java \
             sun/nio/fs/BsdFileSystemProvider.java \
             sun/nio/fs/BsdNativeDispatcher.java \
138 139 140
             sun/nio/fs/MacOSXFileSystemProvider.java \
             sun/nio/fs/MacOSXFileSystem.java \
             sun/nio/fs/MacOSXNativeDispatcher.java \
141 142 143 144 145 146 147
             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 \
148
	 sun/text/resources/BreakIteratorRules_th.java
149 150 151 152 153 154 155 156 157 158

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

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

159
# Used on windows and macosx
160
ifeq (,$(filter $(OPENJDK_TARGET_OS), windows macosx))
161 162 163
    EXFILES+=sun/awt/AWTCharset.java
endif

164
ifneq ($(OPENJDK_TARGET_OS), macosx)
O
ohair 已提交
165 166 167 168 169 170 171 172 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
    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
207
endif
208 209 210 211

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

212
ifeq (,$(filter $(OPENJDK_TARGET_OS), solaris macosx))
213 214 215
#
# only solaris and macosx
#
216 217 218 219 220 221 222 223
    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

224
ifeq ($(OPENJDK_TARGET_OS), windows)
225 226
    EXFILES+=sun/nio/ch/AbstractPollSelectorImpl.java \
        sun/nio/ch/PollSelectorProvider.java \
E
erikj 已提交
227
	sun/nio/ch/SimpleAsynchronousFileChannelImpl.java
228 229
endif

O
ohair 已提交
230 231 232 233 234 235 236 237
# Exclude nimbus files from rt.jar
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
238

239 240 241 242 243
# 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
O
ohair 已提交
244 245 246 247
    CLOSED_SRC_DIRS:=$(JDK_TOPDIR)/src/closed/share/classes
    ifneq ($(OPENJDK_TARGET_OS_API_DIR),windows)
      CLOSED_SRC_DIRS += $(JDK_TOPDIR)/src/closed/$(OPENJDK_TARGET_OS_API_DIR)/classes
    endif
248 249
endif

250
MACOSX_SRC_DIRS :=
251
ifeq ($(OPENJDK_TARGET_OS),macosx)
252 253 254 255 256 257
     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 \
258
               $(JDK_TOPDIR)/src/solaris/classes/java/lang/ClassLoaderHelper.java \
259 260
               $(JDK_TOPDIR)/src/solaris/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java \
               $(JDK_TOPDIR)/src/solaris/classes/sun/nio/fs/GnomeFileTypeDetector.java
261 262 263 264 265 266

     # 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
267 268 269 270 271 272 273 274 275
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
	$(MKDIR) -p $(@D)
	$(CP) $< $@

276 277 278 279 280 281
# 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)))

282 283 284
$(eval $(call SetupJavaCompilation,BUILD_JDK,\
                SETUP:=GENERATE_JDKBYTECODE,\
		SRC:=$(JDK_TOPDIR)/src/share/classes \
285
		     $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes \
286
		     $(MACOSX_SRC_DIRS) \
287 288
		     $(JDK_OUTPUTDIR)/gensrc \
		     $(CLOSED_SRC_DIRS),\
289
		INCLUDES:=$(JDK_USER_DEFINED_FILTER),\
290 291
		EXCLUDES:=$(EXCLUDES),\
		EXCLUDE_FILES:=$(EXFILES),\
292
		BIN:=$(JDK_OUTPUTDIR)/classes,\
293 294 295 296
		COPY:=$(COPY_PATTERNS),\
		COPY_FILES:=$(COPY_FILES),\
		HEADERS:=$(JDK_OUTPUTDIR)/gensrc_headers))

297 298 299 300 301 302 303 304
##########################################################################################
# Special handling of header file generation for classes in the jigsaw base module which
# currently can't add the annotaion GenerateNativeHeaders. For these specific classes the
# java file and the class have the same names which enables shortcutting the dependencies.

JDK_BASE_HEADER_CLASSES:=java.lang.Integer \
			 java.lang.Long \
			 java.net.SocketOptions \
305 306
			 sun.nio.ch.IOStatus \
			 java.io.FileSystem
307 308 309 310

JDK_BASE_HEADER_JAVA_FILES:=$(patsubst %,$(JDK_TOPDIR)/src/share/classes/%.java,\
				$(subst .,/,$(JDK_BASE_HEADER_CLASSES)))

311
ifeq ($(OPENJDK_TARGET_OS),windows)
312
    JDK_BASE_HEADER_CLASSES_WINDOWS:=sun.nio.ch.PollArrayWrapper
313 314 315 316 317 318 319
    JDK_BASE_HEADER_CLASSES+=$(JDK_BASE_HEADER_CLASSES_WINDOWS)
    JDK_BASE_HEADER_JAVA_FILES+=$(patsubst %,$(JDK_TOPDIR)/src/windows/classes/%.java,\
				$(subst .,/,$(JDK_BASE_HEADER_CLASSES_WINDOWS)))
endif

# Set prereqs to the java files since make doesn't know about the class files. Add BUILD_JDK
# as an order only dependency to avoid race with the java compilation.
O
ohair 已提交
320
$(JDK_OUTPUTDIR)/gensrc_headers/_the.jdk.base.headers: $(JDK_BASE_HEADER_JAVA_FILES) | $(BUILD_JDK)
321 322 323 324 325 326 327 328 329
	$(ECHO) Generating headers for jdk base classes
	$(JAVAH) -bootclasspath $(JDK_OUTPUTDIR)/classes -d $(JDK_OUTPUTDIR)/gensrc_headers \
		$(JDK_BASE_HEADER_CLASSES)
	$(TOUCH) $@

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

ifndef OPENJDK

330
    $(eval $(call SetupJavaCompilation,BUILD_ALTCLASSES,\
331 332
		SETUP:=GENERATE_JDKBYTECODE,\
		SRC:=$(JDK_TOPDIR)/src/closed/share/altclasses, \
333
		BIN:=$(JDK_OUTPUTDIR)/altclasses_classes))
334

335
    $(BUILD_ALTCLASSES): $(BUILD_JDK)
336 337 338 339 340 341 342 343 344 345 346

endif

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

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

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

347 348 349 350 351 352 353 354
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),\
355 356
     SERVER_DIR:=$(SJAVAC_SERVER_DIR),\
     SERVER_JVM:=$(SJAVAC_SERVER_JAVA)))
357

358
$(eval $(call SetupJavaCompilation,BUILD_JOBJC,\
359
		SETUP:=GENERATE_15BYTECODE,\
360
		DISABLE_SJAVAC:=true,\
361 362 363 364 365 366 367 368 369
		SRC:=$(JDK_TOPDIR)/src/macosx/native/jobjc/src/core/java \
		     $(JDK_TOPDIR)/src/macosx/native/jobjc/src/runtime-additions/java \
		     $(JDK_OUTPUTDIR)/gensrc, \
		INCLUDES := com/apple/jobjc,\
                EXCLUDES := tests/java/com/apple/jobjc,\
		BIN:=$(JDK_OUTPUTDIR)/jobjc_classes,\
		JAR:=$(JDK_OUTPUTDIR)/lib/JObjC.jar, \
		JARINDEX := true))

370
$(BUILD_JOBJC) : $(BUILD_JDK)
371

372
$(eval $(call SetupJavaCompilation,BUILD_JOBJC_HEADERS,\
373 374 375 376 377 378 379
		SETUP:=GENERATE_JDKBYTECODE,\
		SRC:=$(JDK_TOPDIR)/src/macosx/native/jobjc/src/core/java \
		     $(JDK_TOPDIR)/src/macosx/native/jobjc/src/runtime-additions/java \
		     $(JDK_OUTPUTDIR)/gensrc, \
		INCLUDES := com/apple/jobjc,\
                EXCLUDES := tests/java/com/apple/jobjc,\
		BIN:=$(JDK_OUTPUTDIR)/jobjc_classes_headers,\
380
		HEADERS:=$(JDK_OUTPUTDIR)/gensrc_headers_jobjc))
381

382
$(BUILD_JOBJC_HEADERS) : $(BUILD_JDK)
383 384 385 386 387

endif

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

388
# copy with -a to preserve timestamps so dependencies down the line aren't messed up
389 390
all: $(BUILD_JDK) $(BUILD_ALTCLASSES) $(BUILD_JOBJC) $(BUILD_JOBJC_HEADERS) $(COPY_EXTRA) \
	$(JDK_OUTPUTDIR)/classes/META-INF/services/com.sun.tools.xjc.Plugin \
O
ohair 已提交
391
	$(JDK_OUTPUTDIR)/gensrc_headers/_the.jdk.base.headers
392 393

.PHONY: all