8331886: Allow markdown src file overrides

Reviewed-by: ihse
This commit is contained in:
Erik Joelsson 2024-05-08 21:57:55 +00:00
parent 0d1216c7a1
commit 588e314e4b
2 changed files with 65 additions and 62 deletions

View File

@ -681,13 +681,11 @@ ifeq ($(ENABLE_PANDOC), true)
$(TOPDIR)/make/jdk/src/classes/build/tools/pandocfilter)
$(foreach m, $(ALL_MODULES), \
$(eval MAN_$m := $(call FindModuleManDirs, $m)) \
$(foreach d, $(MAN_$m), \
$(foreach f, $(call ApplySpecFilter, $(filter %.md, $(call FindFiles, $d))), \
$(eval $m_$f_NAME := MAN_TO_HTML_$m_$(strip $(call RelativePath, $f, $(TOPDIR)))) \
$(eval $(call SetupProcessMarkdown, $($m_$f_NAME), \
SRC := $d, \
FILES := $f, \
$(eval MAN_$m := $(call ApplySpecFilter, $(filter %.md, $(call FindFiles, \
$(call FindModuleManDirs, $m))))) \
$(if $(MAN_$m), \
$(eval $(call SetupProcessMarkdown, MAN_TO_HTML_$m, \
FILES := $(MAN_$m), \
DEST := $(DOCS_OUTPUTDIR)/specs/man, \
FILTER := $(PANDOC_HTML_MANPAGE_FILTER), \
CSS := $(GLOBAL_SPECS_DEFAULT_CSS_FILE), \
@ -701,8 +699,7 @@ ifeq ($(ENABLE_PANDOC), true)
EXTRA_DEPS := $(PANDOC_HTML_MANPAGE_FILTER) \
$(PANDOC_HTML_MANPAGE_FILTER_SOURCE), \
)) \
$(eval JDK_SPECS_TARGETS += $($($m_$f_NAME))) \
) \
$(eval JDK_SPECS_TARGETS += $(MAN_TO_HTML_$m)) \
) \
)

View File

@ -38,6 +38,11 @@ define ProcessMarkdown
$1_$2_INPUT_FILE := $3/$2
$1_$2_MARKER := $$(subst /,_,$1_$2)
# Only continue if this target file hasn't been processed already. This lets
# the first found source file override any other with the same name.
ifeq ($$($1_$2_OUTPUT_FILE_PROCESSED), )
$1_$2_OUTPUT_FILE_PROCESSED := true
ifneq ($$($1_REPLACEMENTS), )
$1_$2_PANDOC_INPUT := $$(SUPPORT_OUTPUTDIR)/markdown/$$($1_$2_MARKER)_pre.tmp
@ -107,6 +112,7 @@ define ProcessMarkdown
endif
$1 += $$($1_$2_OUTPUT_FILE)
endif
endef
################################################################################