make/common/ProcessMarkdown.gmk
author ihse
Fri, 23 Nov 2018 12:19:38 +0100
branchihse-manpages-branch
changeset 57035 f7a879e76ab8
parent 57000 03413eb7301f
child 57045 9c7f4a3c4139
permissions -rw-r--r--
Fix race in ProcessMarkdown.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
56950
55725429863a Make pandoc conversion of man pages work again.
ihse
parents: 56893
diff changeset
     1
# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
44983
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
     2
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
     3
#
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
     4
# This code is free software; you can redistribute it and/or modify it
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
     5
# under the terms of the GNU General Public License version 2 only, as
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
     6
# published by the Free Software Foundation.  Oracle designates this
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
     7
# particular file as subject to the "Classpath" exception as provided
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
     8
# by Oracle in the LICENSE file that accompanied this code.
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
     9
#
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
    10
# This code is distributed in the hope that it will be useful, but WITHOUT
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
    11
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
    12
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
    13
# version 2 for more details (a copy is included in the LICENSE file that
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
    14
# accompanied this code).
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
    15
#
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
    16
# You should have received a copy of the GNU General Public License version
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
    17
# 2 along with this work; if not, write to the Free Software Foundation,
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
    18
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
    19
#
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
    20
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
    21
# or visit www.oracle.com if you need additional information or have any
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
    22
# questions.
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
    23
#
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
    24
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
    25
ifeq (,$(_MAKEBASE_GMK))
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
    26
  $(error You must include MakeBase.gmk prior to including ProcessMarkdown.gmk)
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
    27
endif
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
    28
57000
03413eb7301f Use REPLACEMENTS instead of pre-processing.
ihse
parents: 56977
diff changeset
    29
include TextFileProcessing.gmk
03413eb7301f Use REPLACEMENTS instead of pre-processing.
ihse
parents: 56977
diff changeset
    30
44983
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
    31
# Helper function for SetupProcessMarkdown
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
    32
# $1: The $1 from SetupProcessMarkdown
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
    33
# $2: The name of the current source file, relative to $1_SRC
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
    34
define ProcessMarkdown
56891
78ed9c424877 Revive "Support for generating man pages from markdown." (changeset f00e76e7d53f
ihse
parents: 45227
diff changeset
    35
  $1_$2_OUTPUT_FILE := $$($1_DEST)/$$(basename $2)$$($1_FILE_EXT)
44983
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
    36
  $1_$2_TARGET_DIR := $$(dir $$($1_$2_OUTPUT_FILE))
56973
57ed7a70cd1f Add support for pre-processing to markdown.
ihse
parents: 56972
diff changeset
    37
  $1_$2_INPUT_FILE := $$($1_SRC)/$2
57ed7a70cd1f Add support for pre-processing to markdown.
ihse
parents: 56972
diff changeset
    38
  $1_$2_MARKER := $$(subst /,_,$1_$2)
57ed7a70cd1f Add support for pre-processing to markdown.
ihse
parents: 56972
diff changeset
    39
57000
03413eb7301f Use REPLACEMENTS instead of pre-processing.
ihse
parents: 56977
diff changeset
    40
  ifneq ($$($1_REPLACEMENTS), )
56973
57ed7a70cd1f Add support for pre-processing to markdown.
ihse
parents: 56972
diff changeset
    41
    $1_$2_PANDOC_INPUT := $$(SUPPORT_OUTPUTDIR)/markdown/$$($1_$2_MARKER)_pre.tmp
57000
03413eb7301f Use REPLACEMENTS instead of pre-processing.
ihse
parents: 56977
diff changeset
    42
03413eb7301f Use REPLACEMENTS instead of pre-processing.
ihse
parents: 56977
diff changeset
    43
    $$(eval $$(call SetupTextFileProcessing, $1_$2_PREPROCESSED, \
03413eb7301f Use REPLACEMENTS instead of pre-processing.
ihse
parents: 56977
diff changeset
    44
        SOURCE_FILES := $$($1_$2_INPUT_FILE), \
03413eb7301f Use REPLACEMENTS instead of pre-processing.
ihse
parents: 56977
diff changeset
    45
        OUTPUT_FILE := $$($1_$2_PANDOC_INPUT), \
03413eb7301f Use REPLACEMENTS instead of pre-processing.
ihse
parents: 56977
diff changeset
    46
        REPLACEMENTS := $$($1_REPLACEMENTS), \
03413eb7301f Use REPLACEMENTS instead of pre-processing.
ihse
parents: 56977
diff changeset
    47
    ))
56973
57ed7a70cd1f Add support for pre-processing to markdown.
ihse
parents: 56972
diff changeset
    48
  else
57ed7a70cd1f Add support for pre-processing to markdown.
ihse
parents: 56972
diff changeset
    49
    $1_$2_PANDOC_INPUT := $$($1_$2_INPUT_FILE)
57ed7a70cd1f Add support for pre-processing to markdown.
ihse
parents: 56972
diff changeset
    50
  endif
57ed7a70cd1f Add support for pre-processing to markdown.
ihse
parents: 56972
diff changeset
    51
57ed7a70cd1f Add support for pre-processing to markdown.
ihse
parents: 56972
diff changeset
    52
  ifneq ($$($1_POST_PROCESS), )
57ed7a70cd1f Add support for pre-processing to markdown.
ihse
parents: 56972
diff changeset
    53
    $1_$2_PANDOC_OUTPUT := $$(SUPPORT_OUTPUTDIR)/markdown/$$($1_$2_MARKER)_post.tmp
57ed7a70cd1f Add support for pre-processing to markdown.
ihse
parents: 56972
diff changeset
    54
  else
57ed7a70cd1f Add support for pre-processing to markdown.
ihse
parents: 56972
diff changeset
    55
    $1_$2_PANDOC_OUTPUT := $$($1_$2_OUTPUT_FILE)
57ed7a70cd1f Add support for pre-processing to markdown.
ihse
parents: 56972
diff changeset
    56
  endif
56891
78ed9c424877 Revive "Support for generating man pages from markdown." (changeset f00e76e7d53f
ihse
parents: 45227
diff changeset
    57
44983
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
    58
  ifneq ($$($1_CSS), )
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
    59
    ifneq ($$(findstring http:/, $$($1_CSS)), )
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
    60
      $1_$2_CSS_OPTION := --css '$$($1_CSS)'
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
    61
    else
45227
97be1bcd7b25 8180472: Pandoc should generate html5 from markdown
ihse
parents: 44983
diff changeset
    62
      $1_$2_CSS := $$(strip $$(call RelativePath, $$($1_CSS), $$($1_$2_TARGET_DIR)))
44983
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
    63
      $1_$2_CSS_OPTION := --css '$$($1_$2_CSS)'
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
    64
    endif
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
    65
  endif
56977
9221e7c3bf36 Add a pandoc filter for man pages written in javascript, to transform man pages.
ihse
parents: 56974
diff changeset
    66
56972
e134eea44a09 Revive remaining fixes from old jdk9 sandbox.
ihse
parents: 56951
diff changeset
    67
  $1_$2_OPTIONS := $$(shell $$(GREP) _pandoc-options_: $$($1_SRC)/$2 | $$(CUT) -d : -f 2-)
e134eea44a09 Revive remaining fixes from old jdk9 sandbox.
ihse
parents: 56951
diff changeset
    68
56977
9221e7c3bf36 Add a pandoc filter for man pages written in javascript, to transform man pages.
ihse
parents: 56974
diff changeset
    69
  ifneq ($$($1_FILTER), )
9221e7c3bf36 Add a pandoc filter for man pages written in javascript, to transform man pages.
ihse
parents: 56974
diff changeset
    70
    $1_$2_OPTIONS += --filter $$($1_FILTER)
9221e7c3bf36 Add a pandoc filter for man pages written in javascript, to transform man pages.
ihse
parents: 56974
diff changeset
    71
  endif
9221e7c3bf36 Add a pandoc filter for man pages written in javascript, to transform man pages.
ihse
parents: 56974
diff changeset
    72
57000
03413eb7301f Use REPLACEMENTS instead of pre-processing.
ihse
parents: 56977
diff changeset
    73
  $1_$2_VARDEPS := $$($1_OPTIONS) $$($1_$2_OPTIONS) $$($1_CSS) \
03413eb7301f Use REPLACEMENTS instead of pre-processing.
ihse
parents: 56977
diff changeset
    74
      $$($1_REPLACEMENTS) $$($1_POST_PROCESS)
44983
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
    75
  $1_$2_VARDEPS_FILE := $$(call DependOnVariable, $1_$2_VARDEPS, \
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
    76
      $$(SUPPORT_OUTPUTDIR)/markdown/$$($1_$2_MARKER).vardeps)
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
    77
57035
f7a879e76ab8 Fix race in ProcessMarkdown.
ihse
parents: 57000
diff changeset
    78
$$($1_$2_PANDOC_OUTPUT): $$($1_$2_PANDOC_INPUT) $$($1_$2_VARDEPS_FILE) $$($1_EXTRA_DEPS)
56972
e134eea44a09 Revive remaining fixes from old jdk9 sandbox.
ihse
parents: 56951
diff changeset
    79
	$$(call LogInfo, Converting $2 to $$($1_FORMAT))
57035
f7a879e76ab8 Fix race in ProcessMarkdown.
ihse
parents: 57000
diff changeset
    80
	$$(call MakeDir, $$(SUPPORT_OUTPUTDIR)/markdown $$(dir $$($1_$2_PANDOC_OUTPUT)))
44983
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
    81
	$$(call ExecuteWithLog, $$(SUPPORT_OUTPUTDIR)/markdown/$$($1_$2_MARKER), \
56972
e134eea44a09 Revive remaining fixes from old jdk9 sandbox.
ihse
parents: 56951
diff changeset
    82
	    $$(PANDOC) $$($1_OPTIONS) -f markdown -t $$($1_FORMAT) --standalone \
56973
57ed7a70cd1f Add support for pre-processing to markdown.
ihse
parents: 56972
diff changeset
    83
	    $$($1_$2_CSS_OPTION) $$($1_$2_OPTIONS) '$$($1_$2_PANDOC_INPUT)' \
57ed7a70cd1f Add support for pre-processing to markdown.
ihse
parents: 56972
diff changeset
    84
	    -o '$$($1_$2_PANDOC_OUTPUT)')
44983
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
    85
        ifneq ($$(findstring $$(LOG_LEVEL), debug trace),)
56972
e134eea44a09 Revive remaining fixes from old jdk9 sandbox.
ihse
parents: 56951
diff changeset
    86
	  TOO_LONG_LINES=`$$(GREP) -E -e '^.{80}.+$$$$' $$<` || true ; \
e134eea44a09 Revive remaining fixes from old jdk9 sandbox.
ihse
parents: 56951
diff changeset
    87
	  if [ "x$$$$TOO_LONG_LINES" != x ]; then \
e134eea44a09 Revive remaining fixes from old jdk9 sandbox.
ihse
parents: 56951
diff changeset
    88
	    $$(ECHO) "Warning: Unsuitable markdown in $$<:" ; \
e134eea44a09 Revive remaining fixes from old jdk9 sandbox.
ihse
parents: 56951
diff changeset
    89
	    $$(ECHO) "The following lines are longer than 80 characters:" ; \
e134eea44a09 Revive remaining fixes from old jdk9 sandbox.
ihse
parents: 56951
diff changeset
    90
	    $$(GREP) -E -n -e '^.{80}.+$$$$' $$< || true ; \
e134eea44a09 Revive remaining fixes from old jdk9 sandbox.
ihse
parents: 56951
diff changeset
    91
	  fi
44983
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
    92
        endif
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
    93
57035
f7a879e76ab8 Fix race in ProcessMarkdown.
ihse
parents: 57000
diff changeset
    94
  # If we have no post processing, PANDOC_OUTPUT is set to OUTPUT_FILE. Otherwise
f7a879e76ab8 Fix race in ProcessMarkdown.
ihse
parents: 57000
diff changeset
    95
  # PANDOC_OUTPUT is a temporary file, and we must now create the real OUTPUT_FILE.
f7a879e76ab8 Fix race in ProcessMarkdown.
ihse
parents: 57000
diff changeset
    96
  ifneq ($$($1_POST_PROCESS), )
f7a879e76ab8 Fix race in ProcessMarkdown.
ihse
parents: 57000
diff changeset
    97
$$($1_$2_OUTPUT_FILE): $$($1_$2_PANDOC_OUTPUT)
f7a879e76ab8 Fix race in ProcessMarkdown.
ihse
parents: 57000
diff changeset
    98
	$$(call LogInfo, Post-processing markdown file $2)
f7a879e76ab8 Fix race in ProcessMarkdown.
ihse
parents: 57000
diff changeset
    99
	$$(call MakeDir, $$(SUPPORT_OUTPUTDIR)/markdown $$($1_$2_TARGET_DIR))
f7a879e76ab8 Fix race in ProcessMarkdown.
ihse
parents: 57000
diff changeset
   100
	$$(call ExecuteWithLog, $$(SUPPORT_OUTPUTDIR)/markdown/$$($1_$2_MARKER)_post, \
f7a879e76ab8 Fix race in ProcessMarkdown.
ihse
parents: 57000
diff changeset
   101
	    $$($1_POST_PROCESS) < $$($1_$2_PANDOC_OUTPUT) > $$($1_$2_OUTPUT_FILE))
f7a879e76ab8 Fix race in ProcessMarkdown.
ihse
parents: 57000
diff changeset
   102
  endif
f7a879e76ab8 Fix race in ProcessMarkdown.
ihse
parents: 57000
diff changeset
   103
44983
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
   104
  $1 += $$($1_$2_OUTPUT_FILE)
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
   105
endef
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
   106
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
   107
################################################################################
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
   108
# Setup make rules for converting a markdown file to html.
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
   109
#
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
   110
# Parameter 1 is the name of the rule. This name is used as variable prefix,
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
   111
# and the targets generated are listed in a variable by that name.
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
   112
#
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
   113
# Remaining parameters are named arguments. These include:
56891
78ed9c424877 Revive "Support for generating man pages from markdown." (changeset f00e76e7d53f
ihse
parents: 45227
diff changeset
   114
#   SRC      : Source root dir (defaults to dir of first file)
78ed9c424877 Revive "Support for generating man pages from markdown." (changeset f00e76e7d53f
ihse
parents: 45227
diff changeset
   115
#   DEST     : Dest root dir
78ed9c424877 Revive "Support for generating man pages from markdown." (changeset f00e76e7d53f
ihse
parents: 45227
diff changeset
   116
#   FILES    : List of files to copy with absolute paths, or path relative to SRC.
78ed9c424877 Revive "Support for generating man pages from markdown." (changeset f00e76e7d53f
ihse
parents: 45227
diff changeset
   117
#              Must be in SRC.
56972
e134eea44a09 Revive remaining fixes from old jdk9 sandbox.
ihse
parents: 56951
diff changeset
   118
#   FORMAT   : The target format (defaults to html5)
56891
78ed9c424877 Revive "Support for generating man pages from markdown." (changeset f00e76e7d53f
ihse
parents: 45227
diff changeset
   119
#   FILE_EXT : The file extension to replace .md with (defaults to .html)
78ed9c424877 Revive "Support for generating man pages from markdown." (changeset f00e76e7d53f
ihse
parents: 45227
diff changeset
   120
#   OPTIONS  : Additional options to pandoc
56977
9221e7c3bf36 Add a pandoc filter for man pages written in javascript, to transform man pages.
ihse
parents: 56974
diff changeset
   121
#   EXTRA_DEPS : Additional dependencies to add to each pandoc call
9221e7c3bf36 Add a pandoc filter for man pages written in javascript, to transform man pages.
ihse
parents: 56974
diff changeset
   122
#   FILTER   : Optional pandoc filter command
57000
03413eb7301f Use REPLACEMENTS instead of pre-processing.
ihse
parents: 56977
diff changeset
   123
#   POST_PROCESS : Optional command-line to post-process generated markdown
03413eb7301f Use REPLACEMENTS instead of pre-processing.
ihse
parents: 56977
diff changeset
   124
#   REPLACEMENTS : Text replacements to perform on input file before processing
44983
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
   125
#
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
   126
SetupProcessMarkdown = $(NamedParamsMacroTemplate)
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
   127
define SetupProcessMarkdownBody
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
   128
  ifeq ($$($1_FILES), )
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
   129
    $$(error FILES is missing in SetupProcessMarkdown $1)
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
   130
  endif
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
   131
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
   132
  ifeq ($$($1_DEST), )
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
   133
    $$(error DEST is missing in SetupProcessMarkdown $1)
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
   134
  endif
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
   135
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
   136
  # Default SRC to the dir of the first file.
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
   137
  ifeq ($$($1_SRC), )
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
   138
    $1_SRC := $$(dir $$(firstword $$($1_FILES)))
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
   139
  endif
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
   140
56972
e134eea44a09 Revive remaining fixes from old jdk9 sandbox.
ihse
parents: 56951
diff changeset
   141
  # If no target format is specified, default to html5.
56891
78ed9c424877 Revive "Support for generating man pages from markdown." (changeset f00e76e7d53f
ihse
parents: 45227
diff changeset
   142
  ifeq ($$($1_FORMAT), )
56972
e134eea44a09 Revive remaining fixes from old jdk9 sandbox.
ihse
parents: 56951
diff changeset
   143
    $1_FORMAT := html5
56891
78ed9c424877 Revive "Support for generating man pages from markdown." (changeset f00e76e7d53f
ihse
parents: 45227
diff changeset
   144
  endif
78ed9c424877 Revive "Support for generating man pages from markdown." (changeset f00e76e7d53f
ihse
parents: 45227
diff changeset
   145
78ed9c424877 Revive "Support for generating man pages from markdown." (changeset f00e76e7d53f
ihse
parents: 45227
diff changeset
   146
  ifeq ($$($1_FORMAT), man)
56950
55725429863a Make pandoc conversion of man pages work again.
ihse
parents: 56893
diff changeset
   147
    # If no file extension is specified, default to '.1'.
55725429863a Make pandoc conversion of man pages work again.
ihse
parents: 56893
diff changeset
   148
    ifeq ($$($1_FILE_EXT), )
55725429863a Make pandoc conversion of man pages work again.
ihse
parents: 56893
diff changeset
   149
      $1_FILE_EXT := .1
55725429863a Make pandoc conversion of man pages work again.
ihse
parents: 56893
diff changeset
   150
    endif
56972
e134eea44a09 Revive remaining fixes from old jdk9 sandbox.
ihse
parents: 56951
diff changeset
   151
  else ifeq ($$($1_FORMAT), html5)
e134eea44a09 Revive remaining fixes from old jdk9 sandbox.
ihse
parents: 56951
diff changeset
   152
    ifeq ($$($1_FILE_EXT), )
e134eea44a09 Revive remaining fixes from old jdk9 sandbox.
ihse
parents: 56951
diff changeset
   153
      $1_FILE_EXT := .html
e134eea44a09 Revive remaining fixes from old jdk9 sandbox.
ihse
parents: 56951
diff changeset
   154
    endif
56950
55725429863a Make pandoc conversion of man pages work again.
ihse
parents: 56893
diff changeset
   155
  else ifeq ($$($1_FORMAT), html)
55725429863a Make pandoc conversion of man pages work again.
ihse
parents: 56893
diff changeset
   156
    ifeq ($$($1_FILE_EXT), )
55725429863a Make pandoc conversion of man pages work again.
ihse
parents: 56893
diff changeset
   157
      $1_FILE_EXT := .html
55725429863a Make pandoc conversion of man pages work again.
ihse
parents: 56893
diff changeset
   158
    endif
56891
78ed9c424877 Revive "Support for generating man pages from markdown." (changeset f00e76e7d53f
ihse
parents: 45227
diff changeset
   159
  endif
78ed9c424877 Revive "Support for generating man pages from markdown." (changeset f00e76e7d53f
ihse
parents: 45227
diff changeset
   160
44983
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
   161
  # Remove any trailing slash from SRC and DEST
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
   162
  $1_SRC := $$(patsubst %/,%,$$($1_SRC))
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
   163
  $1_DEST := $$(patsubst %/,%,$$($1_DEST))
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
   164
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
   165
  $$(foreach f, $$(patsubst $$($1_SRC)/%,%,$$($1_FILES)), \
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
   166
    $$(eval $$(call ProcessMarkdown,$1,$$f)) \
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
   167
  )
4e216c0475ee 8179453: Add a proper SetupProcessMarkdown
ihse
parents:
diff changeset
   168
endef