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/java9speclicense.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 # Which doclint checks to ignore
 101 JAVADOC_DISABLED_DOCLINT := accessibility html missing syntax reference
 102 
 103 # The initial set of options for javadoc
 104 JAVADOC_OPTIONS := -use -keywords -notimestamp \
 105     -serialwarn -encoding ISO-8859-1 -docencoding UTF-8 -breakiterator \
 106     -splitIndex --system none -html5 -javafx --expand-requires transitive
 107 
 108 # Should we add DRAFT stamps to the generated javadoc?
 109 ifeq ($(VERSION_IS_GA), true)
 110   IS_DRAFT := false
 111 else
 112   IS_DRAFT := true
 113 endif
 114 
 115 ################################################################################
 116 # General text snippets
 117 
 118 FULL_COMPANY_NAME := Oracle and/or its affiliates
 119 COMPANY_ADDRESS := 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 120 
 121 JAVA_PLATFORM := Java Platform
 122 
 123 ifeq ($(IS_DRAFT), true)
 124   DRAFT_MARKER_STR := <br><strong>DRAFT $(VERSION_STRING)</strong>
 125   ifeq ($(VERSION_BUILD), 0)
 126     DRAFT_MARKER_TITLE := [ad-hoc build]
 127   else
 128     DRAFT_MARKER_TITLE := [build $(VERSION_BUILD)]
 129   endif
 130   DRAFT_TEXT := This specification is not final and is subject to change. \
 131       Use is subject to <a href="$(LICENSE_URL)">license terms</a>.
 132 endif
 133 
 134 JAVADOC_BOTTOM := \
 135     <a href="$(BUG_SUBMIT_URL)">Report a bug or suggest an enhancement</a><br> \
 136     For further API reference and developer documentation see the \
 137     <a href="$(JAVADOC_BASE_URL)" target="_blank">Java SE \
 138     Documentation</a>, which contains more detailed, \
 139     developer-targeted descriptions with conceptual overviews, definitions \
 140     of terms, workarounds, and working code examples.<br> \
 141     Java is a trademark or registered trademark of $(FULL_COMPANY_NAME) in \
 142     the US and other countries.<br> \
 143     <a href="$(COPYRIGHT_URL)">Copyright</a> \
 144     &copy; 1993, $(COPYRIGHT_YEAR), $(FULL_COMPANY_NAME), \
 145     $(COMPANY_ADDRESS).<br>All rights reserved. \
 146     Use is subject to <a href="$(LICENSE_URL)">license terms</a> and the \
 147     <a href="$(REDISTRIBUTION_URL)">documentation redistribution policy</a>. \
 148     $(DRAFT_MARKER_STR) <!-- Version $(VERSION_STRING) -->
 149 
 150 
 151 JAVADOC_TOP := \
 152     <div style="padding: 6px; text-align: center; font-size: 80%; \
 153     font-family: DejaVu Sans, Arial, Helvetica, sans-serif; \
 154     font-weight: normal;">$(DRAFT_TEXT)</div>
 155 
 156 ################################################################################
 157 # JDK javadoc titles/text snippets
 158 
 159 JDK_SHORT_NAME := Java SE $(VERSION_SPECIFICATION) &amp; JDK $(VERSION_SPECIFICATION)
 160 JDK_LONG_NAME := Java<sup>&reg;</sup> Platform, Standard Edition \
 161     &amp;&nbsp;Java&nbsp;Development&nbsp;Kit
 162 
 163 ################################################################################
 164 # Java SE javadoc titles/text snippets
 165 
 166 JAVASE_SHORT_NAME := Java SE $(VERSION_SPECIFICATION)
 167 JAVASE_LONG_NAME := Java<sup>&reg;</sup> Platform, Standard Edition
 168 
 169 ################################################################################
 170 # Functions
 171 
 172 # Helper function for creating a png file from a dot file generated by the
 173 # GenGraphs tool.
 174 # param 1: SetupJavadocGeneration namespace ($1)
 175 # param 2: module name
 176 #
 177 define setup_gengraph_dot_to_png
 178   $1_$2_DOT_SRC :=  $$($1_GENGRAPHS_DIR)/$2.dot
 179   $1_$2_PNG_TARGET := $$($1_TARGET_DIR)/$2-graph.png
 180 
 181     # For each module needing a graph, create a png file from the dot file
 182     # generated by the GenGraphs tool and store it in the target dir.
 183     $$($1_$2_PNG_TARGET): $$($1_GENGRAPHS_MARKER)
 184         $$(call MakeDir, $$(@D))
 185         $$(call ExecuteWithLog, $$($1_$2_DOT_SRC), \
 186             $$(DOT) -Tpng -o $$($1_$2_PNG_TARGET) $$($1_$2_DOT_SRC))
 187 
 188   $1_MODULEGRAPH_TARGETS += $$($1_$2_PNG_TARGET)
 189 endef
 190 
 191 # Helper function to create the overview.html file to use with the -overview
 192 # javadoc option.
 193 # Returns the filename as $1_OVERVIEW.
 194 #
 195 # param 1: SetupJavadocGeneration namespace ($1)
 196 define create_overview_file
 197   $1_OVERVIEW_TEXT := \
 198       <!DOCTYPE html> \
 199       <html><head></head><body> \
 200       #
 201   ifneq ($$($1_GROUPS),)
 202     $1_OVERVIEW_TEXT += \
 203       <p>This document is divided into \
 204       $$(subst 2,two,$$(subst 3,three,$$(words $$($1_GROUPS)))) sections:</p> \
 205       <blockquote><dl> \
 206       #
 207     $1_OVERVIEW_TEXT += $$(foreach g, $$($1_GROUPS), \
 208         <dt style="margin-top: 8px;"><a href="\#$$g">$$($$g_GROUP_NAME)</a></dt> \
 209         <dd style="margin-top: 8px;">$$($$g_GROUP_DESCRIPTION)</dd> \
 210     )
 211     $1_OVERVIEW_TEXT += \
 212         </dl></blockquote> \
 213         #
 214   endif
 215   $1_OVERVIEW_TEXT += \
 216       </body></html> \
 217       #
 218 
 219   $1_OVERVIEW := $$(SUPPORT_OUTPUTDIR)/docs/$1-overview.html
 220 
 221   $1_OVERVIEW_VARDEPS_FILE := $$(call DependOnVariable, $1_OVERVIEW_TEXT, \
 222       $$($1_OVERVIEW).vardeps)
 223 
 224   $$($1_OVERVIEW): $$($1_OVERVIEW_VARDEPS_FILE)
 225         $$(call LogInfo, Creating overview.html for $1)
 226         $$(call MakeDir, $$(@D))
 227         $$(PRINTF) > $$@ '$$($1_OVERVIEW_TEXT)'
 228 endef
 229 
 230 ################################################################################
 231 # Setup make rules to create an API documentation collection, using javadoc and
 232 # other tools if needed.
 233 #
 234 # Parameter 1 is the name of the rule. This name is used as variable prefix.
 235 # Targets generated are returned as $1_JAVADOC_TARGETS and
 236 # $1_MODULEGRAPH_TARGETS. Note that the index.html file will work as a "touch
 237 # file" for all the magnitude of files that are generated by javadoc.
 238 #
 239 # Remaining parameters are named arguments. These include:
 240 #   MODULES - Modules to generate javadoc for
 241 #   GROUPS - Name of the groups to divide the modules into, if any
 242 #   SHORT_NAME - The short name of this documentation collection
 243 #   LONG_NAME - The long name of this documentation collection
 244 #   TARGET_DIR - Where to store the output
 245 #
 246 SetupApiDocsGeneration = $(NamedParamsMacroTemplate)
 247 define SetupApiDocsGenerationBody
 248 
 249   # Figure out all modules, both specified and transitive indirect exports, that
 250   # will be processed by javadoc.
 251   $1_INDIRECT_EXPORTS := $$(call FindTransitiveIndirectDepsForModules, $$($1_MODULES))
 252   $1_ALL_MODULES := $$(sort $$($1_MODULES) $$($1_INDIRECT_EXPORTS))
 253 
 254   ifeq ($$(ENABLE_FULL_DOCS), true)
 255     # Tell the ModuleGraph taglet to generate html links to soon-to-be-created
 256     # png files with module graphs.
 257     $1_JAVA_ARGS += -DenableModuleGraph=true
 258   endif
 259 
 260   # Always include tags and basic options
 261   $1_OPTIONS := $$(JAVADOC_TAGS) $$(JAVADOC_OPTIONS)
 262 
 263   $1_OPTIONS += --module-source-path $$(MODULES_SOURCE_PATH)
 264   $1_OPTIONS += --module $$(call CommaList, $$($1_MODULES))
 265 
 266   # Create a string like "-Xdoclint:all,-syntax,-html,..."
 267   $1_OPTIONS += -Xdoclint:all,$$(call CommaList, $$(addprefix -, \
 268       $$(JAVADOC_DISABLED_DOCLINT)))
 269 
 270   $1_DOC_TITLE := $$($1_LONG_NAME)<br>Version $$(VERSION_SPECIFICATION) API Specification
 271   $1_WINDOW_TITLE := $$(subst &amp;,&,$$($1_SHORT_NAME)) \
 272     $$(DRAFT_MARKER_TITLE)
 273   ifeq ($(VERSION_IS_GA), true) # Workaround stylesheet bug
 274     $1_HEADER_PAD := 14
 275   else
 276     $1_HEADER_PAD := 9
 277   endif
 278   $1_HEADER_TITLE := <div style="margin-top: $$($1_HEADER_PAD)px;"><strong>$$($1_SHORT_NAME)</strong> \
 279       $$(DRAFT_MARKER_STR)</div>
 280 
 281   $1_OPTIONS += -doctitle '$$($1_DOC_TITLE)'
 282   $1_OPTIONS += -windowtitle '$$($1_WINDOW_TITLE)'
 283   $1_OPTIONS += -header '$$($1_HEADER_TITLE)'
 284   $1_OPTIONS += -bottom '$$(JAVADOC_BOTTOM)'
 285   ifeq ($$(IS_DRAFT), true)
 286     $1_OPTIONS += -top '$$(JAVADOC_TOP)'
 287   endif
 288 
 289   # Do not store debug level options in VARDEPS.
 290   ifneq ($$(LOG_LEVEL), trace)
 291     $1_LOG_OPTION += -quiet
 292   else
 293     $1_LOG_OPTION += -verbose
 294   endif
 295 
 296   # Generate the overview.html file. This will return the filename in
 297   # $1_OVERVIEW.
 298   $$(eval $$(call create_overview_file,$1))
 299   $1_OPTIONS += -overview $$($1_OVERVIEW)
 300 
 301   $$(foreach g, $$($1_GROUPS), \
 302     $$(eval $1_OPTIONS += -group "$$($$g_GROUP_NAME)" "$$($$g_GROUP_MODULES)") \
 303   )
 304 
 305   $1_VARDEPS := $$($1_JAVA_ARGS) $$($1_OPTIONS) $$(MODULES_SOURCE_PATH) \
 306       $$($1_ALL_MODULES)
 307   $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \
 308       $$(SUPPORT_OUTPUTDIR)/docs/$1.vardeps)
 309 
 310   # Get a list of all files in all the source dirs for all included modules
 311   $1_SOURCE_DEPS := $$(call CacheFind, $$(wildcard $$(foreach module, \
 312       $$($1_ALL_MODULES), $$(call FindModuleSrcDirs, $$(module)))))
 313 
 314   # Javadoc creates a lot of files but use index.html as a marker
 315   $$($1_TARGET_DIR)/index.html: $$(BUILD_TOOLS_JDK) $$($1_VARDEPS_FILE) \
 316       $$($1_SOURCE_DEPS) $$($1_OVERVIEW)
 317         $$(call LogWarn, Generating $1 javadoc for \
 318             $$(words $$($1_ALL_MODULES)) modules)
 319         $$(call LogInfo, Javadoc modules: $$($1_ALL_MODULES))
 320         $$(call MakeDir, $$($1_TARGET_DIR))
 321         $$(call ExecuteWithLog, $$(SUPPORT_OUTPUTDIR)/docs/$1, \
 322             $$(JAVA) -Djava.awt.headless=true $$($1_JAVA_ARGS) \
 323                 $$(NEW_JAVADOC) -d $$($1_TARGET_DIR) \
 324                 $$(JAVADOC_TAGS) $$($1_OPTIONS) $$($1_LOG_OPTION))
 325 
 326   $1_JAVADOC_TARGETS := $$($1_TARGET_DIR)/index.html
 327 
 328   ifeq ($$(ENABLE_FULL_DOCS), true)
 329     # We have asked ModuleGraph to generate links to png files. Now we must
 330     # produce the png files.
 331 
 332     # Locate which modules has the @moduleGraph tag in their module-info.java
 333     $1_MODULES_NEEDING_GRAPH := $$(strip $$(foreach m, $$($1_ALL_MODULES), \
 334       $$(if $$(shell $$(GREP) -e @moduleGraph \
 335           $$(wildcard $$(addsuffix /module-info.java, \
 336           $$(call FindModuleSrcDirs, $$m)))), \
 337         $$m) \
 338     ))
 339 
 340     # First we run the GenGraph tool. It will query the module structure of the
 341     # running JVM and output .dot files for all existing modules.
 342     GENGRAPHS_PROPS := \
 343         $$(TOPDIR)/make/jdk/src/classes/build/tools/jigsaw/javadoc-graphs.properties
 344 
 345     $1_GENGRAPHS_DIR := $$(SUPPORT_OUTPUTDIR)/docs/$1-gengraphs
 346     $1_GENGRAPHS_MARKER := $$($1_GENGRAPHS_DIR)/_gengraphs_run.marker
 347 
 348     $$($1_GENGRAPHS_MARKER): $$(BUILD_JIGSAW_TOOLS) $$(GENGRAPHS_PROPS)
 349         $$(call LogInfo, Running gengraphs for $1 documentation)
 350         $$(call MakeDir, $$($1_GENGRAPHS_DIR))
 351         $$(call ExecuteWithLog, $$($1_GENGRAPHS_DIR)/gengraphs, \
 352             $$(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
 363 endef
 364 
 365 ################################################################################
 366 # Setup generation of the JDK API documentation (javadoc + modulegraph)
 367 
 368 # Define the groups of the JDK API documentation
 369 JavaSE_GROUP_NAME := Java SE
 370 JavaSE_GROUP_MODULES := $(call ColonList, $(sort java.se.ee \
 371     $(call FindTransitiveIndirectDepsForModules, java.se.ee)))
 372 JavaSE_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     #
 377 JDK_GROUPS += JavaSE
 378 
 379 JDK_GROUP_NAME := JDK
 380 JDK_GROUP_MODULES := jdk.*
 381 JDK_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     #
 386 JDK_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.
 391 ifneq ($(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
 400 endif
 401 
 402 # All modules to have docs generated by docs-jdk-api target
 403 JDK_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.
 421 JAVASE_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 
 435 JDK_INDEX_HTML := $(DOCS_OUTPUTDIR)/index.html
 436 
 437 JDK_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 
 448 JDK_INDEX_TARGETS += $(JDK_INDEX_HTML)
 449 
 450 # Copy the global resources
 451 GLOBAL_SPECS_RESOURCES_DIR := $(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 ))
 457 JDK_INDEX_TARGETS += $(COPY_GLOBAL_RESOURCES)
 458 
 459 # Copy the legal notices distributed with the docs bundle
 460 DOCS_LEGAL_NOTICES := jquery.md jszip.md pako.md
 461 $(eval $(call SetupCopyFiles, COPY_DOCS_LEGAL_NOTICES, \
 462     SRC := $(TOPDIR)/src/jdk.javadoc/share/legal, \
 463     FILES := $(DOCS_LEGAL_NOTICES), \
 464     DEST := $(DOCS_OUTPUTDIR)/legal, \
 465 ))
 466 JDK_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 
 474 ALL_MODULES := $(call FindAllModules)
 475 COPY_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 
 491 ifeq ($(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 $m_$d_NAME := CONVERT_MARKDOWN_$m_$(strip $(call RelativePath, $d, $(TOPDIR)))) \
 502         $(eval $(call SetupProcessMarkdown, $($m_$d_NAME), \
 503             SRC := $d, \
 504             FILES := $(filter %.md, $(call CacheFind, $d)), \
 505             DEST := $(DOCS_OUTPUTDIR)/specs/, \
 506             CSS := $(GLOBAL_SPECS_DEFAULT_CSS_FILE), \
 507         )) \
 508         $(eval JDK_SPECS_TARGETS += $($($m_$d_NAME))) \
 509       ) \
 510     ) \
 511   )
 512 endif
 513 
 514 # Special treatment for generated documentation
 515 
 516 JDWP_PROTOCOL := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/jdwp-protocol.html
 517 $(eval $(call SetupCopyFiles, COPY_JDWP_PROTOCOL, \
 518     FILES := $(JDWP_PROTOCOL), \
 519     DEST := $(DOCS_OUTPUTDIR)/specs/jdwp, \
 520 ))
 521 JDK_SPECS_TARGETS += $(COPY_JDWP_PROTOCOL)
 522 
 523 # Get jvmti.html from the main jvm variant (all variants' jvmti.html are identical).
 524 JVMTI_HTML := $(HOTSPOT_OUTPUTDIR)/variant-$(JVM_VARIANT_MAIN)/gensrc/jvmtifiles/jvmti.html
 525 $(eval $(call SetupCopyFiles, COPY_JVMTI_HTML, \
 526     FILES := $(JVMTI_HTML), \
 527     DEST := $(DOCS_OUTPUTDIR)/specs, \
 528 ))
 529 JDK_SPECS_TARGETS += $(COPY_JVMTI_HTML)
 530 
 531 ################################################################################
 532 # Optional target which bundles all generated javadocs into a zip archive.
 533 
 534 JAVADOC_ZIP_NAME := jdk-$(VERSION_STRING)-docs.zip
 535 JAVADOC_ZIP_FILE := $(OUTPUTDIR)/bundles/$(JAVADOC_ZIP_NAME)
 536 
 537 $(eval $(call SetupZipArchive, BUILD_JAVADOC_ZIP, \
 538     SRC := $(DOCS_OUTPUTDIR), \
 539     ZIP := $(JAVADOC_ZIP_FILE), \
 540     EXTRA_DEPS := $(JDK_API_JAVADOC_TARGETS) $(JDK_API_MODULEGRAPH_TARGETS) \
 541         $(JDK_SPECS_TARGETS), \
 542 ))
 543 
 544 ZIP_TARGETS += $(BUILD_JAVADOC_ZIP)
 545 
 546 ################################################################################
 547 
 548 docs-jdk-api-javadoc: $(JDK_API_JAVADOC_TARGETS) $(JDK_API_CUSTOM_TARGETS)
 549 
 550 docs-jdk-api-modulegraph: $(JDK_API_MODULEGRAPH_TARGETS)
 551 
 552 docs-javase-api-javadoc: $(JAVASE_API_JAVADOC_TARGETS) $(JAVASE_API_CUSTOM_TARGETS)
 553 
 554 docs-javase-api-modulegraph: $(JAVASE_API_MODULEGRAPH_TARGETS)
 555 
 556 docs-jdk-specs: $(JDK_SPECS_TARGETS)
 557 
 558 docs-jdk-index: $(JDK_INDEX_TARGETS)
 559 
 560 docs-zip: $(ZIP_TARGETS)
 561 
 562 all: docs-jdk-api-javadoc docs-jdk-api-modulegraph docs-javase-api-javadoc \
 563     docs-javase-api-modulegraph docs-jdk-specs docs-jdk-index docs-zip
 564 
 565 .PHONY: default all docs-jdk-api-javadoc docs-jdk-api-modulegraph \
 566     docs-javase-api-javadoc docs-javase-api-modulegraph docs-jdk-specs \
 567     docs-jdk-index docs-zip