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