make/UpdateBuildDocs.gmk
changeset 46388 d7a164ad6b7f
parent 44511 f3c27401a860
child 44983 4e216c0475ee
equal deleted inserted replaced
46387:c46632622b17 46388:d7a164ad6b7f
    45 # and the targets generated are listed in a variable by that name.
    45 # and the targets generated are listed in a variable by that name.
    46 #
    46 #
    47 # Remaining parameters are named arguments. These include:
    47 # Remaining parameters are named arguments. These include:
    48 #   SOURCE_FILE  The markdown source file
    48 #   SOURCE_FILE  The markdown source file
    49 #   TARGET_DIR   The directory where to store the generated html file
    49 #   TARGET_DIR   The directory where to store the generated html file
       
    50 #   OPTIONS      Additional options to pandoc
    50 #
    51 #
    51 SetupMarkdownToHtml = $(NamedParamsMacroTemplate)
    52 SetupMarkdownToHtml = $(NamedParamsMacroTemplate)
    52 define SetupMarkdownToHtmlBody
    53 define SetupMarkdownToHtmlBody
    53   ifeq ($$($1_SOURCE_FILE), )
    54   ifeq ($$($1_SOURCE_FILE), )
    54     $$(error SOURCE_FILE is missing in SetupMarkdownToHtml $1)
    55     $$(error SOURCE_FILE is missing in SetupMarkdownToHtml $1)
    63 
    64 
    64 $$($1_OUTPUT_FILE): $$($1_SOURCE_FILE)
    65 $$($1_OUTPUT_FILE): $$($1_SOURCE_FILE)
    65 	$$(call LogInfo, Converting $$(notdir $1) to html)
    66 	$$(call LogInfo, Converting $$(notdir $1) to html)
    66 	$$(call MakeDir, $$($1_TARGET_DIR) $$(MAKESUPPORT_OUTPUTDIR)/markdown)
    67 	$$(call MakeDir, $$($1_TARGET_DIR) $$(MAKESUPPORT_OUTPUTDIR)/markdown)
    67 	$$(call ExecuteWithLog, $$(MAKESUPPORT_OUTPUTDIR)/markdown/$1, \
    68 	$$(call ExecuteWithLog, $$(MAKESUPPORT_OUTPUTDIR)/markdown/$1, \
    68 	    $$(PANDOC) -f markdown -t html --standalone '$$<' -o '$$@')
    69 	    $$(PANDOC) $$($1_OPTIONS) -f markdown -t html --standalone \
    69 	TOO_LONG_LINES=`$$(GREP) -E -e '^.{80}.+$$$$' $$<` ; \
    70 	    --css 'http://openjdk.java.net/page.css' '$$<' -o '$$@')
    70 	if [ "x$$TOO_LONG_LINES" != x ]; then \
    71 	TOO_LONG_LINES=`$$(GREP) -E -e '^.{80}.+$$$$' $$<` || true ; \
       
    72 	if [ "x$$$$TOO_LONG_LINES" != x ]; then \
    71 	  $$(ECHO) "Warning: Unsuitable markdown in $$<:" ; \
    73 	  $$(ECHO) "Warning: Unsuitable markdown in $$<:" ; \
    72 	  $$(ECHO) "The following lines are longer than 80 characters:" ; \
    74 	  $$(ECHO) "The following lines are longer than 80 characters:" ; \
    73 	  $$(GREP) -E -e '^.{80}.+$$$$' $$< ; \
    75 	  $$(GREP) -E -n -e '^.{80}.+$$$$' $$< || true ; \
    74 	fi
    76 	fi
    75 
    77 
    76   $1 := $$($1_OUTPUT_FILE)
    78   $1 := $$($1_OUTPUT_FILE)
    77 
    79 
    78   TARGETS += $$($1)
    80   TARGETS += $$($1)
    79 endef
    81 endef
    80 
    82 
    81 ################################################################################
    83 ################################################################################
    82 
    84 
    83 BUILD_DOCS_DIR := $(TOPDIR)/common/doc
    85 DOCS_DIR := $(TOPDIR)/common/doc
    84 BUILD_DOCS_MD_FILE := building.md
       
    85 
    86 
    86 $(eval $(call SetupMarkdownToHtml, building, \
    87 $(eval $(call SetupMarkdownToHtml, building, \
    87   SOURCE_FILE := $(BUILD_DOCS_DIR)/$(BUILD_DOCS_MD_FILE), \
    88   SOURCE_FILE := $(DOCS_DIR)/building.md, \
    88   TARGET_DIR := $(BUILD_DOCS_DIR), \
    89   TARGET_DIR := $(DOCS_DIR), \
       
    90 ))
       
    91 
       
    92 $(eval $(call SetupMarkdownToHtml, testing, \
       
    93   SOURCE_FILE := $(DOCS_DIR)/testing.md, \
       
    94   TARGET_DIR := $(DOCS_DIR), \
       
    95   OPTIONS := --toc, \
    89 ))
    96 ))
    90 
    97 
    91 ################################################################################
    98 ################################################################################
    92 
    99 
    93 $(eval $(call IncludeCustomExtension, , UpdateBuildDocs.gmk))
   100 $(eval $(call IncludeCustomExtension, , UpdateBuildDocs.gmk))