| # | |
| # Copyright (c) 2014, 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 := | |
| # Hook to include the corresponding custom file, if present. | |
| $(eval $(call IncludeCustomExtension, , common/Modules.gmk)) | |
| BOOT_MODULES += \ | |
| java.base \ | |
| java.datatransfer \ | |
| java.desktop \ | |
| java.httpclient \ | |
| java.instrument \ | |
| java.logging \ | |
| java.management \ | |
| java.naming \ | |
| java.prefs \ | |
| java.rmi \ | |
| java.security.jgss \ | |
| java.security.sasl \ | |
| java.xml \ | |
| java.xml.crypto \ | |
| jdk.httpserver \ | |
| jdk.management \ | |
| jdk.net \ | |
| jdk.sctp \ | |
| jdk.security.auth \ | |
| jdk.security.jgss \ | |
| jdk.unsupported \ | |
| jdk.vm.ci \ | |
| # | |
| # to be deprivileged | |
| BOOT_MODULES += \ | |
| java.smartcardio \ | |
| jdk.naming.rmi \ | |
| # | |
| UPGRADEABLE_MODULES += \ | |
| java.activation \ | |
| java.annotations.common \ | |
| java.corba \ | |
| java.transaction \ | |
| java.xml.bind \ | |
| java.xml.ws \ | |
| # | |
| # Modules explicitly declared as not being upgradeable even though they require | |
| # an upgradeable module. | |
| NON_UPGRADEABLE_MODULES += | |
| AGGREGATOR_MODULES += \ | |
| java.compact1 \ | |
| java.compact2 \ | |
| java.compact3 \ | |
| java.se \ | |
| java.se.ee \ | |
| # | |
| PLATFORM_MODULES += \ | |
| $(UPGRADEABLE_MODULES) \ | |
| $(AGGREGATOR_MODULES) | |
| # | |
| PLATFORM_MODULES += \ | |
| java.compiler \ | |
| java.scripting \ | |
| java.sql \ | |
| java.sql.rowset \ | |
| jdk.accessibility \ | |
| jdk.charsets \ | |
| jdk.crypto.ec \ | |
| jdk.crypto.pkcs11 \ | |
| jdk.dynalink \ | |
| jdk.jsobject \ | |
| jdk.xml.dom \ | |
| jdk.localedata \ | |
| jdk.naming.dns \ | |
| jdk.scripting.nashorn \ | |
| jdk.zipfs \ | |
| # | |
| JRE_TOOL_MODULES += \ | |
| jdk.jdwp.agent \ | |
| jdk.pack200 \ | |
| jdk.scripting.nashorn.shell \ | |
| # | |
| ifeq ($(OPENJDK_TARGET_OS), windows) | |
| PLATFORM_MODULES += jdk.crypto.mscapi | |
| endif | |
| ifeq ($(OPENJDK_TARGET_OS), solaris) | |
| PLATFORM_MODULES += jdk.crypto.ucrypto | |
| endif | |
| # 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 | |
| ################################################################################ | |
| # Some platforms don't have the serviceability agent | |
| ifeq ($(INCLUDE_SA), false) | |
| MODULES_FILTER += jdk.hotspot.agent | |
| 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 += \ | |
| $(CORBA_TOPDIR)/src \ | |
| $(HOTSPOT_TOPDIR)/src \ | |
| $(JDK_TOPDIR)/src \ | |
| $(LANGTOOLS_TOPDIR)/src \ | |
| $(JAXP_TOPDIR)/src \ | |
| $(JAXWS_TOPDIR)/src \ | |
| $(NASHORN_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 | |
| # 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 = \ | |
| $(wildcard \ | |
| $(foreach sub, $(SRC_SUBDIRS), \ | |
| $(patsubst %,%/$(strip $1)/$(sub)/module-info.java, $(TOP_SRC_DIRS))) \ | |
| $(patsubst %,%/$(strip $1)/module-info.java, $(IMPORT_MODULES_SRC))) | |
| # 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)))) | |
| 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))))) | |
| # 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. | |
| 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(/public/, ""); \ | |
| sub(/\/\/.*/, ""); \ | |
| sub(/\/\*.*\*\//, ""); \ | |
| gsub(/ /, ""); \ | |
| printf(" %s", $$0) } \ | |
| END { printf("\n") }' $m \ | |
| ) >> $@ $(NEWLINE)) | |
| -include $(MODULE_DEPS_MAKEFILE) | |
| # Param 1: Module to find deps for | |
| FindDepsForModule = \ | |
| $(DEPS_$(strip $1)) | |
| # Finds transitive dependencies in 3 levels. | |
| # Param 1: Module to find transitive deps for | |
| FindTransitiveDepsForModule = \ | |
| $(sort $(call FindDepsForModule, $1) \ | |
| $(foreach m, $(call FindDepsForModule, $1), \ | |
| $(call FindDepsForModule, $m) \ | |
| $(foreach n, $(call FindDepsForModule, $m), \ | |
| $(call FindDepsForModule, $n)))) | |
| # Upgradeable modules are those that are either defined as upgradeable or that | |
| # require an upradeable module. | |
| FindAllUpgradeableModules = \ | |
| $(filter-out $(MODULES_FILTER) $(NON_UPGRADEABLE_MODULES), \ | |
| $(sort $(UPGRADEABLE_MODULES) $(foreach m, \ | |
| $(filter-out $(UPGRADEABLE_MODULES), $(call FindAllModules)), \ | |
| $(if $(filter $(UPGRADEABLE_MODULES), \ | |
| $(call FindTransitiveDepsForModule, $m)), \ | |
| $m \ | |
| ) \ | |
| )) \ | |
| ) | |
| ################################################################################ | |
| # 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 | |
| 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 |