1 # Copyright (c) 1997, 2024, 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 30 include CopyFiles.gmk 31 include Execute.gmk 32 include Modules.gmk 33 include ModuleTools.gmk 34 include ProcessMarkdown.gmk 35 include ToolsJdk.gmk 36 include ZipArchive.gmk 37 include TextFileProcessing.gmk 38 39 # This is needed to properly setup DOCS_MODULES. 40 $(eval $(call ReadImportMetaData)) 41 42 ################################################################################ 43 # Hook to include the corresponding custom file, if present. 44 $(eval $(call IncludeCustomExtension, Docs.gmk)) 45 46 ################################################################################ 47 # This file generates all documentation for OpenJDK. 48 # 49 # We will generate API documentation for two different selections of the source 50 # code: "Java SE", which contains just the modules covered by the top-level 51 # module java.se and "JDK", which covers all of Java SE and also all 52 # other available modules that should be documented, including imported modules, 53 # if any. 54 # 55 # We will also generate separate, free-standing specifications from either 56 # markdown or existing html files. 57 # 58 59 ################################################################################ 60 # Javadoc settings 61 62 # Include configuration for URLs in generated javadoc 63 include $(TOPDIR)/make/conf/javadoc.conf 64 65 MODULES_SOURCE_PATH := $(call PathList, $(call GetModuleSrcPath) ) 66 67 68 # In order to get a specific ordering it's necessary to specify the total 69 # ordering of tags as the tags are otherwise ordered in order of definition. 70 JAVADOC_TAGS := \ 71 -tag 'apiNote:a:API Note:' \ 72 -tag 'implSpec:a:Implementation Requirements:' \ 73 -tag 'implNote:a:Implementation Note:' \ 74 -tag param \ 75 -tag return \ 76 -tag throws \ 77 -taglet build.tools.taglet.JSpec\$$JLS \ 78 -taglet build.tools.taglet.JSpec\$$JVMS \ 79 -taglet build.tools.taglet.ModuleGraph \ 80 -taglet build.tools.taglet.SealedGraph \ 81 -taglet build.tools.taglet.ToolGuide \ 82 -tag since \ 83 -tag serialData \ 84 -tag factory \ 85 -tag spec \ 86 -tag see \ 87 -taglet build.tools.taglet.ExtLink \ 88 -taglet build.tools.taglet.Incubating \ 89 -tagletpath $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \ 90 $(CUSTOM_JAVADOC_TAGS) \ 91 # 92 93 # The reference tags must stay stable to allow for comparisons across the 94 # development cycle. If JAVADOC_TAGS needs to change, make sure that 95 # REFERENCE_TAGS remains unchanged, by copying and hardcoding, if necessary. 96 REFERENCE_TAGS := $(JAVADOC_TAGS) 97 98 # Which doclint checks to ignore 99 JAVADOC_DISABLED_DOCLINT_WARNINGS := missing 100 JAVADOC_DISABLED_DOCLINT_PACKAGES := org.w3c.* javax.smartcardio 101 102 # Allow overriding on the command line 103 # (intentionally sharing name with the javac option) 104 JAVA_WARNINGS_ARE_ERRORS ?= -Werror 105 106 # The initial set of options for javadoc 107 JAVADOC_OPTIONS := -XDignore.symbol.file=true -use -keywords -notimestamp \ 108 -encoding ISO-8859-1 -docencoding UTF-8 -breakiterator \ 109 -splitIndex --system none -javafx --expand-requires transitive \ 110 -XDenableValueTypes \ 111 --enable-preview -source $(JDK_SOURCE_TARGET_VERSION) \ 112 --override-methods=summary \ 113 --no-external-specs-page 114 115 # The reference options must stay stable to allow for comparisons across the 116 # development cycle. 117 REFERENCE_OPTIONS := -XDignore.symbol.file=true -use -keywords -notimestamp \ 118 -encoding ISO-8859-1 -breakiterator -splitIndex --system none \ 119 -html5 -javafx --expand-requires transitive \ 120 --no-external-specs-page 121 122 # Should we add DRAFT stamps to the generated javadoc? 123 ifeq ($(VERSION_IS_GA), true) 124 IS_DRAFT := false 125 else 126 IS_DRAFT := true 127 endif 128 129 ################################################################################ 130 # General text snippets 131 132 FULL_COMPANY_NAME := Oracle and/or its affiliates 133 COMPANY_ADDRESS := 500 Oracle Parkway, Redwood Shores, CA 94065 USA 134 135 JAVA_PLATFORM := Java Platform 136 137 ifeq ($(IS_DRAFT), true) 138 DRAFT_MARKER_STR := <br><strong>DRAFT $(VERSION_STRING)</strong> 139 ifeq ($(VERSION_BUILD), ) 140 DRAFT_MARKER_TITLE := $(SPACE)[ad-hoc build] 141 else 142 DRAFT_MARKER_TITLE := $(SPACE)[build $(VERSION_BUILD)] 143 endif 144 DRAFT_TEXT := This specification is not final and is subject to change. \ 145 Use is subject to <a href="$(LICENSE_URL)">license terms</a>. 146 endif 147 148 # $1 - Relative prefix to COPYRIGHT_URL 149 COPYRIGHT_BOTTOM = \ 150 <a href="$(strip $1)$(COPYRIGHT_URL)">Copyright</a> \ 151 © 1993, $(COPYRIGHT_YEAR), $(FULL_COMPANY_NAME), \ 152 $(COMPANY_ADDRESS).<br>All rights reserved. \ 153 Use is subject to <a href="$(LICENSE_URL)">license terms</a> and the \ 154 <a href="$(REDISTRIBUTION_URL)">documentation redistribution policy</a>. \ 155 $(DRAFT_MARKER_STR) <!-- Version $(VERSION_STRING) --> 156 157 # $1 - Optional "Other Versions" link 158 JAVADOC_BOTTOM = \ 159 <a href="$(BUG_SUBMIT_URL)">Report a bug or suggest an enhancement</a><br> \ 160 For further API reference and developer documentation see the \ 161 <a href="$(JAVADOC_BASE_URL)" target="_blank">Java SE \ 162 Documentation</a>, which contains more detailed, \ 163 developer-targeted descriptions with conceptual overviews, definitions \ 164 of terms, workarounds, and working code examples. $1<br> \ 165 Java is a trademark or registered trademark of $(FULL_COMPANY_NAME) in \ 166 the US and other countries.<br> \ 167 $(call COPYRIGHT_BOTTOM, {@docroot}/../) 168 169 JAVADOC_TOP := \ 170 <div style="padding: 6px; text-align: center; font-size: 80%; \ 171 font-family: DejaVu Sans, Arial, Helvetica, sans-serif; \ 172 font-weight: normal;">$(DRAFT_TEXT)</div> 173 174 ################################################################################ 175 # JDK javadoc titles/text snippets 176 177 JDK_SHORT_NAME := Java SE $(VERSION_SPECIFICATION) & JDK $(VERSION_SPECIFICATION) 178 JDK_LONG_NAME := Java<sup>®</sup> Platform, Standard Edition \ 179 & Java Development Kit 180 181 ################################################################################ 182 # Java SE javadoc titles/text snippets 183 184 JAVASE_SHORT_NAME := Java SE $(VERSION_SPECIFICATION) 185 JAVASE_LONG_NAME := Java<sup>®</sup> Platform, Standard Edition 186 187 ################################################################################ 188 # Functions 189 190 # Helper function for creating a svg file from a dot file generated by the 191 # GenGraphs tool for a module. 192 # param 1: SetupJavadocGeneration namespace ($1) 193 # param 2: module name 194 # 195 define setup_module_graph_dot_to_svg 196 $1_$2_DOT_SRC := $$($1_MODULE_GRAPHS_DIR)/$2.dot 197 $1_$2_SVG_TARGET := $$($1_TARGET_DIR)/$2/module-graph.svg 198 199 # For each module needing a graph, create a svg file from the dot file 200 # generated by the GenGraphs tool and store it in the target dir. 201 $$(eval $$(call SetupExecute, module_graphs_svg_$1_$2, \ 202 INFO := Running dot for module graphs for $2, \ 203 DEPS := $$(module_graphs_dot_$1_TARGET), \ 204 OUTPUT_FILE := $$($1_$2_SVG_TARGET), \ 205 SUPPORT_DIR := $$($1_MODULE_GRAPHS_DIR), \ 206 COMMAND := $$(DOT) -Tsvg -o $$($1_$2_SVG_TARGET) $$($1_$2_DOT_SRC), \ 207 )) 208 209 $1_GRAPHS_TARGETS += $$($1_$2_SVG_TARGET) 210 endef 211 212 # Helper function for creating a svg file for a class for which the SealedGraph 213 # taglet has generated a dot file. The dot file has a special name which 214 # encodes the module and class the graph belongs to. 215 # 216 # param 1: SetupJavadocGeneration namespace ($1) 217 # param 2: dot file name 218 # 219 define setup_sealed_graph_dot_to_svg 220 $1_$2_DOT_SRC := $$($1_SEALED_GRAPHS_DIR)/$2.dot 221 $1_$2_TARGET_CLASS := $$(word 2, $$(subst _, , $2)) 222 $1_$2_SLASHED_NAME := $$(subst .,/, $$($1_$2_TARGET_CLASS)) 223 $1_$2_TARGET_MODULE := $$(word 1, $$(subst _, , $2)) 224 $1_$2_TARGET_PATH := $$($1_TARGET_DIR)/$$($1_$2_TARGET_MODULE)/$$(dir $$($1_$2_SLASHED_NAME)) 225 $1_$2_TARGET_NAME := $$(notdir $$($1_$2_SLASHED_NAME)) 226 $1_$2_SVG_TARGET := $$($1_$2_TARGET_PATH)/$$($1_$2_TARGET_NAME)-sealed-graph.svg 227 $$(call MakeDir, $$($1_$2_TARGET_PATH)) 228 229 # For each class needing a graph, create a svg file from the dot file 230 # generated by the SealedGraph taglet and store it in the target dir. 231 $$(eval $$(call SetupExecute, sealed_graphs_svg_$1_$2, \ 232 INFO := Running dot for sealed graphs for $$($1_$2_TARGET_MODULE)/$$($1_$2_TARGET_CLASS), \ 233 DEPS := $$($1_$2_DOT_SRC), \ 234 OUTPUT_FILE := $$($1_$2_SVG_TARGET), \ 235 SUPPORT_DIR := $$($1_SEALED_GRAPHS_DIR), \ 236 COMMAND := $$(DOT) -Tsvg -o $$($1_$2_SVG_TARGET) $$($1_$2_DOT_SRC), \ 237 )) 238 239 $1_GRAPHS_TARGETS += $$($1_$2_SVG_TARGET) 240 endef 241 242 # Helper function to create the overview.html file to use with the -overview 243 # javadoc option. 244 # Returns the filename as $1_OVERVIEW. 245 # 246 # param 1: SetupJavadocGeneration namespace ($1) 247 define create_overview_file 248 $1_OVERVIEW_TEXT := \ 249 <!DOCTYPE html> \ 250 <html><head></head><body> \ 251 # 252 ifneq ($$($1_GROUPS), ) 253 $1_OVERVIEW_TEXT += \ 254 <p>This document is divided into \ 255 $$(subst 2,two,$$(subst 3,three,$$(words $$($1_GROUPS)))) sections:</p> \ 256 <blockquote><dl> \ 257 # 258 $1_OVERVIEW_TEXT += $$(foreach g, $$($1_GROUPS), \ 259 <dt style="margin-top: 8px;">$$($$g_GROUP_NAME)</dt> \ 260 <dd style="margin-top: 8px;">$$($$g_GROUP_DESCRIPTION)</dd> \ 261 ) 262 $1_OVERVIEW_TEXT += \ 263 </dl></blockquote> \ 264 # 265 endif 266 $1_OVERVIEW_TEXT += \ 267 </body></html> \ 268 # 269 270 $1_OVERVIEW := $$(SUPPORT_OUTPUTDIR)/docs/$1-overview.html 271 272 $1_OVERVIEW_VARDEPS_FILE := $$(call DependOnVariable, $1_OVERVIEW_TEXT, \ 273 $$($1_OVERVIEW).vardeps) 274 275 $$($1_OVERVIEW): $$($1_OVERVIEW_VARDEPS_FILE) 276 $$(call LogInfo, Creating overview.html for $1) 277 $$(call MakeDir, $$(@D)) 278 $$(PRINTF) > $$@ '$$($1_OVERVIEW_TEXT)' 279 endef 280 281 ################################################################################ 282 # Setup make rules to create an API documentation collection, using javadoc and 283 # other tools if needed. 284 # 285 # Parameter 1 is the name of the rule. This name is used as variable prefix. 286 # Targets generated are returned as $1_JAVADOC_TARGETS and 287 # $1_GRAPHS_TARGETS. Note that the index.html file will work as a "touch 288 # file" for all the magnitude of files that are generated by javadoc. 289 # 290 # Remaining parameters are named arguments. These include: 291 # MODULES - Modules to generate javadoc for 292 # GROUPS - Name of the groups to divide the modules into, if any 293 # SHORT_NAME - The short name of this documentation collection 294 # LONG_NAME - The long name of this documentation collection 295 # TARGET_DIR - Where to store the output 296 # OTHER_VERSIONS - URL for other page listing versions 297 # 298 SetupApiDocsGeneration = $(NamedParamsMacroTemplate) 299 define SetupApiDocsGenerationBody 300 301 # Figure out all modules, both specified and transitive indirect exports, that 302 # will be processed by javadoc. 303 $1_INDIRECT_EXPORTS := $$(call FindTransitiveIndirectDepsForModules, $$($1_MODULES)) 304 $1_ALL_MODULES := $$(sort $$($1_MODULES) $$($1_INDIRECT_EXPORTS)) 305 306 $1_JAVA_ARGS := -Dextlink.spec.version=$$(VERSION_SPECIFICATION) \ 307 -Djspec.version=$$(VERSION_SPECIFICATION) 308 309 ifeq ($$(ENABLE_FULL_DOCS), true) 310 $1_SEALED_GRAPHS_DIR := $$(SUPPORT_OUTPUTDIR)/docs/$1-sealed-graphs 311 312 # Tell the ModuleGraph and SealedGraph taglets to generate html links to 313 # soon-to-be-created svg files with module/sealed graphs. 314 $1_JAVA_ARGS += -DenableModuleGraph=true -DsealedDotOutputDir=$$($1_SEALED_GRAPHS_DIR) 315 $$(call MakeDir, $$($1_SEALED_GRAPHS_DIR)) 316 endif 317 318 # Start with basic options and tags 319 ifeq ($$($1_OPTIONS), ) 320 $1_OPTIONS := $$(JAVADOC_OPTIONS) 321 endif 322 ifeq ($$($1_TAGS), ) 323 $1_TAGS := $$(JAVADOC_TAGS) 324 endif 325 $1_OPTIONS += $$($1_TAGS) 326 327 $1_OPTIONS += --module-source-path $$(MODULES_SOURCE_PATH) 328 $1_OPTIONS += --module $$(call CommaList, $$($1_MODULES)) 329 330 # Create a string like "-Xdoclint:all,-syntax,-html,..." 331 $1_OPTIONS += -Xdoclint:all,$$(call CommaList, $$(addprefix -, \ 332 $$(JAVADOC_DISABLED_DOCLINT_WARNINGS))) 333 # Ignore the doclint warnings in certain packages 334 $1_OPTIONS += -Xdoclint/package:$$(call CommaList, $$(addprefix -, \ 335 $$(JAVADOC_DISABLED_DOCLINT_PACKAGES))) 336 $1_OPTIONS += $$(JAVA_WARNINGS_ARE_ERRORS) 337 338 $1_DOC_TITLE := $$($1_LONG_NAME)<br>Version $$(VERSION_SPECIFICATION) API \ 339 Specification 340 $1_WINDOW_TITLE := $$(subst &,&,$$($1_SHORT_NAME))$$(DRAFT_MARKER_TITLE) 341 $1_HEADER_TITLE := <div><strong>$$($1_SHORT_NAME)</strong> \ 342 $$(DRAFT_MARKER_STR)</div> 343 ifneq ($$($1_OTHER_VERSIONS), ) 344 $1_JAVADOC_BOTTOM := $$(call JAVADOC_BOTTOM, <a href="$$($1_OTHER_VERSIONS)">Other versions.</a>) 345 else 346 $1_JAVADOC_BOTTOM := $$(call JAVADOC_BOTTOM, ) 347 endif 348 349 $1_OPTIONS += -doctitle '$$($1_DOC_TITLE)' 350 $1_OPTIONS += -windowtitle '$$($1_WINDOW_TITLE)' 351 $1_OPTIONS += -header '$$($1_HEADER_TITLE)' 352 $1_OPTIONS += -bottom '$$($1_JAVADOC_BOTTOM)' 353 ifeq ($$(IS_DRAFT), true) 354 $1_OPTIONS += -top '$$(JAVADOC_TOP)' 355 endif 356 357 # Do not store debug level options in VARDEPS. 358 ifneq ($$(LOG_LEVEL), trace) 359 $1_LOG_OPTION += -quiet 360 else 361 $1_LOG_OPTION += -verbose 362 endif 363 364 # Generate the overview.html file. This will return the filename in 365 # $1_OVERVIEW. 366 $$(eval $$(call create_overview_file,$1)) 367 $1_OPTIONS += -overview $$($1_OVERVIEW) 368 369 # Add summary pages for new/deprecated APIs in recent releases 370 $1_OPTIONS += --since $(call CommaList, \ 371 $(filter-out $(VERSION_DOCS_API_SINCE), \ 372 $(call sequence, $(VERSION_DOCS_API_SINCE), $(VERSION_FEATURE)))) 373 $1_OPTIONS += --since-label "New API since JDK $(VERSION_DOCS_API_SINCE)" 374 375 $$(foreach g, $$($1_GROUPS), \ 376 $$(eval $1_OPTIONS += -group "$$($$g_GROUP_NAME)" "$$($$g_GROUP_MODULES)") \ 377 ) 378 379 ifeq ($$($1_JAVADOC_CMD), ) 380 $1_JAVADOC_CMD := $$(JAVA) -Djava.awt.headless=true $$($1_JAVA_ARGS) \ 381 $$(NEW_JAVADOC) 382 else 383 $1_OPTIONS += $$(addprefix -J, $$($1_JAVA_ARGS)) 384 endif 385 386 $1_VARDEPS := $$($1_JAVA_ARGS) $$($1_OPTIONS) $$(MODULES_SOURCE_PATH) \ 387 $$($1_ALL_MODULES) $$($1_JAVADOC_CMD) 388 $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \ 389 $$(SUPPORT_OUTPUTDIR)/docs/$1.vardeps) 390 391 # Get a list of all files in all the source dirs for all included modules 392 $1_SOURCE_DEPS := $$(call FindFiles, $$(wildcard $$(foreach module, \ 393 $$($1_ALL_MODULES), $$(call FindModuleSrcDirs, $$(module))))) 394 395 $$(eval $$(call SetupExecute, javadoc_$1, \ 396 WARN := Generating $1 javadoc for $$(words $$($1_ALL_MODULES)) modules, \ 397 INFO := Javadoc modules: $$($1_ALL_MODULES), \ 398 DEPS := $$(BUILD_TOOLS_JDK) $$($1_VARDEPS_FILE) $$($1_SOURCE_DEPS) \ 399 $$($1_OVERVIEW), \ 400 OUTPUT_DIR := $$($1_TARGET_DIR), \ 401 SUPPORT_DIR := $$(SUPPORT_OUTPUTDIR)/docs, \ 402 COMMAND := $$($1_JAVADOC_CMD) -d $$($1_TARGET_DIR) $$($1_OPTIONS) \ 403 $$($1_LOG_OPTION), \ 404 )) 405 406 $1_JAVADOC_TARGETS := $$(javadoc_$1_TARGET) 407 408 ifeq ($$(ENABLE_FULL_DOCS), true) 409 # We have asked ModuleGraph to generate links to svg files. Now we must 410 # produce the svg files. 411 412 # Locate which modules has the @moduleGraph tag in their module-info.java 413 $1_MODULES_NEEDING_GRAPH := $$(strip $$(foreach m, $$($1_ALL_MODULES), \ 414 $$(if $$(shell $$(GREP) -e @moduleGraph \ 415 $$(wildcard $$(addsuffix /module-info.java, \ 416 $$(call FindModuleSrcDirs, $$m)))), \ 417 $$m) \ 418 )) 419 420 # First we run the GenGraph tool. It will query the module structure of the 421 # running JVM and output .dot files for all existing modules. 422 MODULE_GRAPHS_PROPS := \ 423 $$(TOPDIR)/make/jdk/src/classes/build/tools/jigsaw/javadoc-graphs.properties 424 425 $1_MODULE_GRAPHS_DIR := $$(SUPPORT_OUTPUTDIR)/docs/$1-module-graphs 426 427 $$(eval $$(call SetupExecute, module_graphs_dot_$1, \ 428 INFO := Generating module graphs for $1 documentation, \ 429 DEPS := $$(BUILD_JIGSAW_TOOLS) $$(MODULE_GRAPHS_PROPS), \ 430 OUTPUT_DIR := $$($1_MODULE_GRAPHS_DIR), \ 431 COMMAND := $$(TOOL_GENGRAPHS) --spec --output $$($1_MODULE_GRAPHS_DIR) \ 432 --dot-attributes $$(MODULE_GRAPHS_PROPS), \ 433 )) 434 435 # For each module needing a graph, create a svg file from the dot file 436 # generated by the GenGraphs tool and store it in the target dir. 437 # They will depend on module_graphs_dot_$1_TARGET, and will be added to 438 # $1_GRAPHS_TARGETS. 439 $$(foreach m, $$($1_MODULES_NEEDING_GRAPH), \ 440 $$(eval $$(call setup_module_graph_dot_to_svg,$1,$$m)) \ 441 ) 442 443 # We have asked SealedGraph to generate dot files and links to svg files. 444 # Now we must produce the svg files from the dot files. 445 446 # Get a list of classes for which SealedGraph has generated dot files 447 $1_SEALED_CLASSES := $$(patsubst %.dot,%,$$(patsubst \ 448 $$($1_SEALED_GRAPHS_DIR)/%,%, \ 449 $$(wildcard $$($1_SEALED_GRAPHS_DIR)/*.dot))) 450 451 # For each class needing a graph, create a svg file from the dot file 452 # generated by the SealedGraph taglet and store it in the target dir. 453 # They will will be added to $1_GRAPHS_TARGETS. 454 $$(foreach c, $$($1_SEALED_CLASSES), \ 455 $$(eval $$(call setup_sealed_graph_dot_to_svg,$1,$$c)) \ 456 ) 457 endif 458 endef 459 460 ################################################################################ 461 # Setup generation of the JDK API documentation (javadoc + graphs) 462 463 # Define the groups of the JDK API documentation 464 JavaSE_GROUP_NAME := Java SE 465 JavaSE_GROUP_MODULES := $(call ColonList, $(sort java.se \ 466 $(call FindTransitiveIndirectDepsForModules, java.se))) 467 JavaSE_GROUP_DESCRIPTION := \ 468 The Java Platform, Standard Edition (Java SE) APIs define the core Java \ 469 platform for general-purpose computing. These APIs are in modules whose \ 470 names start with {@code java}. \ 471 # 472 JDK_GROUPS += JavaSE 473 474 JDK_GROUP_NAME := JDK 475 JDK_GROUP_MODULES := jdk.* 476 JDK_GROUP_DESCRIPTION := \ 477 The Java Development Kit (JDK) APIs are specific to the JDK and will not \ 478 necessarily be available in all implementations of the Java SE Platform. \ 479 These APIs are in modules whose names start with {@code jdk}. \ 480 # 481 JDK_GROUPS += JDK 482 483 # If we are importing JavaFX, we need a JavaFX group. In an ideal world, this 484 # would have been abstracted away to a more proper generic handling of imported 485 # modules. 486 ifneq ($(findstring javafx., $(IMPORTED_MODULES)), ) 487 JavaFX_GROUP_NAME := JavaFX 488 JavaFX_GROUP_MODULES := javafx.* 489 JavaFX_GROUP_DESCRIPTION := \ 490 The JavaFX APIs define a set of user-interface controls, graphics, \ 491 media, and web packages for developing rich client applications. These \ 492 APIs are in modules whose names start with {@code javafx}. \ 493 # 494 JDK_GROUPS += JavaFX 495 endif 496 497 # All modules to have docs generated by docs-jdk-api target 498 JDK_MODULES := $(sort $(filter-out $(MODULES_FILTER), $(DOCS_MODULES))) 499 500 $(eval $(call SetupApiDocsGeneration, JDK_API, \ 501 MODULES := $(JDK_MODULES), \ 502 GROUPS := $(JDK_GROUPS), \ 503 SHORT_NAME := $(JDK_SHORT_NAME), \ 504 LONG_NAME := $(JDK_LONG_NAME), \ 505 TARGET_DIR := $(DOCS_OUTPUTDIR)/api, \ 506 OTHER_VERSIONS := $(OTHER_JDK_VERSIONS_URL), \ 507 )) 508 509 # Targets generated are returned in JDK_API_JAVADOC_TARGETS and 510 # JDK_API_GRAPHS_TARGETS. 511 512 ################################################################################ 513 # Setup generation of the Java SE API documentation (javadoc + graphs) 514 515 # The Java SE module scope is just java.se and its transitive indirect 516 # exports. 517 JAVASE_MODULES := java.se 518 519 $(eval $(call SetupApiDocsGeneration, JAVASE_API, \ 520 MODULES := $(JAVASE_MODULES), \ 521 SHORT_NAME := $(JAVASE_SHORT_NAME), \ 522 LONG_NAME := $(JAVASE_LONG_NAME), \ 523 TARGET_DIR := $(DOCS_JAVASE_IMAGE_DIR)/api, \ 524 )) 525 526 # Targets generated are returned in JAVASE_API_JAVADOC_TARGETS and 527 # JAVASE_API_GRAPHS_TARGETS. 528 529 ################################################################################ 530 # Setup generation of the reference Java SE API documentation (javadoc + graphs) 531 532 # The reference javadoc is just the same as javase, but using the BootJDK javadoc 533 # and a stable set of javadoc options. Typically it is used for generating 534 # diffs between the reference javadoc and a javadoc bundle of a specific build 535 # generated in the same way. 536 537 $(eval $(call SetupApiDocsGeneration, REFERENCE_API, \ 538 MODULES := $(JAVASE_MODULES), \ 539 SHORT_NAME := $(JAVASE_SHORT_NAME), \ 540 LONG_NAME := $(JAVASE_LONG_NAME), \ 541 TARGET_DIR := $(DOCS_REFERENCE_IMAGE_DIR)/api, \ 542 JAVADOC_CMD := $(DOCS_REFERENCE_JAVADOC), \ 543 OPTIONS := $(REFERENCE_OPTIONS), \ 544 TAGS := $(REFERENCE_TAGS), \ 545 )) 546 547 # Targets generated are returned in REFERENCE_API_JAVADOC_TARGETS and 548 # REFERENCE_API_GRAPHS_TARGETS. 549 550 ################################################################################ 551 552 # Use this variable to control which spec files are included in the output. 553 # Format: space-delimited list of names, including at most one '%' as a 554 # wildcard. Spec source files match if their filename or any enclosing folder 555 # name matches one of the items in SPEC_FILTER. 556 SPEC_FILTER := % 557 558 ApplySpecFilter = \ 559 $(strip $(foreach file, $(1), \ 560 $(eval searchkeys := $(subst /, ,$(subst $(WORKSPACE_ROOT),,$(file)))) \ 561 $(if $(filter $(SPEC_FILTER), $(searchkeys)), \ 562 $(file) \ 563 ) \ 564 )) 565 566 # Copy the global resources, including the top-level redirect index.html 567 GLOBAL_SPECS_RESOURCES_DIR := $(TOPDIR)/make/data/docs-resources 568 $(eval $(call SetupCopyFiles, COPY_GLOBAL_RESOURCES, \ 569 SRC := $(GLOBAL_SPECS_RESOURCES_DIR), \ 570 FILES := $(call ApplySpecFilter, $(call FindFiles, $(GLOBAL_SPECS_RESOURCES_DIR))), \ 571 DEST := $(DOCS_OUTPUTDIR), \ 572 )) 573 JDK_INDEX_TARGETS += $(COPY_GLOBAL_RESOURCES) 574 575 # Copy the legal notices distributed with the docs bundle 576 $(eval $(call SetupCopyFiles, COPY_DOCS_LEGAL_NOTICES, \ 577 SRC := $(TOPDIR)/src/jdk.javadoc/share/legal, \ 578 FILES := $(call ApplySpecFilter, $(wildcard $(TOPDIR)/src/jdk.javadoc/share/legal/*)), \ 579 DEST := $(DOCS_OUTPUTDIR)/legal, \ 580 )) 581 JDK_INDEX_TARGETS += $(COPY_DOCS_LEGAL_NOTICES) 582 583 ################################################################################ 584 # Copy JDK specs files 585 586 # For all non html/md files in $module/share/specs directories, copy them 587 # unmodified 588 589 ALL_MODULES := $(call FindAllModules) 590 COPY_SPEC_FILTER := %.gif %.jpg %.mib %.css 591 592 $(foreach m, $(ALL_MODULES), \ 593 $(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \ 594 $(foreach d, $(SPECS_$m), \ 595 $(if $(call ApplySpecFilter, $(filter $(COPY_SPEC_FILTER), $(call FindFiles, $d))), \ 596 $(eval $(call SetupCopyFiles, COPY_$m, \ 597 SRC := $d, \ 598 FILES := $(call ApplySpecFilter, $(filter $(COPY_SPEC_FILTER), $(call FindFiles, $d))), \ 599 DEST := $(DOCS_OUTPUTDIR)/specs/, \ 600 )) \ 601 $(eval JDK_SPECS_TARGETS += $(COPY_$m)) \ 602 ) \ 603 ) \ 604 ) 605 606 # Create copyright footer variables. We need different variables for different 607 # relative paths to the copyright.html file. The number 0-2 below represent how 608 # many extra directory levels down below the specs dir the specs html file is 609 # located. 610 SPECS_BOTTOM = <footer class="legal-footer"><hr/>$(COPYRIGHT_BOTTOM)</footer> 611 # The legal dir is one ../ below the specs dir, so start with one ../. 612 specs_bottom_rel_path := ../ 613 $(foreach n, 0 1 2, \ 614 $(eval SPECS_BOTTOM_$n := $(call SPECS_BOTTOM,$(specs_bottom_rel_path))) \ 615 $(eval specs_bottom_rel_path := $(specs_bottom_rel_path)../) \ 616 ) 617 618 SPECS_TOP := $(if $(filter true, $(IS_DRAFT)), <header class="draft-header" role="banner">$(DRAFT_TEXT)</header>) 619 620 # For all html files in $module/share/specs directories, copy and add the 621 # copyright footer. 622 623 $(foreach m, $(ALL_MODULES), \ 624 $(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \ 625 $(foreach d, $(SPECS_$m), \ 626 $(foreach f, $(call ApplySpecFilter, $(filter %.html, $(call FindFiles, $d))), \ 627 $(eval $m_$f_NOF_SUBDIRS := $(words $(subst /, $(SPACE), $(subst $d, , $(dir $f))))) \ 628 $(eval $m_$f_NAME := PROCESS_HTML_$m_$(strip $(call RelativePath, $f, $(TOPDIR)))) \ 629 $(eval $(call SetupTextFileProcessing, $($m_$f_NAME), \ 630 SOURCE_FILES := $f, \ 631 SOURCE_BASE_DIR := $d, \ 632 OUTPUT_DIR := $(DOCS_OUTPUTDIR)/specs/, \ 633 REPLACEMENTS := \ 634 <body> => <body>$(SPECS_TOP) ; \ 635 </body> => $(SPECS_BOTTOM_$($m_$f_NOF_SUBDIRS))</body>, \ 636 )) \ 637 $(eval JDK_SPECS_TARGETS += $($($m_$f_NAME))) \ 638 ) \ 639 ) \ 640 ) 641 642 ifeq ($(ENABLE_PANDOC), true) 643 # For all markdown files in $module/share/specs directories, convert them to 644 # html, if we have pandoc (otherwise we'll just skip this). 645 646 GLOBAL_SPECS_DEFAULT_CSS_FILE := $(DOCS_OUTPUTDIR)/resources/jdk-default.css 647 # Unset the following to suppress the link to the tool guides 648 NAV_LINK_GUIDES := --nav-link-guides 649 HEADER_RIGHT_SIDE_INFO := <strong>$(subst &,&,$(JDK_SHORT_NAME))</strong>$(DRAFT_MARKER_STR) 650 651 $(foreach m, $(ALL_MODULES), \ 652 $(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \ 653 $(foreach d, $(SPECS_$m), \ 654 $(foreach f, $(call ApplySpecFilter, $(filter %.md, $(call FindFiles, $d))), \ 655 $(eval $m_$f_NOF_SUBDIRS := $(words $(subst /, $(SPACE), $(subst $d, , $(dir $f))))) \ 656 $(eval $m_$f_NAME := SPECS_TO_HTML_$m_$(strip $(call RelativePath, $f, $(TOPDIR)))) \ 657 $(eval $(call SetupProcessMarkdown, $($m_$f_NAME), \ 658 SRC := $d, \ 659 FILES := $f, \ 660 DEST := $(DOCS_OUTPUTDIR)/specs/, \ 661 CSS := $(GLOBAL_SPECS_DEFAULT_CSS_FILE), \ 662 OPTIONS := -V include-before='$(SPECS_TOP)' -V include-after='$(SPECS_BOTTOM_$($m_$f_NOF_SUBDIRS))', \ 663 REPLACEMENTS := \ 664 @@VERSION_SPECIFICATION@@ => $(VERSION_SPECIFICATION) ; \ 665 @@VERSION_STRING@@ => $(VERSION_STRING), \ 666 POST_PROCESS := $(TOOL_FIXUPPANDOC) --insert-nav --nav-right-info '$(HEADER_RIGHT_SIDE_INFO)' \ 667 --nav-subdirs $($m_$f_NOF_SUBDIRS) $(NAV_LINK_GUIDES), \ 668 )) \ 669 $(eval JDK_SPECS_TARGETS += $($($m_$f_NAME))) \ 670 ) \ 671 ) \ 672 ) 673 674 # For all markdown files in $module/share/man directories, convert them to 675 # html. 676 677 # Create dynamic man pages from markdown using pandoc. We need 678 # PANDOC_HTML_MANPAGE_FILTER, a wrapper around 679 # PANDOC_HTML_MANPAGE_FILTER_JAVASCRIPT. This is created by buildtools-jdk. 680 681 # We should also depend on the source code for the filter 682 PANDOC_HTML_MANPAGE_FILTER_SOURCE := $(call FindFiles, \ 683 $(TOPDIR)/make/jdk/src/classes/build/tools/pandocfilter) 684 685 $(foreach m, $(ALL_MODULES), \ 686 $(eval MAN_$m := $(call ApplySpecFilter, $(filter %.md, $(call FindFiles, \ 687 $(call FindModuleManDirs, $m))))) \ 688 $(if $(MAN_$m), \ 689 $(eval $(call SetupProcessMarkdown, MAN_TO_HTML_$m, \ 690 FILES := $(MAN_$m), \ 691 DEST := $(DOCS_OUTPUTDIR)/specs/man, \ 692 FILTER := $(PANDOC_HTML_MANPAGE_FILTER), \ 693 CSS := $(GLOBAL_SPECS_DEFAULT_CSS_FILE), \ 694 REPLACEMENTS := \ 695 @@COPYRIGHT_YEAR@@ => $(COPYRIGHT_YEAR) ; \ 696 @@VERSION_SHORT@@ => $(VERSION_SHORT) ; \ 697 @@VERSION_SPECIFICATION@@ => $(VERSION_SPECIFICATION), \ 698 OPTIONS := --toc -V include-before='$(SPECS_TOP)' -V include-after='$(SPECS_BOTTOM_1)', \ 699 POST_PROCESS := $(TOOL_FIXUPPANDOC) --insert-nav --nav-right-info '$(HEADER_RIGHT_SIDE_INFO)' \ 700 --nav-subdirs 1 --nav-link-guides, \ 701 EXTRA_DEPS := $(PANDOC_HTML_MANPAGE_FILTER) \ 702 $(PANDOC_HTML_MANPAGE_FILTER_SOURCE), \ 703 )) \ 704 $(eval JDK_SPECS_TARGETS += $(MAN_TO_HTML_$m)) \ 705 ) \ 706 ) 707 708 # The html generated from markdown also needs the css file 709 JDK_SPECS_TARGETS += $(COPY_GLOBAL_RESOURCES) 710 endif 711 712 # Special treatment for generated documentation 713 714 SPEC_HEADER_BLOCK := \ 715 <header id="title-block-header"> \ 716 <div class="navbar"> \ 717 <div>$(HEADER_RIGHT_SIDE_INFO)</div> \ 718 <nav><ul><li><a href="PATH_TO_SPECS/../api/index.html">API</a> \ 719 <li><a href="PATH_TO_SPECS/index.html">OTHER SPECIFICATIONS</a> \ 720 <li><a href="PATH_TO_SPECS/man/index.html">TOOL GUIDES</a></ul></nav> \ 721 </div> \ 722 </header> 723 724 JDWP_PROTOCOL := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/jdwp-protocol.html 725 ifneq ($(call ApplySpecFilter, $(JDWP_PROTOCOL)), ) 726 JDWP_HEADER_BLOCK := $(subst PATH_TO_SPECS,..,$(SPEC_HEADER_BLOCK)) 727 $(eval $(call SetupTextFileProcessing, PROCESS_JDWP_PROTOCOL, \ 728 SOURCE_FILES := $(JDWP_PROTOCOL), \ 729 OUTPUT_DIR := $(DOCS_OUTPUTDIR)/specs/jdwp, \ 730 REPLACEMENTS := \ 731 <style> => <link rel="stylesheet" href="../../resources/jdk-default.css"/><style> ; \ 732 <body> => <body>$(SPECS_TOP)$(JDWP_HEADER_BLOCK) ; \ 733 </body> => $(SPECS_BOTTOM_1)</body>, \ 734 )) 735 JDK_SPECS_TARGETS += $(PROCESS_JDWP_PROTOCOL) 736 endif 737 738 # Get jvmti.html from the main jvm variant (all variants' jvmti.html are identical). 739 JVMTI_HTML ?= $(HOTSPOT_OUTPUTDIR)/variant-$(JVM_VARIANT_MAIN)/gensrc/jvmtifiles/jvmti.html 740 ifneq ($(call ApplySpecFilter, $(JVMTI_HTML)), ) 741 JVMTI_HEADER_BLOCK := $(subst PATH_TO_SPECS,.,$(SPEC_HEADER_BLOCK)) 742 $(eval $(call SetupTextFileProcessing, PROCESS_JVMTI_HTML, \ 743 SOURCE_FILES := $(JVMTI_HTML), \ 744 OUTPUT_DIR := $(DOCS_OUTPUTDIR)/specs/, \ 745 REPLACEMENTS := \ 746 <style> => <link rel="stylesheet" href="../resources/jdk-default.css"/><style> ; \ 747 <body> => <body>$(SPECS_TOP)$(JVMTI_HEADER_BLOCK) ; \ 748 </body> => $(SPECS_BOTTOM_0)</body>, \ 749 )) 750 JDK_SPECS_TARGETS += $(PROCESS_JVMTI_HTML) 751 endif 752 753 ################################################################################ 754 # Optional target which bundles all generated javadocs into a zip archive. 755 756 JAVADOC_ZIP_NAME := jdk-$(VERSION_STRING)-docs.zip 757 JAVADOC_ZIP_FILE := $(OUTPUTDIR)/bundles/$(JAVADOC_ZIP_NAME) 758 759 $(eval $(call SetupZipArchive, BUILD_JAVADOC_ZIP, \ 760 SRC := $(DOCS_OUTPUTDIR), \ 761 ZIP := $(JAVADOC_ZIP_FILE), \ 762 EXTRA_DEPS := $(JDK_API_JAVADOC_TARGETS) $(JDK_API_GRAPHS_TARGETS) \ 763 $(JDK_SPECS_TARGETS), \ 764 )) 765 766 ZIP_TARGETS += $(BUILD_JAVADOC_ZIP) 767 768 ################################################################################ 769 # Hook to include the corresponding custom file, if present. 770 $(eval $(call IncludeCustomExtension, Docs-post.gmk)) 771 772 ################################################################################ 773 # Bundles all generated specs into a zip archive, skipping javadocs. 774 775 SPECS_ZIP_NAME := jdk-$(VERSION_STRING)-specs.zip 776 SPECS_ZIP_FILE := $(OUTPUTDIR)/bundles/$(SPECS_ZIP_NAME) 777 778 $(eval $(call SetupZipArchive, BUILD_SPECS_ZIP, \ 779 SRC := $(DOCS_OUTPUTDIR), \ 780 ZIP := $(SPECS_ZIP_FILE), \ 781 EXTRA_DEPS := $(JDK_SPECS_TARGETS), \ 782 )) 783 784 SPECS_ZIP_TARGETS += $(BUILD_SPECS_ZIP) 785 786 ################################################################################ 787 788 docs-jdk-api-javadoc: $(JDK_API_JAVADOC_TARGETS) $(JDK_API_CUSTOM_TARGETS) 789 790 docs-jdk-api-graphs: $(JDK_API_GRAPHS_TARGETS) 791 792 docs-javase-api-javadoc: $(JAVASE_API_JAVADOC_TARGETS) $(JAVASE_API_CUSTOM_TARGETS) 793 794 docs-javase-api-graphs: $(JAVASE_API_GRAPHS_TARGETS) 795 796 docs-reference-api-javadoc: $(REFERENCE_API_JAVADOC_TARGETS) $(REFERENCE_API_CUSTOM_TARGETS) 797 798 docs-reference-api-graphs: $(REFERENCE_API_GRAPHS_TARGETS) 799 800 docs-jdk-specs: $(JDK_SPECS_TARGETS) 801 802 docs-jdk-index: $(JDK_INDEX_TARGETS) 803 804 docs-zip: $(ZIP_TARGETS) 805 806 docs-specs-zip: $(SPECS_ZIP_TARGETS) 807 808 all: docs-jdk-api-javadoc docs-jdk-api-graphs docs-javase-api-javadoc \ 809 docs-javase-api-graphs docs-reference-api-javadoc \ 810 docs-reference-api-graphs docs-jdk-specs docs-jdk-index docs-zip \ 811 docs-specs-zip 812 813 .PHONY: default all docs-jdk-api-javadoc docs-jdk-api-graphs \ 814 docs-javase-api-javadoc docs-javase-api-graphs \ 815 docs-reference-api-javadoc docs-reference-api-graphs docs-jdk-specs \ 816 docs-jdk-index docs-zip docs-specs-zip