Modules.gmk revision 1994:1d992540870f
1279264Sdelphij# 2110010Smarkm# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 3110010Smarkm# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4160819Ssimon# 5110010Smarkm# This code is free software; you can redistribute it and/or modify it 6110010Smarkm# under the terms of the GNU General Public License version 2 only, as 7110010Smarkm# published by the Free Software Foundation. Oracle designates this 8110010Smarkm# particular file as subject to the "Classpath" exception as provided 9110010Smarkm# by Oracle in the LICENSE file that accompanied this code. 10110010Smarkm# 11110010Smarkm# This code is distributed in the hope that it will be useful, but WITHOUT 12110010Smarkm# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13110010Smarkm# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14110010Smarkm# version 2 for more details (a copy is included in the LICENSE file that 15110010Smarkm# accompanied this code). 16110010Smarkm# 17110010Smarkm# You should have received a copy of the GNU General Public License version 18110010Smarkm# 2 along with this work; if not, write to the Free Software Foundation, 19110010Smarkm# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20215698Ssimon# 21215698Ssimon# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22215698Ssimon# or visit www.oracle.com if you need additional information or have any 23215698Ssimon# questions. 24215698Ssimon# 25110010Smarkm 26110010Smarkmifndef _MODULES_GMK 27110010Smarkm_MODULES_GMK := 1 28110010Smarkm 29110010Smarkm################################################################################ 30110010Smarkm# 31110010Smarkm# BOOT_MODULES are modules defined by the boot loader 32110010Smarkm# PLATFORM_MODULES are modules defined by the platform loader 33110010Smarkm# JRE_TOOL_MODULES are tools included in JRE and defined by the application loader 34110010Smarkm# 35110010Smarkm# All other modules not declared below are defined by the application loader 36110010Smarkm# and are not included in JRE. 37110010Smarkm 38110010SmarkmBOOT_MODULES := 39110010SmarkmPLATFORM_MODULES := 40110010SmarkmJRE_TOOL_MODULES := 41279264Sdelphij 42279264Sdelphij# Hook to include the corresponding custom file, if present. 43110010Smarkm$(eval $(call IncludeCustomExtension, , common/Modules.gmk)) 44110010Smarkm 45215698SsimonUPGRADEABLE_MDOULES := 46215698SsimonAGGREGATOR_MDOULES := 47215698Ssimon 48215698SsimonBOOT_MODULES += \ 49160819Ssimon java.base \ 50215698Ssimon java.datatransfer \ 51160819Ssimon java.desktop \ 52160819Ssimon java.httpclient \ 53279264Sdelphij java.instrument \ 54279264Sdelphij java.logging \ 55279264Sdelphij java.management \ 56110010Smarkm java.naming \ 57279264Sdelphij java.prefs \ 58279264Sdelphij java.rmi \ 59279264Sdelphij java.security.jgss \ 60279264Sdelphij java.security.sasl \ 61279264Sdelphij java.sql \ 62279264Sdelphij java.xml \ 63215698Ssimon java.xml.crypto \ 64279264Sdelphij jdk.httpserver \ 65279264Sdelphij jdk.management \ 66279264Sdelphij jdk.sctp \ 67279264Sdelphij jdk.security.auth \ 68279264Sdelphij jdk.security.jgss \ 69215698Ssimon jdk.unsupported \ 70279264Sdelphij jdk.vm.ci \ 71110010Smarkm # 72110010Smarkm 73110010Smarkm# to be deprivileged 74110010SmarkmBOOT_MODULES += \ 75110010Smarkm java.compiler \ 76110010Smarkm java.scripting \ 77110010Smarkm java.sql.rowset \ 78110010Smarkm java.smartcardio \ 79110010Smarkm jdk.charsets \ 80110010Smarkm jdk.naming.rmi \ 81110010Smarkm # 82110010Smarkm 83110010SmarkmUPGRADEABLE_MODULES += \ 84110010Smarkm java.activation \ 85110010Smarkm java.annotations.common \ 86110010Smarkm java.corba \ 87110010Smarkm java.transaction \ 88110010Smarkm java.xml.bind \ 89110010Smarkm java.xml.ws \ 90110010Smarkm # 91110010Smarkm 92110010SmarkmAGGREGATOR_MODULES += \ 93110010Smarkm java.compact1 \ 94110010Smarkm java.compact2 \ 95110010Smarkm java.compact3 \ 96110010Smarkm java.se \ 97110010Smarkm java.se.ee \ 98110010Smarkm # 99110010Smarkm 100110010SmarkmPLATFORM_MODULES += \ 101110010Smarkm $(UPGRADEABLE_MODULES) \ 102110010Smarkm $(AGGREGATOR_MODULES) 103110010Smarkm # 104110010Smarkm 105110010SmarkmPLATFORM_MODULES += \ 106110010Smarkm jdk.accessibility \ 107110010Smarkm jdk.crypto.ec \ 108110010Smarkm jdk.crypto.pkcs11 \ 109110010Smarkm jdk.dynalink \ 110110010Smarkm jdk.jsobject \ 111110010Smarkm jdk.xml.dom \ 112110010Smarkm jdk.localedata \ 113110010Smarkm jdk.naming.dns \ 114110010Smarkm jdk.scripting.nashorn \ 115110010Smarkm jdk.zipfs \ 116110010Smarkm # 117110010Smarkm 118110010SmarkmJRE_TOOL_MODULES += \ 119110010Smarkm jdk.jdwp.agent \ 120110010Smarkm jdk.pack200 \ 121110010Smarkm jdk.scripting.nashorn.shell \ 122110010Smarkm # 123110010Smarkm 124110010Smarkmifeq ($(OPENJDK_TARGET_OS), windows) 125110010Smarkm PLATFORM_MODULES += jdk.crypto.mscapi 126110010Smarkmendif 127110010Smarkmifeq ($(OPENJDK_TARGET_OS), solaris) 128110010Smarkm PLATFORM_MODULES += jdk.crypto.ucrypto 129110010Smarkmendif 130110010Smarkm 131110010Smarkm################################################################################ 132110010Smarkm# Some platforms don't have the serviceability agent 133160819Ssimon 134110010Smarkmifeq ($(INCLUDE_SA), false) 135110010Smarkm MODULES_FILTER += jdk.hotspot.agent 136279264Sdelphijendif 137215698Ssimon 138215698Ssimon################################################################################ 139215698Ssimon# Module list macros 140215698Ssimon 141110010Smarkm# Use append so that the custom extension may add to this variable 142160819Ssimon 143110010SmarkmALL_TOP_SRC_DIRS += \ 144110010Smarkm $(HOTSPOT_TOPDIR)/src \ 145110010Smarkm $(JDK_TOPDIR)/src \ 146110010Smarkm $(LANGTOOLS_TOPDIR)/src \ 147215698Ssimon $(CORBA_TOPDIR)/src \ 148160819Ssimon $(JAXP_TOPDIR)/src \ 149110010Smarkm $(JAXWS_TOPDIR)/src \ 150110010Smarkm $(NASHORN_TOPDIR)/src \ 151110010Smarkm # 152110010Smarkm 153110010Smarkm# Find all module-info.java files for the current build target platform and 154110010Smarkm# configuration. 155279264Sdelphij# Param 1 - Module to find for, set to * for finding all 156110010SmarkmFindAllModuleInfos = \ 157110010Smarkm $(wildcard \ 158110010Smarkm $(patsubst %,%/$(strip $1)/$(OPENJDK_TARGET_OS)/classes/module-info.java, $(ALL_TOP_SRC_DIRS)) \ 159110010Smarkm $(patsubst %,%/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/classes/module-info.java, $(ALL_TOP_SRC_DIRS)) \ 160279264Sdelphij $(patsubst %,%/$(strip $1)/share/classes/module-info.java, $(ALL_TOP_SRC_DIRS)) \ 161110010Smarkm $(patsubst %,%/$(strip $1)/module-info.java, $(IMPORT_MODULES_SRC))) 162279264Sdelphij 163110010Smarkm# Extract the module names from the paths of module-info.java files. The 164110010Smarkm# position of the module directory differs depending on if this is an imported 165110010Smarkm# src dir or not. 166110010SmarkmGetModuleNameFromModuleInfo = \ 167160819Ssimon $(strip $(foreach mi, $1, \ 168110010Smarkm $(if $(filter $(addsuffix %, $(IMPORT_MODULES_SRC)), $(mi)), \ 169279264Sdelphij $(notdir $(patsubst %/,%, $(dir $(mi)))), \ 170110010Smarkm $(notdir $(patsubst %/,%, $(dir $(patsubst %/,%, $(dir $(patsubst %/,%, $(dir $(mi))))))))))) 171160819Ssimon 172110010Smarkm# Find all modules by looking for module-info.java files and looking at parent 173279264Sdelphij# directories. 174279264SdelphijFindAllModules = \ 175110010Smarkm $(sort $(filter-out $(MODULES_FILTER), \ 176110010Smarkm $(call GetModuleNameFromModuleInfo, $(MODULE_INFOS)))) 177110010Smarkm 178110010SmarkmFindImportedModules = \ 179279264Sdelphij $(if $(IMPORT_MODULES_CLASSES), $(notdir $(wildcard $(IMPORT_MODULES_CLASSES)/*))) 180110010Smarkm 181279264Sdelphij################################################################################ 182110010Smarkm# Extract module dependencies from module-info.java files. 183110010Smarkm 184110010SmarkmMODULE_DEPS_MAKEFILE := $(MAKESUPPORT_OUTPUTDIR)/module-deps.gmk 185110010Smarkm 186110010SmarkmMODULE_INFOS := $(call FindAllModuleInfos, *) 187110010Smarkm 188110010Smarkm$(MODULE_DEPS_MAKEFILE): $(MODULE_INFOS) \ 189110010Smarkm $(call DependOnVariable, MODULE_INFOS, $(MAKESUPPORT_OUTPUTDIR)/MODULE_INFOS.vardeps) 190110010Smarkm $(MKDIR) -p $(@D) 191110010Smarkm $(RM) $@ 192110010Smarkm $(foreach m, $(MODULE_INFOS), \ 193110010Smarkm ( $(PRINTF) "DEPS_$(call GetModuleNameFromModuleInfo, $m) :=" && \ 194279264Sdelphij $(NAWK) -v MODULE=$(call GetModuleNameFromModuleInfo, $m) '\ 195110010Smarkm BEGIN { if (MODULE != "java.base") printf(" java.base"); } \ 196279264Sdelphij /requires/ { sub(/;/, ""); \ 197110010Smarkm sub(/requires/, ""); \ 198110010Smarkm sub(/public/, ""); \ 199110010Smarkm sub(/\/\/.*/, ""); \ 200110010Smarkm sub(/\/\*.*\*\//, ""); \ 201110010Smarkm gsub(/ /, ""); \ 202279264Sdelphij printf(" %s", $$0) } \ 203110010Smarkm END { printf("\n") }' $m \ 204279264Sdelphij ) >> $@ $(NEWLINE)) 205110010Smarkm 206110010Smarkm-include $(MODULE_DEPS_MAKEFILE) 207110010Smarkm 208279264Sdelphij# Param 1: Module to find deps for 209110010SmarkmFindDepsForModule = \ 210110010Smarkm $(DEPS_$(strip $1)) 211110010Smarkm 212160819Ssimon# Finds transitive dependencies in 3 levels. 213110010Smarkm# Param 1: Module to find transitive deps for 214110010SmarkmFindTransitiveDepsForModule = \ 215110010Smarkm $(sort $(call FindDepsForModule, $1) \ 216279264Sdelphij $(foreach m, $(call FindDepsForModule, $1), \ 217110010Smarkm $(call FindDepsForModule, $m) \ 218160819Ssimon $(foreach n, $(call FindDepsForModule, $m), \ 219110010Smarkm $(call FindDepsForModule, $n)))) 220110010Smarkm 221110010Smarkm################################################################################ 222110010Smarkm 223110010Smarkm# Param 1 - Name of module 224110010Smarkmdefine ReadSingleImportMetaData 225110010Smarkm ifneq ($$(wildcard $(IMPORT_MODULES_MAKE)/$$(strip $1)/build.properties), ) 226160819Ssimon classloader := 227110010Smarkm include_in_jre := 228110010Smarkm include_in_jdk := 229110010Smarkm include $(IMPORT_MODULES_MAKE)/$$(strip $1)/build.properties 230110010Smarkm ifeq ($$(include_in_jre), true) 231110010Smarkm JRE_MODULES += $1 232160819Ssimon endif 233110010Smarkm ifeq ($$(include_in_jdk), true) 234110010Smarkm JDK_MODULES += $1 235110010Smarkm endif 236 ifeq ($$(classloader), boot) 237 BOOT_MODULES += $1 238 else ifeq ($$(classloader), ext) 239 PLATFORM_MODULES += $1 240 endif 241 else 242 # Default to include in all 243 JRE_MODULES += $1 244 JDK_MODULES += $1 245 endif 246endef 247 248# Reading the imported modules metadata has a cost, so to make it available, 249# a makefile needs to eval-call this macro first. After calling this, the 250# following variables are populated with data from the imported modules: 251# * JRE_MODULES 252# * JDK_MODULES 253# * BOOT_MODULES 254# * PLATFORM_MODULES 255# * JRE_TOOL_MODULES 256define ReadImportMetaData 257 IMPORTED_MODULES := $$(call FindImportedModules) 258 $$(foreach m, $$(IMPORTED_MODULES), \ 259 $$(eval $$(call ReadSingleImportMetaData, $$m))) 260endef 261 262################################################################################ 263 264endif # _MODULES_GMK 265