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