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