--- a/make/CompileToolsJdk.gmk Tue Nov 27 13:47:31 2018 +0530
+++ b/make/CompileToolsJdk.gmk Thu Nov 29 14:32:23 2018 +0530
@@ -29,6 +29,7 @@
include MakeBase.gmk
include JavaCompilation.gmk
include SetupJavaCompilers.gmk
+include TextFileProcessing.gmk
################################################################################
@@ -87,4 +88,30 @@
################################################################################
+# To be able to call the javascript filter when generating man pages using
+# pandoc, we need to create this executable wrapper script.
+ifneq ($(PANDOC), )
+ # PANDOC_FILTER is duplicated for export in ToolsJdk.gmk.
+ PANDOC_FILTER := $(BUILDTOOLS_OUTPUTDIR)/manpages/pandoc-manpage-filter
+ PANDOC_FILTER_SETUP := $(BUILDTOOLS_OUTPUTDIR)/manpages/_pandoc_filter_setup.marker
+
+ # Create a usable instance of the wrapper script that calls the pandoc filter
+ # (which is written in javascript).
+ $(eval $(call SetupTextFileProcessing, CREATE_PANDOC_FILTER, \
+ SOURCE_FILES := $(TOPDIR)/make/scripts/pandoc-manpage-filter.sh.template, \
+ OUTPUT_FILE := $(PANDOC_FILTER), \
+ REPLACEMENTS := \
+ @@BOOT_JDK@@ => $(BOOT_JDK) ; \
+ @@TOPDIR@@ => $(TOPDIR) ; \
+ @@JJS_FLAGS@@ => $(addprefix -J, $(JAVA_FLAGS_SMALL)), \
+ ))
+
+ # Created script must be made executable
+ $(PANDOC_FILTER_SETUP): $(CREATE_PANDOC_FILTER)
+ $(CHMOD) a+rx $(PANDOC_FILTER)
+ $(TOUCH) $@
+
+ TARGETS += $(PANDOC_FILTER_SETUP)
+endif
+
all: $(TARGETS)