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