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