1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468
|
#
# Copyright (c) 2014, 2020, 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
# 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
################################################################################
#
# BOOT_MODULES are modules defined by the boot loader
# PLATFORM_MODULES are modules defined by the platform loader
# JRE_TOOL_MODULES are tools included in JRE and defined by the application loader
#
# All other modules not declared below are defined by the application loader
# and are not included in JRE.
BOOT_MODULES :=
PLATFORM_MODULES :=
JRE_TOOL_MODULES :=
UPGRADEABLE_MODULES :=
AGGREGATOR_MODULES :=
DOCS_MODULES :=
# Hook to include the corresponding custom file, if present.
$(eval $(call IncludeCustomExtension, common/Modules.gmk))
BOOT_MODULES += \
java.base \
java.datatransfer \
java.desktop \
java.instrument \
java.logging \
java.management \
java.management.rmi \
java.naming \
java.prefs \
java.rmi \
java.security.sasl \
java.xml \
jdk.internal.vm.ci \
jdk.jfr \
jdk.management \
jdk.management.jfr \
jdk.management.agent \
jdk.naming.ldap \
jdk.net \
jdk.sctp \
jdk.unsupported \
#
# to be deprivileged
BOOT_MODULES += \
jdk.naming.rmi \
#
# Modules that directly or indirectly requiring upgradeable modules
# should carefully be considered if it should be upgradeable or not.
UPGRADEABLE_MODULES += \
java.compiler \
jdk.aot \
jdk.internal.vm.compiler \
jdk.internal.vm.compiler.management \
#
AGGREGATOR_MODULES += \
java.se \
#
PLATFORM_MODULES += \
$(UPGRADEABLE_MODULES) \
$(AGGREGATOR_MODULES)
#
PLATFORM_MODULES += \
java.net.http \
java.scripting \
java.security.jgss \
java.smartcardio \
java.sql \
java.sql.rowset \
java.transaction.xa \
java.xml.crypto \
jdk.accessibility \
jdk.charsets \
jdk.crypto.cryptoki \
jdk.crypto.ec \
jdk.dynalink \
jdk.httpserver \
jdk.jsobject \
jdk.localedata \
jdk.naming.dns \
jdk.scripting.nashorn \
jdk.security.auth \
jdk.security.jgss \
jdk.xml.dom \
jdk.zipfs \
#
ifeq ($(call isTargetOs, windows), true)
PLATFORM_MODULES += jdk.crypto.mscapi
endif
ifeq ($(call isTargetOs, solaris), true)
PLATFORM_MODULES += jdk.crypto.ucrypto
endif
JRE_TOOL_MODULES += \
jdk.jdwp.agent \
jdk.pack \
jdk.scripting.nashorn.shell \
#
################################################################################
# DOCS_MODULES defines the root modules for javadoc generation.
# All of their `require transitive` modules directly and indirectly will be included.
DOCS_MODULES += \
java.se \
java.smartcardio \
jdk.accessibility \
jdk.attach \
jdk.charsets \
jdk.compiler \
jdk.crypto.cryptoki \
jdk.crypto.ec \
jdk.dynalink \
jdk.editpad \
jdk.hotspot.agent \
jdk.httpserver \
jdk.jartool \
jdk.javadoc \
jdk.jcmd \
jdk.jconsole \
jdk.jdeps \
jdk.jdi \
jdk.jdwp.agent \
jdk.jfr \
jdk.jlink \
jdk.jsobject \
jdk.jshell \
jdk.jstatd \
jdk.localedata \
jdk.management \
jdk.management.agent \
jdk.management.jfr \
jdk.naming.dns \
jdk.naming.ldap \
jdk.naming.rmi \
jdk.net \
jdk.pack \
jdk.rmic \
jdk.scripting.nashorn \
jdk.sctp \
jdk.security.auth \
jdk.security.jgss \
jdk.xml.dom \
jdk.zipfs \
#
# These modules are included in the interim image which is used to run profiling
# before building the real images.
INTERIM_IMAGE_MODULES := java.base java.logging
LANGTOOLS_MODULES := \
java.compiler \
jdk.compiler \
jdk.javadoc \
jdk.jdeps \
jdk.jshell \
#
HOTSPOT_MODULES := \
jdk.aot \
jdk.hotspot.agent \
jdk.internal.vm.ci \
jdk.internal.vm.compiler \
jdk.internal.vm.compiler.management \
#
################################################################################
# Some platforms don't have the serviceability agent
ifeq ($(INCLUDE_SA), false)
MODULES_FILTER += jdk.hotspot.agent
endif
################################################################################
# Filter out jvmci specific modules if jvmci is disabled
ifeq ($(INCLUDE_JVMCI), false)
MODULES_FILTER += jdk.internal.vm.ci
endif
################################################################################
# Filter out Graal specific modules if Graal is disabled
ifeq ($(INCLUDE_GRAAL), false)
MODULES_FILTER += jdk.internal.vm.compiler
MODULES_FILTER += jdk.internal.vm.compiler.management
endif
################################################################################
# Filter out aot specific modules if aot is disabled
ifeq ($(ENABLE_AOT), false)
MODULES_FILTER += jdk.aot
endif
################################################################################
# Module list macros
# Use append so that the custom extension may add to these variables
GENERATED_SRC_DIRS += \
$(SUPPORT_OUTPUTDIR)/gensrc \
#
TOP_SRC_DIRS += \
$(TOPDIR)/src \
#
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
SPEC_SUBDIRS += share/specs
# 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 = \
$(sort $(wildcard \
$(foreach sub, $(SRC_SUBDIRS), \
$(patsubst %,%/$(strip $1)/$(sub)/module-info.java, $(TOP_SRC_DIRS))) \
$(patsubst %,%/$(strip $1)/module-info.java, $(IMPORT_MODULES_SRC))))
# 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)) \
)
# 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))))
# 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)) \
))
FindImportedModules = \
$(filter-out $(MODULES_FILTER), \
$(if $(IMPORT_MODULES_CLASSES), $(notdir $(wildcard $(IMPORT_MODULES_CLASSES)/*))))
# 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)))))
# 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)))))
# 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))))
################################################################################
# Extract module dependencies from module-info.java files, both normal
# dependencies ("requires"), and indirect exports ("requires transitive").
MODULE_DEPS_MAKEFILE := $(MAKESUPPORT_OUTPUTDIR)/module-deps.gmk
MODULE_INFOS := $(call FindAllModuleInfos, *)
$(MODULE_DEPS_MAKEFILE): $(MODULE_INFOS) \
$(call DependOnVariable, MODULE_INFOS, $(MAKESUPPORT_OUTPUTDIR)/MODULE_INFOS.vardeps)
$(MKDIR) -p $(@D)
$(RM) $@
$(foreach m, $(MODULE_INFOS), \
( $(PRINTF) "DEPS_$(call GetModuleNameFromModuleInfo, $m) :=" && \
$(NAWK) -v MODULE=$(call GetModuleNameFromModuleInfo, $m) '\
BEGIN { if (MODULE != "java.base") printf(" java.base"); } \
/^ *requires/ { sub(/;/, ""); \
sub(/requires /, " "); \
sub(/ static /, " "); \
sub(/ transitive /, " "); \
sub(/\/\/.*/, ""); \
sub(/\/\*.*\*\//, ""); \
gsub(/^ +\*.*/, ""); \
gsub(/ /, ""); \
gsub(/\r/, ""); \
printf(" %s", $$0) } \
END { printf("\n") }' $m && \
$(PRINTF) "TRANSITIVE_MODULES_$(call GetModuleNameFromModuleInfo, $m) :=" && \
$(NAWK) -v MODULE=$(call GetModuleNameFromModuleInfo, $m) '\
BEGIN { if (MODULE != "java.base") printf(" java.base"); } \
/^ *requires *transitive/ { \
sub(/;/, ""); \
sub(/requires/, ""); \
sub(/transitive/, ""); \
sub(/\/\/.*/, ""); \
sub(/\/\*.*\*\//, ""); \
gsub(/^ +\*.*/, ""); \
gsub(/ /, ""); \
gsub(/\r/, ""); \
printf(" %s", $$0) } \
END { printf("\n") }' $m \
) >> $@ $(NEWLINE))
-include $(MODULE_DEPS_MAKEFILE)
# Find dependencies ("requires") for a given module.
# Param 1: Module to find dependencies for.
FindDepsForModule = \
$(DEPS_$(strip $1))
# Find dependencies ("requires") transitively in 3 levels for a given module.
# Param 1: Module to find dependencies for.
FindTransitiveDepsForModule = \
$(sort $(call FindDepsForModule, $1) \
$(foreach m, $(call FindDepsForModule, $1), \
$(call FindDepsForModule, $m) \
$(foreach n, $(call FindDepsForModule, $m), \
$(call FindDepsForModule, $n))))
# Find dependencies ("requires") transitively in 3 levels for a set of modules.
# Param 1: List of modules to find dependencies for.
FindTransitiveDepsForModules = \
$(sort $(foreach m, $1, $(call FindTransitiveDepsForModule, $m)))
# 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), \
$(call FindIndirectExportsForModule, $n))))
# 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)))
# Upgradeable modules are those that are either defined as upgradeable or that
# require an upradeable module.
FindAllUpgradeableModules = \
$(sort $(filter-out $(MODULES_FILTER), $(UPGRADEABLE_MODULES)))
################################################################################
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
# Find all legal src dirs for a particular module
# $1 - Module to find legal dirs for
FindModuleLegalSrcDirs = \
$(strip $(wildcard \
$(addsuffix /$(strip $1), $(IMPORT_MODULES_LEGAL)) \
$(foreach sub, $(LEGAL_SUBDIRS), $(addsuffix /$(strip $1)/$(sub), $(TOP_SRC_DIRS))) \
))
################################################################################
# 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
ifneq ($$(include_in_docs), false)
# defaults to true if unspecified
DOCS_MODULES += $1
endif
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
# * JRE_TOOL_MODULES
define ReadImportMetaData
IMPORTED_MODULES := $$(call FindImportedModules)
$$(foreach m, $$(IMPORTED_MODULES), \
$$(eval $$(call ReadSingleImportMetaData, $$m)))
endef
################################################################################
endif # _MODULES_GMK
|