Docs.gmk revision 2756:035a3a7c0ea7
114062Swpaul# Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
214062Swpaul# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
314062Swpaul#
414062Swpaul# This code is free software; you can redistribute it and/or modify it
514062Swpaul# under the terms of the GNU General Public License version 2 only, as
614062Swpaul# published by the Free Software Foundation.  Oracle designates this
714062Swpaul# particular file as subject to the "Classpath" exception as provided
814062Swpaul# by Oracle in the LICENSE file that accompanied this code.
914062Swpaul#
1014062Swpaul# This code is distributed in the hope that it will be useful, but WITHOUT
1114062Swpaul# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1214062Swpaul# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1314062Swpaul# version 2 for more details (a copy is included in the LICENSE file that
1414062Swpaul# accompanied this code).
1514062Swpaul#
1614062Swpaul# You should have received a copy of the GNU General Public License version
1714062Swpaul# 2 along with this work; if not, write to the Free Software Foundation,
1814062Swpaul# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1914062Swpaul#
2014062Swpaul# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2114062Swpaul# or visit www.oracle.com if you need additional information or have any
2214062Swpaul# questions.
2314062Swpaul#
2414062Swpaul
2514062Swpauldefault: all
2614062Swpaul
2714062Swpaulinclude $(SPEC)
2814062Swpaulinclude MakeBase.gmk
2914062Swpaulinclude Modules.gmk
3014062Swpaulinclude ProcessMarkdown.gmk
3114062Swpaulinclude ZipArchive.gmk
3214062Swpaulinclude $(JDK_TOPDIR)/make/Tools.gmk
33114601Sobrieninclude $(JDK_TOPDIR)/make/ModuleTools.gmk
34114601Sobrien
3530377Scharnier# This is needed to properly setup DOCS_MODULES.
3614062Swpaul$(eval $(call ReadImportMetaData))
3714062Swpaul
3814062Swpaul################################################################################
3914062Swpaul# Hook to include the corresponding custom file, if present.
4096222Sdes$(eval $(call IncludeCustomExtension, , Docs.gmk))
4196222Sdes
4214062Swpaul################################################################################
4396222Sdes# This file generates all documentation for OpenJDK.
4414062Swpaul#
4514062Swpaul# We will generate API documentation for two different selections of the source
4696222Sdes# code: "Java SE", which contains just the modules covered by the top-level
4796222Sdes# module java.se.ee, and "JDK", which covers all of Java SE and also all
4896222Sdes# other available modules that should be documented, including imported modules,
4996222Sdes# if any.
5096222Sdes#
5196222Sdes# We will also generate separate, free-standing specifications from either
5296222Sdes# markdown or existing html files.
5396222Sdes#
5496222Sdes
5596222Sdes################################################################################
56109363Smbr# Javadoc settings
5796222Sdes
5814062Swpaul# On top of the sources that was used to compile the JDK, we need some
5914062Swpaul# extra java.rmi sources that are used just for javadoc.
6096222SdesMODULES_SOURCE_PATH := $(call PathList, $(call GetModuleSrcPath) \
6196222Sdes    $(SUPPORT_OUTPUTDIR)/rmic/* $(JDK_TOPDIR)/src/*/share/doc/stub)
6214062Swpaul
6327758Swpaul# URLs
6414062SwpaulJAVADOC_BASE_URL := http://www.oracle.com/pls/topic/lookup?ctx=javase9&id=homepage
6596222SdesBUG_SUBMIT_URL := http://bugreport.java.com/bugreport/
6614062SwpaulCOPYRIGHT_URL := {@docroot}/../legal/copyright.html
6714062SwpaulLICENSE_URL := http://www.oracle.com/technetwork/java/javase/terms/license/java9speclicense.html
6814062SwpaulREDISTRIBUTION_URL := http://www.oracle.com/technetwork/java/redist-137594.html
6914062Swpaul
7014062Swpaul# In order to get a specific ordering it's necessary to specify the total
7114062Swpaul# ordering of tags as the tags are otherwise ordered in order of definition.
7214062SwpaulJAVADOC_TAGS := \
7314062Swpaul    -tag beaninfo:X \
7414062Swpaul    -tag revised:X \
7514062Swpaul    -tag since.unbundled:X \
7614062Swpaul    -tag spec:X \
7714062Swpaul    -tag specdefault:X \
7814062Swpaul    -tag Note:X \
7914062Swpaul    -tag ToDo:X \
8014062Swpaul    -tag 'apiNote:a:API Note:' \
8114062Swpaul    -tag 'implSpec:a:Implementation Requirements:' \
8214062Swpaul    -tag 'implNote:a:Implementation Note:' \
8314062Swpaul    -tag param \
8414062Swpaul    -tag return \
8596222Sdes    -tag throws \
8696222Sdes    -taglet build.tools.taglet.ModuleGraph \
8714062Swpaul    -tag since \
8896222Sdes    -tag version \
8996222Sdes    -tag serialData \
9096222Sdes    -tag factory \
9196222Sdes    -tag see \
9296222Sdes    -tag 'jvms:a:See <cite>The Java&trade; Virtual Machine Specification</cite>:' \
9396222Sdes    -tag 'jls:a:See <cite>The Java&trade; Language Specification</cite>:' \
9414062Swpaul    -taglet build.tools.taglet.ExtLink \
9514062Swpaul    -taglet build.tools.taglet.Incubating \
9614062Swpaul    -tagletpath $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
9714062Swpaul    $(CUSTOM_JAVADOC_TAGS) \
9814062Swpaul    #
9914062Swpaul
10014062Swpaul# Which doclint checks to ignore
10114241SwpaulJAVADOC_DISABLED_DOCLINT := accessibility html missing syntax reference
10216134Swpaul
10396222Sdes# The initial set of options for javadoc
10414062SwpaulJAVADOC_OPTIONS := -XDignore.symbol.file=true -use -keywords -notimestamp \
10590298Sdes    -serialwarn -encoding ISO-8859-1 -breakiterator -splitIndex --system none \
10696222Sdes    -html5 -javafx --expand-requires transitive
10714062Swpaul
10890253Salfred# Should we add DRAFT stamps to the generated javadoc?
10990253Salfredifeq ($(VERSION_IS_GA), true)
11014062Swpaul  IS_DRAFT := false
11114062Swpaulelse
11214062Swpaul  IS_DRAFT := true
11314241Swpaulendif
11490298Sdes
11596222Sdes################################################################################
11614241Swpaul# General text snippets
11714241Swpaul
11814241SwpaulFULL_COMPANY_NAME := Oracle and/or its affiliates
11914241SwpaulCOMPANY_ADDRESS := 500 Oracle Parkway, Redwood Shores, CA 94065 USA
12014062Swpaul
12196222SdesJAVA_PLATFORM := Java Platform
12214062Swpaul
12314062Swpaulifeq ($(IS_DRAFT), true)
12414062Swpaul  DRAFT_MARKER_STR := <br><strong>DRAFT $(VERSION_STRING)</strong>
12514062Swpaul  ifeq ($(VERSION_BUILD), 0)
12614062Swpaul    DRAFT_MARKER_TITLE := [ad-hoc build]
12714062Swpaul  else
12814062Swpaul    DRAFT_MARKER_TITLE := [build $(VERSION_BUILD)]
12914062Swpaul  endif
13014062Swpaul  DRAFT_TEXT := This specification is not final and is subject to change. \
13114062Swpaul      Use is subject to <a href="$(LICENSE_URL)">license terms</a>.
13214062Swpaulendif
13314062Swpaul
13414062SwpaulJAVADOC_BOTTOM := \
13514062Swpaul    <a href="$(BUG_SUBMIT_URL)">Report a bug or suggest an enhancement</a><br> \
13614062Swpaul    For further API reference and developer documentation see the \
13714062Swpaul    <a href="$(JAVADOC_BASE_URL)" target="_blank">Java SE \
13814062Swpaul    Documentation</a>, which contains more detailed, \
13914062Swpaul    developer-targeted descriptions with conceptual overviews, definitions \
14014062Swpaul    of terms, workarounds, and working code examples.<br> \
14114062Swpaul    Java is a trademark or registered trademark of $(FULL_COMPANY_NAME) in \
14214062Swpaul    the US and other countries.<br> \
14314062Swpaul    <a href="$(COPYRIGHT_URL)">Copyright</a> \
14414062Swpaul    &copy; 1993, $(COPYRIGHT_YEAR), $(FULL_COMPANY_NAME), \
14514062Swpaul    $(COMPANY_ADDRESS).<br>All rights reserved. \
14614062Swpaul    Use is subject to <a href="$(LICENSE_URL)">license terms</a> and the \
14714062Swpaul    <a href="$(REDISTRIBUTION_URL)">documentation redistribution policy</a>. \
14814062Swpaul    $(DRAFT_MARKER_STR) <!-- Version $(VERSION_STRING) -->
14914062Swpaul
15090298Sdes
15190298SdesJAVADOC_TOP := \
15214062Swpaul    <div style="padding: 6px; text-align: center; font-size: 80%; \
15330377Scharnier    font-family: DejaVu Sans, Arial, Helvetica, sans-serif; \
15430377Scharnier    font-weight: normal;">$(DRAFT_TEXT)</div>
15530377Scharnier
15614062Swpaul################################################################################
15714062Swpaul# JDK javadoc titles/text snippets
15814062Swpaul
15919778SpeterJDK_SHORT_NAME := Java SE $(VERSION_SPECIFICATION) &amp; JDK $(VERSION_SPECIFICATION)
16090298SdesJDK_LONG_NAME := Java<sup>&reg;</sup> Platform, Standard Edition \
16114062Swpaul    <span style="white-space: nowrap;">&amp; Java Development Kit</span>
16296222Sdes
16396222Sdes################################################################################
16414062Swpaul# Java SE javadoc titles/text snippets
165145803Sdelphij
16690253SalfredJAVASE_SHORT_NAME := Java SE $(VERSION_SPECIFICATION)
167184459SrafanJAVASE_LONG_NAME := Java<sup>&reg;</sup> Platform, Standard Edition
16890253Salfred
16914062Swpaul################################################################################
17014062Swpaul# Functions
17114062Swpaul
172109363Smbr# Helper function for creating a png file from a dot file generated by the
17390253Salfred# GenGraphs tool.
17414062Swpaul# param 1: SetupJavadocGeneration namespace ($1)
17514062Swpaul# param 2: module name
17614062Swpaul#
17714062Swpauldefine setup_gengraph_dot_to_png
17824428Simp  $1_$2_DOT_SRC :=  $$($1_GENGRAPHS_DIR)/$2.dot
17990297Sdes  $1_$2_PNG_TARGET := $$($1_TARGET_DIR)/$2-graph.png
18014062Swpaul
18114062Swpaul    # For each module needing a graph, create a png file from the dot file
18214062Swpaul    # generated by the GenGraphs tool and store it in the target dir.
18314062Swpaul    $$($1_$2_PNG_TARGET): $$($1_GENGRAPHS_MARKER)
18414062Swpaul	$$(call MakeDir, $$(@D))
18514062Swpaul	$$(call ExecuteWithLog, $$($1_$2_DOT_SRC), \
18614062Swpaul	    $$(DOT) -Tpng -o $$($1_$2_PNG_TARGET) $$($1_$2_DOT_SRC))
18714062Swpaul
18814062Swpaul  $1_MODULEGRAPH_TARGETS += $$($1_$2_PNG_TARGET)
18914062Swpaulendef
19014062Swpaul
19114062Swpaul# Helper function to create the overview.html file to use with the -overview
19214062Swpaul# javadoc option.
19314062Swpaul# Returns the filename as $1_OVERVIEW.
19414062Swpaul#
19514062Swpaul# param 1: SetupJavadocGeneration namespace ($1)
19614062Swpauldefine create_overview_file
19714062Swpaul  $1_OVERVIEW_TEXT := \
19814062Swpaul      <!DOCTYPE html> \
19914062Swpaul      <html><head></head><body> \
20014062Swpaul      #
20116134Swpaul  ifneq ($$($1_GROUPS),)
20216134Swpaul    $1_OVERVIEW_TEXT += \
20316134Swpaul      <p>This document is divided into \
20414062Swpaul      $$(subst 2,two,$$(subst 3,three,$$(words $$($1_GROUPS)))) sections:</p> \
20514062Swpaul      <blockquote><dl> \
20614062Swpaul      #
20714241Swpaul    $1_OVERVIEW_TEXT += $$(foreach g, $$($1_GROUPS), \
20814241Swpaul        <dt style="margin-top: 8px;"><a href="\#$$g">$$($$g_GROUP_NAME)</a></dt> \
20914241Swpaul        <dd style="margin-top: 8px;">$$($$g_GROUP_DESCRIPTION)</dt> \
21014062Swpaul    )
21114062Swpaul    $1_OVERVIEW_TEXT += \
21214062Swpaul        </dl><blockquote> \
21314062Swpaul        #
21414062Swpaul  endif
21514062Swpaul  $1_OVERVIEW_TEXT += \
21614062Swpaul      </body></html> \
21714062Swpaul      #
21814062Swpaul
21914062Swpaul  $1_OVERVIEW := $$(SUPPORT_OUTPUTDIR)/docs/$1-overview.html
22014062Swpaul
22114062Swpaul  $1_OVERVIEW_VARDEPS_FILE := $$(call DependOnVariable, $1_OVERVIEW_TEXT, \
22214062Swpaul      $$($1_OVERVIEW).vardeps)
22314062Swpaul
22414062Swpaul  $$($1_OVERVIEW): $$($1_OVERVIEW_VARDEPS_FILE)
22514241Swpaul	$$(call LogInfo, Creating overview.html for $1)
22614241Swpaul	$$(call MakeDir, $$(@D))
22796222Sdes	$$(PRINTF) > $$@ '$$($1_OVERVIEW_TEXT)'
22819130Swpaulendef
22914062Swpaul
23014062Swpaul################################################################################
23114062Swpaul# Setup make rules to create an API documentation collection, using javadoc and
23214062Swpaul# other tools if needed.
23396222Sdes#
23496222Sdes# Parameter 1 is the name of the rule. This name is used as variable prefix.
23519130Swpaul# Targets generated are returned as $1_JAVADOC_TARGETS and
23619130Swpaul# $1_MODULEGRAPH_TARGETS. Note that the index.html file will work as a "touch
23714062Swpaul# file" for all the magnitude of files that are generated by javadoc.
23814062Swpaul#
23914062Swpaul# Remaining parameters are named arguments. These include:
24014062Swpaul#   MODULES - Modules to generate javadoc for
24114062Swpaul#   GROUPS - Name of the groups to divide the modules into, if any
24214062Swpaul#   SHORT_NAME - The short name of this documentation collection
24314062Swpaul#   LONG_NAME - The long name of this documentation collection
24414062Swpaul#   TARGET_DIR - Where to store the output
24544791Sbrian#
24619130SwpaulSetupApiDocsGeneration = $(NamedParamsMacroTemplate)
24719130Swpauldefine SetupApiDocsGenerationBody
24819130Swpaul
24919130Swpaul  # Figure out all modules, both specified and transitive indirect exports, that
25014062Swpaul  # will be processed by javadoc.
25114062Swpaul  $1_INDIRECT_EXPORTS := $$(call FindTransitiveIndirectDepsForModules, $$($1_MODULES))
25214062Swpaul  $1_ALL_MODULES := $$(sort $$($1_MODULES) $$($1_INDIRECT_EXPORTS))
25314241Swpaul
25414241Swpaul  ifeq ($$(ENABLE_FULL_DOCS), true)
25514062Swpaul    # Tell the ModuleGraph taglet to generate html links to soon-to-be-created
256145803Sdelphij    # png files with module graphs.
25714062Swpaul    $1_JAVA_ARGS += -DenableModuleGraph=true
25814062Swpaul  endif
25914062Swpaul
26090253Salfred  # Always include tags and basic options
26114062Swpaul  $1_OPTIONS := $$(JAVADOC_TAGS) $$(JAVADOC_OPTIONS)
26214062Swpaul
26314062Swpaul  $1_OPTIONS += --module-source-path $$(MODULES_SOURCE_PATH)
26414062Swpaul  $1_OPTIONS += --module $$(call CommaList, $$($1_MODULES))
26590253Salfred
26690253Salfred  # Create a string like "-Xdoclint:all,-syntax,-html,..."
26790253Salfred  $1_OPTIONS += -Xdoclint:all,$$(call CommaList, $$(addprefix -, \
26814062Swpaul      $$(JAVADOC_DISABLED_DOCLINT)))
26914062Swpaul
27090253Salfred  $1_DOC_TITLE := $$($1_LONG_NAME)<br>Version $$(VERSION_SPECIFICATION) API Specification
271184459Srafan  $1_WINDOW_TITLE := $$(subst &amp;,&,$$($1_SHORT_NAME)) \
272184459Srafan    $$(DRAFT_MARKER_TITLE)
273184459Srafan  ifeq ($(VERSION_IS_GA), true) # Workaround stylesheet bug
27414062Swpaul    $1_HEADER_PAD := 14
27590253Salfred  else
27690253Salfred    $1_HEADER_PAD := 9
27790253Salfred  endif
278109363Smbr  $1_HEADER_TITLE := <div style="margin-top: $$($1_HEADER_PAD)px;"><strong>$$($1_SHORT_NAME)</strong> \
279109363Smbr      $$(DRAFT_MARKER_STR)</div>
28090253Salfred
28190253Salfred  $1_OPTIONS += -doctitle '$$($1_DOC_TITLE)'
28290253Salfred  $1_OPTIONS += -windowtitle '$$($1_WINDOW_TITLE)'
28314062Swpaul  $1_OPTIONS += -header '$$($1_HEADER_TITLE)'
28490253Salfred  $1_OPTIONS += -bottom '$$(JAVADOC_BOTTOM)'
28590253Salfred  ifeq ($$(IS_DRAFT), true)
28690253Salfred    $1_OPTIONS += -top '$$(JAVADOC_TOP)'
28790253Salfred  endif
28890253Salfred
28914062Swpaul  # Do not store debug level options in VARDEPS.
29090253Salfred  ifneq ($$(LOG_LEVEL), trace)
29190253Salfred    $1_LOG_OPTION += -quiet
29290253Salfred  else
29390253Salfred    $1_LOG_OPTION += -verbose
29490253Salfred  endif
29590253Salfred
29690253Salfred  # Generate the overview.html file. This will return the filename in
29790253Salfred  # $1_OVERVIEW.
29890253Salfred  $$(eval $$(call create_overview_file,$1))
29990253Salfred  $1_OPTIONS += -overview $$($1_OVERVIEW)
30090253Salfred
30127758Swpaul  $$(foreach g, $$($1_GROUPS), \
30290253Salfred    $$(eval $1_OPTIONS += -group "$$($$g_GROUP_NAME)" "$$($$g_GROUP_MODULES)") \
30327758Swpaul  )
30427758Swpaul
30527758Swpaul  $1_VARDEPS := $$($1_JAVA_ARGS) $$($1_OPTIONS) $$(MODULES_SOURCE_PATH) \
30627758Swpaul      $$($1_ALL_MODULES)
30790253Salfred  $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \
30890253Salfred      $$(SUPPORT_OUTPUTDIR)/docs/$1.vardeps)
30996391Salfred
31090253Salfred  # Get a list of all files in all the source dirs for all included modules
31127758Swpaul  $1_SOURCE_DEPS := $$(call CacheFind, $$(wildcard $$(foreach module, \
31227758Swpaul      $$($1_ALL_MODULES), $$(call FindModuleSrcDirs, $$(module)))))
31390253Salfred
31490253Salfred  # Javadoc creates a lot of files but use index.html as a marker
31527758Swpaul  $$($1_TARGET_DIR)/index.html: $$(BUILD_TOOLS_JDK) $$($1_VARDEPS_FILE) \
31627758Swpaul      $$($1_SOURCE_DEPS) $$($1_OVERVIEW)
31727758Swpaul	$$(call LogWarn, Generating $1 javadoc for \
31827758Swpaul	    $$(words $$($1_ALL_MODULES)) modules)
31914062Swpaul	$$(call LogInfo, Javadoc modules: $$($1_ALL_MODULES))
32014062Swpaul	$$(call MakeDir, $$($1_TARGET_DIR))
32114062Swpaul	$$(call ExecuteWithLog, $$(SUPPORT_OUTPUTDIR)/docs/$1, \
32214062Swpaul	    $$(JAVA) -Djava.awt.headless=true $$($1_JAVA_ARGS) \
32314062Swpaul	        $$(NEW_JAVADOC) -d $$($1_TARGET_DIR) \
32414062Swpaul	        $$(JAVADOC_TAGS) $$($1_OPTIONS) $$($1_LOG_OPTION))
32514062Swpaul
32614062Swpaul  $1_JAVADOC_TARGETS := $$($1_TARGET_DIR)/index.html
32714062Swpaul
32896222Sdes  ifeq ($$(ENABLE_FULL_DOCS), true)
32996222Sdes    # We have asked ModuleGraph to generate links to png files. Now we must
33096222Sdes    # produce the png files.
33196222Sdes
33296222Sdes    # Locate which modules has the @moduleGraph tag in their module-info.java
33396222Sdes    $1_MODULES_NEEDING_GRAPH := $$(strip $$(foreach m, $$($1_ALL_MODULES), \
33496222Sdes      $$(if $$(shell $$(GREP) -e @moduleGraph \
33514062Swpaul          $$(wildcard $$(addsuffix /module-info.java, \
33696222Sdes          $$(call FindModuleSrcDirs, $$m)))), \
33796222Sdes        $$m) \
33896222Sdes    ))
33914241Swpaul
34096222Sdes    # First we run the GenGraph tool. It will query the module structure of the
34196222Sdes    # running JVM and output .dot files for all existing modules.
34296222Sdes    GENGRAPHS_PROPS := \
34396222Sdes        $$(JDK_TOPDIR)/make/src/classes/build/tools/jigsaw/javadoc-graphs.properties
34496222Sdes
34596222Sdes    $1_GENGRAPHS_DIR := $$(SUPPORT_OUTPUTDIR)/docs/$1-gengraphs
34696222Sdes    $1_GENGRAPHS_MARKER := $$($1_GENGRAPHS_DIR)/_gengraphs_run.marker
34796222Sdes
34827758Swpaul    $$($1_GENGRAPHS_MARKER): $$(BUILD_JIGSAW_TOOLS) $$(GENGRAPHS_PROPS)
34914062Swpaul	$$(call LogInfo, Running gengraphs for $1 documentation)
35014062Swpaul	$$(call MakeDir, $$($1_GENGRAPHS_DIR))
35114062Swpaul	$$(call ExecuteWithLog, $$($1_GENGRAPHS_DIR)/gengraphs, \
35214062Swpaul	    $$(TOOL_GENGRAPHS) --spec --output $$($1_GENGRAPHS_DIR) \
353	    --dot-attributes $$(GENGRAPHS_PROPS) && \
354	    $$(TOUCH) $$($1_GENGRAPHS_MARKER))
355
356    # For each module needing a graph, create a png file from the dot file
357    # generated by the GenGraphs tool and store it in the target dir.
358    # They will depend on $1_GENGRAPHS_MARKER, and will be added to $1.
359    $$(foreach m, $$($1_MODULES_NEEDING_GRAPH), \
360      $$(eval $$(call setup_gengraph_dot_to_png,$1,$$m)) \
361    )
362  endif
363endef
364
365################################################################################
366# Setup generation of the JDK API documentation (javadoc + modulegraph)
367
368# Define the groups of the JDK API documentation
369JavaSE_GROUP_NAME := Java SE
370JavaSE_GROUP_MODULES := $(call ColonList, $(sort java.se.ee \
371    $(call FindTransitiveIndirectDepsForModules, java.se.ee)))
372JavaSE_GROUP_DESCRIPTION := \
373    The Java Platform, Standard Edition (Java SE) APIs define the core Java \
374    platform for general-purpose computing. These APIs are in modules whose \
375    names start with {@code java}. \
376    #
377JDK_GROUPS += JavaSE
378
379JDK_GROUP_NAME := JDK
380JDK_GROUP_MODULES := jdk.*
381JDK_GROUP_DESCRIPTION := \
382    The Java Development Kit (JDK) APIs are specific to the JDK and will not \
383    necessarily be available in all implementations of the Java SE Platform. \
384    These APIs are in modules whose names start with {@code jdk}. \
385    #
386JDK_GROUPS += JDK
387
388# If we are importing JavaFX, we need a JavaFX group. In an ideal world, this
389# would have been abstracted away to a more proper generic handling of imported
390# modules.
391ifneq ($(findstring javafx., $(IMPORTED_MODULES)), )
392  JavaFX_GROUP_NAME := JavaFX
393  JavaFX_GROUP_MODULES := javafx.*
394  JavaFX_GROUP_DESCRIPTION := \
395      The JavaFX APIs define a set of user-interface controls, graphics, \
396      media, and web packages for developing rich client applications. These \
397      APIs are in modules whose names start with {@code javafx}. \
398      #
399  JDK_GROUPS += JavaFX
400endif
401
402# All modules to have docs generated by docs-jdk-api target
403JDK_MODULES := $(sort $(DOCS_MODULES))
404
405$(eval $(call SetupApiDocsGeneration, JDK_API, \
406    MODULES := $(JDK_MODULES), \
407    GROUPS := $(JDK_GROUPS), \
408    SHORT_NAME := $(JDK_SHORT_NAME), \
409    LONG_NAME := $(JDK_LONG_NAME), \
410    TARGET_DIR := $(DOCS_OUTPUTDIR)/api, \
411))
412
413# Targets generated are returned in JDK_API_JAVADOC_TARGETS and
414# JDK_API_MODULEGRAPH_TARGETS.
415
416################################################################################
417# Setup generation of the Java SE API documentation (javadoc + modulegraph)
418
419# The Java SE module scope is just java.se.ee and its transitive indirect
420# exports.
421JAVASE_MODULES := java.se.ee
422
423$(eval $(call SetupApiDocsGeneration, JAVASE_API, \
424    MODULES := $(JAVASE_MODULES), \
425    SHORT_NAME := $(JAVASE_SHORT_NAME), \
426    LONG_NAME := $(JAVASE_LONG_NAME), \
427    TARGET_DIR := $(IMAGES_OUTPUTDIR)/javase-docs/api, \
428))
429
430# Targets generated are returned in JAVASE_API_JAVADOC_TARGETS and
431# JAVASE_API_MODULEGRAPH_TARGETS.
432
433################################################################################
434
435JDK_INDEX_HTML := $(DOCS_OUTPUTDIR)/index.html
436
437JDK_INDEX_CONTENT := \
438    <!DOCTYPE html> \
439    <html lang="en"> \
440    <head> \
441    <meta http-equiv="refresh" content="0;url=api/index.html"> \
442    </head> \
443    </html>
444
445$(JDK_INDEX_HTML): 
446	$(ECHO) '$(JDK_INDEX_CONTENT)' > $@
447
448JDK_INDEX_TARGETS += $(JDK_INDEX_HTML)
449
450# Copy the global resources
451GLOBAL_SPECS_RESOURCES_DIR := $(JDK_TOPDIR)/make/data/docs-resources/
452$(eval $(call SetupCopyFiles, COPY_GLOBAL_RESOURCES, \
453    SRC := $(GLOBAL_SPECS_RESOURCES_DIR), \
454    FILES := $(call CacheFind, $(GLOBAL_SPECS_RESOURCES_DIR)), \
455    DEST := $(DOCS_OUTPUTDIR), \
456))
457JDK_INDEX_TARGETS += $(COPY_GLOBAL_RESOURCES)
458
459# Copy the legal notices distributed with the docs bundle
460DOCS_LEGAL_NOTICES := jquery.md jszip.md pako.md
461$(eval $(call SetupCopyFiles, COPY_DOCS_LEGAL_NOTICES, \
462    SRC := $(LANGTOOLS_TOPDIR)/src/jdk.javadoc/share/legal, \
463    FILES := $(DOCS_LEGAL_NOTICES), \
464    DEST := $(DOCS_OUTPUTDIR)/legal, \
465))
466JDK_INDEX_TARGETS += $(COPY_DOCS_LEGAL_NOTICES)
467
468################################################################################
469# Copy JDK specs files
470
471# For all html documentation in $module/share/specs directories, copy it
472# unmodified
473
474ALL_MODULES := $(call FindAllModules)
475COPY_SPEC_FILTER := %.html %.gif %.jpg %.mib %.css
476
477$(foreach m, $(ALL_MODULES), \
478  $(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \
479  $(foreach d, $(SPECS_$m), \
480    $(if $(filter $(COPY_SPEC_FILTER), $(call CacheFind, $d)), \
481      $(eval $(call SetupCopyFiles, COPY_$m, \
482          SRC := $d, \
483          FILES := $(filter $(COPY_SPEC_FILTER), $(call CacheFind, $d)), \
484          DEST := $(DOCS_OUTPUTDIR)/specs/, \
485      )) \
486      $(eval JDK_SPECS_TARGETS += $(COPY_$m)) \
487    ) \
488  ) \
489)
490
491ifeq ($(ENABLE_FULL_DOCS), true)
492  # For all markdown files in $module/share/specs directories, convert them to
493  # html.
494
495  GLOBAL_SPECS_DEFAULT_CSS_FILE := $(DOCS_OUTPUTDIR)/resources/jdk-default.css
496
497  $(foreach m, $(ALL_MODULES), \
498    $(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \
499    $(foreach d, $(SPECS_$m), \
500      $(if $(filter %.md, $(call CacheFind, $d)), \
501        $(eval $(call SetupProcessMarkdown, CONVERT_MARKDOWN_$m_$(patsubst $(TOPDIR)/%,%,$d), \
502            SRC := $d, \
503            FILES := $(filter %.md, $(call CacheFind, $d)), \
504            DEST := $(DOCS_OUTPUTDIR)/specs/, \
505            CSS := $(GLOBAL_SPECS_DEFAULT_CSS_FILE), \
506        )) \
507      ) \
508      $(eval JDK_SPECS_TARGETS += $(CONVERT_MARKDOWN_$m_$(patsubst $(TOPDIR)/%,%,$d))) \
509    ) \
510  )
511endif
512
513# Special treatment for generated documentation
514
515JDWP_PROTOCOL := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/jdwp-protocol.html
516$(eval $(call SetupCopyFiles, COPY_JDWP_PROTOCOL, \
517    FILES := $(JDWP_PROTOCOL), \
518    DEST := $(DOCS_OUTPUTDIR)/specs/jdwp, \
519))
520JDK_SPECS_TARGETS += $(COPY_JDWP_PROTOCOL)
521
522# Get jvmti.html from the main jvm variant (all variants' jvmti.html are identical).
523JVMTI_HTML := $(HOTSPOT_OUTPUTDIR)/variant-$(JVM_VARIANT_MAIN)/gensrc/jvmtifiles/jvmti.html
524$(eval $(call SetupCopyFiles, COPY_JVMTI_HTML, \
525    FILES := $(JVMTI_HTML), \
526    DEST := $(DOCS_OUTPUTDIR)/specs, \
527))
528JDK_SPECS_TARGETS += $(COPY_JVMTI_HTML)
529
530################################################################################
531# Optional target which bundles all generated javadocs into a zip archive.
532
533JAVADOC_ZIP_NAME := jdk-$(VERSION_STRING)-docs.zip
534JAVADOC_ZIP_FILE := $(OUTPUT_ROOT)/bundles/$(JAVADOC_ZIP_NAME)
535
536$(eval $(call SetupZipArchive, BUILD_JAVADOC_ZIP, \
537    SRC := $(DOCS_OUTPUTDIR), \
538    ZIP := $(JAVADOC_ZIP_FILE), \
539    EXTRA_DEPS := $(JDK_API_JAVADOC_TARGETS) $(JDK_API_MODULEGRAPH_TARGETS) \
540        $(JDK_SPECS_TARGETS), \
541))
542
543ZIP_TARGETS += $(BUILD_JAVADOC_ZIP)
544
545################################################################################
546
547docs-jdk-api-javadoc: $(JDK_API_JAVADOC_TARGETS) $(JDK_API_CUSTOM_TARGETS)
548
549docs-jdk-api-modulegraph: $(JDK_API_MODULEGRAPH_TARGETS)
550
551docs-javase-api-javadoc: $(JAVASE_API_JAVADOC_TARGETS) $(JAVASE_API_CUSTOM_TARGETS)
552
553docs-javase-api-modulegraph: $(JAVASE_API_MODULEGRAPH_TARGETS)
554
555docs-jdk-specs: $(JDK_SPECS_TARGETS)
556
557docs-jdk-index: $(JDK_INDEX_TARGETS)
558
559docs-zip: $(ZIP_TARGETS)
560
561all: docs-jdk-api-javadoc docs-jdk-api-modulegraph docs-javase-api-javadoc \
562    docs-javase-api-modulegraph docs-jdk-specs docs-jdk-index docs-zip
563
564.PHONY: default all docs-jdk-api-javadoc docs-jdk-api-modulegraph \
565    docs-javase-api-javadoc docs-javase-api-modulegraph docs-jdk-specs \
566    docs-jdk-index docs-zip
567