author | ihse |
Fri, 23 Nov 2018 12:21:47 +0100 | |
branch | ihse-manpages-branch |
changeset 57037 | 91a7d19da889 |
parent 57034 | 6f85b6e0f8f8 |
child 57043 | 23d7457ca4c6 |
permissions | -rw-r--r-- |
25859 | 1 |
# |
49070
d7859531621b
8198751: Refactor SetupNativeCompilation to take NAME and TYPE
ihse
parents:
47217
diff
changeset
|
2 |
# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. |
25859 | 3 |
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
# |
|
5 |
# This code is free software; you can redistribute it and/or modify it |
|
6 |
# under the terms of the GNU General Public License version 2 only, as |
|
7 |
# published by the Free Software Foundation. Oracle designates this |
|
8 |
# particular file as subject to the "Classpath" exception as provided |
|
9 |
# by Oracle in the LICENSE file that accompanied this code. |
|
10 |
# |
|
11 |
# This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
# version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
# accompanied this code). |
|
16 |
# |
|
17 |
# You should have received a copy of the GNU General Public License version |
|
18 |
# 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
# |
|
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 |
|
23 |
# questions. |
|
24 |
# |
|
25 |
||
57037 | 26 |
include Modules.gmk |
49244
995a5556edfa
8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
49241
diff
changeset
|
27 |
include JdkNativeCompilation.gmk |
57037 | 28 |
include ProcessMarkdown.gmk |
25859 | 29 |
|
49534 | 30 |
# Tell the compiler not to export any functions unless declared so in |
31 |
# the source code. On Windows, this is the default and cannot be changed. |
|
32 |
# On Mac, we have always exported all symbols, probably due to oversight |
|
33 |
# and/or misunderstanding. To emulate this, don't hide any symbols |
|
34 |
# by default. |
|
50126
98f57dff16f3
8202322: AIX: symbol visibility flags not support on xlc 12.1
mbaesken
parents:
49534
diff
changeset
|
35 |
# On AIX/xlc we need at least xlc 13.1 for the symbol hiding |
49534 | 36 |
# Also provide an override for non-conformant libraries. |
37 |
ifeq ($(TOOLCHAIN_TYPE), gcc) |
|
38 |
LAUNCHER_CFLAGS += -fvisibility=hidden |
|
39 |
LDFLAGS_JDKEXE += -Wl,--exclude-libs,ALL |
|
40 |
else ifeq ($(TOOLCHAIN_TYPE), clang) |
|
51855 | 41 |
LAUNCHER_CFLAGS += -fvisibility=hidden |
49534 | 42 |
else ifeq ($(TOOLCHAIN_TYPE), solstudio) |
43 |
LAUNCHER_CFLAGS += -xldscope=hidden |
|
44 |
else ifeq ($(TOOLCHAIN_TYPE), xlc) |
|
50126
98f57dff16f3
8202322: AIX: symbol visibility flags not support on xlc 12.1
mbaesken
parents:
49534
diff
changeset
|
45 |
ifneq ($(CC_VERSION_NUMBER), 12.1) |
98f57dff16f3
8202322: AIX: symbol visibility flags not support on xlc 12.1
mbaesken
parents:
49534
diff
changeset
|
46 |
CXXFLAGS_JDKEXE += -qvisibility=hidden |
98f57dff16f3
8202322: AIX: symbol visibility flags not support on xlc 12.1
mbaesken
parents:
49534
diff
changeset
|
47 |
endif |
49534 | 48 |
endif |
49 |
||
47217 | 50 |
LAUNCHER_SRC := $(TOPDIR)/src/java.base/share/native/launcher |
49534 | 51 |
LAUNCHER_CFLAGS += -I$(TOPDIR)/src/java.base/share/native/launcher \ |
47217 | 52 |
-I$(TOPDIR)/src/java.base/share/native/libjli \ |
53 |
-I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjli \ |
|
54 |
-I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/native/libjli \ |
|
25859 | 55 |
# |
47217 | 56 |
GLOBAL_VERSION_INFO_RESOURCE := $(TOPDIR)/src/java.base/windows/native/common/version.rc |
57 |
JAVA_VERSION_INFO_RESOURCE := $(TOPDIR)/src/java.base/windows/native/launcher/java.rc |
|
58 |
MACOSX_PLIST_DIR := $(TOPDIR)/src/java.base/macosx/native/launcher |
|
59 |
JAVA_MANIFEST := $(TOPDIR)/src/java.base/windows/native/launcher/java.manifest |
|
25859 | 60 |
|
33523 | 61 |
################################################################################ |
62 |
# Build standard launcher. |
|
25859 | 63 |
|
33523 | 64 |
# Setup make rules for building a standard launcher. |
65 |
# |
|
66 |
# Parameter 1 is the name of the rule. This name is used as variable prefix, |
|
67 |
# and the targets generated are listed in a variable by that name. It is also |
|
68 |
# used as the name of the executable. |
|
69 |
# |
|
70 |
# Remaining parameters are named arguments. These include: |
|
36511 | 71 |
# MAIN_MODULE The module of the main class to launch if different from the |
72 |
# current module |
|
33523 | 73 |
# MAIN_CLASS The Java main class to launch |
45463
d9325138bac6
8180334: Unable to build jaotc launcher on windows
ksrini
parents:
42753
diff
changeset
|
74 |
# JAVA_ARGS Processed into a -DJAVA_ARGS and added to CFLAGS |
d9325138bac6
8180334: Unable to build jaotc launcher on windows
ksrini
parents:
42753
diff
changeset
|
75 |
# EXTRA_JAVA_ARGS Processed into a -DEXTRA_JAVA_ARGS and is prepended |
d9325138bac6
8180334: Unable to build jaotc launcher on windows
ksrini
parents:
42753
diff
changeset
|
76 |
# before JAVA_ARGS to CFLAGS, primarily to allow long string literal |
d9325138bac6
8180334: Unable to build jaotc launcher on windows
ksrini
parents:
42753
diff
changeset
|
77 |
# compile time defines exceeding Visual Studio 2013 limitations. |
33523 | 78 |
# CFLAGS Additional CFLAGS |
79 |
# CFLAGS_windows Additional CFLAGS_windows |
|
80 |
# LDFLAGS_solaris Additional LDFLAGS_solaris |
|
81 |
# RC_FLAGS Additional RC_FLAGS |
|
82 |
# MACOSX_SIGNED On macosx, sign this binary |
|
83 |
# OPTIMIZATION Override default optimization level (LOW) |
|
84 |
# OUTPUT_DIR Override default output directory |
|
85 |
# VERSION_INFO_RESOURCE Override default Windows resource file |
|
86 |
SetupBuildLauncher = $(NamedParamsMacroTemplate) |
|
87 |
define SetupBuildLauncherBody |
|
88 |
# Setup default values (unless overridden) |
|
89 |
ifeq ($$($1_OPTIMIZATION), ) |
|
90 |
$1_OPTIMIZATION := LOW |
|
91 |
endif |
|
92 |
||
36511 | 93 |
ifeq ($$($1_MAIN_MODULE), ) |
94 |
$1_MAIN_MODULE := $(MODULE) |
|
95 |
endif |
|
96 |
||
51808 | 97 |
$1_JAVA_ARGS += -ms8m |
98 |
ifneq ($$($1_MAIN_CLASS), ) |
|
99 |
$1_LAUNCHER_CLASS := -m $$($1_MAIN_MODULE)/$$($1_MAIN_CLASS) |
|
33523 | 100 |
endif |
101 |
||
51808 | 102 |
ifneq ($$($1_EXTRA_JAVA_ARGS), ) |
103 |
$1_EXTRA_JAVA_ARGS_STR := '{ $$(strip $$(foreach a, \ |
|
104 |
$$(addprefix -J, $$($1_EXTRA_JAVA_ARGS)), "$$a"$(COMMA) )) }' |
|
105 |
$1_CFLAGS += -DEXTRA_JAVA_ARGS=$$($1_EXTRA_JAVA_ARGS_STR) |
|
106 |
endif |
|
107 |
$1_JAVA_ARGS_STR := '{ $$(strip $$(foreach a, \ |
|
108 |
$$(addprefix -J, $$($1_JAVA_ARGS)) $$($1_LAUNCHER_CLASS), "$$a"$(COMMA) )) }' |
|
109 |
$1_CFLAGS += -DJAVA_ARGS=$$($1_JAVA_ARGS_STR) |
|
110 |
||
25859 | 111 |
ifeq ($(OPENJDK_TARGET_OS), macosx) |
33523 | 112 |
ifeq ($$($1_MACOSX_SIGNED), true) |
113 |
$1_PLIST_FILE := Info-privileged.plist |
|
25859 | 114 |
$1_CODESIGN := true |
33523 | 115 |
else |
116 |
$1_PLIST_FILE := Info-cmdline.plist |
|
25859 | 117 |
endif |
118 |
||
51825
e3632b4706c4
8210931: JLI and launchers normalization and cleanup
ihse
parents:
51811
diff
changeset
|
119 |
$1_LDFLAGS += -sectcreate __TEXT __info_plist $(MACOSX_PLIST_DIR)/$$($1_PLIST_FILE) |
e3632b4706c4
8210931: JLI and launchers normalization and cleanup
ihse
parents:
51811
diff
changeset
|
120 |
|
33653
c1ee09fe3274
8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents:
32515
diff
changeset
|
121 |
ifeq ($(STATIC_BUILD), true) |
33666 | 122 |
$1_LDFLAGS += -exported_symbols_list \ |
123 |
$(SUPPORT_OUTPUTDIR)/build-static/exported.symbols |
|
124 |
$1_LIBS += \ |
|
35241 | 125 |
$$(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_libs/java.base -name "*.a") \ |
33653
c1ee09fe3274
8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents:
32515
diff
changeset
|
126 |
$(SUPPORT_OUTPUTDIR)/modules_libs/jdk.jdwp.agent/libdt_socket.a \ |
c1ee09fe3274
8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents:
32515
diff
changeset
|
127 |
$(SUPPORT_OUTPUTDIR)/modules_libs/jdk.jdwp.agent/libjdwp.a \ |
c1ee09fe3274
8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents:
32515
diff
changeset
|
128 |
$(SUPPORT_OUTPUTDIR)/native/java.base/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX) \ |
c1ee09fe3274
8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents:
32515
diff
changeset
|
129 |
-framework CoreFoundation \ |
c1ee09fe3274
8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents:
32515
diff
changeset
|
130 |
-framework Foundation \ |
c1ee09fe3274
8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents:
32515
diff
changeset
|
131 |
-framework SystemConfiguration \ |
33666 | 132 |
-lstdc++ -liconv |
33653
c1ee09fe3274
8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents:
32515
diff
changeset
|
133 |
endif |
25859 | 134 |
endif |
135 |
||
136 |
ifeq ($(USE_EXTERNAL_LIBZ), true) |
|
33406 | 137 |
$1_LIBS += -lz |
25859 | 138 |
endif |
139 |
||
52022
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51855
diff
changeset
|
140 |
$1_WINDOWS_JLI_LIB := $(call FindStaticLib, java.base, jli, /libjli) |
25859 | 141 |
|
49244
995a5556edfa
8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
49241
diff
changeset
|
142 |
$$(eval $$(call SetupJdkExecutable, BUILD_LAUNCHER_$1, \ |
49070
d7859531621b
8198751: Refactor SetupNativeCompilation to take NAME and TYPE
ihse
parents:
47217
diff
changeset
|
143 |
NAME := $1, \ |
35241 | 144 |
EXTRA_FILES := $(LAUNCHER_SRC)/main.c, \ |
33523 | 145 |
OPTIMIZATION := $$($1_OPTIMIZATION), \ |
51808 | 146 |
CFLAGS := $$(CFLAGS_JDKEXE) $$($1_CFLAGS) \ |
25859 | 147 |
$(LAUNCHER_CFLAGS) \ |
33984
2333676816eb
8085822: JEP 223: New Version-String Scheme (initial integration)
ihse
parents:
29931
diff
changeset
|
148 |
$(VERSION_CFLAGS) \ |
25859 | 149 |
-DLAUNCHER_NAME='"$(LAUNCHER_NAME)"' \ |
33523 | 150 |
-DPROGNAME='"$1"' \ |
151 |
$$($1_CFLAGS), \ |
|
25859 | 152 |
CFLAGS_linux := -fPIC, \ |
153 |
CFLAGS_solaris := -KPIC -DHAVE_GETHRTIME, \ |
|
33523 | 154 |
CFLAGS_windows := $$($1_CFLAGS_windows), \ |
51853
ec62d6cab037
8211029: Have a common set of enabled warnings for all native libraries
ihse
parents:
51825
diff
changeset
|
155 |
DISABLED_WARNINGS_gcc := unused-function, \ |
34695
7a6cc9982d22
8142907: Integration of minor fixes from the build-infra project
ihse
parents:
34389
diff
changeset
|
156 |
LDFLAGS := $$(LDFLAGS_JDKEXE) \ |
51825
e3632b4706c4
8210931: JLI and launchers normalization and cleanup
ihse
parents:
51811
diff
changeset
|
157 |
$$(call SET_EXECUTABLE_ORIGIN) \ |
25859 | 158 |
$$($1_LDFLAGS), \ |
51825
e3632b4706c4
8210931: JLI and launchers normalization and cleanup
ihse
parents:
51811
diff
changeset
|
159 |
LDFLAGS_linux := $$(call SET_EXECUTABLE_ORIGIN,/../lib) \ |
e3632b4706c4
8210931: JLI and launchers normalization and cleanup
ihse
parents:
51811
diff
changeset
|
160 |
-L$(call FindLibDirForModule, java.base), \ |
e3632b4706c4
8210931: JLI and launchers normalization and cleanup
ihse
parents:
51811
diff
changeset
|
161 |
LDFLAGS_macosx := $$(call SET_EXECUTABLE_ORIGIN,/../lib) \ |
e3632b4706c4
8210931: JLI and launchers normalization and cleanup
ihse
parents:
51811
diff
changeset
|
162 |
-L$(call FindLibDirForModule, java.base), \ |
e3632b4706c4
8210931: JLI and launchers normalization and cleanup
ihse
parents:
51811
diff
changeset
|
163 |
LDFLAGS_solaris := $$(call SET_EXECUTABLE_ORIGIN,/../lib) \ |
e3632b4706c4
8210931: JLI and launchers normalization and cleanup
ihse
parents:
51811
diff
changeset
|
164 |
-L$(call FindLibDirForModule, java.base), \ |
e3632b4706c4
8210931: JLI and launchers normalization and cleanup
ihse
parents:
51811
diff
changeset
|
165 |
LDFLAGS_aix := -L$(SUPPORT_OUTPUTDIR)/native/java.base, \ |
33406 | 166 |
LIBS := $(JDKEXE_LIBS) $$($1_LIBS), \ |
51825
e3632b4706c4
8210931: JLI and launchers normalization and cleanup
ihse
parents:
51811
diff
changeset
|
167 |
LIBS_linux := -ljli -lpthread $(LIBDL), \ |
e3632b4706c4
8210931: JLI and launchers normalization and cleanup
ihse
parents:
51811
diff
changeset
|
168 |
LIBS_macosx := -ljli -framework Cocoa -framework Security \ |
e3632b4706c4
8210931: JLI and launchers normalization and cleanup
ihse
parents:
51811
diff
changeset
|
169 |
-framework ApplicationServices, \ |
49241 | 170 |
LIBS_solaris := -ljli -lthread $(LIBDL), \ |
51825
e3632b4706c4
8210931: JLI and launchers normalization and cleanup
ihse
parents:
51811
diff
changeset
|
171 |
LIBS_aix := -ljli_static, \ |
33406 | 172 |
LIBS_windows := $$($1_WINDOWS_JLI_LIB) \ |
51825
e3632b4706c4
8210931: JLI and launchers normalization and cleanup
ihse
parents:
51811
diff
changeset
|
173 |
$(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib, \ |
33523 | 174 |
OUTPUT_DIR := $$($1_OUTPUT_DIR), \ |
25859 | 175 |
VERSIONINFO_RESOURCE := $$($1_VERSION_INFO_RESOURCE), \ |
49244
995a5556edfa
8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
49241
diff
changeset
|
176 |
EXTRA_RC_FLAGS := $$($1_EXTRA_RC_FLAGS), \ |
25859 | 177 |
MANIFEST := $(JAVA_MANIFEST), \ |
33984
2333676816eb
8085822: JEP 223: New Version-String Scheme (initial integration)
ihse
parents:
29931
diff
changeset
|
178 |
MANIFEST_VERSION := $(VERSION_NUMBER_FOUR_POSITIONS), \ |
29925
6d47adfc6b47
8077847: Better handling of Windows executable manifest version
ihse
parents:
27953
diff
changeset
|
179 |
CODESIGN := $$($1_CODESIGN), \ |
33523 | 180 |
)) |
25859 | 181 |
|
33523 | 182 |
$1 += $$(BUILD_LAUNCHER_$1) |
183 |
TARGETS += $$($1) |
|
25859 | 184 |
|
51783 | 185 |
ifeq ($(OPENJDK_TARGET_OS), aix) |
52022
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51855
diff
changeset
|
186 |
$$(BUILD_LAUNCHER_$1): $(call FindStaticLib, java.base, jli_static) |
25859 | 187 |
endif |
188 |
||
189 |
ifeq ($(OPENJDK_TARGET_OS), windows) |
|
52022
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51855
diff
changeset
|
190 |
$$(BUILD_LAUNCHER_$1): $(call FindStaticLib, java.base, java, /libjava) \ |
25859 | 191 |
$$($1_WINDOWS_JLI_LIB) |
192 |
endif |
|
193 |
endef |
|
57034
6f85b6e0f8f8
If we have *.1 troff man pages, let jmod copy them along.
ihse
parents:
52022
diff
changeset
|
194 |
|
6f85b6e0f8f8
If we have *.1 troff man pages, let jmod copy them along.
ihse
parents:
52022
diff
changeset
|
195 |
|
6f85b6e0f8f8
If we have *.1 troff man pages, let jmod copy them along.
ihse
parents:
52022
diff
changeset
|
196 |
################################################################################ |
6f85b6e0f8f8
If we have *.1 troff man pages, let jmod copy them along.
ihse
parents:
52022
diff
changeset
|
197 |
# Process/copy man pages. There should be a one-to-one relationship between |
6f85b6e0f8f8
If we have *.1 troff man pages, let jmod copy them along.
ihse
parents:
52022
diff
changeset
|
198 |
# executables and man pages (even if this is not always the case), so piggyback |
6f85b6e0f8f8
If we have *.1 troff man pages, let jmod copy them along.
ihse
parents:
52022
diff
changeset
|
199 |
# man page generation on the launcher compilation. |
6f85b6e0f8f8
If we have *.1 troff man pages, let jmod copy them along.
ihse
parents:
52022
diff
changeset
|
200 |
|
6f85b6e0f8f8
If we have *.1 troff man pages, let jmod copy them along.
ihse
parents:
52022
diff
changeset
|
201 |
ifeq ($(BUILD_MANPAGES), true) |
6f85b6e0f8f8
If we have *.1 troff man pages, let jmod copy them along.
ihse
parents:
52022
diff
changeset
|
202 |
MAN_$(MODULE) := $(call FindModuleManDirs, $(MODULE)) |
6f85b6e0f8f8
If we have *.1 troff man pages, let jmod copy them along.
ihse
parents:
52022
diff
changeset
|
203 |
|
6f85b6e0f8f8
If we have *.1 troff man pages, let jmod copy them along.
ihse
parents:
52022
diff
changeset
|
204 |
$(foreach d, $(MAN_$(MODULE)), \ |
6f85b6e0f8f8
If we have *.1 troff man pages, let jmod copy them along.
ihse
parents:
52022
diff
changeset
|
205 |
$(if $(filter %.1, $(call CacheFind, $d)), \ |
6f85b6e0f8f8
If we have *.1 troff man pages, let jmod copy them along.
ihse
parents:
52022
diff
changeset
|
206 |
$(eval $(MODULE)_$d_NAME := COPY_MAN_$(MODULE)_$(strip $(call RelativePath, $d, $(TOPDIR)))) \ |
6f85b6e0f8f8
If we have *.1 troff man pages, let jmod copy them along.
ihse
parents:
52022
diff
changeset
|
207 |
$(eval $(call SetupCopyFiles, $($(MODULE)_$d_NAME), \ |
6f85b6e0f8f8
If we have *.1 troff man pages, let jmod copy them along.
ihse
parents:
52022
diff
changeset
|
208 |
SRC := $d, \ |
6f85b6e0f8f8
If we have *.1 troff man pages, let jmod copy them along.
ihse
parents:
52022
diff
changeset
|
209 |
FILES := $(filter %.1, $(call CacheFind, $d)), \ |
6f85b6e0f8f8
If we have *.1 troff man pages, let jmod copy them along.
ihse
parents:
52022
diff
changeset
|
210 |
DEST := $(SUPPORT_OUTPUTDIR)/modules_man/$(MODULE)/man1, \ |
6f85b6e0f8f8
If we have *.1 troff man pages, let jmod copy them along.
ihse
parents:
52022
diff
changeset
|
211 |
)) \ |
6f85b6e0f8f8
If we have *.1 troff man pages, let jmod copy them along.
ihse
parents:
52022
diff
changeset
|
212 |
$(eval MAN_PAGE_TARGETS += $($($(MODULE)_$d_NAME))) \ |
6f85b6e0f8f8
If we have *.1 troff man pages, let jmod copy them along.
ihse
parents:
52022
diff
changeset
|
213 |
) \ |
6f85b6e0f8f8
If we have *.1 troff man pages, let jmod copy them along.
ihse
parents:
52022
diff
changeset
|
214 |
) |
6f85b6e0f8f8
If we have *.1 troff man pages, let jmod copy them along.
ihse
parents:
52022
diff
changeset
|
215 |
|
6f85b6e0f8f8
If we have *.1 troff man pages, let jmod copy them along.
ihse
parents:
52022
diff
changeset
|
216 |
TARGETS += $(MAN_PAGE_TARGETS) |
57037 | 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) |
|
57034
6f85b6e0f8f8
If we have *.1 troff man pages, let jmod copy them along.
ihse
parents:
52022
diff
changeset
|
280 |
endif |