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