1 # Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
   2 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   3 #
   4 # This code is free software; you can redistribute it and/or modify it
   5 # under the terms of the GNU General Public License version 2 only, as
   6 # published by the Free Software Foundation.  Oracle designates this
   7 # particular file as subject to the "Classpath" exception as provided
   8 # by Oracle in the LICENSE file that accompanied this code.
   9 #
  10 # This code is distributed in the hope that it will be useful, but WITHOUT
  11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13 # version 2 for more details (a copy is included in the LICENSE file that
  14 # accompanied this code).
  15 #
  16 # You should have received a copy of the GNU General Public License version
  17 # 2 along with this work; if not, write to the Free Software Foundation,
  18 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19 #
  20 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21 # or visit www.oracle.com if you need additional information or have any
  22 # questions.
  23 #
  24 
  25 default: all
  26 
  27 include $(SPEC)
  28 include MakeBase.gmk
  29 include Modules.gmk
  30 include ProcessMarkdown.gmk
  31 include ZipArchive.gmk
  32 include $(TOPDIR)/make/ToolsJdk.gmk
  33 include $(TOPDIR)/make/ModuleTools.gmk
  34 
  35 # This is needed to properly setup DOCS_MODULES.
  36 $(eval $(call ReadImportMetaData))
  37 
  38 ################################################################################
  39 # Hook to include the corresponding custom file, if present.
  40 $(eval $(call IncludeCustomExtension, Docs.gmk))
  41 
  42 ################################################################################
  43 # This file generates all documentation for OpenJDK.
  44 #
  45 # We will generate API documentation for two different selections of the source
  46 # code: "Java SE", which contains just the modules covered by the top-level
  47 # module java.se.ee, and "JDK", which covers all of Java SE and also all
  48 # other available modules that should be documented, including imported modules,
  49 # if any.
  50 #
  51 # We will also generate separate, free-standing specifications from either
  52 # markdown or existing html files.
  53 #
  54 
  55 ################################################################################
  56 # Javadoc settings
  57 
  58 # On top of the sources that was used to compile the JDK, we need some
  59 # extra java.rmi sources that are used just for javadoc.
  60 MODULES_SOURCE_PATH := $(call PathList, $(call GetModuleSrcPath) \
  61     $(SUPPORT_OUTPUTDIR)/rmic/* $(TOPDIR)/src/*/share/doc/stub)
  62 
  63 # URLs
  64 JAVADOC_BASE_URL := http://www.oracle.com/pls/topic/lookup?ctx=javase9&id=homepage
  65 BUG_SUBMIT_URL := http://bugreport.java.com/bugreport/
  66 COPYRIGHT_URL := {@docroot}/../legal/copyright.html
  67 LICENSE_URL := http://www.oracle.com/technetwork/java/javase/terms/license/java10speclicense.html
  68 REDISTRIBUTION_URL := http://www.oracle.com/technetwork/java/redist-137594.html
  69 
  70 # In order to get a specific ordering it's necessary to specify the total
  71 # ordering of tags as the tags are otherwise ordered in order of definition.
  72 JAVADOC_TAGS := \
  73     -tag beaninfo:X \
  74     -tag revised:X \
  75     -tag since.unbundled:X \
  76     -tag spec:X \
  77     -tag specdefault:X \
  78     -tag Note:X \
  79     -tag ToDo:X \
  80     -tag 'apiNote:a:API Note:' \
  81     -tag 'implSpec:a:Implementation Requirements:' \
  82     -tag 'implNote:a:Implementation Note:' \
  83     -tag param \
  84     -tag return \
  85     -tag throws \
  86     -taglet build.tools.taglet.ModuleGraph \
  87     -tag since \
  88     -tag version \
  89     -tag serialData \
  90     -tag factory \
  91     -tag see \
  92     -tag 'jvms:a:See <cite>The Java&trade; Virtual Machine Specification</cite>:' \
  93     -tag 'jls:a:See <cite>The Java&trade; Language Specification</cite>:' \
  94     -taglet build.tools.taglet.ExtLink \
  95     -taglet build.tools.taglet.Incubating \
  96     -tagletpath $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
  97     $(CUSTOM_JAVADOC_TAGS) \
  98     #
  99 
 100 # The reference tags must stay stable to allow for comparisons across the
 101 # development cycle. If JAVADOC_TAGS needs to change, make sure that
 102 # REFERENCE_TAGS remains unchanged, by copying and hardcoding, if necessary.
 103 REFERENCE_TAGS := $(JAVADOC_TAGS)
 104 
 105 # Which doclint checks to ignore
 106 JAVADOC_DISABLED_DOCLINT := accessibility html missing syntax reference
 107 
 108 # The initial set of options for javadoc
 109 JAVADOC_OPTIONS := -use -keywords -notimestamp \
 110     -serialwarn -encoding ISO-8859-1 -docencoding UTF-8 -breakiterator \
 111     -splitIndex --system none -html5 -javafx --expand-requires transitive \
 112     --override-methods=summary
 113 
 114 # The reference options must stay stable to allow for comparisons across the
 115 # development cycle.
 116 REFERENCE_OPTIONS := -XDignore.symbol.file=true -use -keywords -notimestamp \
 117     -serialwarn -encoding ISO-8859-1 -breakiterator -splitIndex --system none \
 118     -html5 -javafx --expand-requires transitive
 119 
 120 # Should we add DRAFT stamps to the generated javadoc?
 121 ifeq ($(VERSION_IS_GA), true)
 122   IS_DRAFT := false
 123 else
 124   IS_DRAFT := true
 125 endif
 126 
 127 ################################################################################
 128 # General text snippets
 129 
 130 FULL_COMPANY_NAME := Oracle and/or its affiliates
 131 COMPANY_ADDRESS := 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 132 
 133 JAVA_PLATFORM := Java Platform
 134 
 135 ifeq ($(IS_DRAFT), true)
 136   DRAFT_MARKER_STR := <br><strong>DRAFT $(VERSION_STRING)</strong>
 137   ifeq ($(VERSION_BUILD), 0)
 138     DRAFT_MARKER_TITLE := [ad-hoc build]
 139   else
 140     DRAFT_MARKER_TITLE := [build $(VERSION_BUILD)]
 141   endif
 142   DRAFT_TEXT := This specification is not final and is subject to change. \
 143       Use is subject to <a href="$(LICENSE_URL)">license terms</a>.
 144 
 145   # Workaround stylesheet bug
 146   HEADER_STYLE := style="margin-top: 9px;"
 147 else
 148   HEADER_STYLE := style="margin-top: 14px;"
 149 endif
 150 
 151 JAVADOC_BOTTOM := \
 152     <a href="$(BUG_SUBMIT_URL)">Report a bug or suggest an enhancement</a><br> \
 153     For further API reference and developer documentation see the \
 154     <a href="$(JAVADOC_BASE_URL)" target="_blank">Java SE \
 155     Documentation</a>, which contains more detailed, \
 156     developer-targeted descriptions with conceptual overviews, definitions \
 157     of terms, workarounds, and working code examples.<br> \
 158     Java is a trademark or registered trademark of $(FULL_COMPANY_NAME) in \
 159     the US and other countries.<br> \
 160     <a href="$(COPYRIGHT_URL)">Copyright</a> \
 161     &copy; 1993, $(COPYRIGHT_YEAR), $(FULL_COMPANY_NAME), \
 162     $(COMPANY_ADDRESS).<br>All rights reserved. \
 163     Use is subject to <a href="$(LICENSE_URL)">license terms</a> and the \
 164     <a href="$(REDISTRIBUTION_URL)">documentation redistribution policy</a>. \
 165     $(DRAFT_MARKER_STR) <!-- Version $(VERSION_STRING) -->
 166 
 167 JAVADOC_TOP := \
 168     <div style="padding: 6px; text-align: center; font-size: 80%; \
 169     font-family: DejaVu Sans, Arial, Helvetica, sans-serif; \
 170     font-weight: normal;">$(DRAFT_TEXT)</div>
 171 
 172 JDK_INDEX_CONTENT := \
 173     <!DOCTYPE html> \
 174     <html lang="en"> \
 175     <head> \
 176     <meta http-equiv="refresh" content="0;url=api/index.html"> \
 177     </head> \
 178     </html>
 179 
 180 ################################################################################
 181 # JDK javadoc titles/text snippets
 182 
 183 JDK_SHORT_NAME := Java SE $(VERSION_SPECIFICATION) &amp; JDK $(VERSION_SPECIFICATION)
 184 JDK_LONG_NAME := Java<sup>&reg;</sup> Platform, Standard Edition \
 185     &amp;&nbsp;Java&nbsp;Development&nbsp;Kit
 186 
 187 ################################################################################
 188 # Java SE javadoc titles/text snippets
 189 
 190 JAVASE_SHORT_NAME := Java SE $(VERSION_SPECIFICATION)
 191 JAVASE_LONG_NAME := Java<sup>&reg;</sup> Platform, Standard Edition
 192 
 193 ################################################################################
 194 # Functions
 195 
 196 # Helper function for creating a png file from a dot file generated by the
 197 # GenGraphs tool.
 198 # param 1: SetupJavadocGeneration namespace ($1)
 199 # param 2: module name
 200 #
 201 define setup_gengraph_dot_to_png
 202   $1_$2_DOT_SRC :=  $$($1_GENGRAPHS_DIR)/$2.dot
 203   $1_$2_PNG_TARGET := $$($1_TARGET_DIR)/$2/module-graph.png
 204 
 205     # For each module needing a graph, create a png file from the dot file
 206     # generated by the GenGraphs tool and store it in the target dir.
 207     $$($1_$2_PNG_TARGET): $$($1_GENGRAPHS_MARKER)
 208         $$(call MakeDir, $$(@D))
 209         $$(call ExecuteWithLog, $$($1_$2_DOT_SRC), \
 210             $$(DOT) -Tpng -o $$($1_$2_PNG_TARGET) $$($1_$2_DOT_SRC))
 211 
 212   $1_MODULEGRAPH_TARGETS += $$($1_$2_PNG_TARGET)
 213 endef
 214 
 215 # Helper function to create the overview.html file to use with the -overview
 216 # javadoc option.
 217 # Returns the filename as $1_OVERVIEW.
 218 #
 219 # param 1: SetupJavadocGeneration namespace ($1)
 220 define create_overview_file
 221   $1_OVERVIEW_TEXT := \
 222       <!DOCTYPE html> \
 223       <html><head></head><body> \
 224       #
 225   ifneq ($$($1_GROUPS),)
 226     $1_OVERVIEW_TEXT += \
 227       <p>This document is divided into \
 228       $$(subst 2,two,$$(subst 3,three,$$(words $$($1_GROUPS)))) sections:</p> \
 229       <blockquote><dl> \
 230       #
 231     $1_OVERVIEW_TEXT += $$(foreach g, $$($1_GROUPS), \
 232         <dt style="margin-top: 8px;"><a href="\#$$g">$$($$g_GROUP_NAME)</a></dt> \
 233         <dd style="margin-top: 8px;">$$($$g_GROUP_DESCRIPTION)</dd> \
 234     )
 235     $1_OVERVIEW_TEXT += \
 236         </dl></blockquote> \
 237         #
 238   endif
 239   $1_OVERVIEW_TEXT += \
 240       </body></html> \
 241       #
 242 
 243   $1_OVERVIEW := $$(SUPPORT_OUTPUTDIR)/docs/$1-overview.html
 244 
 245   $1_OVERVIEW_VARDEPS_FILE := $$(call DependOnVariable, $1_OVERVIEW_TEXT, \
 246       $$($1_OVERVIEW).vardeps)
 247 
 248   $$($1_OVERVIEW): $$($1_OVERVIEW_VARDEPS_FILE)
 249         $$(call LogInfo, Creating overview.html for $1)
 250         $$(call MakeDir, $$(@D))
 251         $$(PRINTF) > $$@ '$$($1_OVERVIEW_TEXT)'
 252 endef
 253 
 254 ################################################################################
 255 # Setup make rules to create an API documentation collection, using javadoc and
 256 # other tools if needed.
 257 #
 258 # Parameter 1 is the name of the rule. This name is used as variable prefix.
 259 # Targets generated are returned as $1_JAVADOC_TARGETS and
 260 # $1_MODULEGRAPH_TARGETS. Note that the index.html file will work as a "touch
 261 # file" for all the magnitude of files that are generated by javadoc.
 262 #
 263 # Remaining parameters are named arguments. These include:
 264 #   MODULES - Modules to generate javadoc for
 265 #   GROUPS - Name of the groups to divide the modules into, if any
 266 #   SHORT_NAME - The short name of this documentation collection
 267 #   LONG_NAME - The long name of this documentation collection
 268 #   TARGET_DIR - Where to store the output
 269 #
 270 SetupApiDocsGeneration = $(NamedParamsMacroTemplate)
 271 define SetupApiDocsGenerationBody
 272 
 273   # Figure out all modules, both specified and transitive indirect exports, that
 274   # will be processed by javadoc.
 275   $1_INDIRECT_EXPORTS := $$(call FindTransitiveIndirectDepsForModules, $$($1_MODULES))
 276   $1_ALL_MODULES := $$(sort $$($1_MODULES) $$($1_INDIRECT_EXPORTS))
 277 
 278   ifeq ($$(ENABLE_FULL_DOCS), true)
 279     # Tell the ModuleGraph taglet to generate html links to soon-to-be-created
 280     # png files with module graphs.
 281     $1_JAVA_ARGS += -DenableModuleGraph=true
 282   endif
 283 
 284   # Start with basic options and tags
 285   ifeq ($$($1_OPTIONS), )
 286     $1_OPTIONS := $$(JAVADOC_OPTIONS)
 287   endif
 288   ifeq ($$($1_TAGS), )
 289     $1_TAGS := $$(JAVADOC_TAGS)
 290   endif
 291   $1_OPTIONS += $$($1_TAGS)
 292 
 293   $1_OPTIONS += --module-source-path $$(MODULES_SOURCE_PATH)
 294   $1_OPTIONS += --module $$(call CommaList, $$($1_MODULES))
 295 
 296   # Create a string like "-Xdoclint:all,-syntax,-html,..."
 297   $1_OPTIONS += -Xdoclint:all,$$(call CommaList, $$(addprefix -, \
 298       $$(JAVADOC_DISABLED_DOCLINT)))
 299 
 300   $1_DOC_TITLE := $$($1_LONG_NAME)<br>Version $$(VERSION_SPECIFICATION) API \
 301       Specification
 302   $1_WINDOW_TITLE := $$(subst &amp;,&,$$($1_SHORT_NAME)) $$(DRAFT_MARKER_TITLE)
 303   $1_HEADER_TITLE := <div $$(HEADER_STYLE)><strong>$$($1_SHORT_NAME)</strong> \
 304       $$(DRAFT_MARKER_STR)</div>
 305 
 306   $1_OPTIONS += -doctitle '$$($1_DOC_TITLE)'
 307   $1_OPTIONS += -windowtitle '$$($1_WINDOW_TITLE)'
 308   $1_OPTIONS += -header '$$($1_HEADER_TITLE)'
 309   $1_OPTIONS += -bottom '$$(JAVADOC_BOTTOM)'
 310   ifeq ($$(IS_DRAFT), true)
 311     $1_OPTIONS += -top '$$(JAVADOC_TOP)'
 312   endif
 313 
 314   # Do not store debug level options in VARDEPS.
 315   ifneq ($$(LOG_LEVEL), trace)
 316     $1_LOG_OPTION += -quiet
 317   else
 318     $1_LOG_OPTION += -verbose
 319   endif
 320 
 321   # Generate the overview.html file. This will return the filename in
 322   # $1_OVERVIEW.
 323   $$(eval $$(call create_overview_file,$1))
 324   $1_OPTIONS += -overview $$($1_OVERVIEW)
 325 
 326   $$(foreach g, $$($1_GROUPS), \
 327     $$(eval $1_OPTIONS += -group "$$($$g_GROUP_NAME)" "$$($$g_GROUP_MODULES)") \
 328   )
 329 
 330   ifeq ($$($1_JAVADOC_CMD), )
 331     $1_JAVADOC_CMD := $$(JAVA) -Djava.awt.headless=true $$($1_JAVA_ARGS) \
 332         $$(NEW_JAVADOC)
 333   endif
 334 
 335   $1_VARDEPS := $$($1_JAVA_ARGS) $$($1_OPTIONS) $$(MODULES_SOURCE_PATH) \
 336       $$($1_ALL_MODULES) $$($1_JAVADOC_CMD)
 337   $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \
 338       $$(SUPPORT_OUTPUTDIR)/docs/$1.vardeps)
 339 
 340   # Get a list of all files in all the source dirs for all included modules
 341   $1_SOURCE_DEPS := $$(call CacheFind, $$(wildcard $$(foreach module, \
 342       $$($1_ALL_MODULES), $$(call FindModuleSrcDirs, $$(module)))))
 343 
 344   # Javadoc creates a lot of files but use index.html as a marker
 345   $$($1_TARGET_DIR)/index.html: $$(BUILD_TOOLS_JDK) $$($1_VARDEPS_FILE) \
 346       $$($1_SOURCE_DEPS) $$($1_OVERVIEW)
 347         $$(call LogWarn, Generating $1 javadoc for \
 348             $$(words $$($1_ALL_MODULES)) modules)
 349         $$(call LogInfo, Javadoc modules: $$($1_ALL_MODULES))
 350         $$(call MakeDir, $$($1_TARGET_DIR))
 351         $$(call ExecuteWithLog, $$(SUPPORT_OUTPUTDIR)/docs/$1, \
 352             $$($1_JAVADOC_CMD) -d $$($1_TARGET_DIR) \
 353                 $$($1_OPTIONS) $$($1_LOG_OPTION))
 354 
 355   $1_JAVADOC_TARGETS := $$($1_TARGET_DIR)/index.html
 356 
 357   ifeq ($$(ENABLE_FULL_DOCS), true)
 358     # We have asked ModuleGraph to generate links to png files. Now we must
 359     # produce the png files.
 360 
 361     # Locate which modules has the @moduleGraph tag in their module-info.java
 362     $1_MODULES_NEEDING_GRAPH := $$(strip $$(foreach m, $$($1_ALL_MODULES), \
 363       $$(if $$(shell $$(GREP) -e @moduleGraph \
 364           $$(wildcard $$(addsuffix /module-info.java, \
 365           $$(call FindModuleSrcDirs, $$m)))), \
 366         $$m) \
 367     ))
 368 
 369     # First we run the GenGraph tool. It will query the module structure of the
 370     # running JVM and output .dot files for all existing modules.
 371     GENGRAPHS_PROPS := \
 372         $$(TOPDIR)/make/jdk/src/classes/build/tools/jigsaw/javadoc-graphs.properties
 373 
 374     $1_GENGRAPHS_DIR := $$(SUPPORT_OUTPUTDIR)/docs/$1-gengraphs
 375     $1_GENGRAPHS_MARKER := $$($1_GENGRAPHS_DIR)/_gengraphs_run.marker
 376 
 377     $$($1_GENGRAPHS_MARKER): $$(BUILD_JIGSAW_TOOLS) $$(GENGRAPHS_PROPS)
 378         $$(call LogInfo, Running gengraphs for $1 documentation)
 379         $$(call MakeDir, $$($1_GENGRAPHS_DIR))
 380         $$(call ExecuteWithLog, $$($1_GENGRAPHS_DIR)/gengraphs, \
 381             $$(TOOL_GENGRAPHS) --spec --output $$($1_GENGRAPHS_DIR) \
 382             --dot-attributes $$(GENGRAPHS_PROPS) && \
 383             $$(TOUCH) $$($1_GENGRAPHS_MARKER))
 384 
 385     # For each module needing a graph, create a png file from the dot file
 386     # generated by the GenGraphs tool and store it in the target dir.
 387     # They will depend on $1_GENGRAPHS_MARKER, and will be added to $1.
 388     $$(foreach m, $$($1_MODULES_NEEDING_GRAPH), \
 389       $$(eval $$(call setup_gengraph_dot_to_png,$1,$$m)) \
 390     )
 391   endif
 392 endef
 393 
 394 ################################################################################
 395 # Setup generation of the JDK API documentation (javadoc + modulegraph)
 396 
 397 # Define the groups of the JDK API documentation
 398 JavaSE_GROUP_NAME := Java SE
 399 JavaSE_GROUP_MODULES := $(call ColonList, $(sort java.se.ee \
 400     $(call FindTransitiveIndirectDepsForModules, java.se.ee)))
 401 JavaSE_GROUP_DESCRIPTION := \
 402     The Java Platform, Standard Edition (Java SE) APIs define the core Java \
 403     platform for general-purpose computing. These APIs are in modules whose \
 404     names start with {@code java}. \
 405     #
 406 JDK_GROUPS += JavaSE
 407 
 408 JDK_GROUP_NAME := JDK
 409 JDK_GROUP_MODULES := jdk.*
 410 JDK_GROUP_DESCRIPTION := \
 411     The Java Development Kit (JDK) APIs are specific to the JDK and will not \
 412     necessarily be available in all implementations of the Java SE Platform. \
 413     These APIs are in modules whose names start with {@code jdk}. \
 414     #
 415 JDK_GROUPS += JDK
 416 
 417 # If we are importing JavaFX, we need a JavaFX group. In an ideal world, this
 418 # would have been abstracted away to a more proper generic handling of imported
 419 # modules.
 420 ifneq ($(findstring javafx., $(IMPORTED_MODULES)), )
 421   JavaFX_GROUP_NAME := JavaFX
 422   JavaFX_GROUP_MODULES := javafx.*
 423   JavaFX_GROUP_DESCRIPTION := \
 424       The JavaFX APIs define a set of user-interface controls, graphics, \
 425       media, and web packages for developing rich client applications. These \
 426       APIs are in modules whose names start with {@code javafx}. \
 427       #
 428   JDK_GROUPS += JavaFX
 429 endif
 430 
 431 # All modules to have docs generated by docs-jdk-api target
 432 JDK_MODULES := $(sort $(DOCS_MODULES))
 433 
 434 $(eval $(call SetupApiDocsGeneration, JDK_API, \
 435     MODULES := $(JDK_MODULES), \
 436     GROUPS := $(JDK_GROUPS), \
 437     SHORT_NAME := $(JDK_SHORT_NAME), \
 438     LONG_NAME := $(JDK_LONG_NAME), \
 439     TARGET_DIR := $(DOCS_OUTPUTDIR)/api, \
 440 ))
 441 
 442 # Targets generated are returned in JDK_API_JAVADOC_TARGETS and
 443 # JDK_API_MODULEGRAPH_TARGETS.
 444 
 445 ################################################################################
 446 # Setup generation of the Java SE API documentation (javadoc + modulegraph)
 447 
 448 # The Java SE module scope is just java.se.ee and its transitive indirect
 449 # exports.
 450 JAVASE_MODULES := java.se.ee
 451 
 452 $(eval $(call SetupApiDocsGeneration, JAVASE_API, \
 453     MODULES := $(JAVASE_MODULES), \
 454     SHORT_NAME := $(JAVASE_SHORT_NAME), \
 455     LONG_NAME := $(JAVASE_LONG_NAME), \
 456     TARGET_DIR := $(IMAGES_OUTPUTDIR)/javase-docs/api, \
 457 ))
 458 
 459 # Targets generated are returned in JAVASE_API_JAVADOC_TARGETS and
 460 # JAVASE_API_MODULEGRAPH_TARGETS.
 461 
 462 ################################################################################
 463 # Setup generation of the reference Java SE API documentation (javadoc + modulegraph)
 464 
 465 # The reference javadoc is just the same as javase, but using the BootJDK javadoc
 466 # and a stable set of javadoc options.
 467 
 468 $(eval $(call SetupApiDocsGeneration, REFERENCE_API, \
 469     MODULES := $(JAVASE_MODULES), \
 470     SHORT_NAME := $(JAVASE_SHORT_NAME), \
 471     LONG_NAME := $(JAVASE_LONG_NAME), \
 472     TARGET_DIR := $(IMAGES_OUTPUTDIR)/reference-docs/api, \
 473     JAVADOC_CMD := $(JAVADOC), \
 474     OPTIONS := $(REFERENCE_OPTIONS), \
 475     TAGS := $(REFERENCE_TAGS), \
 476 ))
 477 
 478 # Targets generated are returned in REFERENCE_API_JAVADOC_TARGETS and
 479 # REFERENCE_API_MODULEGRAPH_TARGETS.
 480 
 481 ################################################################################
 482 
 483 JDK_INDEX_HTML := $(DOCS_OUTPUTDIR)/index.html
 484 
 485 $(JDK_INDEX_HTML):
 486         $(ECHO) '$(JDK_INDEX_CONTENT)' > $@
 487 
 488 JDK_INDEX_TARGETS += $(JDK_INDEX_HTML)
 489 
 490 # Copy the global resources
 491 GLOBAL_SPECS_RESOURCES_DIR := $(TOPDIR)/make/data/docs-resources/
 492 $(eval $(call SetupCopyFiles, COPY_GLOBAL_RESOURCES, \
 493     SRC := $(GLOBAL_SPECS_RESOURCES_DIR), \
 494     FILES := $(call CacheFind, $(GLOBAL_SPECS_RESOURCES_DIR)), \
 495     DEST := $(DOCS_OUTPUTDIR), \
 496 ))
 497 JDK_INDEX_TARGETS += $(COPY_GLOBAL_RESOURCES)
 498 
 499 # Copy the legal notices distributed with the docs bundle
 500 DOCS_LEGAL_NOTICES := jquery.md jszip.md pako.md
 501 $(eval $(call SetupCopyFiles, COPY_DOCS_LEGAL_NOTICES, \
 502     SRC := $(TOPDIR)/src/jdk.javadoc/share/legal, \
 503     FILES := $(DOCS_LEGAL_NOTICES), \
 504     DEST := $(DOCS_OUTPUTDIR)/legal, \
 505 ))
 506 JDK_INDEX_TARGETS += $(COPY_DOCS_LEGAL_NOTICES)
 507 
 508 ################################################################################
 509 # Copy JDK specs files
 510 
 511 # For all html documentation in $module/share/specs directories, copy it
 512 # unmodified
 513 
 514 ALL_MODULES := $(call FindAllModules)
 515 COPY_SPEC_FILTER := %.html %.gif %.jpg %.mib %.css
 516 
 517 $(foreach m, $(ALL_MODULES), \
 518   $(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \
 519   $(foreach d, $(SPECS_$m), \
 520     $(if $(filter $(COPY_SPEC_FILTER), $(call CacheFind, $d)), \
 521       $(eval $(call SetupCopyFiles, COPY_$m, \
 522           SRC := $d, \
 523           FILES := $(filter $(COPY_SPEC_FILTER), $(call CacheFind, $d)), \
 524           DEST := $(DOCS_OUTPUTDIR)/specs/, \
 525       )) \
 526       $(eval JDK_SPECS_TARGETS += $(COPY_$m)) \
 527     ) \
 528   ) \
 529 )
 530 
 531 ifeq ($(ENABLE_FULL_DOCS), true)
 532   # For all markdown files in $module/share/specs directories, convert them to
 533   # html.
 534 
 535   GLOBAL_SPECS_DEFAULT_CSS_FILE := $(DOCS_OUTPUTDIR)/resources/jdk-default.css
 536 
 537   $(foreach m, $(ALL_MODULES), \
 538     $(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \
 539     $(foreach d, $(SPECS_$m), \
 540       $(if $(filter %.md, $(call CacheFind, $d)), \
 541         $(eval $m_$d_NAME := CONVERT_MARKDOWN_$m_$(strip $(call RelativePath, $d, $(TOPDIR)))) \
 542         $(eval $(call SetupProcessMarkdown, $($m_$d_NAME), \
 543             SRC := $d, \
 544             FILES := $(filter %.md, $(call CacheFind, $d)), \
 545             DEST := $(DOCS_OUTPUTDIR)/specs/, \
 546             CSS := $(GLOBAL_SPECS_DEFAULT_CSS_FILE), \
 547         )) \
 548         $(eval JDK_SPECS_TARGETS += $($($m_$d_NAME))) \
 549       ) \
 550     ) \
 551   )
 552 endif
 553 
 554 # Special treatment for generated documentation
 555 
 556 JDWP_PROTOCOL := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/jdwp-protocol.html
 557 $(eval $(call SetupCopyFiles, COPY_JDWP_PROTOCOL, \
 558     FILES := $(JDWP_PROTOCOL), \
 559     DEST := $(DOCS_OUTPUTDIR)/specs/jdwp, \
 560 ))
 561 JDK_SPECS_TARGETS += $(COPY_JDWP_PROTOCOL)
 562 
 563 # Get jvmti.html from the main jvm variant (all variants' jvmti.html are identical).
 564 JVMTI_HTML := $(HOTSPOT_OUTPUTDIR)/variant-$(JVM_VARIANT_MAIN)/gensrc/jvmtifiles/jvmti.html
 565 $(eval $(call SetupCopyFiles, COPY_JVMTI_HTML, \
 566     FILES := $(JVMTI_HTML), \
 567     DEST := $(DOCS_OUTPUTDIR)/specs, \
 568 ))
 569 JDK_SPECS_TARGETS += $(COPY_JVMTI_HTML)
 570 
 571 ################################################################################
 572 # Optional target which bundles all generated javadocs into a zip archive.
 573 
 574 JAVADOC_ZIP_NAME := jdk-$(VERSION_STRING)-docs.zip
 575 JAVADOC_ZIP_FILE := $(OUTPUTDIR)/bundles/$(JAVADOC_ZIP_NAME)
 576 
 577 $(eval $(call SetupZipArchive, BUILD_JAVADOC_ZIP, \
 578     SRC := $(DOCS_OUTPUTDIR), \
 579     ZIP := $(JAVADOC_ZIP_FILE), \
 580     EXTRA_DEPS := $(JDK_API_JAVADOC_TARGETS) $(JDK_API_MODULEGRAPH_TARGETS) \
 581         $(JDK_SPECS_TARGETS), \
 582 ))
 583 
 584 ZIP_TARGETS += $(BUILD_JAVADOC_ZIP)
 585 
 586 ################################################################################
 587 
 588 docs-jdk-api-javadoc: $(JDK_API_JAVADOC_TARGETS) $(JDK_API_CUSTOM_TARGETS)
 589 
 590 docs-jdk-api-modulegraph: $(JDK_API_MODULEGRAPH_TARGETS)
 591 
 592 docs-javase-api-javadoc: $(JAVASE_API_JAVADOC_TARGETS) $(JAVASE_API_CUSTOM_TARGETS)
 593 
 594 docs-javase-api-modulegraph: $(JAVASE_API_MODULEGRAPH_TARGETS)
 595 
 596 docs-reference-api-javadoc: $(REFERENCE_API_JAVADOC_TARGETS) $(REFERENCE_API_CUSTOM_TARGETS)
 597 
 598 docs-reference-api-modulegraph: $(REFERENCE_API_MODULEGRAPH_TARGETS)
 599 
 600 docs-jdk-specs: $(JDK_SPECS_TARGETS)
 601 
 602 docs-jdk-index: $(JDK_INDEX_TARGETS)
 603 
 604 docs-zip: $(ZIP_TARGETS)
 605 
 606 all: docs-jdk-api-javadoc docs-jdk-api-modulegraph docs-javase-api-javadoc \
 607     docs-javase-api-modulegraph docs-reference-api-javadoc \
 608     docs-reference-api-modulegraph docs-jdk-specs docs-jdk-index docs-zip
 609 
 610 .PHONY: default all docs-jdk-api-javadoc docs-jdk-api-modulegraph \
 611     docs-javase-api-javadoc docs-javase-api-modulegraph \
 612     docs-reference-api-javadoc docs-reference-api-modulegraph docs-jdk-specs \
 613     docs-jdk-index docs-zip