1 #
   2 # Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
   3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 #
   5 # This code is free software; you can redistribute it and/or modify it
   6 # under the terms of the GNU General Public License version 2 only, as
   7 # published by the Free Software Foundation.  Oracle designates this
   8 # particular file as subject to the "Classpath" exception as provided
   9 # by Oracle in the LICENSE file that accompanied this code.
  10 #
  11 # This code is distributed in the hope that it will be useful, but WITHOUT
  12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14 # version 2 for more details (a copy is included in the LICENSE file that
  15 # accompanied this code).
  16 #
  17 # You should have received a copy of the GNU General Public License version
  18 # 2 along with this work; if not, write to the Free Software Foundation,
  19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20 #
  21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22 # or visit www.oracle.com if you need additional information or have any
  23 # questions.
  24 #
  25 
  26 default: all
  27 
  28 include $(SPEC)
  29 include MakeBase.gmk
  30 include JavaCompilation.gmk
  31 
  32 # Setup the java compilers for the JDK build.
  33 include Setup.gmk
  34 
  35 JARS :=
  36 EXFILES :=
  37 EXCLUDES :=
  38 
  39 ##########################################################################################
  40 # Include the corresponding custom file, if present.
  41 
  42 -include $(CUSTOM_MAKE_DIR)/CompileJavaClasses.gmk
  43 
  44 ##########################################################################################
  45 
  46 EXCLUDES += com/sun/pept \
  47     com/sun/tools/example/trace \
  48     com/sun/tools/example/debug/bdi \
  49     com/sun/tools/example/debug/event \
  50     com/sun/tools/example/debug/gui
  51 
  52 ifdef OPENJDK
  53   EXCLUDES += sun/dc \
  54       com/sun/jmx/snmp \
  55       sun/management/snmp \
  56       com/sun/script
  57 endif
  58 
  59 ifndef OPENJDK
  60   # There exists two versions of these files...
  61   EXFILES += $(JDK_TOPDIR)/src/share/classes/javax/crypto/JarVerifier.java
  62 
  63   ifeq ($(OPENJDK_TARGET_OS), windows)
  64     # This gets built on unix platforms implicitly in the old build even though
  65     # it's excluded in the closed build.
  66     EXCLUDES += sun/java2d/pisces
  67   endif
  68 endif
  69 
  70 ifeq ($(OPENJDK_TARGET_OS), windows)
  71     # AccessBridge is compiled separately below.
  72     EXFILES += AccessBridge.java \
  73         AccessBridgeLoader.java
  74   endif
  75 
  76 ifneq ($(OPENJDK_TARGET_OS), solaris)
  77   # Exclude Solaris nio and two security related files in src/share/classes
  78   EXFILES += SolarisAclFileAttributeView.java \
  79       SolarisFileStore.java \
  80       SolarisFileSystem.java \
  81       SolarisFileSystemProvider.java \
  82       SolarisNativeDispatcher.java \
  83       SolarisUserDefinedFileAttributeView.java \
  84       SolarisWatchService.java \
  85       SolarisAclFileAttributeView.java \
  86       SolarisLoginModule.java \
  87       SolarisSystem.java \
  88       sun/nio/ch/DevPollArrayWrapper.java \
  89       sun/nio/ch/DevPollSelectorImpl.java \
  90       sun/nio/ch/DevPollSelectorProvider.java \
  91       sun/nio/ch/EventPortSelectorImpl.java \
  92       sun/nio/ch/EventPortSelectorProvider.java \
  93       sun/nio/ch/EventPortWrapper.java \
  94       sun/nio/ch/SolarisAsynchronousChannelProvider.java \
  95       sun/nio/ch/SolarisEventPort.java \
  96       sun/tools/attach/SolarisAttachProvider.java \
  97       sun/tools/attach/SolarisVirtualMachine.java
  98 
  99   EXCLUDES += com/oracle/security
 100 endif
 101 
 102 EXFILES += WrapperGenerator.java
 103 
 104 ifneq ($(OPENJDK_TARGET_OS), windows)
 105   # Exclude Window security related files in src/share/classes
 106   EXFILES += NTLoginModule.java \
 107       NTSystem.java
 108 else
 109   EXFILES += UnixLoginModule.java \
 110       UnixSystem.java
 111 endif
 112 
 113 ifeq ($(OPENJDK_TARGET_OS), windows)
 114   # Don't build GTK L&F on Windows
 115   EXCLUDES += com/sun/java/swing/plaf/gtk
 116 endif
 117 
 118 ifneq ($(OPENJDK_TARGET_OS), linux)
 119   EXFILES += sun/tools/attach/LinuxAttachProvider.java \
 120       sun/tools/attach/LinuxVirtualMachine.java \
 121       sun/nio/ch/EPoll.java \
 122       sun/nio/ch/EPollArrayWrapper.java \
 123       sun/nio/ch/EPollPort.java \
 124       sun/nio/ch/EPollSelectorImpl.java \
 125       sun/nio/ch/EPollSelectorProvider.java \
 126       sun/nio/ch/LinuxAsynchronousChannelProvider.java \
 127       sun/nio/fs/LinuxDosFileAttributeView.java \
 128       sun/nio/fs/LinuxFileStore.java \
 129       sun/nio/fs/LinuxFileSystem.java \
 130       sun/nio/fs/LinuxFileSystemProvider.java \
 131       sun/nio/fs/MagicFileTypeDetector.java \
 132       sun/nio/fs/LinuxNativeDispatcher.java \
 133       sun/nio/fs/LinuxUserDefinedFileAttributeView.java \
 134       sun/nio/fs/LinuxWatchService.java
 135 endif
 136 
 137 ifneq ($(OPENJDK_TARGET_OS), macosx)
 138   EXFILES += sun/nio/ch/BsdAsynchronousChannelProvider.java \
 139       sun/nio/ch/KQueue.java \
 140       sun/nio/ch/KQueuePort.java \
 141       sun/nio/fs/BsdFileStore.java \
 142       sun/nio/fs/BsdFileSystem.java \
 143       sun/nio/fs/BsdFileSystemProvider.java \
 144       sun/nio/fs/BsdNativeDispatcher.java \
 145       sun/nio/fs/MacOSXFileSystemProvider.java \
 146       sun/nio/fs/MacOSXFileSystem.java \
 147       sun/nio/fs/MacOSXNativeDispatcher.java \
 148       sun/tools/attach/BsdAttachProvider.java \
 149       sun/tools/attach/BsdVirtualMachine.java
 150 endif
 151 
 152 ifneq ($(OPENJDK_TARGET_OS),aix)
 153     EXFILES+=sun/nio/ch/AixAsynchronousChannelProvider.java \
 154              sun/nio/ch/AixPollPort.java \
 155              sun/nio/fs/AixFileStore.java \
 156              sun/nio/fs/AixFileSystem.java \
 157              sun/nio/fs/AixFileSystemProvider.java \
 158              sun/nio/fs/AixNativeDispatcher.java \
 159              sun/tools/attach/AixAttachProvider.java \
 160              sun/tools/attach/AixVirtualMachine.java
 161 endif
 162 
 163 # Exclude BreakIterator classes that are just used in compile process to generate
 164 # data files and shouldn't go in the product
 165 EXFILES += sun/text/resources/BreakIteratorRules.java \
 166     sun/text/resources/BreakIteratorRules_th.java
 167 
 168 # TODO: Add BUILD_HEADLESS_ONLY to configure?
 169 ifdef BUILD_HEADLESS_ONLY
 170   EXCLUDES += sun/applet
 171 endif
 172 
 173 ifdef OPENJDK
 174   EXCLUDES += sun/java2d/cmm/kcms
 175 endif
 176 
 177 # Used on windows and macosx
 178 ifeq (, $(filter $(OPENJDK_TARGET_OS), windows macosx))
 179   EXFILES += sun/awt/AWTCharset.java
 180 endif
 181 
 182 ifeq ($(OPENJDK_TARGET_OS), macosx)
 183   # exclude all X11 on Mac, we can't exclude some like below or we'll have compilation errors
 184   EXCLUDES += sun/awt/X11
 185 else
 186   # TBD: figure out how to eliminate this long list
 187   EXFILES += sun/awt/X11/ScreenFormat.java \
 188       sun/awt/X11/XArc.java \
 189       sun/awt/X11/XChar2b.java \
 190       sun/awt/X11/XCharStruct.java \
 191       sun/awt/X11/XClassHint.java \
 192       sun/awt/X11/XComposeStatus.java \
 193       sun/awt/X11/XExtCodes.java \
 194       sun/awt/X11/XFontProp.java \
 195       sun/awt/X11/XFontSetExtents.java \
 196       sun/awt/X11/XFontStruct.java \
 197       sun/awt/X11/XGCValues.java \
 198       sun/awt/X11/XHostAddress.java \
 199       sun/awt/X11/XIMCallback.java \
 200       sun/awt/X11/XIMHotKeyTrigger.java \
 201       sun/awt/X11/XIMHotKeyTriggers.java \
 202       sun/awt/X11/XIMPreeditCaretCallbackStruct.java \
 203       sun/awt/X11/XIMPreeditDrawCallbackStruct.java \
 204       sun/awt/X11/XIMPreeditStateNotifyCallbackStruct.java \
 205       sun/awt/X11/XIMStatusDrawCallbackStruct.java \
 206       sun/awt/X11/XIMStringConversionCallbackStruct.java \
 207       sun/awt/X11/XIMStringConversionText.java \
 208       sun/awt/X11/XIMStyles.java \
 209       sun/awt/X11/XIMText.java \
 210       sun/awt/X11/XIMValuesList.java \
 211       sun/awt/X11/XImage.java \
 212       sun/awt/X11/XKeyboardControl.java \
 213       sun/awt/X11/XKeyboardState.java \
 214       sun/awt/X11/XOMCharSetList.java \
 215       sun/awt/X11/XOMFontInfo.java \
 216       sun/awt/X11/XOMOrientation.java \
 217       sun/awt/X11/XPoint.java \
 218       sun/awt/X11/XRectangle.java \
 219       sun/awt/X11/XSegment.java \
 220       sun/awt/X11/XStandardColormap.java \
 221       sun/awt/X11/XTextItem.java \
 222       sun/awt/X11/XTextItem16.java \
 223       sun/awt/X11/XTextProperty.java \
 224       sun/awt/X11/XTimeCoord.java \
 225       sun/awt/X11/XWindowChanges.java \
 226       sun/awt/X11/XdbeSwapInfo.java \
 227       sun/awt/X11/XmbTextItem.java \
 228       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 endif
 240 
 241 ifeq ($(OPENJDK_TARGET_OS), windows)
 242   EXFILES += sun/nio/ch/AbstractPollSelectorImpl.java \
 243       sun/nio/ch/PollSelectorProvider.java \
 244       sun/nio/ch/SimpleAsynchronousFileChannelImpl.java
 245 endif
 246 
 247 # These files do not appear in the build result of the old build. This
 248 # is because they are generated sources, but the AUTO_JAVA_FILES won't
 249 # pick them up since they aren't generated when the source dirs are
 250 # searched and they aren't referenced by any other classes so they won't
 251 # be picked up by implicit compilation. On a rebuild, they are picked up
 252 # and compiled. Exclude them here to produce the same rt.jar as the old
 253 # build does when building just once.
 254 EXFILES += javax/swing/plaf/nimbus/InternalFrameTitlePanePainter.java \
 255     javax/swing/plaf/nimbus/OptionPaneMessageAreaPainter.java \
 256     javax/swing/plaf/nimbus/ScrollBarPainter.java \
 257     javax/swing/plaf/nimbus/SliderPainter.java \
 258     javax/swing/plaf/nimbus/SpinnerPainter.java \
 259     javax/swing/plaf/nimbus/SplitPanePainter.java \
 260     javax/swing/plaf/nimbus/TabbedPanePainter.java
 261 
 262 # Acquire a list of files that should be copied straight over to the classes.
 263 include CopyIntoClasses.gmk
 264 # Now we have COPY_PATTERNS, COPY_FILES and COPY_EXTRA
 265 
 266 ifndef OPENJDK
 267   CLOSED_SRC_DIRS := $(JDK_TOPDIR)/src/closed/share/classes \
 268       $(wildcard $(JDK_TOPDIR)/src/closed/$(OPENJDK_TARGET_OS_API_DIR)/classes)
 269 endif
 270 
 271 MACOSX_SRC_DIRS :=
 272 ifeq ($(OPENJDK_TARGET_OS), macosx)
 273   MACOSX_SRC_DIRS += $(JDK_TOPDIR)/src/macosx/classes
 274 
 275   # this files are duplicated in MACOSX_SRC_DIRS
 276   EXFILES += $(JDK_TOPDIR)/src/solaris/classes/sun/nio/ch/DefaultSelectorProvider.java \
 277       $(JDK_TOPDIR)/src/solaris/classes/sun/java2d/BackBufferCapsProvider.java \
 278       $(JDK_TOPDIR)/src/solaris/classes/java/net/DefaultInterface.java \
 279       $(JDK_TOPDIR)/src/solaris/classes/java/lang/ClassLoaderHelper.java \
 280       $(JDK_TOPDIR)/src/solaris/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java \
 281       $(JDK_TOPDIR)/src/solaris/classes/sun/nio/fs/GnomeFileTypeDetector.java \
 282       $(JDK_TOPDIR)/src/solaris/classes/sun/nio/ch/sctp/SctpChannelImpl.java \
 283       $(JDK_TOPDIR)/src/solaris/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java \
 284       $(JDK_TOPDIR)/src/solaris/classes/sun/nio/ch/sctp/SctpServerChannelImpl.java
 285 
 286 endif
 287 
 288 # The security classes should not end up in the classes directory as that will prevent them
 289 # from working when running the exploded jdk image. Compile them separately to a different
 290 # directory from where the jars can be created.
 291 SECURITY_PKGS := \
 292     com/oracle/security/ucrypto \
 293     com/sun/crypto/provider \
 294     javax/crypto \
 295     sun/security/ec \
 296     sun/security/internal \
 297     sun/security/mscapi \
 298     sun/security/pkcs11 \
 299     #
 300 
 301 AIX_SRC_DIRS :=
 302 ifeq ($(OPENJDK_TARGET_OS),aix)
 303      AIX_SRC_DIRS += $(JDK_TOPDIR)/src/aix/classes
 304 
 305   # these files are duplicated in AIX_SRC_DIRS
 306   EXFILES += $(JDK_TOPDIR)/src/solaris/classes/sun/nio/ch/sctp/SctpChannelImpl.java \
 307       $(JDK_TOPDIR)/src/solaris/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java \
 308       $(JDK_TOPDIR)/src/solaris/classes/sun/nio/ch/sctp/SctpServerChannelImpl.java
 309 endif
 310 
 311 # The exception handling of swing beaninfo
 312 # These resources violates the convention of having code and resources together under
 313 # $(JDK_TOPDIR)/src/.../classes directories
 314 $(JDK_OUTPUTDIR)/classes/javax/swing/beaninfo/images/%.gif: $(JDK_TOPDIR)/make/data/swingbeaninfo/images/%.gif
 315         $(call install-file)
 316 
 317 # The JDK_USER_DEFINED_FILTER is a poor man's incremental build: by specifying
 318 # JDK_FILTER at the make command line, only a subset of the JDK java files will
 319 # be recompiled. If multiple paths are separated by comma, convert that into a
 320 # space separated list.
 321 JDK_USER_DEFINED_FILTER := $(strip $(subst $(COMMA),$(SPACE), $(JDK_FILTER)))
 322 
 323 ifeq ($(ENABLE_SJAVAC),yes)
 324   # With sjavac enabled, excluded sources are not even considered for linking. 
 325   # Explicitly add the security sources to sourcepath for linking.
 326   BUILD_JDK_SOURCEPATH:=$(patsubst %,-i$(SPACE)%.*,$(subst /,.,$(SECURITY_PKGS))) \
 327       -sourcepath $(JDK_TOPDIR)/src/share/classes
 328 endif
 329 
 330 $(eval $(call SetupJavaCompilation,BUILD_JDK,\
 331     SETUP:=GENERATE_JDKBYTECODE,\
 332     SRC:=$(JDK_TOPDIR)/src/share/classes \
 333         $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes \
 334         $(MACOSX_SRC_DIRS) \
 335         $(AIX_SRC_DIRS) \
 336         $(JDK_OUTPUTDIR)/gensrc \
 337         $(JDK_OUTPUTDIR)/gensrc_no_srczip \
 338         $(CLOSED_SRC_DIRS),\
 339     INCLUDES:=$(JDK_USER_DEFINED_FILTER),\
 340     EXCLUDES:=$(EXCLUDES) $(SECURITY_PKGS),\
 341     EXCLUDE_FILES:=$(EXFILES),\
 342     BIN:=$(JDK_OUTPUTDIR)/classes,\
 343     COPY:=$(COPY_PATTERNS),\
 344     COPY_FILES:=$(COPY_FILES),\
 345     HEADERS:=$(JDK_OUTPUTDIR)/gensrc_headers,\
 346     ADD_JAVAC_FLAGS:=$(BUILD_JDK_SOURCEPATH)))
 347 
 348 ##########################################################################################
 349 
 350 $(eval $(call SetupJavaCompilation,BUILD_SECURITY, \
 351     SETUP := GENERATE_JDKBYTECODE, \
 352     SRC := $(JDK_TOPDIR)/src/share/classes \
 353         $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes \
 354         $(MACOSX_SRC_DIRS) \
 355         $(CLOSED_SRC_DIRS), \
 356     INCLUDES := $(SECURITY_PKGS), \
 357     EXCLUDES := $(EXCLUDES), \
 358     EXCLUDE_FILES := $(EXFILES), \
 359     BIN := $(JDK_OUTPUTDIR)/classes_security, \
 360     HEADERS := $(JDK_OUTPUTDIR)/gensrc_headers))
 361 
 362 $(BUILD_SECURITY): $(BUILD_JDK)
 363 
 364 ##########################################################################################
 365 
 366 $(JDK_OUTPUTDIR)/classes/META-INF/services/com.sun.tools.xjc.Plugin:
 367         $(MKDIR) -p $(@D)
 368         $(TOUCH) $@
 369 
 370 ##########################################################################################
 371 
 372 
 373 ##########################################################################################
 374 
 375   ifeq ($(OPENJDK_TARGET_OS), windows)
 376     ifeq ($(OPENJDK_TARGET_CPU_BITS), 32)
 377       $(eval $(call SetupJavaCompilation,BUILD_ACCESSBRIDGE_32, \
 378           SETUP := GENERATE_JDKBYTECODE, \
 379           JAVAC_FLAGS := -cp $(JDK_OUTPUTDIR)/classes, \
 380           SRC := $(JDK_OUTPUTDIR)/gensrc_ab/32bit, \
 381           BIN := $(JDK_OUTPUTDIR)/classes_ab/32bit, \
 382           HEADERS := $(JDK_OUTPUTDIR)/gensrc_headers_ab/32))
 383 
 384       $(BUILD_ACCESSBRIDGE_32): $(BUILD_JDK)
 385 
 386       $(eval $(call SetupJavaCompilation,BUILD_ACCESSBRIDGE_LEGACY, \
 387           SETUP := GENERATE_JDKBYTECODE, \
 388           JAVAC_FLAGS := -cp $(JDK_OUTPUTDIR)/classes, \
 389           SRC := $(JDK_OUTPUTDIR)/gensrc_ab/legacy, \
 390           BIN := $(JDK_OUTPUTDIR)/classes_ab/legacy, \
 391           HEADERS := $(JDK_OUTPUTDIR)/gensrc_headers_ab/LEGACY))
 392 
 393       $(BUILD_ACCESSBRIDGE_LEGACY): $(BUILD_JDK)
 394 
 395     else
 396 
 397       $(eval $(call SetupJavaCompilation,BUILD_ACCESSBRIDGE_64, \
 398           SETUP := GENERATE_JDKBYTECODE, \
 399           JAVAC_FLAGS := -cp $(JDK_OUTPUTDIR)/classes, \
 400           SRC := $(JDK_OUTPUTDIR)/gensrc_ab/64bit, \
 401           BIN := $(JDK_OUTPUTDIR)/classes_ab/64bit, \
 402           HEADERS := $(JDK_OUTPUTDIR)/gensrc_headers_ab/64))
 403 
 404       $(BUILD_ACCESSBRIDGE_64): $(BUILD_JDK)
 405 
 406     endif
 407   endif
 408 
 409 ##########################################################################################
 410 
 411 all: $(BUILD_JDK) $(BUILD_SECURITY) $(COPY_EXTRA) \
 412     $(JDK_OUTPUTDIR)/classes/META-INF/services/com.sun.tools.xjc.Plugin \
 413     $(BUILD_ACCESSBRIDGE_32) $(BUILD_ACCESSBRIDGE_64) \
 414     $(BUILD_ACCESSBRIDGE_LEGACY)
 415 
 416 .PHONY: all