make/Javadoc.gmk
author lana
Thu, 17 Nov 2016 22:18:31 +0000
changeset 42164 8a725a4f3757
parent 41652 a0664e2b49a1
child 42289 08548fd6e608
child 42134 bbcdb49521b1
permissions -rw-r--r--
Merge

# Copyright (c) 1997, 2016, 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

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

# List of all possible directories for javadoc to look for sources
# Allow custom to overwrite.
JAVADOC_SOURCE_DIRS = \
      $(SUPPORT_OUTPUTDIR)/gensrc/* \
      $(if $(IMPORT_MODULES_SRC), $(IMPORT_MODULES_SRC)/*) \
      $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS)/classes \
      $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS_TYPE)/classes \
      $(JDK_TOPDIR)/src/*/share/classes \
      $(HOTSPOT_TOPDIR)/src/*/share/classes \
      $(LANGTOOLS_TOPDIR)/src/*/share/classes \
      $(NASHORN_TOPDIR)/src/*/share/classes \
      $(CORBA_TOPDIR)/src/*/share/classes \
      $(JAXP_TOPDIR)/src/*/share/classes \
      $(JAXWS_TOPDIR)/src/*/share/classes \
      $(SUPPORT_OUTPUTDIR)/rmic/* \
      $(JDK_TOPDIR)/src/*/share/doc/stub \
      #

# Should we use -Xdocrootparent? Allow custom to overwrite.
DOCROOTPARENT_FLAG = TRUE

# The core api index file is the target for the core api javadocs rule
# and needs to be defined early so that all other javadoc rules may
# depend on it.
CORE_INDEX_FILE := $(JAVADOC_OUTPUTDIR)/api/index.html

# Symbols
TRADEMARK := ™
COPYRIGHT_SYMBOL := &$(HASH)x00a9;
COPYRIGHT_TEXT := Copyright
ALL_RIGHTS_RESERVED := All rights reserved.

# URLs
JAVADOC_BASE_URL := http://docs.oracle.com/javase/$(VERSION_SPECIFICATION)/docs
BUG_SUBMIT_URL := http://bugreport.java.com/bugreport/

################################################################################
# Text snippets

FULL_COMPANY_NAME := Oracle and/or its affiliates
COMPANY_ADDRESS := 500 Oracle Parkway<br>Redwood Shores, CA 94065 USA.
BUG_SUBMIT_LINE := <a href="$(BUG_SUBMIT_URL)">Submit a bug or feature</a>
JAVA_TRADEMARK_LINE := Java is a trademark or registered trademark of \
    $(FULL_COMPANY_NAME) in the US and other countries.

COMMON_BOTTOM_ADDRESS := $(COMPANY_ADDRESS)
COMMON_BOTTOM_TEXT := $(BUG_SUBMIT_LINE)<br>$(JAVA_TRADEMARK_LINE)

CORE_BOTTOM_COPYRIGHT_URL := {@docroot}/../legal/cpyr.html
CORE_BOTTOM_TEXT := $(BUG_SUBMIT_LINE)\
<br>For further API reference and developer documentation, \
see <a href="$(JAVADOC_BASE_URL)/index.html" target="_blank">Java SE \
Documentation</a>. That documentation contains more detailed, \
developer-targeted descriptions, with conceptual overviews, definitions of \
terms, workarounds, and working code examples.

ifeq ($(VERSION_IS_GA), true)
  DRAFT_HEADER :=
  DRAFT_BOTTOM :=
  DRAFT_WINTITLE :=
  CORE_TOP_EARLYACCESS :=
else
  # We need a draft format when not building the GA version.
  DRAFT_HEADER := <br><strong>DRAFT&nbsp;$(VERSION_STRING)</strong>
  DRAFT_BOTTOM := <br><strong>DRAFT&nbsp;$(VERSION_STRING)</strong>
  DRAFT_WINTITLE := $(VERSION_BUILD)
  CORE_TOP_EARLYACCESS := \
<div style="background-color: $$(HASH)EEEEEE"> \
<div style="padding: 6px; margin-top: 2px; margin-bottom: 6px; \
margin-left: 6px; margin-right: 6px; text-align: justify; \
font-size: 80%; font-family: Helvetica, Arial, sans-serif; \
font-weight: normal;"> \
Please note that the specifications and other information \
contained herein are not final and are subject to change. \
The information is being made available to you solely for purpose of \
evaluation. \
</div> </div>
endif

################################################################################
# Support functions for SetupJavadocGeneration

# Print an option line to the target file
# Arguments:
# arg 1: the option name
# arg 2-3: optional arguments to the option
define AddOption
	$(PRINTF) "%s$(if $(strip $2), '%s',)$(if $(strip $3), '%s',)\n" \
	    "$(strip $1)"$(if $(strip $2), '$(strip $2)',)$(if $(strip $3), \
	    '$(strip $3)',) >> $@
endef

# This function goes to great pains to exactly mimic the old behavior
# in all details, including whitespace.
# Note that COPYRIGHT_YEAR is the current year (from spec.gmk)
# Arguments:
# arg 1: first copyright year
# arg 2: copyright url (optional)
# arg 3: company address (optional)
# arg 4: free-form text snippet (optional)
define GenerateBottom
  <font size="-1">$(if $(strip $4), $(strip $4))<br> $(if \
      $(strip $2),<a href="$(strip $2)">$(COPYRIGHT_TEXT)</a>,$(COPYRIGHT_TEXT)) \
      $(COPYRIGHT_SYMBOL) $(strip $1), $(COPYRIGHT_YEAR), \
      $(FULL_COMPANY_NAME). $(strip $3) \
      $(ALL_RIGHTS_RESERVED)$(if $(strip $4), )</font>
endef

# Speed up finding by filling cache
$(eval $(call FillCacheFind, $(wildcard $(JAVADOC_SOURCE_DIRS))))

# Prevent # from expanding
EscapeHash = $(subst $(HASH),{hash},$(strip $1))

################################################################################
# Setup make rules for running javadoc.
#
# Parameter 1 is the name of the rule. This name is used as variable prefix,
# and the targets generated are listed in a variable by that name. Note that
# the index.html file will work as a "touch file" for all the magnitude of
# files that are generated by javadoc.
#
# Remaining parameters are named arguments. These include:
#   MODULES - Modules to include
#   PACKAGES - Packages to include
#   PACKAGE_FILTER - Filter for packages
#   IS_CORE - Set to TRUE for the Core API package which needs special treatment
#   API_ROOT - Where to base the documentation (jre or jdk)
#   DEST_DIR - A directory relative to the API root
#   OVERVIEW - Path to a html overview file
#   TITLE - Default title to use for the more specific versions below
#   WINDOW_TITLE - Title to use in -windowtitle. Computed from TITLE if empty.
#   HEADER_TITLE - Title to use in -header. Computed from TITLE if empty.
#   DOC_TITLE - Title to use in -doctitle. Computed from TITLE if empty.
#   FIRST_COPYRIGHT_YEAR - First year this bundle was introduced
#   DOCLINT - Doclint level. Defaults to "all".
#   DOCLINT_PACKAGES - Optional -Xdoclint/package value
#   ENCODING - Change character encoding (defaults to 'ascii')
#   SPLIT_INDEX - Enable -splitIndex
#   BREAKITERATOR - Enable -breakiterator
#   NODEPRECATEDLIST - Enable nodeprecatedlist
#   NOINDEX - Enable -noindex and -nonavbar
#   BOTTOM_COPYRIGHT_URL - Copyright URL to use in -bottom
#   BOTTOM_ADDRESS - Company address to use in -bottom
#   BOTTOM_TEXT - Extra text to use in -bottom
#   EXTRA_TOP - Additional -top data
#
SetupJavadocGeneration = $(NamedParamsMacroTemplate)
define SetupJavadocGenerationBody
  ifeq ($$($1_IS_CORE), TRUE)
    $1_JAVA := $$(JAVA)
    $1_OUTPUT_DIRNAME := api
  else
    $1_JAVA := $$(JAVA_SMALL)
    $1_OUTPUT_DIRNAME := $$($1_API_ROOT)/api/$$($1_DEST_DIR)

    ifeq ($$($1_RELATIVE_CORE_DIR),)
      # Compute a relative path to core root.
      # The non-core api javadocs need to be able to access the root of the core
      # api directory, so for jdk/api or jre/api to get to the core api/
      # directory we would use this
      # NOTE: Need to be able to override for broken old code in JShell
      $1_RELATIVE_CORE_DIR := $$(strip $$(subst $$(call DirToDotDot, \
          $$(JAVADOC_OUTPUTDIR))/,, $$(call DirToDotDot, \
          $$(JAVADOC_OUTPUTDIR)/$$($1_OUTPUT_DIRNAME))))
    endif

    $1_DEPS += $(CORE_INDEX_FILE)
  endif

  ifneq ($$($1_OVERVIEW), )
    $1_DEPS +=  $$($1_OVERVIEW)
  endif

  ifeq ($$($1_ENCODING), )
    $1_ENCODING := ascii
  endif

  ifeq ($$($1_DOCLINT), )
    $1_DOCLINT := all
  endif

  ifeq ($$($1_DOC_TITLE), )
    $1_DOC_TITLE := $$($1_TITLE)
  endif

  ifeq ($$($1_WINDOW_TITLE), )
    $1_WINDOW_TITLE := $$(strip $$(subst $$(TRADEMARK),, $$($1_TITLE)))
  endif

  ifeq ($$($1_HEADER_TITLE), )
    $1_HEADER_TITLE := $$(strip $$(subst $$(TRADEMARK),, $$($1_TITLE)))
  endif
  $1_HEADER := <strong>$$($1_HEADER_TITLE)</strong>

  $1_BOTTOM := $$(call GenerateBottom, $$($1_FIRST_COPYRIGHT_YEAR), \
      $$($1_BOTTOM_COPYRIGHT_URL), $$($1_BOTTOM_ADDRESS), $$($1_BOTTOM_TEXT))

  # The index.html, options, and packages files
  $1_INDEX_FILE := $$(JAVADOC_OUTPUTDIR)/$$($1_OUTPUT_DIRNAME)/index.html
  $1_OPTIONS_FILE := $$(SUPPORT_OUTPUTDIR)/docs/$1.options
  $1_PACKAGES_FILE := $$(SUPPORT_OUTPUTDIR)/docs/$1.packages

  $1_PACKAGES_VARDEPS := $$($1_PACKAGES) $$($1_PACKAGES_SINGLE_CLASS)
  $1_PACKAGES_VARDEPS_FILE := $$(call DependOnVariable, $1_PACKAGES_VARDEPS, \
       $$($1_PACKAGES_FILE).vardeps)

  # Rule for creating a file with the package names in it
  $$($1_PACKAGES_FILE): $$($1_PACKAGES_VARDEPS_FILE)
	$$(call LogInfo, Creating Javadoc package file for $1)
	$$(call MakeDir, $$(@D))
        ifeq ($$($1_PACKAGES_SINGLE_CLASS), )
	  $$(ECHO) $$($1_PACKAGES) | $$(TR) ' ' '\n' > $$@
        else
          # NOTE: This is for backwards compatibility for taglet
	  $$(ECHO) $$($1_PACKAGES_SINGLE_CLASS) > $$@
        endif

  # NOTE: Not including $$($1_EXTRA_TOP) due to $$(HASH)
  $1_OPTIONS_VARDEPS := $$(call EscapeHash, \
      $$($DOCROOTPARENT_FLAG) $$(JAVADOC_BASE_URL) $$($1_NO_COMMON_TAGS) \
      $$($1_DOCLINT) $$($1_DOCLINT_PACKAGES) $$(JAVADOC_SOURCE_DIRS) \
      $$($1_MODULES) $$($1_ENCODING) $$($1_NODEPRECATEDLIST) \
      $$($1_BREAKITERATOR) $$($1_SPLIT_INDEX) $$($1_OVERVIEW) \
      $$($1_DOC_TITLE) $$($1_WINDOW_TITLE) $$(DRAFT_WINTITLE) \
      $$($1_HEADER) $$(DRAFT_HEADER) $$($1_NOINDEX) $$($1_EXTRA_TOP_2) \
      $$($1_BOTTOM) $$(DRAFT_BOTTOM)) $$($1_PACKAGE_FILTER) $$($1_RELATIVE_CORE_DIR) \
      $$(JAVADOC_OUTPUTDIR) \
  )
  $1_OPTIONS_VARDEPS_FILE := $$(call DependOnVariable, $1_OPTIONS_VARDEPS, \
       $$($1_OPTIONS_FILE).vardeps)

  # Rule for creating a file with javadoc options in it
  $$($1_OPTIONS_FILE): $$($1_OPTIONS_VARDEPS_FILE)
	$$(call LogInfo, Creating Javadoc options file for $1)
	$$(call MakeDir, $$(@D))
	$$(RM) $$@
	$$(call AddOption, -XDignore.symbol.file=true)
        ifneq ($$(LOG_LEVEL), trace)
	  $$(call AddOption, -quiet)
        endif
	$$(call AddOption, -use)
	$$(call AddOption, -keywords)
        ifneq ($$($DOCROOTPARENT_FLAG), )
          # NOTE: Argument to -Xdocrootparent is not quoted to keep backwards compatibility.
	  $$(call AddOption, -Xdocrootparent $(JAVADOC_BASE_URL))
        endif
        ifneq ($$($1_NO_COMMON_TAGS), TRUE)
          # In order to get a specific ordering it's necessary to specify the total
          # ordering of tags as the tags are otherwise ordered in order of definition.
	  $$(call AddOption, -tag, beaninfo:X)
	  $$(call AddOption, -tag, revised:X)
	  $$(call AddOption, -tag, since.unbundled:X)
	  $$(call AddOption, -tag, spec:X)
	  $$(call AddOption, -tag, specdefault:X)
	  $$(call AddOption, -tag, Note:X)
	  $$(call AddOption, -tag, ToDo:X)
	  $$(call AddOption, -tag, apiNote:a:API Note:)
	  $$(call AddOption, -tag, implSpec:a:Implementation Requirements:)
	  $$(call AddOption, -tag, implNote:a:Implementation Note:)
	  $$(call AddOption, -tag, param)
	  $$(call AddOption, -tag, return)
	  $$(call AddOption, -tag, throws)
	  $$(call AddOption, -tag, since)
	  $$(call AddOption, -tag, version)
	  $$(call AddOption, -tag, serialData)
	  $$(call AddOption, -tag, factory)
	  $$(call AddOption, -tag, see)
	  $$(call AddOption, -tag, \
              jvms:a:See <cite> The Java&trade; Virtual Machine Specification</cite>:)
	  $$(call AddOption, -tag, \
              jls:a:See <cite> The Java&trade; Language Specification</cite>:)
        endif
	$$(call AddOption, -Xdoclint:$$($1_DOCLINT))
        ifneq ($$($1_DOCLINT_PACKAGES), )
	  $$(call AddOption, -Xdoclint/package:$$(call CommaList, $$($1_DOCLINT_PACKAGES)))
        endif
	$$(call AddOption, --system, none)
	$$(call AddOption, --module-source-path, $$(subst ",, $$(call PathList, $$(JAVADOC_SOURCE_DIRS))))
	$$(call AddOption, --add-modules, $$(call CommaList, $$($1_MODULES)))
	$$(call AddOption, -encoding, $$($1_ENCODING))
        ifneq ($$($1_NODEPRECATEDLIST), )
	  $$(call AddOption, -nodeprecatedlist)
        endif
        ifneq ($$($1_BREAKITERATOR), )
	  $$(call AddOption, -breakiterator)
        endif
        ifneq ($$($1_SPLIT_INDEX), )
	  $$(call AddOption, -splitIndex)
        endif
        ifneq ($$($1_OVERVIEW), )
	  $$(call AddOption, -overview, $$($1_OVERVIEW))
        endif
	$$(call AddOption, -doctitle, $$($1_DOC_TITLE))
	$$(call AddOption, -windowtitle, $$($1_WINDOW_TITLE) $$(DRAFT_WINTITLE))
	$$(call AddOption, -header, $$($1_HEADER)$$(DRAFT_HEADER))
        ifneq ($$($1_NOINDEX), )
	  $$(call AddOption, -nonavbar)
	  $$(call AddOption, -noindex)
        endif
        ifneq ($$($1_EXTRA_TOP_2), )
	  $$(call AddOption, -top,$$($1_EXTRA_TOP_2))
        endif
	$$(call AddOption, -bottom, $$($1_BOTTOM)$$(DRAFT_BOTTOM))
        ifneq ($$($1_PACKAGE_FILTER), )
	  $$(call AddOption, -group, Packages, $$($1_PACKAGE_FILTER))
        endif
        ifneq ($$($1_RELATIVE_CORE_DIR), )
	  $$(call AddOption, -linkoffline, $$($1_RELATIVE_CORE_DIR)/api, $$(JAVADOC_OUTPUTDIR)/api/)
        endif
        ifneq ($$($1_EXTRA_TOP), )
	  $$(call AddOption, -top, $$($1_EXTRA_TOP))
        endif

  $1_PACKAGE_DEPS := $$(call CacheFind, $$(wildcard $$(foreach p, \
      $$(subst .,/,$$(strip $$($1_PACKAGES))), \
      $$(addsuffix /$$p, $$(wildcard $$(JAVADOC_SOURCE_DIRS))))))

  # Rule for actually running javadoc
  $$($1_INDEX_FILE): $$($1_OPTIONS_FILE) $$($1_PACKAGES_FILE) \
    $$($1_PACKAGE_DEPS) $$($1_DEPS)
	$$(call LogWarn, Generating Javadoc for $$($1_OUTPUT_DIRNAME))
	$$(call MakeDir, $$(@D))
        ifneq ($$(findstring $$(LOG_LEVEL), debug trace),)
	  $$(ECHO) "Contents of $$($1_OPTIONS_FILE):" `$$(CAT) $$($1_OPTIONS_FILE)`
	  $$(ECHO) "Contents of $$($1_PACKAGES_FILE):" `$$(CAT) $$($1_PACKAGES_FILE)`
        endif
	$$(call ExecuteWithLog, $$(SUPPORT_OUTPUTDIR)/docs/$1.javadoc, \
	    $$($1_JAVA) -Djava.awt.headless=true $(NEW_JAVADOC) -d $$(@D) \
	    @$$($1_OPTIONS_FILE) @$$($1_PACKAGES_FILE))
	$$(TOUCH) $$($1_INDEX_FILE)

  # The output returned will be the index.html file
  $1 := $$($1_INDEX_FILE)
endef

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

CORE_PACKAGES := \
    java.applet \
    java.awt \
    java.awt.color \
    java.awt.datatransfer \
    java.awt.desktop \
    java.awt.dnd \
    java.awt.event \
    java.awt.font \
    java.awt.geom \
    java.awt.im \
    java.awt.im.spi \
    java.awt.image \
    java.awt.image.renderable \
    java.awt.print \
    java.beans \
    java.beans.beancontext \
    java.io \
    java.lang \
    java.lang.annotation \
    java.lang.instrument \
    java.lang.invoke \
    java.lang.management \
    java.lang.module \
    java.lang.ref \
    java.lang.reflect \
    java.math \
    java.net \
    java.net.http \
    java.net.spi \
    java.nio \
    java.nio.channels \
    java.nio.channels.spi \
    java.nio.charset \
    java.nio.charset.spi \
    java.nio.file \
    java.nio.file.attribute \
    java.nio.file.spi \
    java.rmi \
    java.rmi.activation \
    java.rmi.dgc \
    java.rmi.registry \
    java.rmi.server \
    java.security \
    java.security.acl \
    java.security.cert \
    java.security.interfaces \
    java.security.spec \
    java.sql \
    java.text \
    java.text.spi \
    java.time \
    java.time.chrono \
    java.time.format \
    java.time.temporal \
    java.time.zone \
    java.util \
    java.util.concurrent \
    java.util.concurrent.atomic \
    java.util.concurrent.locks \
    java.util.function \
    java.util.jar \
    java.util.logging \
    java.util.prefs \
    java.util.regex \
    java.util.spi \
    java.util.stream \
    java.util.zip \
    javax.accessibility \
    javax.activation \
    javax.activity \
    javax.annotation \
    javax.annotation.processing \
    javax.crypto \
    javax.crypto.interfaces \
    javax.crypto.spec \
    javax.imageio \
    javax.imageio.event \
    javax.imageio.metadata \
    javax.imageio.plugins.jpeg \
    javax.imageio.plugins.bmp \
    javax.imageio.plugins.tiff \
    javax.imageio.spi \
    javax.imageio.stream \
    javax.jws \
    javax.jws.soap \
    javax.lang.model \
    javax.lang.model.element \
    javax.lang.model.type \
    javax.lang.model.util \
    javax.management \
    javax.management.loading \
    javax.management.monitor \
    javax.management.relation \
    javax.management.openmbean \
    javax.management.timer \
    javax.management.modelmbean \
    javax.management.remote \
    javax.management.remote.rmi \
    javax.naming \
    javax.naming.directory \
    javax.naming.event \
    javax.naming.ldap \
    javax.naming.spi \
    javax.net \
    javax.net.ssl \
    javax.print \
    javax.print.attribute \
    javax.print.attribute.standard \
    javax.print.event \
    javax.rmi \
    javax.rmi.CORBA \
    javax.rmi.ssl \
    javax.script \
    javax.security.auth \
    javax.security.auth.callback \
    javax.security.auth.kerberos \
    javax.security.auth.login \
    javax.security.auth.spi \
    javax.security.auth.x500 \
    javax.security.cert \
    javax.security.sasl \
    javax.sound.sampled \
    javax.sound.sampled.spi \
    javax.sound.midi \
    javax.sound.midi.spi \
    javax.sql \
    javax.sql.rowset \
    javax.sql.rowset.serial \
    javax.sql.rowset.spi \
    javax.swing \
    javax.swing.border \
    javax.swing.colorchooser \
    javax.swing.filechooser \
    javax.swing.event \
    javax.swing.table \
    javax.swing.text \
    javax.swing.text.html \
    javax.swing.text.html.parser \
    javax.swing.text.rtf \
    javax.swing.tree \
    javax.swing.undo \
    javax.swing.plaf \
    javax.swing.plaf.basic \
    javax.swing.plaf.metal \
    javax.swing.plaf.multi \
    javax.swing.plaf.nimbus \
    javax.swing.plaf.synth \
    javax.tools \
    javax.transaction \
    javax.transaction.xa \
    javax.xml.catalog \
    javax.xml.parsers \
    javax.xml.bind \
    javax.xml.bind.annotation \
    javax.xml.bind.annotation.adapters \
    javax.xml.bind.attachment \
    javax.xml.bind.helpers \
    javax.xml.bind.util \
    javax.xml.soap \
    javax.xml.ws \
    javax.xml.ws.handler \
    javax.xml.ws.handler.soap \
    javax.xml.ws.http \
    javax.xml.ws.soap \
    javax.xml.ws.spi \
    javax.xml.ws.spi.http \
    javax.xml.ws.wsaddressing \
    javax.xml.transform \
    javax.xml.transform.sax \
    javax.xml.transform.dom \
    javax.xml.transform.stax \
    javax.xml.transform.stream \
    javax.xml \
    javax.xml.crypto \
    javax.xml.crypto.dom \
    javax.xml.crypto.dsig \
    javax.xml.crypto.dsig.dom \
    javax.xml.crypto.dsig.keyinfo \
    javax.xml.crypto.dsig.spec \
    javax.xml.datatype \
    javax.xml.validation \
    javax.xml.namespace \
    javax.xml.xpath \
    javax.xml.stream \
    javax.xml.stream.events \
    javax.xml.stream.util \
    org.ietf.jgss \
    org.omg.CORBA \
    org.omg.CORBA.DynAnyPackage \
    org.omg.CORBA.ORBPackage \
    org.omg.CORBA.TypeCodePackage \
    org.omg.stub.java.rmi \
    org.omg.CORBA.portable \
    org.omg.CORBA_2_3 \
    org.omg.CORBA_2_3.portable \
    org.omg.CosNaming \
    org.omg.CosNaming.NamingContextExtPackage \
    org.omg.CosNaming.NamingContextPackage \
    org.omg.SendingContext \
    org.omg.PortableServer \
    org.omg.PortableServer.CurrentPackage \
    org.omg.PortableServer.POAPackage \
    org.omg.PortableServer.POAManagerPackage \
    org.omg.PortableServer.ServantLocatorPackage \
    org.omg.PortableServer.portable \
    org.omg.PortableInterceptor \
    org.omg.PortableInterceptor.ORBInitInfoPackage \
    org.omg.Messaging \
    org.omg.IOP \
    org.omg.IOP.CodecFactoryPackage \
    org.omg.IOP.CodecPackage \
    org.omg.Dynamic \
    org.omg.DynamicAny \
    org.omg.DynamicAny.DynAnyPackage \
    org.omg.DynamicAny.DynAnyFactoryPackage \
    org.w3c.dom \
    org.w3c.dom.events \
    org.w3c.dom.bootstrap \
    org.w3c.dom.ls \
    org.w3c.dom.ranges \
    org.w3c.dom.traversal \
    org.w3c.dom.views \
    org.xml.sax \
    org.xml.sax.ext \
    org.xml.sax.helpers

$(eval $(call SetupJavadocGeneration, coredocs, \
    MODULES := java.se.ee, \
    PACKAGES := $(CORE_PACKAGES), \
    IS_CORE := TRUE, \
    OVERVIEW := $(JDK_TOPDIR)/src/java.base/share/classes/overview-core.html, \
    WINDOW_TITLE := Java Platform SE $(VERSION_SPECIFICATION), \
    HEADER_TITLE := Java$(TRADEMARK)&nbsp;Platform<br>Standard&nbsp;Ed.&nbsp;$(VERSION_SPECIFICATION), \
    DOC_TITLE := Java$(TRADEMARK) Platform$(COMMA) Standard Edition \
      $(VERSION_SPECIFICATION)<br>API Specification, \
    FIRST_COPYRIGHT_YEAR := 1993, \
    DOCLINT := reference, \
    DOCLINT_PACKAGES := -org.omg.* jdk.internal.logging.*, \
    ENCODING := ISO-8859-1, \
    SPLIT_INDEX := TRUE, \
    BOTTOM_COPYRIGHT_URL := $(CORE_BOTTOM_COPYRIGHT_URL), \
    BOTTOM_TEXT := $(CORE_BOTTOM_TEXT), \
    EXTRA_TOP := $(CORE_TOP_EARLYACCESS), \
))

TARGETS += $(coredocs)

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

$(eval $(call SetupJavadocGeneration, docletapi, \
    MODULES := jdk.javadoc, \
    PACKAGES := \
        jdk.javadoc.doclet \
        jdk.javadoc.doclet.taglet \
        jdk.javadoc.doclets, \
    PACKAGE_FILTER := jdk.javadoc.doclet*, \
    API_ROOT := jdk, \
    DEST_DIR := javadoc/doclet, \
    TITLE := Doclet API, \
    FIRST_COPYRIGHT_YEAR := 1993, \
    BREAKITERATOR := TRUE, \
    BOTTOM_ADDRESS := $(COMMON_BOTTOM_ADDRESS), \
    BOTTOM_TEXT := $(COMMON_BOTTOM_TEXT), \
))

TARGETS += $(docletapi)

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

$(eval $(call SetupJavadocGeneration, old-docletapi, \
    MODULES := jdk.javadoc, \
    PACKAGES := com.sun.javadoc, \
    PACKAGE_FILTER := com.sun.javadoc, \
    API_ROOT := jdk, \
    DEST_DIR := javadoc/old/doclet, \
    TITLE := Doclet API, \
    FIRST_COPYRIGHT_YEAR := 1993, \
    BREAKITERATOR := TRUE, \
    BOTTOM_ADDRESS := $(COMMON_BOTTOM_ADDRESS), \
    BOTTOM_TEXT := $(COMMON_BOTTOM_TEXT), \
))

TARGETS += $(old-docletapi)

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

# Specify a single class instead of a package
TAGLET_PACKAGE_SINGLE_CLASS := com/sun/tools/doclets/Taglet.java
TAGLET_PACKAGE_DIR := $(LANGTOOLS_TOPDIR)/src/jdk.javadoc/share/classes

$(eval $(call SetupJavadocGeneration, tagletapi, \
    MODULES := jdk.javadoc, \
    PACKAGES := com.sun.tools.doclets, \
    PACKAGES_SINGLE_CLASS := $(TAGLET_PACKAGE_DIR)/$(TAGLET_PACKAGE_SINGLE_CLASS), \
    API_ROOT := jdk, \
    DEST_DIR := javadoc/old/taglet, \
    TITLE := Taglet API, \
    FIRST_COPYRIGHT_YEAR := 1993, \
    BREAKITERATOR := TRUE, \
    NOINDEX := TRUE, \
    BOTTOM_ADDRESS := $(COMMON_BOTTOM_ADDRESS), \
    BOTTOM_TEXT := $(COMMON_BOTTOM_TEXT), \
))

TARGETS += $(tagletapi)

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

$(eval $(call SetupJavadocGeneration, domapi, \
    MODULES := \
        java.xml \
        jdk.xml.dom, \
    PACKAGES := \
        org.w3c.dom \
        org.w3c.dom.bootstrap \
        org.w3c.dom.ls \
        org.w3c.dom.ranges \
        org.w3c.dom.traversal \
        org.w3c.dom.html \
        org.w3c.dom.stylesheets \
        org.w3c.dom.css \
        org.w3c.dom.events \
        org.w3c.dom.views, \
    PACKAGE_FILTER := org.w3c.dom*, \
    API_ROOT := jre, \
    DEST_DIR := plugin/dom, \
    TITLE := Common DOM API, \
    FIRST_COPYRIGHT_YEAR := 2005, \
    DOCLINT := none, \
    SPLIT_INDEX := TRUE, \
    BOTTOM_ADDRESS := $(COMMON_BOTTOM_ADDRESS), \
    BOTTOM_TEXT := $(COMMON_BOTTOM_TEXT), \
))

TARGETS += $(domapi)

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

$(eval $(call SetupJavadocGeneration, jdi, \
    MODULES := jdk.jdi, \
    PACKAGES := \
        com.sun.jdi \
        com.sun.jdi.event \
        com.sun.jdi.request \
        com.sun.jdi.connect \
        com.sun.jdi.connect.spi, \
    API_ROOT := jdk, \
    DEST_DIR := jpda/jdi, \
    OVERVIEW := $(JDK_TOPDIR)/src/jdk.jdi/share/classes/jdi-overview.html, \
    TITLE := Java$(TRADEMARK) Debug Interface, \
    FIRST_COPYRIGHT_YEAR := 1999, \
    DOCLINT := none, \
))

TARGETS += $(jdi)

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

$(eval $(call SetupJavadocGeneration, jaas, \
    MODULES := jdk.security.auth, \
    PACKAGES := \
        com.sun.security.auth \
        com.sun.security.auth.callback \
        com.sun.security.auth.login \
        com.sun.security.auth.module, \
    API_ROOT := jre, \
    DEST_DIR := security/jaas/spec, \
    OVERVIEW := $(JDK_TOPDIR)/src/jdk.security.auth/share/classes/jaas-overview.html, \
    TITLE := Java$(TRADEMARK) Authentication and Authorization Service, \
    FIRST_COPYRIGHT_YEAR := 1998, \
    DOCLINT := none, \
))

TARGETS += $(jaas)

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

$(eval $(call SetupJavadocGeneration, jgss, \
    MODULES := jdk.security.jgss, \
    PACKAGES := com.sun.security.jgss, \
    API_ROOT := jre, \
    DEST_DIR := security/jgss/spec, \
    OVERVIEW := $(JDK_TOPDIR)/src/java.security.jgss/share/classes/jgss-overview.html, \
    TITLE := Java$(TRADEMARK) GSS-API Utilities, \
    FIRST_COPYRIGHT_YEAR := 2000, \
    DOCLINT := none, \
    NODEPRECATEDLIST := TRUE, \
))

TARGETS += $(jgss)

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

$(eval $(call SetupJavadocGeneration, smartcardio, \
    MODULES := java.smartcardio, \
    PACKAGES := javax.smartcardio, \
    API_ROOT := jre, \
    DEST_DIR := security/smartcardio/spec, \
    TITLE := Java$(TRADEMARK) Smart Card I/O, \
    FIRST_COPYRIGHT_YEAR := 2005, \
    DOCLINT := none, \
    NODEPRECATEDLIST := TRUE, \
))

TARGETS += $(smartcardio)

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

$(eval $(call SetupJavadocGeneration, httpserver, \
    MODULES := jdk.httpserver, \
    PACKAGES := \
        com.sun.net.httpserver \
        com.sun.net.httpserver.spi, \
    API_ROOT := jre, \
    DEST_DIR := net/httpserver/spec, \
    TITLE := Java$(TRADEMARK) HTTP Server, \
    FIRST_COPYRIGHT_YEAR := 2005, \
    DOCLINT := none, \
    NODEPRECATEDLIST := TRUE, \
))

TARGETS += $(httpserver)

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

$(eval $(call SetupJavadocGeneration, jsobject, \
    MODULES := jdk.jsobject, \
    PACKAGES := netscape.javascript, \
    API_ROOT := jre, \
    DEST_DIR := plugin/jsobject, \
    FIRST_COPYRIGHT_YEAR := 1993, \
    TITLE := Java$(TRADEMARK) JSObject Doc, \
    DOCLINT := none, \
    NODEPRECATEDLIST := TRUE, \
))

TARGETS += $(jsobject)

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

$(eval $(call SetupJavadocGeneration, mgmt, \
    MODULES := jdk.management, \
    PACKAGES := com.sun.management, \
    API_ROOT := jre, \
    DEST_DIR := management/extension, \
    OVERVIEW := $(JDK_TOPDIR)/src/java.management/share/classes/mgmt-overview.html, \
    TITLE := Monitoring and Management Interface for the Java$(TRADEMARK) Platform, \
    FIRST_COPYRIGHT_YEAR := 2003, \
    DOCLINT := none, \
    NODEPRECATEDLIST := TRUE, \
))

TARGETS += $(mgmt)

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

$(eval $(call SetupJavadocGeneration, attach, \
    MODULES := jdk.attach, \
    PACKAGES := \
        com.sun.tools.attach \
        com.sun.tools.attach.spi, \
    API_ROOT := jdk, \
    DEST_DIR := attach/spec, \
    TITLE := Attach API, \
    FIRST_COPYRIGHT_YEAR := 2005, \
    DOCLINT := none, \
    NODEPRECATEDLIST := TRUE, \
))

TARGETS += $(attach)

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

$(eval $(call SetupJavadocGeneration, jconsole, \
    MODULES := jdk.jconsole, \
    PACKAGES := com.sun.tools.jconsole, \
    API_ROOT := jdk, \
    DEST_DIR := jconsole/spec, \
    TITLE := JConsole API, \
    FIRST_COPYRIGHT_YEAR := 2006, \
    DOCLINT := none, \
    NODEPRECATEDLIST := TRUE, \
))

TARGETS += $(jconsole)

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

# NOTE: Need to override RELATIVE_CORE_DIR to be bug compatible with old code.
$(eval $(call SetupJavadocGeneration, jshellapi, \
    MODULES := jdk.jshell, \
    PACKAGES := \
        jdk.jshell \
        jdk.jshell.spi \
        jdk.jshell.execution, \
    API_ROOT := jdk, \
    DEST_DIR := jshell, \
    RELATIVE_CORE_DIR := ../../../.., \
    OVERVIEW := $(LANGTOOLS_TOPDIR)/src/jdk.jshell/share/classes/jdk/jshell/overview.html, \
    TITLE := JShell API, \
    HEADER_TITLE := JSHELL API, \
    FIRST_COPYRIGHT_YEAR := 2015, \
))

TARGETS += $(jshellapi)

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

$(eval $(call SetupJavadocGeneration, treeapi, \
    MODULES := jdk.compiler, \
    PACKAGES := \
        com.sun.source.doctree \
        com.sun.source.tree \
        com.sun.source.util, \
    PACKAGE_FILTER := com.sun.source.*, \
    API_ROOT := jdk, \
    DEST_DIR := javac/tree, \
    TITLE := Compiler Tree API, \
    FIRST_COPYRIGHT_YEAR := 2005, \
))

TARGETS += $(treeapi)

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

$(eval $(call SetupJavadocGeneration, nashornapi, \
    MODULES := jdk.scripting.nashorn, \
    PACKAGES := \
        jdk.nashorn.api.scripting \
        jdk.nashorn.api.tree, \
    PACKAGE_FILTER := jdk.nashorn.api.*, \
    API_ROOT := jdk, \
    DEST_DIR := nashorn, \
    TITLE := Nashorn API, \
    FIRST_COPYRIGHT_YEAR := 2014, \
))

TARGETS += $(nashornapi)

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

$(eval $(call SetupJavadocGeneration, dynalinkapi, \
    MODULES := jdk.dynalink, \
    PACKAGES := \
        jdk.dynalink \
        jdk.dynalink.beans \
        jdk.dynalink.linker \
        jdk.dynalink.linker.support \
        jdk.dynalink.support, \
    API_ROOT := jdk, \
    DEST_DIR := dynalink, \
    TITLE := Dynalink API, \
    FIRST_COPYRIGHT_YEAR := 2015, \
))

TARGETS += $(dynalinkapi)

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

$(eval $(call SetupJavadocGeneration, sctp, \
    MODULES := jdk.sctp, \
    PACKAGES := com.sun.nio.sctp, \
    API_ROOT := jre, \
    DEST_DIR := nio/sctp/spec, \
    TITLE := SCTP API, \
    FIRST_COPYRIGHT_YEAR := 2009, \
    DOCLINT := none, \
    NODEPRECATEDLIST := TRUE, \
))

TARGETS += $(sctp)

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

$(eval $(call SetupJavadocGeneration, jaccess, \
    MODULES := jdk.accessibility, \
    PACKAGES := com.sun.java.accessibility.util, \
    API_ROOT := jre, \
    DEST_DIR := accessibility/jaccess/spec, \
    TITLE := JACCESS API, \
    FIRST_COPYRIGHT_YEAR := 2002, \
    NODEPRECATEDLIST := TRUE, \
))

TARGETS += $(jaccess)

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

$(eval $(call SetupJavadocGeneration, jdknet, \
    MODULES := jdk.net, \
    PACKAGES := jdk.net, \
    API_ROOT := jre, \
    DEST_DIR := net/socketoptions/spec, \
    TITLE := jdk.net API, \
    FIRST_COPYRIGHT_YEAR := 2014, \
    DOCLINT := none, \
    NODEPRECATEDLIST := TRUE, \
))

TARGETS += $(jdknet)

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

# TODO: Need to decide when the plugin API is ready to publish as experimental API.
# This target is temporarily added for internal use for now.
$(eval $(call SetupJavadocGeneration, jlinkplugins, \
    MODULES := jdk.jlink, \
    PACKAGES := jdk.tools.jlink.plugin, \
    API_ROOT := jdk, \
    DEST_DIR := jlink, \
    TITLE := JLink Plugin API - EXPERIMENTAL, \
    FIRST_COPYRIGHT_YEAR := 2015, \
    DOCLINT := none, \
    NODEPRECATEDLIST := TRUE, \
))

TARGETS += $(jlinkplugins)

################################################################################
# Copy JDWP html file

JDWP_HTML := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/jdwp-protocol.html

$(eval $(call SetupCopyFiles, COPY_JDWP_HTML, \
    FILES := $(JDWP_HTML), \
    DEST := $(JAVADOC_OUTPUTDIR)/platform/jpda/jdwp, \
))

COPY_TARGETS += $(COPY_JDWP_HTML)

################################################################################
# Copy JVMTI html file

# Pick jvmti.html from any jvm variant, they are all the same.
JVMTI_HTML := $(firstword \
    $(wildcard $(HOTSPOT_OUTPUTDIR)/variant-*/gensrc/jvmtifiles/jvmti.html))

$(eval $(call SetupCopyFiles, COPY_JVMTI_HTML, \
    FILES := $(JVMTI_HTML), \
    DEST := $(JAVADOC_OUTPUTDIR)/platform/jvmti, \
))

COPY_TARGETS += $(COPY_JVMTI_HTML)

################################################################################
# Optional target which bundles all generated javadocs into a zip archive.
# The dependency on docs is handled in Main.gmk.

# Add the core docs as prerequisite to the archive to trigger a rebuild
# if the core docs were rebuilt. Ideally any doc rebuild should trigger
# this, but the way prerequisites are currently setup in this file, that
# is hard to achieve.

JAVADOC_ARCHIVE_NAME := jdk-$(VERSION_STRING)-docs.zip
JAVADOC_ARCHIVE_ASSEMBLY_DIR := $(SUPPORT_OUTPUTDIR)/docs/zip-docs
JAVADOC_ARCHIVE_DIR := $(OUTPUT_ROOT)/bundles
JAVADOC_ARCHIVE := $(JAVADOC_ARCHIVE_DIR)/$(JAVADOC_ARCHIVE_NAME)

$(JAVADOC_ARCHIVE): $(CORE_INDEX_FILE)
	$(call LogInfo, Compressing javadoc to single $(JAVADOC_ARCHIVE_NAME))
	$(MKDIR) -p $(JAVADOC_ARCHIVE_DIR)
	$(RM) -r $(JAVADOC_ARCHIVE_ASSEMBLY_DIR)
	$(MKDIR) -p $(JAVADOC_ARCHIVE_ASSEMBLY_DIR)
	all_roots=`$(FIND) $(JAVADOC_OUTPUTDIR) | $(GREP) index.html | grep -v old/doclet`; \
	pushd $(JAVADOC_ARCHIVE_ASSEMBLY_DIR); \
	for index_file in $${all_roots} ; do \
	  target_dir=`dirname $${index_file}`; \
	  name=`$(ECHO) $${target_dir} | $(SED) "s;/spec;;" | $(SED) "s;.*/;;"`; \
	  $(LN) -s $${target_dir}  $${name}; \
	done; \
	$(ZIP) -q -r $(JAVADOC_ARCHIVE) * ; \
	popd ;

ZIP_TARGETS += $(JAVADOC_ARCHIVE)

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

# Hook to include the corresponding custom file, if present.
$(eval $(call IncludeCustomExtension, , Javadoc.gmk))

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

docs-javadoc: $(TARGETS)

docs-copy: $(COPY_TARGETS)

docs-zip: $(ZIP_TARGETS)

all: docs-javadoc docs-copy docs-zip

.PHONY: default all docs-javadoc docs-copy docs-zip