diff -r 635cc02314e3 -r 10f543db5dcb make/UpdateBuildDocs.gmk --- a/make/UpdateBuildDocs.gmk Thu May 11 20:24:27 2017 +0000 +++ b/make/UpdateBuildDocs.gmk Wed Jul 05 23:26:27 2017 +0200 @@ -27,6 +27,7 @@ include $(SPEC) include MakeBase.gmk +include ProcessMarkdown.gmk ################################################################################ # This makefile updates the generated build html documentation. @@ -38,62 +39,26 @@ $(error Cannot continue) endif -################################################################################ -# Setup make rules for converting a markdown file to html. -# -# Parameter 1 is the name of the rule. This name is used as variable prefix, -# and the targets generated are listed in a variable by that name. -# -# Remaining parameters are named arguments. These include: -# SOURCE_FILE The markdown source file -# TARGET_DIR The directory where to store the generated html file -# OPTIONS Additional options to pandoc -# -SetupMarkdownToHtml = $(NamedParamsMacroTemplate) -define SetupMarkdownToHtmlBody - ifeq ($$($1_SOURCE_FILE), ) - $$(error SOURCE_FILE is missing in SetupMarkdownToHtml $1) - endif - - ifeq ($$($1_TARGET_DIR), ) - $$(error TARGET_DIR is missing in SetupMarkdownToHtml $1) - endif - - $1_BASENAME := $$(notdir $$(basename $$($1_SOURCE_FILE))) - $1_OUTPUT_FILE := $$($1_TARGET_DIR)/$$($1_BASENAME).html - -$$($1_OUTPUT_FILE): $$($1_SOURCE_FILE) - $$(call LogInfo, Converting $$(notdir $1) to html) - $$(call MakeDir, $$($1_TARGET_DIR) $$(MAKESUPPORT_OUTPUTDIR)/markdown) - $$(call ExecuteWithLog, $$(MAKESUPPORT_OUTPUTDIR)/markdown/$1, \ - $$(PANDOC) $$($1_OPTIONS) -f markdown -t html --standalone \ - --css 'http://openjdk.java.net/page.css' '$$<' -o '$$@') - TOO_LONG_LINES=`$$(GREP) -E -e '^.{80}.+$$$$' $$<` || true ; \ - if [ "x$$$$TOO_LONG_LINES" != x ]; then \ - $$(ECHO) "Warning: Unsuitable markdown in $$<:" ; \ - $$(ECHO) "The following lines are longer than 80 characters:" ; \ - $$(GREP) -E -n -e '^.{80}.+$$$$' $$< || true ; \ - fi - - $1 := $$($1_OUTPUT_FILE) - - TARGETS += $$($1) -endef +GLOBAL_SPECS_DEFAULT_CSS_FILE := $(JDK_TOPDIR)/make/data/docs-resources/specs/resources/jdk-default.css ################################################################################ DOCS_DIR := $(TOPDIR)/common/doc -$(eval $(call SetupMarkdownToHtml, building, \ - SOURCE_FILE := $(DOCS_DIR)/building.md, \ - TARGET_DIR := $(DOCS_DIR), \ +$(eval $(call SetupProcessMarkdown, building, \ + FILES := $(DOCS_DIR)/building.md, \ + DEST := $(DOCS_DIR), \ + CSS := $(GLOBAL_SPECS_DEFAULT_CSS_FILE), \ )) +TARGETS += $(building) -$(eval $(call SetupMarkdownToHtml, testing, \ - SOURCE_FILE := $(DOCS_DIR)/testing.md, \ - TARGET_DIR := $(DOCS_DIR), \ +$(eval $(call SetupProcessMarkdown, testing, \ + FILES := $(DOCS_DIR)/testing.md, \ + DEST := $(DOCS_DIR), \ + CSS := $(GLOBAL_SPECS_DEFAULT_CSS_FILE), \ OPTIONS := --toc, \ )) +TARGETS += $(testing) ################################################################################