21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 # or visit www.oracle.com if you need additional information or have any |
22 # or visit www.oracle.com if you need additional information or have any |
23 # questions. |
23 # questions. |
24 # |
24 # |
25 |
25 |
|
26 include Modules.gmk |
26 include JdkNativeCompilation.gmk |
27 include JdkNativeCompilation.gmk |
27 include Modules.gmk |
28 include ProcessMarkdown.gmk |
28 |
29 |
29 # Tell the compiler not to export any functions unless declared so in |
30 # Tell the compiler not to export any functions unless declared so in |
30 # the source code. On Windows, this is the default and cannot be changed. |
31 # the source code. On Windows, this is the default and cannot be changed. |
31 # On Mac, we have always exported all symbols, probably due to oversight |
32 # On Mac, we have always exported all symbols, probably due to oversight |
32 # and/or misunderstanding. To emulate this, don't hide any symbols |
33 # and/or misunderstanding. To emulate this, don't hide any symbols |
211 $(eval MAN_PAGE_TARGETS += $($($(MODULE)_$d_NAME))) \ |
212 $(eval MAN_PAGE_TARGETS += $($($(MODULE)_$d_NAME))) \ |
212 ) \ |
213 ) \ |
213 ) |
214 ) |
214 |
215 |
215 TARGETS += $(MAN_PAGE_TARGETS) |
216 TARGETS += $(MAN_PAGE_TARGETS) |
|
217 |
|
218 else |
|
219 # Create dynamic man pages from markdown |
|
220 |
|
221 PANDOC_FILTER := $(SUPPORT_OUTPUTDIR)/docs/pandoc-manpage-filter |
|
222 PANDOC_FILTER_SETUP := $(SUPPORT_OUTPUTDIR)/docs/_pandoc_filter_setup.marker |
|
223 PANDOC_FILTER_JAVASCRIPT := $(TOPDIR)/make/scripts/pandoc-manpage-filter.js |
|
224 |
|
225 # Create a usable instance of the wrapper script that calls the pandoc filter |
|
226 # (which is written in javascript). |
|
227 $(eval $(call SetupTextFileProcessing, CREATE_PANDOC_FILTER, \ |
|
228 SOURCE_FILES := $(TOPDIR)/make/scripts/pandoc-manpage-filter.sh.template, \ |
|
229 OUTPUT_FILE := $(PANDOC_FILTER), \ |
|
230 REPLACEMENTS := \ |
|
231 @@BOOT_JDK@@ => $(BOOT_JDK) ; \ |
|
232 @@TOPDIR@@ => $(TOPDIR) ; \ |
|
233 @@JJS_FLAGS@@ => $(addprefix -J, $(JAVA_FLAGS_SMALL)), \ |
|
234 )) |
|
235 |
|
236 # Created script must be made executable |
|
237 $(PANDOC_FILTER_SETUP): $(CREATE_PANDOC_FILTER) |
|
238 $(CHMOD) a+rx $(PANDOC_FILTER) |
|
239 $(TOUCH) $@ |
|
240 |
|
241 # The norm in man pages is to display code literals as bold, but pandoc |
|
242 # "correctly" converts these constructs (encoded in markdown using `...` |
|
243 # or ```...```) to \f[C]. Ideally, we should use the filter to encapsulate |
|
244 # the Code/CodeBlock in Strong. While this works for Code, pandoc cannot |
|
245 # correctly render man page output for CodeBlock wrapped in Strong. So we |
|
246 # take the easy way out, and post-process the troff output, replacing |
|
247 # \f[C] with \f[CB]. This has the added benefit of working correctly on |
|
248 # pandoc prior to version 2.0, which cannot properly produced nested |
|
249 # formatting in man pages (see https://github.com/jgm/pandoc/issues/3568). |
|
250 # |
|
251 # As of pandoc 2.3, the termination of formatting is still broken |
|
252 # (see https://github.com/jgm/pandoc/issues/4973). We need to replace |
|
253 # \f[] with \f[R]. |
|
254 MAN_POST_PROCESS := $(SED) -e 's/\\f\[C\]/\\f\[CB\]/g' \ |
|
255 -e 's/\\f\[\]/\\f\[R\]/g' |
|
256 |
|
257 # We assume all man pages should reside in section 1 |
|
258 |
|
259 # Generate man pages from markdown |
|
260 MAN_$(MODULE) := $(call FindModuleManDirs, $(MODULE)) |
|
261 |
|
262 $(foreach d, $(MAN_$(MODULE)), \ |
|
263 $(if $(filter %.md, $(call CacheFind, $d)), \ |
|
264 $(eval $(MODULE)_$d_NAME := MAN_TO_TROFF_$(MODULE)_$(strip $(call RelativePath, $d, $(TOPDIR)))) \ |
|
265 $(eval $(call SetupProcessMarkdown, $($(MODULE)_$d_NAME), \ |
|
266 SRC := $d, \ |
|
267 FILES := $(filter %.md, $(call CacheFind, $d)), \ |
|
268 DEST := $(SUPPORT_OUTPUTDIR)/modules_man/$(MODULE)/man1, \ |
|
269 FORMAT := man, \ |
|
270 EXTRA_DEPS := $(PANDOC_FILTER_SETUP) \ |
|
271 $(PANDOC_FILTER_JAVASCRIPT), \ |
|
272 FILTER := $(PANDOC_FILTER), \ |
|
273 POST_PROCESS := $(MAN_POST_PROCESS), \ |
|
274 REPLACEMENTS := @@VERSION_SHORT@@ => $(VERSION_SHORT), \ |
|
275 )) \ |
|
276 $(eval MAN_PAGE_TARGETS += $($($(MODULE)_$d_NAME))) \ |
|
277 ) \ |
|
278 ) |
|
279 TARGETS += $(MAN_PAGE_TARGETS) |
216 endif |
280 endif |