make/Docs.gmk
branchihse-setupexecute-branch
changeset 58834 f78e7ce060b0
parent 57231 461128671cdf
parent 58726 449555c346d9
equal deleted inserted replaced
58833:ed9ef56bc7d5 58834:f78e7ce060b0
    30 include Modules.gmk
    30 include Modules.gmk
    31 include ModuleTools.gmk
    31 include ModuleTools.gmk
    32 include ProcessMarkdown.gmk
    32 include ProcessMarkdown.gmk
    33 include ToolsJdk.gmk
    33 include ToolsJdk.gmk
    34 include ZipArchive.gmk
    34 include ZipArchive.gmk
       
    35 include TextFileProcessing.gmk
    35 
    36 
    36 # This is needed to properly setup DOCS_MODULES.
    37 # This is needed to properly setup DOCS_MODULES.
    37 $(eval $(call ReadImportMetaData))
    38 $(eval $(call ReadImportMetaData))
    38 
    39 
    39 ################################################################################
    40 ################################################################################
    62     $(SUPPORT_OUTPUTDIR)/rmic/* $(TOPDIR)/src/*/share/doc/stub)
    63     $(SUPPORT_OUTPUTDIR)/rmic/* $(TOPDIR)/src/*/share/doc/stub)
    63 
    64 
    64 # URLs
    65 # URLs
    65 JAVADOC_BASE_URL := https://docs.oracle.com/pls/topic/lookup?ctx=javase$(VERSION_NUMBER)&id=homepage
    66 JAVADOC_BASE_URL := https://docs.oracle.com/pls/topic/lookup?ctx=javase$(VERSION_NUMBER)&id=homepage
    66 BUG_SUBMIT_URL := https://bugreport.java.com/bugreport/
    67 BUG_SUBMIT_URL := https://bugreport.java.com/bugreport/
    67 COPYRIGHT_URL := {@docroot}/../legal/copyright.html
    68 COPYRIGHT_URL := legal/copyright.html
    68 LICENSE_URL := https://www.oracle.com/technetwork/java/javase/terms/license/java$(VERSION_NUMBER)speclicense.html
    69 LICENSE_URL := https://www.oracle.com/technetwork/java/javase/terms/license/java$(VERSION_NUMBER)speclicense.html
    69 REDISTRIBUTION_URL := https://www.oracle.com/technetwork/java/redist-137594.html
    70 REDISTRIBUTION_URL := https://www.oracle.com/technetwork/java/redist-137594.html
    70 
    71 
    71 # In order to get a specific ordering it's necessary to specify the total
    72 # In order to get a specific ordering it's necessary to specify the total
    72 # ordering of tags as the tags are otherwise ordered in order of definition.
    73 # ordering of tags as the tags are otherwise ordered in order of definition.
    82     -tag 'implSpec:a:Implementation Requirements:' \
    83     -tag 'implSpec:a:Implementation Requirements:' \
    83     -tag 'implNote:a:Implementation Note:' \
    84     -tag 'implNote:a:Implementation Note:' \
    84     -tag param \
    85     -tag param \
    85     -tag return \
    86     -tag return \
    86     -tag throws \
    87     -tag throws \
       
    88     -taglet build.tools.taglet.JSpec\$$JLS \
       
    89     -taglet build.tools.taglet.JSpec\$$JVMS \
    87     -taglet build.tools.taglet.ModuleGraph \
    90     -taglet build.tools.taglet.ModuleGraph \
       
    91     -taglet build.tools.taglet.ToolGuide \
    88     -tag since \
    92     -tag since \
    89     -tag serialData \
    93     -tag serialData \
    90     -tag factory \
    94     -tag factory \
    91     -tag see \
    95     -tag see \
    92     -tag 'jvms:a:See <cite>The Java&trade; Virtual Machine Specification</cite>:' \
       
    93     -tag 'jls:a:See <cite>The Java&trade; Language Specification</cite>:' \
       
    94     -taglet build.tools.taglet.ExtLink \
    96     -taglet build.tools.taglet.ExtLink \
    95     -taglet build.tools.taglet.Incubating \
    97     -taglet build.tools.taglet.Incubating \
       
    98     -taglet build.tools.taglet.Preview \
    96     -tagletpath $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
    99     -tagletpath $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
    97     $(CUSTOM_JAVADOC_TAGS) \
   100     $(CUSTOM_JAVADOC_TAGS) \
    98     #
   101     #
    99 
   102 
   100 # The reference tags must stay stable to allow for comparisons across the
   103 # The reference tags must stay stable to allow for comparisons across the
   145   # Workaround stylesheet bug
   148   # Workaround stylesheet bug
   146   HEADER_STYLE := style="margin-top: 9px;"
   149   HEADER_STYLE := style="margin-top: 9px;"
   147 else
   150 else
   148   HEADER_STYLE := style="margin-top: 14px;"
   151   HEADER_STYLE := style="margin-top: 14px;"
   149 endif
   152 endif
       
   153 
       
   154 # $1 - Relative prefix to COPYRIGHT_URL
       
   155 COPYRIGHT_BOTTOM = \
       
   156     <a href="$(strip $1)$(COPYRIGHT_URL)">Copyright</a> \
       
   157     &copy; 1993, $(COPYRIGHT_YEAR), $(FULL_COMPANY_NAME), \
       
   158     $(COMPANY_ADDRESS).<br>All rights reserved. \
       
   159     Use is subject to <a href="$(LICENSE_URL)">license terms</a> and the \
       
   160     <a href="$(REDISTRIBUTION_URL)">documentation redistribution policy</a>. \
       
   161     $(DRAFT_MARKER_STR) <!-- Version $(VERSION_STRING) -->
   150 
   162 
   151 JAVADOC_BOTTOM := \
   163 JAVADOC_BOTTOM := \
   152     <a href="$(BUG_SUBMIT_URL)">Report a bug or suggest an enhancement</a><br> \
   164     <a href="$(BUG_SUBMIT_URL)">Report a bug or suggest an enhancement</a><br> \
   153     For further API reference and developer documentation see the \
   165     For further API reference and developer documentation see the \
   154     <a href="$(JAVADOC_BASE_URL)" target="_blank">Java SE \
   166     <a href="$(JAVADOC_BASE_URL)" target="_blank">Java SE \
   155     Documentation</a>, which contains more detailed, \
   167     Documentation</a>, which contains more detailed, \
   156     developer-targeted descriptions with conceptual overviews, definitions \
   168     developer-targeted descriptions with conceptual overviews, definitions \
   157     of terms, workarounds, and working code examples.<br> \
   169     of terms, workarounds, and working code examples.<br> \
   158     Java is a trademark or registered trademark of $(FULL_COMPANY_NAME) in \
   170     Java is a trademark or registered trademark of $(FULL_COMPANY_NAME) in \
   159     the US and other countries.<br> \
   171     the US and other countries.<br> \
   160     <a href="$(COPYRIGHT_URL)">Copyright</a> \
   172     $(call COPYRIGHT_BOTTOM, {@docroot}/../)
   161     &copy; 1993, $(COPYRIGHT_YEAR), $(FULL_COMPANY_NAME), \
       
   162     $(COMPANY_ADDRESS).<br>All rights reserved. \
       
   163     Use is subject to <a href="$(LICENSE_URL)">license terms</a> and the \
       
   164     <a href="$(REDISTRIBUTION_URL)">documentation redistribution policy</a>. \
       
   165     $(DRAFT_MARKER_STR) <!-- Version $(VERSION_STRING) -->
       
   166 
   173 
   167 JAVADOC_TOP := \
   174 JAVADOC_TOP := \
   168     <div style="padding: 6px; text-align: center; font-size: 80%; \
   175     <div style="padding: 6px; text-align: center; font-size: 80%; \
   169     font-family: DejaVu Sans, Arial, Helvetica, sans-serif; \
   176     font-family: DejaVu Sans, Arial, Helvetica, sans-serif; \
   170     font-weight: normal;">$(DRAFT_TEXT)</div>
   177     font-weight: normal;">$(DRAFT_TEXT)</div>
   183 JAVASE_LONG_NAME := Java<sup>&reg;</sup> Platform, Standard Edition
   190 JAVASE_LONG_NAME := Java<sup>&reg;</sup> Platform, Standard Edition
   184 
   191 
   185 ################################################################################
   192 ################################################################################
   186 # Functions
   193 # Functions
   187 
   194 
   188 # Helper function for creating a png file from a dot file generated by the
   195 # Helper function for creating a svg file from a dot file generated by the
   189 # GenGraphs tool.
   196 # GenGraphs tool.
   190 # param 1: SetupJavadocGeneration namespace ($1)
   197 # param 1: SetupJavadocGeneration namespace ($1)
   191 # param 2: module name
   198 # param 2: module name
   192 #
   199 #
   193 define setup_gengraph_dot_to_png
   200 define setup_gengraph_dot_to_svg
   194   $1_$2_DOT_SRC :=  $$($1_GENGRAPHS_DIR)/$2.dot
   201   $1_$2_DOT_SRC :=  $$($1_GENGRAPHS_DIR)/$2.dot
   195   $1_$2_PNG_TARGET := $$($1_TARGET_DIR)/$2/module-graph.png
   202   $1_$2_SVG_TARGET := $$($1_TARGET_DIR)/$2/module-graph.svg
   196 
   203 
   197     # For each module needing a graph, create a png file from the dot file
   204     # For each module needing a graph, create a svg file from the dot file
   198     # generated by the GenGraphs tool and store it in the target dir.
   205     # generated by the GenGraphs tool and store it in the target dir.
   199     $$(eval $$(call SetupExecute, gengraphs_png_$1_$2, \
   206     $$(eval $$(call SetupExecute, gengraphs_png_$1_$2, \
   200         INFO := Running dot for module graphs for $2, \
   207         INFO := Running dot for module graphs for $2, \
   201         DEPS := $$(gengraphs_$1_TARGET), \
   208         DEPS := $$(gengraphs_$1_TARGET), \
   202         OUTPUT_FILE := $$($1_$2_PNG_TARGET), \
   209         OUTPUT_FILE := $$($1_$2_PNG_TARGET), \
   203         SUPPORT_DIR := $$($1_GENGRAPHS_DIR), \
   210         SUPPORT_DIR := $$($1_GENGRAPHS_DIR), \
   204         COMMAND := $$(DOT) -Tpng -o $$($1_$2_PNG_TARGET) $$($1_$2_DOT_SRC), \
   211         COMMAND := $$(DOT) -Tpng -o $$($1_$2_PNG_TARGET) $$($1_$2_DOT_SRC), \
   205     ))
   212     ))
   206 
   213 
   207   $1_MODULEGRAPH_TARGETS += $$($1_$2_PNG_TARGET)
   214   $1_MODULEGRAPH_TARGETS += $$($1_$2_SVG_TARGET)
   208 endef
   215 endef
   209 
   216 
   210 # Helper function to create the overview.html file to use with the -overview
   217 # Helper function to create the overview.html file to use with the -overview
   211 # javadoc option.
   218 # javadoc option.
   212 # Returns the filename as $1_OVERVIEW.
   219 # Returns the filename as $1_OVERVIEW.
   268   # Figure out all modules, both specified and transitive indirect exports, that
   275   # Figure out all modules, both specified and transitive indirect exports, that
   269   # will be processed by javadoc.
   276   # will be processed by javadoc.
   270   $1_INDIRECT_EXPORTS := $$(call FindTransitiveIndirectDepsForModules, $$($1_MODULES))
   277   $1_INDIRECT_EXPORTS := $$(call FindTransitiveIndirectDepsForModules, $$($1_MODULES))
   271   $1_ALL_MODULES := $$(sort $$($1_MODULES) $$($1_INDIRECT_EXPORTS))
   278   $1_ALL_MODULES := $$(sort $$($1_MODULES) $$($1_INDIRECT_EXPORTS))
   272 
   279 
   273   $1_JAVA_ARGS := -Dextlink.spec.version=$$(VERSION_SPECIFICATION)
   280   $1_JAVA_ARGS := -Dextlink.spec.version=$$(VERSION_SPECIFICATION) \
       
   281 	-Djspec.version=$$(VERSION_SPECIFICATION)
   274 
   282 
   275   ifeq ($$(ENABLE_FULL_DOCS), true)
   283   ifeq ($$(ENABLE_FULL_DOCS), true)
   276     # Tell the ModuleGraph taglet to generate html links to soon-to-be-created
   284     # Tell the ModuleGraph taglet to generate html links to soon-to-be-created
   277     # png files with module graphs.
   285     # svg files with module graphs.
   278     $1_JAVA_ARGS += -DenableModuleGraph=true
   286     $1_JAVA_ARGS += -DenableModuleGraph=true
   279   endif
   287   endif
   280 
   288 
   281   # Start with basic options and tags
   289   # Start with basic options and tags
   282   ifeq ($$($1_OPTIONS), )
   290   ifeq ($$($1_OPTIONS), )
   335       $$($1_ALL_MODULES) $$($1_JAVADOC_CMD)
   343       $$($1_ALL_MODULES) $$($1_JAVADOC_CMD)
   336   $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \
   344   $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \
   337       $$(SUPPORT_OUTPUTDIR)/docs/$1.vardeps)
   345       $$(SUPPORT_OUTPUTDIR)/docs/$1.vardeps)
   338 
   346 
   339   # Get a list of all files in all the source dirs for all included modules
   347   # Get a list of all files in all the source dirs for all included modules
   340   $1_SOURCE_DEPS := $$(call CacheFind, $$(wildcard $$(foreach module, \
   348   $1_SOURCE_DEPS := $$(call FindFiles, $$(wildcard $$(foreach module, \
   341       $$($1_ALL_MODULES), $$(call FindModuleSrcDirs, $$(module)))))
   349       $$($1_ALL_MODULES), $$(call FindModuleSrcDirs, $$(module)))))
   342 
   350 
   343   $$(eval $$(call SetupExecute, javadoc_$1, \
   351   $$(eval $$(call SetupExecute, javadoc_$1, \
   344       WARN := Generating $1 javadoc for $$(words $$($1_ALL_MODULES)) modules, \
   352       WARN := Generating $1 javadoc for $$(words $$($1_ALL_MODULES)) modules, \
   345       INFO := Javadoc modules: $$($1_ALL_MODULES), \
   353       INFO := Javadoc modules: $$($1_ALL_MODULES), \
   352   ))
   360   ))
   353 
   361 
   354   $1_JAVADOC_TARGETS := $$(javadoc_$1_TARGET)
   362   $1_JAVADOC_TARGETS := $$(javadoc_$1_TARGET)
   355 
   363 
   356   ifeq ($$(ENABLE_FULL_DOCS), true)
   364   ifeq ($$(ENABLE_FULL_DOCS), true)
   357     # We have asked ModuleGraph to generate links to png files. Now we must
   365     # We have asked ModuleGraph to generate links to svg files. Now we must
   358     # produce the png files.
   366     # produce the svg files.
   359 
   367 
   360     # Locate which modules has the @moduleGraph tag in their module-info.java
   368     # Locate which modules has the @moduleGraph tag in their module-info.java
   361     $1_MODULES_NEEDING_GRAPH := $$(strip $$(foreach m, $$($1_ALL_MODULES), \
   369     $1_MODULES_NEEDING_GRAPH := $$(strip $$(foreach m, $$($1_ALL_MODULES), \
   362       $$(if $$(shell $$(GREP) -e @moduleGraph \
   370       $$(if $$(shell $$(GREP) -e @moduleGraph \
   363           $$(wildcard $$(addsuffix /module-info.java, \
   371           $$(wildcard $$(addsuffix /module-info.java, \
   382 
   390 
   383     # For each module needing a graph, create a png file from the dot file
   391     # For each module needing a graph, create a png file from the dot file
   384     # generated by the GenGraphs tool and store it in the target dir.
   392     # generated by the GenGraphs tool and store it in the target dir.
   385     # They will depend on gengraphs_$1_TARGET, and will be added to $1.
   393     # They will depend on gengraphs_$1_TARGET, and will be added to $1.
   386     $$(foreach m, $$($1_MODULES_NEEDING_GRAPH), \
   394     $$(foreach m, $$($1_MODULES_NEEDING_GRAPH), \
   387       $$(eval $$(call setup_gengraph_dot_to_png,$1,$$m)) \
   395       $$(eval $$(call setup_gengraph_dot_to_svg,$1,$$m)) \
   388     )
   396     )
   389   endif
   397   endif
   390 endef
   398 endef
   391 
   399 
   392 ################################################################################
   400 ################################################################################
   478 # Targets generated are returned in REFERENCE_API_JAVADOC_TARGETS and
   486 # Targets generated are returned in REFERENCE_API_JAVADOC_TARGETS and
   479 # REFERENCE_API_MODULEGRAPH_TARGETS.
   487 # REFERENCE_API_MODULEGRAPH_TARGETS.
   480 
   488 
   481 ################################################################################
   489 ################################################################################
   482 
   490 
       
   491 # Use this variable to control which spec files are included in the output.
       
   492 # Format: space-delimited list of names, including at most one '%' as a
       
   493 # wildcard. Spec source files match if their filename or any enclosing folder
       
   494 # name matches one of the items in SPEC_FILTER.
       
   495 SPEC_FILTER := %
       
   496 
       
   497 ApplySpecFilter = \
       
   498     $(strip $(foreach file, $(1), \
       
   499         $(eval searchkeys := $(subst /, ,$(subst $(WORKSPACE_ROOT),,$(file)))) \
       
   500         $(if $(filter $(SPEC_FILTER), $(searchkeys)), \
       
   501             $(file) \
       
   502         ) \
       
   503     ))
       
   504 
   483 # Copy the global resources, including the top-level redirect index.html
   505 # Copy the global resources, including the top-level redirect index.html
   484 GLOBAL_SPECS_RESOURCES_DIR := $(TOPDIR)/make/data/docs-resources/
   506 GLOBAL_SPECS_RESOURCES_DIR := $(TOPDIR)/make/data/docs-resources
   485 $(eval $(call SetupCopyFiles, COPY_GLOBAL_RESOURCES, \
   507 $(eval $(call SetupCopyFiles, COPY_GLOBAL_RESOURCES, \
   486     SRC := $(GLOBAL_SPECS_RESOURCES_DIR), \
   508     SRC := $(GLOBAL_SPECS_RESOURCES_DIR), \
   487     FILES := $(call CacheFind, $(GLOBAL_SPECS_RESOURCES_DIR)), \
   509     FILES := $(call ApplySpecFilter, $(call FindFiles, $(GLOBAL_SPECS_RESOURCES_DIR))), \
   488     DEST := $(DOCS_OUTPUTDIR), \
   510     DEST := $(DOCS_OUTPUTDIR), \
   489 ))
   511 ))
   490 JDK_INDEX_TARGETS += $(COPY_GLOBAL_RESOURCES)
   512 JDK_INDEX_TARGETS += $(COPY_GLOBAL_RESOURCES)
   491 
   513 
   492 # Copy the legal notices distributed with the docs bundle
   514 # Copy the legal notices distributed with the docs bundle
   493 $(eval $(call SetupCopyFiles, COPY_DOCS_LEGAL_NOTICES, \
   515 $(eval $(call SetupCopyFiles, COPY_DOCS_LEGAL_NOTICES, \
   494     SRC := $(TOPDIR)/src/jdk.javadoc/share/legal, \
   516     SRC := $(TOPDIR)/src/jdk.javadoc/share/legal, \
   495     FILES := $(wildcard $(TOPDIR)/src/jdk.javadoc/share/legal/*), \
   517     FILES := $(call ApplySpecFilter, $(wildcard $(TOPDIR)/src/jdk.javadoc/share/legal/*)), \
   496     DEST := $(DOCS_OUTPUTDIR)/legal, \
   518     DEST := $(DOCS_OUTPUTDIR)/legal, \
   497 ))
   519 ))
   498 JDK_INDEX_TARGETS += $(COPY_DOCS_LEGAL_NOTICES)
   520 JDK_INDEX_TARGETS += $(COPY_DOCS_LEGAL_NOTICES)
   499 
   521 
   500 ################################################################################
   522 ################################################################################
   501 # Copy JDK specs files
   523 # Copy JDK specs files
   502 
   524 
   503 # For all html documentation in $module/share/specs directories, copy it
   525 # For all non html/md files in $module/share/specs directories, copy them
   504 # unmodified
   526 # unmodified
   505 
   527 
   506 ALL_MODULES := $(call FindAllModules)
   528 ALL_MODULES := $(call FindAllModules)
   507 COPY_SPEC_FILTER := %.html %.gif %.jpg %.mib %.css
   529 COPY_SPEC_FILTER := %.gif %.jpg %.mib %.css
   508 
   530 
   509 $(foreach m, $(ALL_MODULES), \
   531 $(foreach m, $(ALL_MODULES), \
   510   $(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \
   532   $(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \
   511   $(foreach d, $(SPECS_$m), \
   533   $(foreach d, $(SPECS_$m), \
   512     $(if $(filter $(COPY_SPEC_FILTER), $(call CacheFind, $d)), \
   534     $(if $(call ApplySpecFilter, $(filter $(COPY_SPEC_FILTER), $(call FindFiles, $d))), \
   513       $(eval $(call SetupCopyFiles, COPY_$m, \
   535       $(eval $(call SetupCopyFiles, COPY_$m, \
   514           SRC := $d, \
   536           SRC := $d, \
   515           FILES := $(filter $(COPY_SPEC_FILTER), $(call CacheFind, $d)), \
   537           FILES := $(call ApplySpecFilter, $(filter $(COPY_SPEC_FILTER), $(call FindFiles, $d))), \
   516           DEST := $(DOCS_OUTPUTDIR)/specs/, \
   538           DEST := $(DOCS_OUTPUTDIR)/specs/, \
   517       )) \
   539       )) \
   518       $(eval JDK_SPECS_TARGETS += $(COPY_$m)) \
   540       $(eval JDK_SPECS_TARGETS += $(COPY_$m)) \
   519     ) \
   541     ) \
   520   ) \
   542   ) \
   521 )
   543 )
   522 
   544 
       
   545 # Create copyright footer variables. We need different variables for different
       
   546 # relative paths to the copyright.html file. The number 0-2 below represent how
       
   547 # many extra directory levels down below the specs dir the specs html file is
       
   548 # located.
       
   549 SPECS_BOTTOM = <footer class="legal-footer"><hr/>$(COPYRIGHT_BOTTOM)</footer>
       
   550 # The legal dir is one ../ below the specs dir, so start with one ../.
       
   551 specs_bottom_rel_path := ../
       
   552 $(foreach n, 0 1 2, \
       
   553   $(eval SPECS_BOTTOM_$n := $(call SPECS_BOTTOM,$(specs_bottom_rel_path))) \
       
   554   $(eval specs_bottom_rel_path := $(specs_bottom_rel_path)../) \
       
   555 )
       
   556 
       
   557 SPECS_TOP := $(if $(filter true, $(IS_DRAFT)), <header class="draft-header">$(DRAFT_TEXT)</header>)
       
   558 
       
   559 # For all html files in $module/share/specs directories, copy and add the
       
   560 # copyright footer.
       
   561 
       
   562 $(foreach m, $(ALL_MODULES), \
       
   563   $(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \
       
   564   $(foreach d, $(SPECS_$m), \
       
   565     $(foreach f, $(call ApplySpecFilter, $(filter %.html, $(call FindFiles, $d))), \
       
   566       $(eval $m_$f_NOF_SUBDIRS := $(words $(subst /, $(SPACE), $(subst $d, , $(dir $f))))) \
       
   567       $(eval $m_$f_NAME := PROCESS_HTML_$m_$(strip $(call RelativePath, $f, $(TOPDIR)))) \
       
   568       $(eval $(call SetupTextFileProcessing, $($m_$f_NAME), \
       
   569           SOURCE_FILES := $f, \
       
   570           SOURCE_BASE_DIR := $d, \
       
   571           OUTPUT_DIR := $(DOCS_OUTPUTDIR)/specs/, \
       
   572           REPLACEMENTS := \
       
   573               <body> => <body>$(SPECS_TOP) ; \
       
   574               </body> => $(SPECS_BOTTOM_$($m_$f_NOF_SUBDIRS))</body>, \
       
   575       )) \
       
   576       $(eval JDK_SPECS_TARGETS += $($($m_$f_NAME))) \
       
   577     ) \
       
   578   ) \
       
   579 )
       
   580 
   523 ifeq ($(ENABLE_PANDOC), true)
   581 ifeq ($(ENABLE_PANDOC), true)
   524   # For all markdown files in $module/share/specs directories, convert them to
   582   # For all markdown files in $module/share/specs directories, convert them to
   525   # html, if we have pandoc (otherwise we'll just skip this).
   583   # html, if we have pandoc (otherwise we'll just skip this).
   526 
   584 
   527   GLOBAL_SPECS_DEFAULT_CSS_FILE := $(DOCS_OUTPUTDIR)/resources/jdk-default.css
   585   GLOBAL_SPECS_DEFAULT_CSS_FILE := $(DOCS_OUTPUTDIR)/resources/jdk-default.css
   528 
   586 
   529   $(foreach m, $(ALL_MODULES), \
   587   $(foreach m, $(ALL_MODULES), \
   530     $(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \
   588     $(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \
   531     $(foreach d, $(SPECS_$m), \
   589     $(foreach d, $(SPECS_$m), \
   532       $(if $(filter %.md, $(call CacheFind, $d)), \
   590       $(foreach f, $(call ApplySpecFilter, $(filter %.md, $(call FindFiles, $d))), \
   533         $(eval $m_$d_NAME := SPECS_TO_HTML_$m_$(strip $(call RelativePath, $d, $(TOPDIR)))) \
   591         $(eval $m_$f_NOF_SUBDIRS := $(words $(subst /, $(SPACE), $(subst $d, , $(dir $f))))) \
   534         $(eval $(call SetupProcessMarkdown, $($m_$d_NAME), \
   592         $(eval $m_$f_NAME := SPECS_TO_HTML_$m_$(strip $(call RelativePath, $f, $(TOPDIR)))) \
       
   593         $(eval $(call SetupProcessMarkdown, $($m_$f_NAME), \
   535             SRC := $d, \
   594             SRC := $d, \
   536             FILES := $(filter %.md, $(call CacheFind, $d)), \
   595             FILES := $f, \
   537             DEST := $(DOCS_OUTPUTDIR)/specs/, \
   596             DEST := $(DOCS_OUTPUTDIR)/specs/, \
   538             CSS := $(GLOBAL_SPECS_DEFAULT_CSS_FILE), \
   597             CSS := $(GLOBAL_SPECS_DEFAULT_CSS_FILE), \
       
   598             OPTIONS := -V include-before='$(SPECS_TOP)' -V include-after='$(SPECS_BOTTOM_$($m_$f_NOF_SUBDIRS))', \
       
   599             REPLACEMENTS := \
       
   600 		@@VERSION_SPECIFICATION@@ => $(VERSION_SPECIFICATION) ; \
       
   601 		@@VERSION_STRING@@ => $(VERSION_STRING), \
       
   602             POST_PROCESS := $(TOOL_FIXUPPANDOC), \
   539         )) \
   603         )) \
   540         $(eval JDK_SPECS_TARGETS += $($($m_$d_NAME))) \
   604         $(eval JDK_SPECS_TARGETS += $($($m_$f_NAME))) \
   541       ) \
   605       ) \
   542     ) \
   606     ) \
   543   )
   607   )
   544 
   608 
   545   # For all markdown files in $module/share/man directories, convert them to
   609   # For all markdown files in $module/share/man directories, convert them to
   554       $(TOPDIR)/make/scripts/pandoc-html-manpage-filter.js
   618       $(TOPDIR)/make/scripts/pandoc-html-manpage-filter.js
   555 
   619 
   556   $(foreach m, $(ALL_MODULES), \
   620   $(foreach m, $(ALL_MODULES), \
   557     $(eval MAN_$m := $(call FindModuleManDirs, $m)) \
   621     $(eval MAN_$m := $(call FindModuleManDirs, $m)) \
   558     $(foreach d, $(MAN_$m), \
   622     $(foreach d, $(MAN_$m), \
   559       $(if $(filter %.md, $(call CacheFind, $d)), \
   623       $(foreach f, $(call ApplySpecFilter, $(filter %.md, $(call FindFiles, $d))), \
   560         $(eval $m_$d_NAME := MAN_TO_HTML_$m_$(strip $(call RelativePath, $d, $(TOPDIR)))) \
   624         $(eval $m_$f_NAME := MAN_TO_HTML_$m_$(strip $(call RelativePath, $f, $(TOPDIR)))) \
   561         $(eval $(call SetupProcessMarkdown, $($m_$d_NAME), \
   625         $(eval $(call SetupProcessMarkdown, $($m_$f_NAME), \
   562             SRC := $d, \
   626             SRC := $d, \
   563             FILES := $(filter %.md, $(call CacheFind, $d)), \
   627             FILES := $f, \
   564             DEST := $(DOCS_OUTPUTDIR)/specs/man, \
   628             DEST := $(DOCS_OUTPUTDIR)/specs/man, \
   565             FILTER := $(PANDOC_HTML_MANPAGE_FILTER), \
   629             FILTER := $(PANDOC_HTML_MANPAGE_FILTER), \
   566             CSS := $(GLOBAL_SPECS_DEFAULT_CSS_FILE), \
   630             CSS := $(GLOBAL_SPECS_DEFAULT_CSS_FILE), \
   567             REPLACEMENTS := @@VERSION_SHORT@@ => $(VERSION_SHORT), \
   631             REPLACEMENTS := \
       
   632 		@@COPYRIGHT_YEAR@@ => $(COPYRIGHT_YEAR) ; \
       
   633 		@@VERSION_SHORT@@ => $(VERSION_SHORT) ; \
       
   634 		@@VERSION_SPECIFICATION@@ => $(VERSION_SPECIFICATION), \
       
   635             OPTIONS := --toc -V include-before='$(SPECS_TOP)' -V include-after='$(SPECS_BOTTOM_1)', \
       
   636             POST_PROCESS := $(TOOL_FIXUPPANDOC), \
   568             EXTRA_DEPS := $(PANDOC_HTML_MANPAGE_FILTER) \
   637             EXTRA_DEPS := $(PANDOC_HTML_MANPAGE_FILTER) \
   569                 $(PANDOC_HTML_MANPAGE_FILTER_JAVASCRIPT), \
   638                 $(PANDOC_HTML_MANPAGE_FILTER_JAVASCRIPT), \
   570         )) \
   639         )) \
   571         $(eval JDK_SPECS_TARGETS += $($($m_$d_NAME))) \
   640         $(eval JDK_SPECS_TARGETS += $($($m_$f_NAME))) \
   572       ) \
   641       ) \
   573     ) \
   642     ) \
   574   )
   643   )
   575 
   644 
   576   # The html generated from markdown also needs the css file
   645   # The html generated from markdown also needs the css file
   578 endif
   647 endif
   579 
   648 
   580 # Special treatment for generated documentation
   649 # Special treatment for generated documentation
   581 
   650 
   582 JDWP_PROTOCOL := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/jdwp-protocol.html
   651 JDWP_PROTOCOL := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/jdwp-protocol.html
   583 $(eval $(call SetupCopyFiles, COPY_JDWP_PROTOCOL, \
   652 ifneq ($(call ApplySpecFilter, $(JDWP_PROTOCOL)), )
   584     FILES := $(JDWP_PROTOCOL), \
   653   $(eval $(call SetupTextFileProcessing, PROCESS_JDWP_PROTOCOL, \
   585     DEST := $(DOCS_OUTPUTDIR)/specs/jdwp, \
   654       SOURCE_FILES := $(JDWP_PROTOCOL), \
   586 ))
   655       OUTPUT_DIR := $(DOCS_OUTPUTDIR)/specs/jdwp, \
   587 JDK_SPECS_TARGETS += $(COPY_JDWP_PROTOCOL)
   656       REPLACEMENTS := \
       
   657           <body> => <body>$(SPECS_TOP) ; \
       
   658           </body> => $(SPECS_BOTTOM_1)</body>, \
       
   659   ))
       
   660   JDK_SPECS_TARGETS += $(PROCESS_JDWP_PROTOCOL)
       
   661 endif
   588 
   662 
   589 # Get jvmti.html from the main jvm variant (all variants' jvmti.html are identical).
   663 # Get jvmti.html from the main jvm variant (all variants' jvmti.html are identical).
   590 JVMTI_HTML ?= $(HOTSPOT_OUTPUTDIR)/variant-$(JVM_VARIANT_MAIN)/gensrc/jvmtifiles/jvmti.html
   664 JVMTI_HTML ?= $(HOTSPOT_OUTPUTDIR)/variant-$(JVM_VARIANT_MAIN)/gensrc/jvmtifiles/jvmti.html
   591 $(eval $(call SetupCopyFiles, COPY_JVMTI_HTML, \
   665 ifneq ($(call ApplySpecFilter, $(JVMTI_HTML)), )
   592     FILES := $(JVMTI_HTML), \
   666   $(eval $(call SetupTextFileProcessing, PROCESS_JVMTI_HTML, \
   593     DEST := $(DOCS_OUTPUTDIR)/specs, \
   667       SOURCE_FILES := $(JVMTI_HTML), \
   594 ))
   668       OUTPUT_DIR := $(DOCS_OUTPUTDIR)/specs/, \
   595 JDK_SPECS_TARGETS += $(COPY_JVMTI_HTML)
   669       REPLACEMENTS := \
       
   670           <body> => <body>$(SPECS_TOP) ; \
       
   671           </body> => $(SPECS_BOTTOM_0)</body>, \
       
   672   ))
       
   673   JDK_SPECS_TARGETS += $(PROCESS_JVMTI_HTML)
       
   674 endif
   596 
   675 
   597 ################################################################################
   676 ################################################################################
   598 # Optional target which bundles all generated javadocs into a zip archive.
   677 # Optional target which bundles all generated javadocs into a zip archive.
   599 
   678 
   600 JAVADOC_ZIP_NAME := jdk-$(VERSION_STRING)-docs.zip
   679 JAVADOC_ZIP_NAME := jdk-$(VERSION_STRING)-docs.zip
   608 ))
   687 ))
   609 
   688 
   610 ZIP_TARGETS += $(BUILD_JAVADOC_ZIP)
   689 ZIP_TARGETS += $(BUILD_JAVADOC_ZIP)
   611 
   690 
   612 ################################################################################
   691 ################################################################################
       
   692 # Hook to include the corresponding custom file, if present.
       
   693 $(eval $(call IncludeCustomExtension, Docs-post.gmk))
       
   694 
       
   695 ################################################################################
       
   696 # Bundles all generated specs into a zip archive, skipping javadocs.
       
   697 
       
   698 SPECS_ZIP_NAME := jdk-$(VERSION_STRING)-specs.zip
       
   699 SPECS_ZIP_FILE := $(OUTPUTDIR)/bundles/$(SPECS_ZIP_NAME)
       
   700 
       
   701 $(eval $(call SetupZipArchive, BUILD_SPECS_ZIP, \
       
   702     SRC := $(DOCS_OUTPUTDIR), \
       
   703     ZIP := $(SPECS_ZIP_FILE), \
       
   704     EXTRA_DEPS := $(JDK_SPECS_TARGETS), \
       
   705 ))
       
   706 
       
   707 SPECS_ZIP_TARGETS += $(BUILD_SPECS_ZIP)
       
   708 
       
   709 ################################################################################
   613 
   710 
   614 docs-jdk-api-javadoc: $(JDK_API_JAVADOC_TARGETS) $(JDK_API_CUSTOM_TARGETS)
   711 docs-jdk-api-javadoc: $(JDK_API_JAVADOC_TARGETS) $(JDK_API_CUSTOM_TARGETS)
   615 
   712 
   616 docs-jdk-api-modulegraph: $(JDK_API_MODULEGRAPH_TARGETS)
   713 docs-jdk-api-modulegraph: $(JDK_API_MODULEGRAPH_TARGETS)
   617 
   714 
   626 docs-jdk-specs: $(JDK_SPECS_TARGETS)
   723 docs-jdk-specs: $(JDK_SPECS_TARGETS)
   627 
   724 
   628 docs-jdk-index: $(JDK_INDEX_TARGETS)
   725 docs-jdk-index: $(JDK_INDEX_TARGETS)
   629 
   726 
   630 docs-zip: $(ZIP_TARGETS)
   727 docs-zip: $(ZIP_TARGETS)
       
   728 
       
   729 docs-specs-zip: $(SPECS_ZIP_TARGETS)
   631 
   730 
   632 all: docs-jdk-api-javadoc docs-jdk-api-modulegraph docs-javase-api-javadoc \
   731 all: docs-jdk-api-javadoc docs-jdk-api-modulegraph docs-javase-api-javadoc \
   633     docs-javase-api-modulegraph docs-reference-api-javadoc \
   732     docs-javase-api-modulegraph docs-reference-api-javadoc \
   634     docs-reference-api-modulegraph docs-jdk-specs docs-jdk-index docs-zip
   733     docs-reference-api-modulegraph docs-jdk-specs docs-jdk-index docs-zip \
       
   734     docs-specs-zip
   635 
   735 
   636 .PHONY: default all docs-jdk-api-javadoc docs-jdk-api-modulegraph \
   736 .PHONY: default all docs-jdk-api-javadoc docs-jdk-api-modulegraph \
   637     docs-javase-api-javadoc docs-javase-api-modulegraph \
   737     docs-javase-api-javadoc docs-javase-api-modulegraph \
   638     docs-reference-api-javadoc docs-reference-api-modulegraph docs-jdk-specs \
   738     docs-reference-api-javadoc docs-reference-api-modulegraph docs-jdk-specs \
   639     docs-jdk-index docs-zip
   739     docs-jdk-index docs-zip docs-specs-zip