2014-08-21 10:22:42 +00:00
|
|
|
#
|
2023-11-28 21:40:20 +00:00
|
|
|
# Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved.
|
2014-08-21 10:22:42 +00:00
|
|
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
#
|
|
|
|
# This code is free software; you can redistribute it and/or modify it
|
|
|
|
# under the terms of the GNU General Public License version 2 only, as
|
|
|
|
# published by the Free Software Foundation. Oracle designates this
|
|
|
|
# particular file as subject to the "Classpath" exception as provided
|
|
|
|
# by Oracle in the LICENSE file that accompanied this code.
|
|
|
|
#
|
|
|
|
# This code is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
# version 2 for more details (a copy is included in the LICENSE file that
|
|
|
|
# accompanied this code).
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License version
|
|
|
|
# 2 along with this work; if not, write to the Free Software Foundation,
|
|
|
|
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
#
|
|
|
|
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
|
|
# or visit www.oracle.com if you need additional information or have any
|
|
|
|
# questions.
|
|
|
|
#
|
|
|
|
|
|
|
|
ifndef _MODULES_GMK
|
|
|
|
_MODULES_GMK := 1
|
|
|
|
|
2020-12-16 21:57:32 +00:00
|
|
|
################################################################################
|
|
|
|
# Setup module sets for classloaders
|
2016-03-23 16:20:41 +00:00
|
|
|
|
2020-12-16 21:57:32 +00:00
|
|
|
include $(TOPDIR)/make/conf/module-loader-map.conf
|
2017-04-19 08:24:42 +00:00
|
|
|
|
2020-12-16 21:57:32 +00:00
|
|
|
# Append platform-specific and upgradeable modules
|
|
|
|
PLATFORM_MODULES += $(PLATFORM_MODULES_$(OPENJDK_TARGET_OS)) \
|
|
|
|
$(UPGRADEABLE_PLATFORM_MODULES)
|
2017-04-19 08:24:42 +00:00
|
|
|
|
|
|
|
################################################################################
|
2020-12-16 21:57:32 +00:00
|
|
|
# Setup module sets for docs
|
2017-04-19 08:24:42 +00:00
|
|
|
|
2020-12-16 21:57:32 +00:00
|
|
|
include $(TOPDIR)/make/conf/docs-modules.conf
|
2017-04-19 08:24:42 +00:00
|
|
|
|
2020-12-16 21:57:32 +00:00
|
|
|
################################################################################
|
|
|
|
# Setup module sets needed by the build system
|
2017-09-12 17:03:56 +00:00
|
|
|
|
2020-12-16 21:57:32 +00:00
|
|
|
include $(TOPDIR)/make/conf/build-module-sets.conf
|
2017-09-12 17:03:56 +00:00
|
|
|
|
2021-01-25 19:26:36 +00:00
|
|
|
################################################################################
|
|
|
|
# Hook to include the corresponding custom file, if present.
|
|
|
|
# Allowing MODULE list extensions setup above.
|
|
|
|
$(eval $(call IncludeCustomExtension, common/Modules.gmk))
|
|
|
|
|
2015-11-24 11:18:24 +00:00
|
|
|
################################################################################
|
2020-12-16 21:57:32 +00:00
|
|
|
# Depending on the configuration, we might need to filter out some modules that
|
|
|
|
# normally should have been included
|
2016-03-23 16:20:41 +00:00
|
|
|
|
2020-12-16 21:57:32 +00:00
|
|
|
# Some platforms don't have the serviceability agent
|
2015-11-24 11:18:24 +00:00
|
|
|
ifeq ($(INCLUDE_SA), false)
|
|
|
|
MODULES_FILTER += jdk.hotspot.agent
|
|
|
|
endif
|
|
|
|
|
2018-07-11 02:42:48 +00:00
|
|
|
# Filter out jvmci specific modules if jvmci is disabled
|
|
|
|
ifeq ($(INCLUDE_JVMCI), false)
|
|
|
|
MODULES_FILTER += jdk.internal.vm.ci
|
2023-10-23 13:15:31 +00:00
|
|
|
MODULES_FILTER += jdk.graal.compiler
|
|
|
|
MODULES_FILTER += jdk.graal.compiler.management
|
2018-07-11 02:42:48 +00:00
|
|
|
endif
|
|
|
|
|
2019-12-05 16:25:33 +00:00
|
|
|
# jpackage is only on windows, macosx, and linux
|
|
|
|
ifeq ($(call isTargetOs, windows macosx linux), false)
|
2020-11-04 20:27:11 +00:00
|
|
|
MODULES_FILTER += jdk.jpackage
|
2019-12-05 16:25:33 +00:00
|
|
|
endif
|
|
|
|
|
2014-08-21 10:22:42 +00:00
|
|
|
################################################################################
|
|
|
|
# Module list macros
|
|
|
|
|
2016-04-13 16:11:29 +00:00
|
|
|
# Use append so that the custom extension may add to these variables
|
2016-03-17 19:03:53 +00:00
|
|
|
|
2016-04-13 16:11:29 +00:00
|
|
|
GENERATED_SRC_DIRS += \
|
|
|
|
$(SUPPORT_OUTPUTDIR)/gensrc \
|
|
|
|
#
|
|
|
|
|
|
|
|
TOP_SRC_DIRS += \
|
2017-09-12 17:03:56 +00:00
|
|
|
$(TOPDIR)/src \
|
2014-08-21 10:22:42 +00:00
|
|
|
#
|
|
|
|
|
2016-04-13 16:11:29 +00:00
|
|
|
SRC_SUBDIRS += $(OPENJDK_TARGET_OS)/classes
|
|
|
|
ifneq ($(OPENJDK_TARGET_OS), $(OPENJDK_TARGET_OS_TYPE))
|
|
|
|
SRC_SUBDIRS += $(OPENJDK_TARGET_OS_TYPE)/classes
|
|
|
|
endif
|
|
|
|
SRC_SUBDIRS += share/classes
|
|
|
|
|
2017-04-23 19:10:32 +00:00
|
|
|
SPEC_SUBDIRS += share/specs
|
|
|
|
|
2018-11-28 09:00:41 +00:00
|
|
|
MAN_SUBDIRS += share/man
|
|
|
|
|
2016-03-17 19:03:53 +00:00
|
|
|
# Find all module-info.java files for the current build target platform and
|
|
|
|
# configuration.
|
|
|
|
# Param 1 - Module to find for, set to * for finding all
|
|
|
|
FindAllModuleInfos = \
|
2017-10-26 08:39:59 +00:00
|
|
|
$(sort $(wildcard \
|
2016-04-13 16:11:29 +00:00
|
|
|
$(foreach sub, $(SRC_SUBDIRS), \
|
|
|
|
$(patsubst %,%/$(strip $1)/$(sub)/module-info.java, $(TOP_SRC_DIRS))) \
|
2017-10-26 08:39:59 +00:00
|
|
|
$(patsubst %,%/$(strip $1)/module-info.java, $(IMPORT_MODULES_SRC))))
|
2016-03-17 19:03:53 +00:00
|
|
|
|
2016-10-28 12:29:20 +00:00
|
|
|
# Find module-info.java files in the specific source dir
|
|
|
|
# Param 1 - Src dir to find module-info.java files in
|
|
|
|
FindModuleInfosForSrcDir = \
|
|
|
|
$(wildcard \
|
|
|
|
$(foreach sub, $(SRC_SUBDIRS), \
|
|
|
|
$(patsubst %,%/*/$(sub)/module-info.java, $(strip $1)) \
|
|
|
|
) \
|
|
|
|
$(patsubst %,%/*/module-info.java, $(strip $1)) \
|
|
|
|
)
|
|
|
|
|
2016-03-17 19:03:53 +00:00
|
|
|
# Extract the module names from the paths of module-info.java files. The
|
|
|
|
# position of the module directory differs depending on if this is an imported
|
|
|
|
# src dir or not.
|
|
|
|
GetModuleNameFromModuleInfo = \
|
|
|
|
$(strip $(foreach mi, $1, \
|
|
|
|
$(if $(filter $(addsuffix %, $(IMPORT_MODULES_SRC)), $(mi)), \
|
|
|
|
$(notdir $(patsubst %/,%, $(dir $(mi)))), \
|
|
|
|
$(notdir $(patsubst %/,%, $(dir $(patsubst %/,%, $(dir $(patsubst %/,%, $(dir $(mi)))))))))))
|
|
|
|
|
|
|
|
# Find all modules by looking for module-info.java files and looking at parent
|
|
|
|
# directories.
|
|
|
|
FindAllModules = \
|
|
|
|
$(sort $(filter-out $(MODULES_FILTER), \
|
|
|
|
$(call GetModuleNameFromModuleInfo, $(MODULE_INFOS))))
|
|
|
|
|
2016-10-28 12:29:20 +00:00
|
|
|
# Find all modules in a specific src dir
|
|
|
|
# Param 1 - Src dir to find modules in
|
|
|
|
FindModulesForSrcDir = \
|
|
|
|
$(sort $(filter-out $(MODULES_FILTER), \
|
|
|
|
$(call GetModuleNameFromModuleInfo, $(call FindModuleInfosForSrcDir, $1)) \
|
|
|
|
))
|
|
|
|
|
2016-03-17 19:03:53 +00:00
|
|
|
FindImportedModules = \
|
2016-04-28 15:14:59 +00:00
|
|
|
$(filter-out $(MODULES_FILTER), \
|
|
|
|
$(if $(IMPORT_MODULES_CLASSES), $(notdir $(wildcard $(IMPORT_MODULES_CLASSES)/*))))
|
2014-09-16 10:08:04 +00:00
|
|
|
|
2016-04-13 16:11:29 +00:00
|
|
|
# Find all source dirs for a particular module
|
|
|
|
# $1 - Module to find source dirs for
|
|
|
|
FindModuleSrcDirs = \
|
|
|
|
$(strip $(wildcard \
|
|
|
|
$(addsuffix /$(strip $1), $(GENERATED_SRC_DIRS) $(IMPORT_MODULES_SRC)) \
|
|
|
|
$(foreach sub, $(SRC_SUBDIRS), $(addsuffix /$(strip $1)/$(sub), $(TOP_SRC_DIRS)))))
|
|
|
|
|
2017-04-23 19:10:32 +00:00
|
|
|
# Find all specs dirs for a particular module
|
|
|
|
# $1 - Module to find specs dirs for
|
|
|
|
FindModuleSpecsDirs = \
|
|
|
|
$(strip $(wildcard \
|
|
|
|
$(foreach sub, $(SPEC_SUBDIRS), $(addsuffix /$(strip $1)/$(sub), $(TOP_SRC_DIRS)))))
|
|
|
|
|
2018-11-28 09:00:41 +00:00
|
|
|
# Find all man dirs for a particular module
|
|
|
|
# $1 - Module to find man dirs for
|
|
|
|
FindModuleManDirs = \
|
|
|
|
$(strip $(wildcard \
|
|
|
|
$(foreach sub, $(MAN_SUBDIRS), $(addsuffix /$(strip $1)/$(sub), $(TOP_SRC_DIRS)))))
|
|
|
|
|
2016-04-13 16:11:29 +00:00
|
|
|
# Construct the complete module source path
|
|
|
|
GetModuleSrcPath = \
|
|
|
|
$(call PathList, \
|
|
|
|
$(addsuffix /*, $(GENERATED_SRC_DIRS) $(IMPORT_MODULES_SRC)) \
|
|
|
|
$(foreach sub, $(SRC_SUBDIRS), $(addsuffix /*/$(sub), $(TOP_SRC_DIRS))))
|
|
|
|
|
2014-09-16 10:08:04 +00:00
|
|
|
################################################################################
|
2017-05-22 07:47:31 +00:00
|
|
|
# Extract module dependencies from module-info.java files, both normal
|
|
|
|
# dependencies ("requires"), and indirect exports ("requires transitive").
|
2016-03-17 19:03:53 +00:00
|
|
|
|
2014-09-16 10:08:04 +00:00
|
|
|
MODULE_DEPS_MAKEFILE := $(MAKESUPPORT_OUTPUTDIR)/module-deps.gmk
|
2016-03-17 19:03:53 +00:00
|
|
|
|
|
|
|
MODULE_INFOS := $(call FindAllModuleInfos, *)
|
|
|
|
|
|
|
|
$(MODULE_DEPS_MAKEFILE): $(MODULE_INFOS) \
|
|
|
|
$(call DependOnVariable, MODULE_INFOS, $(MAKESUPPORT_OUTPUTDIR)/MODULE_INFOS.vardeps)
|
2018-10-09 21:57:23 +00:00
|
|
|
$(call MakeTargetDir)
|
2016-03-17 19:03:53 +00:00
|
|
|
$(RM) $@
|
|
|
|
$(foreach m, $(MODULE_INFOS), \
|
2024-09-03 15:31:09 +00:00
|
|
|
( $(PRINTF) "DEPS_$(call GetModuleNameFromModuleInfo, $m) := " && \
|
|
|
|
$(AWK) -v MODULE=$(call GetModuleNameFromModuleInfo, $m) ' \
|
2016-03-17 19:03:53 +00:00
|
|
|
BEGIN { if (MODULE != "java.base") printf(" java.base"); } \
|
2017-04-19 08:44:40 +00:00
|
|
|
/^ *requires/ { sub(/;/, ""); \
|
2017-11-17 01:44:03 +00:00
|
|
|
sub(/requires /, " "); \
|
|
|
|
sub(/ static /, " "); \
|
|
|
|
sub(/ transitive /, " "); \
|
2017-04-19 08:44:40 +00:00
|
|
|
sub(/\/\/.*/, ""); \
|
|
|
|
sub(/\/\*.*\*\//, ""); \
|
|
|
|
gsub(/^ +\*.*/, ""); \
|
|
|
|
gsub(/ /, ""); \
|
2020-08-11 14:07:04 +00:00
|
|
|
gsub(/\r/, ""); \
|
2017-04-19 08:44:40 +00:00
|
|
|
printf(" %s", $$0) } \
|
2017-05-22 07:47:31 +00:00
|
|
|
END { printf("\n") }' $m && \
|
2024-09-03 15:31:09 +00:00
|
|
|
$(PRINTF) "TRANSITIVE_MODULES_$(call GetModuleNameFromModuleInfo, $m) := " && \
|
|
|
|
$(AWK) -v MODULE=$(call GetModuleNameFromModuleInfo, $m) ' \
|
2017-05-22 07:47:31 +00:00
|
|
|
BEGIN { if (MODULE != "java.base") printf(" java.base"); } \
|
|
|
|
/^ *requires *transitive/ { \
|
|
|
|
sub(/;/, ""); \
|
|
|
|
sub(/requires/, ""); \
|
|
|
|
sub(/transitive/, ""); \
|
|
|
|
sub(/\/\/.*/, ""); \
|
|
|
|
sub(/\/\*.*\*\//, ""); \
|
|
|
|
gsub(/^ +\*.*/, ""); \
|
|
|
|
gsub(/ /, ""); \
|
2020-08-11 14:07:04 +00:00
|
|
|
gsub(/\r/, ""); \
|
2017-05-22 07:47:31 +00:00
|
|
|
printf(" %s", $$0) } \
|
2017-04-19 08:44:40 +00:00
|
|
|
END { printf("\n") }' $m \
|
2016-03-17 19:03:53 +00:00
|
|
|
) >> $@ $(NEWLINE))
|
|
|
|
|
2014-08-21 10:22:42 +00:00
|
|
|
-include $(MODULE_DEPS_MAKEFILE)
|
|
|
|
|
2017-05-22 07:47:31 +00:00
|
|
|
# Find dependencies ("requires") for a given module.
|
|
|
|
# Param 1: Module to find dependencies for.
|
2016-03-17 19:03:53 +00:00
|
|
|
FindDepsForModule = \
|
2014-08-21 10:22:42 +00:00
|
|
|
$(DEPS_$(strip $1))
|
|
|
|
|
2017-05-22 07:47:31 +00:00
|
|
|
# Find dependencies ("requires") transitively in 3 levels for a given module.
|
|
|
|
# Param 1: Module to find dependencies for.
|
2016-03-17 19:03:53 +00:00
|
|
|
FindTransitiveDepsForModule = \
|
|
|
|
$(sort $(call FindDepsForModule, $1) \
|
|
|
|
$(foreach m, $(call FindDepsForModule, $1), \
|
|
|
|
$(call FindDepsForModule, $m) \
|
|
|
|
$(foreach n, $(call FindDepsForModule, $m), \
|
2024-08-30 08:58:18 +00:00
|
|
|
$(call FindDepsForModule, $n))))
|
2014-08-21 10:22:42 +00:00
|
|
|
|
2017-05-22 07:47:31 +00:00
|
|
|
# Find dependencies ("requires") transitively in 3 levels for a set of modules.
|
|
|
|
# Param 1: List of modules to find dependencies for.
|
2017-04-19 08:44:40 +00:00
|
|
|
FindTransitiveDepsForModules = \
|
|
|
|
$(sort $(foreach m, $1, $(call FindTransitiveDepsForModule, $m)))
|
|
|
|
|
2017-05-22 07:47:31 +00:00
|
|
|
# Find indirect exported modules ("requires transitive") for a given module .
|
|
|
|
# Param 1: Module to find indirect exported modules for.
|
|
|
|
FindIndirectExportsForModule = \
|
|
|
|
$(TRANSITIVE_MODULES_$(strip $1))
|
|
|
|
|
|
|
|
# Finds indirect exported modules transitively in 3 levels for a given module.
|
|
|
|
# Param 1: Module to find indirect exported modules for.
|
|
|
|
FindTransitiveIndirectDepsForModule = \
|
|
|
|
$(sort $(call FindIndirectExportsForModule, $1) \
|
|
|
|
$(foreach m, $(call FindIndirectExportsForModule, $1), \
|
|
|
|
$(call FindIndirectExportsForModule, $m) \
|
|
|
|
$(foreach n, $(call FindIndirectExportsForModule, $m), \
|
2024-08-30 08:58:18 +00:00
|
|
|
$(call FindIndirectExportsForModule, $n))))
|
2017-05-22 07:47:31 +00:00
|
|
|
|
|
|
|
# Finds indirect exported modules transitively in 3 levels for a set of modules.
|
|
|
|
# Param 1: List of modules to find indirect exported modules for.
|
|
|
|
FindTransitiveIndirectDepsForModules = \
|
|
|
|
$(sort $(foreach m, $1, $(call FindTransitiveIndirectDepsForModule, $m)))
|
|
|
|
|
2016-05-19 15:24:50 +00:00
|
|
|
# Upgradeable modules are those that are either defined as upgradeable or that
|
|
|
|
# require an upradeable module.
|
|
|
|
FindAllUpgradeableModules = \
|
2020-12-16 21:57:32 +00:00
|
|
|
$(sort $(filter-out $(MODULES_FILTER), $(UPGRADEABLE_PLATFORM_MODULES)))
|
2016-05-19 15:24:50 +00:00
|
|
|
|
2016-03-17 19:03:53 +00:00
|
|
|
################################################################################
|
2014-08-21 10:22:42 +00:00
|
|
|
|
2016-12-13 02:56:32 +00:00
|
|
|
LEGAL_SUBDIRS += $(OPENJDK_TARGET_OS)/legal
|
|
|
|
ifneq ($(OPENJDK_TARGET_OS), $(OPENJDK_TARGET_OS_TYPE))
|
|
|
|
LEGAL_SUBDIRS += $(OPENJDK_TARGET_OS_TYPE)/legal
|
|
|
|
endif
|
|
|
|
LEGAL_SUBDIRS += share/legal
|
|
|
|
|
2018-04-05 21:46:05 +00:00
|
|
|
# Find all legal src dirs for a particular module
|
2016-12-13 02:56:32 +00:00
|
|
|
# $1 - Module to find legal dirs for
|
2018-04-05 21:46:05 +00:00
|
|
|
FindModuleLegalSrcDirs = \
|
2016-12-13 02:56:32 +00:00
|
|
|
$(strip $(wildcard \
|
2018-04-05 21:46:05 +00:00
|
|
|
$(addsuffix /$(strip $1), $(IMPORT_MODULES_LEGAL)) \
|
2017-11-13 15:32:30 +00:00
|
|
|
$(foreach sub, $(LEGAL_SUBDIRS), $(addsuffix /$(strip $1)/$(sub), $(TOP_SRC_DIRS))) \
|
|
|
|
))
|
2016-12-13 02:56:32 +00:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
|
2016-03-23 16:20:41 +00:00
|
|
|
# Param 1 - Name of module
|
|
|
|
define ReadSingleImportMetaData
|
|
|
|
ifneq ($$(wildcard $(IMPORT_MODULES_MAKE)/$$(strip $1)/build.properties), )
|
|
|
|
classloader :=
|
|
|
|
include_in_jre :=
|
|
|
|
include_in_jdk :=
|
|
|
|
include $(IMPORT_MODULES_MAKE)/$$(strip $1)/build.properties
|
|
|
|
ifeq ($$(include_in_jre), true)
|
|
|
|
JRE_MODULES += $1
|
|
|
|
endif
|
|
|
|
ifeq ($$(include_in_jdk), true)
|
|
|
|
JDK_MODULES += $1
|
|
|
|
endif
|
|
|
|
ifeq ($$(classloader), boot)
|
|
|
|
BOOT_MODULES += $1
|
|
|
|
else ifeq ($$(classloader), ext)
|
|
|
|
PLATFORM_MODULES += $1
|
|
|
|
endif
|
2017-05-11 06:56:44 +00:00
|
|
|
ifneq ($$(include_in_docs), false)
|
|
|
|
# defaults to true if unspecified
|
|
|
|
DOCS_MODULES += $1
|
|
|
|
endif
|
2016-03-23 16:20:41 +00:00
|
|
|
else
|
|
|
|
# Default to include in all
|
|
|
|
JRE_MODULES += $1
|
|
|
|
JDK_MODULES += $1
|
|
|
|
endif
|
|
|
|
endef
|
|
|
|
|
|
|
|
# Reading the imported modules metadata has a cost, so to make it available,
|
|
|
|
# a makefile needs to eval-call this macro first. After calling this, the
|
|
|
|
# following variables are populated with data from the imported modules:
|
|
|
|
# * JRE_MODULES
|
|
|
|
# * JDK_MODULES
|
|
|
|
# * BOOT_MODULES
|
|
|
|
# * PLATFORM_MODULES
|
|
|
|
define ReadImportMetaData
|
2016-04-01 15:08:43 +00:00
|
|
|
IMPORTED_MODULES := $$(call FindImportedModules)
|
|
|
|
$$(foreach m, $$(IMPORTED_MODULES), \
|
|
|
|
$$(eval $$(call ReadSingleImportMetaData, $$m)))
|
2016-03-23 16:20:41 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
|
2014-08-21 10:22:42 +00:00
|
|
|
endif # _MODULES_GMK
|