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