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