If we have *.1 troff man pages, let jmod copy them along. ihse-manpages-branch
authorihse
Fri, 23 Nov 2018 11:32:02 +0100
branchihse-manpages-branch
changeset 57034 6f85b6e0f8f8
parent 57033 f54811c07f2a
child 57035 f7a879e76ab8
If we have *.1 troff man pages, let jmod copy them along.
make/ModuleWrapper.gmk
make/launcher/LauncherCommon.gmk
--- a/make/ModuleWrapper.gmk	Fri Nov 23 10:17:13 2018 +0100
+++ b/make/ModuleWrapper.gmk	Fri Nov 23 11:32:02 2018 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -93,6 +93,12 @@
     FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE)/%, $(TARGETS)), \
 ))
 
+$(eval $(call SetupCopyFiles, COPY_MAN, \
+    SRC := $(SUPPORT_OUTPUTDIR)/modules_man/$(MODULE), \
+    DEST := $(JDK_OUTPUTDIR)/man, \
+    FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_man/$(MODULE)/%, $(TARGETS)), \
+))
+
 $(eval $(call SetupCopyFiles, COPY_CONF, \
     SRC := $(SUPPORT_OUTPUTDIR)/modules_conf/$(MODULE), \
     DEST := $(JDK_OUTPUTDIR)/conf, \
@@ -104,5 +110,5 @@
   all: $(filter $(MAKESUPPORT_OUTPUTDIR)/compile-commands/%, $(TARGETS))
 else
   all: $(TARGETS) $(COPY_LIBS_TO_BIN) $(COPY_LIBS_TO_LIB) \
-      $(COPY_INCLUDE) $(COPY_CMDS) $(COPY_CONF) $(LINK_LIBS_TO_LIB)
+      $(COPY_INCLUDE) $(COPY_CMDS) $(COPY_MAN) $(COPY_CONF) $(LINK_LIBS_TO_LIB)
 endif
--- a/make/launcher/LauncherCommon.gmk	Fri Nov 23 10:17:13 2018 +0100
+++ b/make/launcher/LauncherCommon.gmk	Fri Nov 23 11:32:02 2018 +0100
@@ -24,6 +24,7 @@
 #
 
 include JdkNativeCompilation.gmk
+include Modules.gmk
 
 # Tell the compiler not to export any functions unless declared so in
 # the source code. On Windows, this is the default and cannot be changed.
@@ -189,3 +190,27 @@
         $$($1_WINDOWS_JLI_LIB)
   endif
 endef
+
+
+################################################################################
+# Process/copy man pages. There should be a one-to-one relationship between
+# executables and man pages (even if this is not always the case), so piggyback
+# man page generation on the launcher compilation.
+
+ifeq ($(BUILD_MANPAGES), true)
+  MAN_$(MODULE) := $(call FindModuleManDirs, $(MODULE))
+
+  $(foreach d, $(MAN_$(MODULE)), \
+    $(if $(filter %.1, $(call CacheFind, $d)), \
+      $(eval $(MODULE)_$d_NAME := COPY_MAN_$(MODULE)_$(strip $(call RelativePath, $d, $(TOPDIR)))) \
+      $(eval $(call SetupCopyFiles, $($(MODULE)_$d_NAME), \
+          SRC := $d, \
+          FILES := $(filter %.1, $(call CacheFind, $d)), \
+          DEST := $(SUPPORT_OUTPUTDIR)/modules_man/$(MODULE)/man1, \
+      )) \
+      $(eval MAN_PAGE_TARGETS += $($($(MODULE)_$d_NAME))) \
+    ) \
+  )
+
+  TARGETS += $(MAN_PAGE_TARGETS)
+endif