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 
  68     # AccessBridge is compiled separately below.
  69     EXFILES += AccessBridge.java \
  70         AccessBridgeLoader.java \
  71         com/sun/java/accessibility/util/java/awt/ChoiceTranslator.java
  72     # This seems to never be built
  73     EXCLUDES += com/sun/java/accessibility/extensions
  74   endif
  75 
  76 endif
  77 
  78 ifneq ($(OPENJDK_TARGET_OS), solaris)
  79   # Exclude Solaris nio and two security related files in src/share/classes
  80   EXFILES += SolarisAclFileAttributeView.java \
  81       SolarisFileStore.java \
  82       SolarisFileSystem.java \
  83       SolarisFileSystemProvider.java \
  84       SolarisNativeDispatcher.java \
  85       SolarisUserDefinedFileAttributeView.java \
  86       SolarisWatchService.java \
  87       SolarisAclFileAttributeView.java \
  88       SolarisLoginModule.java \
  89       SolarisSystem.java \
  90       sun/nio/ch/DevPollArrayWrapper.java \
  91       sun/nio/ch/DevPollSelectorImpl.java \
  92       sun/nio/ch/DevPollSelectorProvider.java \
  93       sun/nio/ch/EventPortSelectorImpl.java \
  94       sun/nio/ch/EventPortSelectorProvider.java \
  95       sun/nio/ch/EventPortWrapper.java \
  96       sun/nio/ch/SolarisAsynchronousChannelProvider.java \
  97       sun/nio/ch/SolarisEventPort.java \
  98       sun/tools/attach/SolarisAttachProvider.java \
  99       sun/tools/attach/SolarisVirtualMachine.java
 100 
 101   EXCLUDES += com/oracle/security
 102 endif
 103 
 104 EXFILES += WrapperGenerator.java
 105 
 106 ifneq ($(OPENJDK_TARGET_OS), windows)
 107   # Exclude Window security related files in src/share/classes
 108   EXFILES += NTLoginModule.java \
 109       NTSystem.java
 110 else
 111   EXFILES += UnixLoginModule.java \
 112       UnixSystem.java
 113 endif
 114 
 115 ifeq ($(OPENJDK_TARGET_OS), windows)
 116   # Don't build GTK L&F on Windows
 117   EXCLUDES += com/sun/java/swing/plaf/gtk
 118 endif
 119 
 120 ifneq ($(OPENJDK_TARGET_OS), linux)
 121   EXFILES += sun/tools/attach/LinuxAttachProvider.java \
 122       sun/tools/attach/LinuxVirtualMachine.java \
 123       sun/nio/ch/EPoll.java \
 124       sun/nio/ch/EPollArrayWrapper.java \
 125       sun/nio/ch/EPollPort.java \
 126       sun/nio/ch/EPollSelectorImpl.java \
 127       sun/nio/ch/EPollSelectorProvider.java \
 128       sun/nio/ch/LinuxAsynchronousChannelProvider.java \
 129       sun/nio/fs/LinuxDosFileAttributeView.java \
 130       sun/nio/fs/LinuxFileStore.java \
 131       sun/nio/fs/LinuxFileSystem.java \
 132       sun/nio/fs/LinuxFileSystemProvider.java \
 133       sun/nio/fs/MagicFileTypeDetector.java \
 134       sun/nio/fs/LinuxNativeDispatcher.java \
 135       sun/nio/fs/LinuxUserDefinedFileAttributeView.java \
 136       sun/nio/fs/LinuxWatchService.java
 137 endif
 138 
 139 ifneq ($(OPENJDK_TARGET_OS), macosx)
 140   EXFILES += sun/nio/ch/BsdAsynchronousChannelProvider.java \
 141       sun/nio/ch/KQueue.java \
 142       sun/nio/ch/KQueuePort.java \
 143       sun/nio/fs/BsdFileStore.java \
 144       sun/nio/fs/BsdFileSystem.java \
 145       sun/nio/fs/BsdFileSystemProvider.java \
 146       sun/nio/fs/BsdNativeDispatcher.java \
 147       sun/nio/fs/MacOSXFileSystemProvider.java \
 148       sun/nio/fs/MacOSXFileSystem.java \
 149       sun/nio/fs/MacOSXNativeDispatcher.java \
 150       sun/tools/attach/BsdAttachProvider.java \
 151       sun/tools/attach/BsdVirtualMachine.java
 152 endif
 153 
 154 ifneq ($(OPENJDK_TARGET_OS),aix)
 155     EXFILES+=sun/nio/ch/AixAsynchronousChannelProvider.java \
 156              sun/nio/ch/AixPollPort.java \
 157              sun/nio/fs/AixFileStore.java \
 158              sun/nio/fs/AixFileSystem.java \
 159              sun/nio/fs/AixFileSystemProvider.java \
 160              sun/nio/fs/AixNativeDispatcher.java \
 161              sun/tools/attach/AixAttachProvider.java \
 162              sun/tools/attach/AixVirtualMachine.java
 163 endif
 164 
 165 # Exclude BreakIterator classes that are just used in compile process to generate
 166 # data files and shouldn't go in the product
 167 EXFILES += sun/text/resources/BreakIteratorRules.java \
 168     sun/text/resources/BreakIteratorRules_th.java
 169 
 170 # TODO: Add BUILD_HEADLESS_ONLY to configure?
 171 ifdef BUILD_HEADLESS_ONLY
 172   EXCLUDES += sun/applet
 173 endif
 174 
 175 ifdef OPENJDK
 176   EXCLUDES += sun/java2d/cmm/kcms
 177 endif
 178 
 179 # Used on windows and macosx
 180 ifeq (, $(filter $(OPENJDK_TARGET_OS), windows macosx))
 181   EXFILES += sun/awt/AWTCharset.java
 182 endif
 183 
 184 ifeq ($(OPENJDK_TARGET_OS), macosx)
 185   # exclude all X11 on Mac, we can't exclude some like below or we'll have compilation errors
 186   EXCLUDES += sun/awt/X11
 187 else
 188   # TBD: figure out how to eliminate this long list
 189   EXFILES += sun/awt/X11/ScreenFormat.java \
 190       sun/awt/X11/XArc.java \
 191       sun/awt/X11/XChar2b.java \
 192       sun/awt/X11/XCharStruct.java \
 193       sun/awt/X11/XClassHint.java \
 194       sun/awt/X11/XComposeStatus.java \
 195       sun/awt/X11/XExtCodes.java \
 196       sun/awt/X11/XFontProp.java \
 197       sun/awt/X11/XFontSetExtents.java \
 198       sun/awt/X11/XFontStruct.java \
 199       sun/awt/X11/XGCValues.java \
 200       sun/awt/X11/XHostAddress.java \
 201       sun/awt/X11/XIMCallback.java \
 202       sun/awt/X11/XIMHotKeyTrigger.java \
 203       sun/awt/X11/XIMHotKeyTriggers.java \
 204       sun/awt/X11/XIMPreeditCaretCallbackStruct.java \
 205       sun/awt/X11/XIMPreeditDrawCallbackStruct.java \
 206       sun/awt/X11/XIMPreeditStateNotifyCallbackStruct.java \
 207       sun/awt/X11/XIMStatusDrawCallbackStruct.java \
 208       sun/awt/X11/XIMStringConversionCallbackStruct.java \
 209       sun/awt/X11/XIMStringConversionText.java \
 210       sun/awt/X11/XIMStyles.java \
 211       sun/awt/X11/XIMText.java \
 212       sun/awt/X11/XIMValuesList.java \
 213       sun/awt/X11/XImage.java \
 214       sun/awt/X11/XKeyboardControl.java \
 215       sun/awt/X11/XKeyboardState.java \
 216       sun/awt/X11/XOMCharSetList.java \
 217       sun/awt/X11/XOMFontInfo.java \
 218       sun/awt/X11/XOMOrientation.java \
 219       sun/awt/X11/XPoint.java \
 220       sun/awt/X11/XRectangle.java \
 221       sun/awt/X11/XSegment.java \
 222       sun/awt/X11/XStandardColormap.java \
 223       sun/awt/X11/XTextItem.java \
 224       sun/awt/X11/XTextItem16.java \
 225       sun/awt/X11/XTextProperty.java \
 226       sun/awt/X11/XTimeCoord.java \
 227       sun/awt/X11/XWindowChanges.java \
 228       sun/awt/X11/XdbeSwapInfo.java \
 229       sun/awt/X11/XmbTextItem.java \
 230       sun/awt/X11/XwcTextItem.java
 231 endif
 232 
 233 # Exclude another implicitly not included file.
 234 EXFILES += sun/util/locale/AsciiUtil.java
 235 
 236 ifeq (, $(filter $(OPENJDK_TARGET_OS), solaris macosx aix))
 237   #
 238   # only solaris, macosx and aix
 239   #
 240   EXFILES += sun/nio/fs/PollingWatchService.java
 241 endif
 242 
 243 # TODO: Fix when converting NIO
 244 # Exclude *-linux-arm.java and *-linux-ppc.java from closed.
 245 EXFILES += -linux-arm.java \
 246     -linux-ppc.java
 247 
 248 ifeq ($(OPENJDK_TARGET_OS), windows)
 249   EXFILES += sun/nio/ch/AbstractPollSelectorImpl.java \
 250       sun/nio/ch/PollSelectorProvider.java \
 251       sun/nio/ch/SimpleAsynchronousFileChannelImpl.java
 252 endif
 253 
 254 # These files do not appear in the build result of the old build. This
 255 # is because they are generated sources, but the AUTO_JAVA_FILES won't
 256 # pick them up since they aren't generated when the source dirs are
 257 # searched and they aren't referenced by any other classes so they won't
 258 # be picked up by implicit compilation. On a rebuild, they are picked up
 259 # and compiled. Exclude them here to produce the same rt.jar as the old
 260 # build does when building just once.
 261 EXFILES += javax/swing/plaf/nimbus/InternalFrameTitlePanePainter.java \
 262     javax/swing/plaf/nimbus/OptionPaneMessageAreaPainter.java \
 263     javax/swing/plaf/nimbus/ScrollBarPainter.java \
 264     javax/swing/plaf/nimbus/SliderPainter.java \
 265     javax/swing/plaf/nimbus/SpinnerPainter.java \
 266     javax/swing/plaf/nimbus/SplitPanePainter.java \
 267     javax/swing/plaf/nimbus/TabbedPanePainter.java
 268 
 269 # Acquire a list of files that should be copied straight over to the classes.
 270 include CopyIntoClasses.gmk
 271 # Now we have COPY_PATTERNS, COPY_FILES and COPY_EXTRA
 272 
 273 ifndef OPENJDK
 274   ifeq ($(OPENJDK_TARGET_OS), windows) 
 275     CLOSED_SRC_DIRS := $(JDK_TOPDIR)/src/closed/share/classes
 276   else
 277     CLOSED_SRC_DIRS := $(JDK_TOPDIR)/src/closed/share/classes \
 278       $(JDK_TOPDIR)/src/closed/$(OPENJDK_TARGET_OS_API_DIR)/classes
 279   endif
 280 endif
 281 
 282 MACOSX_SRC_DIRS :=
 283 ifeq ($(OPENJDK_TARGET_OS), macosx)
 284   MACOSX_SRC_DIRS += $(JDK_TOPDIR)/src/macosx/classes
 285 
 286   # this files are duplicated in MACOSX_SRC_DIRS
 287   EXFILES += $(JDK_TOPDIR)/src/solaris/classes/sun/nio/ch/DefaultSelectorProvider.java \
 288       $(JDK_TOPDIR)/src/solaris/classes/sun/java2d/BackBufferCapsProvider.java \
 289       $(JDK_TOPDIR)/src/solaris/classes/java/net/DefaultInterface.java \
 290       $(JDK_TOPDIR)/src/solaris/classes/java/lang/ClassLoaderHelper.java \
 291       $(JDK_TOPDIR)/src/solaris/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java \
 292       $(JDK_TOPDIR)/src/solaris/classes/sun/nio/fs/GnomeFileTypeDetector.java \
 293       $(JDK_TOPDIR)/src/solaris/classes/sun/nio/ch/sctp/SctpChannelImpl.java \
 294       $(JDK_TOPDIR)/src/solaris/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java \
 295       $(JDK_TOPDIR)/src/solaris/classes/sun/nio/ch/sctp/SctpServerChannelImpl.java
 296 
 297 endif
 298 
 299 # The security classes should not end up in the classes directory as that will prevent them
 300 # from working when running the exploded jdk image. Compile them separately to a different
 301 # directory from where the jars can be created.
 302 SECURITY_PKGS := \
 303     com/oracle/security/ucrypto \
 304     com/sun/crypto/provider \
 305     javax/crypto \
 306     sun/security/ec \
 307     sun/security/internal \
 308     sun/security/mscapi \
 309     sun/security/pkcs11 \
 310     #
 311 
 312 AIX_SRC_DIRS :=
 313 ifeq ($(OPENJDK_TARGET_OS),aix)
 314      AIX_SRC_DIRS += $(JDK_TOPDIR)/src/aix/classes
 315 
 316   # these files are duplicated in AIX_SRC_DIRS
 317   EXFILES += $(JDK_TOPDIR)/src/solaris/classes/sun/nio/ch/sctp/SctpChannelImpl.java \
 318       $(JDK_TOPDIR)/src/solaris/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java \
 319       $(JDK_TOPDIR)/src/solaris/classes/sun/nio/ch/sctp/SctpServerChannelImpl.java
 320 endif
 321 
 322 # The exception handling of swing beaninfo
 323 # These resources violates the convention of having code and resources together under
 324 # $(JDK_TOPDIR)/src/.../classes directories
 325 $(JDK_OUTPUTDIR)/classes/javax/swing/beaninfo/images/%.gif: $(JDK_TOPDIR)/make/data/swingbeaninfo/images/%.gif
 326         $(call install-file)
 327 
 328 # The JDK_USER_DEFINED_FILTER is a poor man's incremental build: by specifying
 329 # JDK_FILTER at the make command line, only a subset of the JDK java files will
 330 # be recompiled. If multiple paths are separated by comma, convert that into a
 331 # space separated list.
 332 JDK_USER_DEFINED_FILTER := $(strip $(subst $(COMMA),$(SPACE), $(JDK_FILTER)))
 333 
 334 ifeq ($(ENABLE_SJAVAC),yes)
 335   # With sjavac enabled, excluded sources are not even considered for linking. 
 336   # Explicitly add the security sources to sourcepath for linking.
 337   BUILD_JDK_SOURCEPATH:=$(patsubst %,-i$(SPACE)%.*,$(subst /,.,$(SECURITY_PKGS))) \
 338       -sourcepath $(JDK_TOPDIR)/src/share/classes
 339 endif
 340 
 341 $(eval $(call SetupJavaCompilation,BUILD_JDK,\
 342     SETUP:=GENERATE_JDKBYTECODE,\
 343     SRC:=$(JDK_TOPDIR)/src/share/classes \
 344         $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes \
 345         $(MACOSX_SRC_DIRS) \
 346         $(AIX_SRC_DIRS) \
 347         $(JDK_OUTPUTDIR)/gensrc \
 348         $(JDK_OUTPUTDIR)/gensrc_no_srczip \
 349         $(CLOSED_SRC_DIRS),\
 350     INCLUDES:=$(JDK_USER_DEFINED_FILTER),\
 351     EXCLUDES:=$(EXCLUDES) $(SECURITY_PKGS),\
 352     EXCLUDE_FILES:=$(EXFILES),\
 353     BIN:=$(JDK_OUTPUTDIR)/classes,\
 354     COPY:=$(COPY_PATTERNS),\
 355     COPY_FILES:=$(COPY_FILES),\
 356     HEADERS:=$(JDK_OUTPUTDIR)/gensrc_headers,\
 357     ADD_JAVAC_FLAGS:=$(BUILD_JDK_SOURCEPATH)))
 358 
 359 ##########################################################################################
 360 
 361 $(eval $(call SetupJavaCompilation,BUILD_SECURITY, \
 362     SETUP := GENERATE_JDKBYTECODE, \
 363     SRC := $(JDK_TOPDIR)/src/share/classes \
 364         $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes \
 365         $(MACOSX_SRC_DIRS) \
 366         $(CLOSED_SRC_DIRS), \
 367     INCLUDES := $(SECURITY_PKGS), \
 368     EXCLUDES := $(EXCLUDES), \
 369     EXCLUDE_FILES := $(EXFILES), \
 370     BIN := $(JDK_OUTPUTDIR)/classes_security, \
 371     HEADERS := $(JDK_OUTPUTDIR)/gensrc_headers))
 372 
 373 $(BUILD_SECURITY): $(BUILD_JDK)
 374 
 375 ##########################################################################################
 376 
 377 $(JDK_OUTPUTDIR)/classes/META-INF/services/com.sun.tools.xjc.Plugin:
 378         $(MKDIR) -p $(@D)
 379         $(TOUCH) $@
 380 
 381 ##########################################################################################
 382 
 383 
 384 ##########################################################################################
 385 
 386 ifndef OPENJDK
 387   ifeq ($(OPENJDK_TARGET_OS), windows)
 388     ifeq ($(OPENJDK_TARGET_CPU_BITS), 32)
 389       $(eval $(call SetupJavaCompilation,BUILD_ACCESSBRIDGE_32, \
 390           SETUP := GENERATE_JDKBYTECODE, \
 391           JAVAC_FLAGS := -cp $(JDK_OUTPUTDIR)/classes, \
 392           SRC := $(JDK_OUTPUTDIR)/gensrc_ab/32bit, \
 393           BIN := $(JDK_OUTPUTDIR)/classes_ab/32bit, \
 394           HEADERS := $(JDK_OUTPUTDIR)/gensrc_headers))
 395 
 396       $(BUILD_ACCESSBRIDGE_32): $(BUILD_JDK)
 397 
 398       $(eval $(call SetupJavaCompilation,BUILD_ACCESSBRIDGE_LEGACY, \
 399           SETUP := GENERATE_JDKBYTECODE, \
 400           JAVAC_FLAGS := -cp $(JDK_OUTPUTDIR)/classes, \
 401           SRC := $(JDK_OUTPUTDIR)/gensrc_ab/legacy, \
 402           BIN := $(JDK_OUTPUTDIR)/classes_ab/legacy, \
 403           HEADERS := $(JDK_OUTPUTDIR)/gensrc_headers))
 404 
 405       $(BUILD_ACCESSBRIDGE_LEGACY): $(BUILD_JDK)
 406 
 407     else
 408 
 409       $(eval $(call SetupJavaCompilation,BUILD_ACCESSBRIDGE_64, \
 410           SETUP := GENERATE_JDKBYTECODE, \
 411           JAVAC_FLAGS := -cp $(JDK_OUTPUTDIR)/classes, \
 412           SRC := $(JDK_OUTPUTDIR)/gensrc_ab/64bit, \
 413           BIN := $(JDK_OUTPUTDIR)/classes_ab/64bit, \
 414           HEADERS := $(JDK_OUTPUTDIR)/gensrc_headers))
 415 
 416       $(BUILD_ACCESSBRIDGE_64): $(BUILD_JDK)
 417 
 418     endif
 419   endif
 420 endif
 421 
 422 ##########################################################################################
 423 
 424 all: $(BUILD_JDK) $(BUILD_SECURITY) $(COPY_EXTRA) \
 425     $(JDK_OUTPUTDIR)/classes/META-INF/services/com.sun.tools.xjc.Plugin \
 426     $(BUILD_ACCESSBRIDGE_32) $(BUILD_ACCESSBRIDGE_64) \
 427     $(BUILD_ACCESSBRIDGE_LEGACY)
 428 
 429 .PHONY: all