make/UpdateBuildDocs.gmk
changeset 44983 4e216c0475ee
parent 44511 f3c27401a860
child 45763 2a2e56f4c03b
equal deleted inserted replaced
44831:4577394d5b98 44983:4e216c0475ee
    25 
    25 
    26 default: all
    26 default: all
    27 
    27 
    28 include $(SPEC)
    28 include $(SPEC)
    29 include MakeBase.gmk
    29 include MakeBase.gmk
       
    30 include ProcessMarkdown.gmk
    30 
    31 
    31 ################################################################################
    32 ################################################################################
    32 # This makefile updates the generated build html documentation.
    33 # This makefile updates the generated build html documentation.
    33 #
    34 #
    34 ################################################################################
    35 ################################################################################
    36 ifeq ($(PANDOC), )
    37 ifeq ($(PANDOC), )
    37   $(info No pandoc executable was detected by configure)
    38   $(info No pandoc executable was detected by configure)
    38   $(error Cannot continue)
    39   $(error Cannot continue)
    39 endif
    40 endif
    40 
    41 
    41 ################################################################################
    42 GLOBAL_SPECS_DEFAULT_CSS_FILE := $(JDK_TOPDIR)/make/data/docs-resources/specs/resources/jdk-default.css
    42 # Setup make rules for converting a markdown file to html.
       
    43 #
       
    44 # Parameter 1 is the name of the rule. This name is used as variable prefix,
       
    45 # and the targets generated are listed in a variable by that name.
       
    46 #
       
    47 # Remaining parameters are named arguments. These include:
       
    48 #   SOURCE_FILE  The markdown source file
       
    49 #   TARGET_DIR   The directory where to store the generated html file
       
    50 #   OPTIONS      Additional options to pandoc
       
    51 #
       
    52 SetupMarkdownToHtml = $(NamedParamsMacroTemplate)
       
    53 define SetupMarkdownToHtmlBody
       
    54   ifeq ($$($1_SOURCE_FILE), )
       
    55     $$(error SOURCE_FILE is missing in SetupMarkdownToHtml $1)
       
    56   endif
       
    57 
       
    58   ifeq ($$($1_TARGET_DIR), )
       
    59     $$(error TARGET_DIR is missing in SetupMarkdownToHtml $1)
       
    60   endif
       
    61 
       
    62   $1_BASENAME := $$(notdir $$(basename $$($1_SOURCE_FILE)))
       
    63   $1_OUTPUT_FILE := $$($1_TARGET_DIR)/$$($1_BASENAME).html
       
    64 
       
    65 $$($1_OUTPUT_FILE): $$($1_SOURCE_FILE)
       
    66 	$$(call LogInfo, Converting $$(notdir $1) to html)
       
    67 	$$(call MakeDir, $$($1_TARGET_DIR) $$(MAKESUPPORT_OUTPUTDIR)/markdown)
       
    68 	$$(call ExecuteWithLog, $$(MAKESUPPORT_OUTPUTDIR)/markdown/$1, \
       
    69 	    $$(PANDOC) $$($1_OPTIONS) -f markdown -t html --standalone \
       
    70 	    --css 'http://openjdk.java.net/page.css' '$$<' -o '$$@')
       
    71 	TOO_LONG_LINES=`$$(GREP) -E -e '^.{80}.+$$$$' $$<` || true ; \
       
    72 	if [ "x$$$$TOO_LONG_LINES" != x ]; then \
       
    73 	  $$(ECHO) "Warning: Unsuitable markdown in $$<:" ; \
       
    74 	  $$(ECHO) "The following lines are longer than 80 characters:" ; \
       
    75 	  $$(GREP) -E -n -e '^.{80}.+$$$$' $$< || true ; \
       
    76 	fi
       
    77 
       
    78   $1 := $$($1_OUTPUT_FILE)
       
    79 
       
    80   TARGETS += $$($1)
       
    81 endef
       
    82 
    43 
    83 ################################################################################
    44 ################################################################################
    84 
    45 
    85 DOCS_DIR := $(TOPDIR)/common/doc
    46 DOCS_DIR := $(TOPDIR)/common/doc
    86 
    47 
    87 $(eval $(call SetupMarkdownToHtml, building, \
    48 $(eval $(call SetupProcessMarkdown, building, \
    88   SOURCE_FILE := $(DOCS_DIR)/building.md, \
    49   FILES := $(DOCS_DIR)/building.md, \
    89   TARGET_DIR := $(DOCS_DIR), \
    50   DEST := $(DOCS_DIR), \
       
    51   CSS := $(GLOBAL_SPECS_DEFAULT_CSS_FILE), \
    90 ))
    52 ))
       
    53 TARGETS += $(building)
    91 
    54 
    92 $(eval $(call SetupMarkdownToHtml, testing, \
    55 $(eval $(call SetupProcessMarkdown, testing, \
    93   SOURCE_FILE := $(DOCS_DIR)/testing.md, \
    56   FILES := $(DOCS_DIR)/testing.md, \
    94   TARGET_DIR := $(DOCS_DIR), \
    57   DEST := $(DOCS_DIR), \
       
    58   CSS := $(GLOBAL_SPECS_DEFAULT_CSS_FILE), \
    95   OPTIONS := --toc, \
    59   OPTIONS := --toc, \
    96 ))
    60 ))
       
    61 TARGETS += $(testing)
    97 
    62 
    98 ################################################################################
    63 ################################################################################
    99 
    64 
   100 $(eval $(call IncludeCustomExtension, , UpdateBuildDocs.gmk))
    65 $(eval $(call IncludeCustomExtension, , UpdateBuildDocs.gmk))
   101 
    66