Modules.gmk revision 1994:1d992540870f
1251881Speter# 2251881Speter# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 3251881Speter# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4251881Speter# 5362181Sdim# This code is free software; you can redistribute it and/or modify it 6251881Speter# under the terms of the GNU General Public License version 2 only, as 7251881Speter# published by the Free Software Foundation. Oracle designates this 8251881Speter# particular file as subject to the "Classpath" exception as provided 9251881Speter# by Oracle in the LICENSE file that accompanied this code. 10251881Speter# 11251881Speter# This code is distributed in the hope that it will be useful, but WITHOUT 12251881Speter# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13251881Speter# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14251881Speter# version 2 for more details (a copy is included in the LICENSE file that 15251881Speter# accompanied this code). 16251881Speter# 17251881Speter# You should have received a copy of the GNU General Public License version 18251881Speter# 2 along with this work; if not, write to the Free Software Foundation, 19251881Speter# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20251881Speter# 21251881Speter# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22251881Speter# or visit www.oracle.com if you need additional information or have any 23251881Speter# questions. 24251881Speter# 25251881Speter 26251881Speterifndef _MODULES_GMK 27251881Speter_MODULES_GMK := 1 28251881Speter 29251881Speter################################################################################ 30251881Speter# 31251881Speter# BOOT_MODULES are modules defined by the boot loader 32251881Speter# PLATFORM_MODULES are modules defined by the platform loader 33251881Speter# JRE_TOOL_MODULES are tools included in JRE and defined by the application loader 34251881Speter# 35251881Speter# All other modules not declared below are defined by the application loader 36251881Speter# and are not included in JRE. 37251881Speter 38251881SpeterBOOT_MODULES := 39309511SpeterPLATFORM_MODULES := 40251881SpeterJRE_TOOL_MODULES := 41251881Speter 42309511Speter# Hook to include the corresponding custom file, if present. 43251881Speter$(eval $(call IncludeCustomExtension, , common/Modules.gmk)) 44251881Speter 45251881SpeterUPGRADEABLE_MDOULES := 46251881SpeterAGGREGATOR_MDOULES := 47251881Speter 48251881SpeterBOOT_MODULES += \ 49251881Speter java.base \ 50251881Speter java.datatransfer \ 51251881Speter java.desktop \ 52251881Speter java.httpclient \ 53251881Speter java.instrument \ 54251881Speter java.logging \ 55251881Speter java.management \ 56251881Speter java.naming \ 57251881Speter java.prefs \ 58251881Speter java.rmi \ 59251881Speter java.security.jgss \ 60251881Speter java.security.sasl \ 61251881Speter java.sql \ 62251881Speter java.xml \ 63251881Speter java.xml.crypto \ 64251881Speter jdk.httpserver \ 65251881Speter jdk.management \ 66251881Speter jdk.sctp \ 67251881Speter jdk.security.auth \ 68251881Speter jdk.security.jgss \ 69251881Speter jdk.unsupported \ 70251881Speter jdk.vm.ci \ 71251881Speter # 72251881Speter 73251881Speter# to be deprivileged 74251881SpeterBOOT_MODULES += \ 75251881Speter java.compiler \ 76251881Speter java.scripting \ 77251881Speter java.sql.rowset \ 78251881Speter java.smartcardio \ 79251881Speter jdk.charsets \ 80251881Speter jdk.naming.rmi \ 81251881Speter # 82251881Speter 83251881SpeterUPGRADEABLE_MODULES += \ 84251881Speter java.activation \ 85 java.annotations.common \ 86 java.corba \ 87 java.transaction \ 88 java.xml.bind \ 89 java.xml.ws \ 90 # 91 92AGGREGATOR_MODULES += \ 93 java.compact1 \ 94 java.compact2 \ 95 java.compact3 \ 96 java.se \ 97 java.se.ee \ 98 # 99 100PLATFORM_MODULES += \ 101 $(UPGRADEABLE_MODULES) \ 102 $(AGGREGATOR_MODULES) 103 # 104 105PLATFORM_MODULES += \ 106 jdk.accessibility \ 107 jdk.crypto.ec \ 108 jdk.crypto.pkcs11 \ 109 jdk.dynalink \ 110 jdk.jsobject \ 111 jdk.xml.dom \ 112 jdk.localedata \ 113 jdk.naming.dns \ 114 jdk.scripting.nashorn \ 115 jdk.zipfs \ 116 # 117 118JRE_TOOL_MODULES += \ 119 jdk.jdwp.agent \ 120 jdk.pack200 \ 121 jdk.scripting.nashorn.shell \ 122 # 123 124ifeq ($(OPENJDK_TARGET_OS), windows) 125 PLATFORM_MODULES += jdk.crypto.mscapi 126endif 127ifeq ($(OPENJDK_TARGET_OS), solaris) 128 PLATFORM_MODULES += jdk.crypto.ucrypto 129endif 130 131################################################################################ 132# Some platforms don't have the serviceability agent 133 134ifeq ($(INCLUDE_SA), false) 135 MODULES_FILTER += jdk.hotspot.agent 136endif 137 138################################################################################ 139# Module list macros 140 141# Use append so that the custom extension may add to this variable 142 143ALL_TOP_SRC_DIRS += \ 144 $(HOTSPOT_TOPDIR)/src \ 145 $(JDK_TOPDIR)/src \ 146 $(LANGTOOLS_TOPDIR)/src \ 147 $(CORBA_TOPDIR)/src \ 148 $(JAXP_TOPDIR)/src \ 149 $(JAXWS_TOPDIR)/src \ 150 $(NASHORN_TOPDIR)/src \ 151 # 152 153# Find all module-info.java files for the current build target platform and 154# configuration. 155# Param 1 - Module to find for, set to * for finding all 156FindAllModuleInfos = \ 157 $(wildcard \ 158 $(patsubst %,%/$(strip $1)/$(OPENJDK_TARGET_OS)/classes/module-info.java, $(ALL_TOP_SRC_DIRS)) \ 159 $(patsubst %,%/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/classes/module-info.java, $(ALL_TOP_SRC_DIRS)) \ 160 $(patsubst %,%/$(strip $1)/share/classes/module-info.java, $(ALL_TOP_SRC_DIRS)) \ 161 $(patsubst %,%/$(strip $1)/module-info.java, $(IMPORT_MODULES_SRC))) 162 163# Extract the module names from the paths of module-info.java files. The 164# position of the module directory differs depending on if this is an imported 165# src dir or not. 166GetModuleNameFromModuleInfo = \ 167 $(strip $(foreach mi, $1, \ 168 $(if $(filter $(addsuffix %, $(IMPORT_MODULES_SRC)), $(mi)), \ 169 $(notdir $(patsubst %/,%, $(dir $(mi)))), \ 170 $(notdir $(patsubst %/,%, $(dir $(patsubst %/,%, $(dir $(patsubst %/,%, $(dir $(mi))))))))))) 171 172# Find all modules by looking for module-info.java files and looking at parent 173# directories. 174FindAllModules = \ 175 $(sort $(filter-out $(MODULES_FILTER), \ 176 $(call GetModuleNameFromModuleInfo, $(MODULE_INFOS)))) 177 178FindImportedModules = \ 179 $(if $(IMPORT_MODULES_CLASSES), $(notdir $(wildcard $(IMPORT_MODULES_CLASSES)/*))) 180 181################################################################################ 182# Extract module dependencies from module-info.java files. 183 184MODULE_DEPS_MAKEFILE := $(MAKESUPPORT_OUTPUTDIR)/module-deps.gmk 185 186MODULE_INFOS := $(call FindAllModuleInfos, *) 187 188$(MODULE_DEPS_MAKEFILE): $(MODULE_INFOS) \ 189 $(call DependOnVariable, MODULE_INFOS, $(MAKESUPPORT_OUTPUTDIR)/MODULE_INFOS.vardeps) 190 $(MKDIR) -p $(@D) 191 $(RM) $@ 192 $(foreach m, $(MODULE_INFOS), \ 193 ( $(PRINTF) "DEPS_$(call GetModuleNameFromModuleInfo, $m) :=" && \ 194 $(NAWK) -v MODULE=$(call GetModuleNameFromModuleInfo, $m) '\ 195 BEGIN { if (MODULE != "java.base") printf(" java.base"); } \ 196 /requires/ { sub(/;/, ""); \ 197 sub(/requires/, ""); \ 198 sub(/public/, ""); \ 199 sub(/\/\/.*/, ""); \ 200 sub(/\/\*.*\*\//, ""); \ 201 gsub(/ /, ""); \ 202 printf(" %s", $$0) } \ 203 END { printf("\n") }' $m \ 204 ) >> $@ $(NEWLINE)) 205 206-include $(MODULE_DEPS_MAKEFILE) 207 208# Param 1: Module to find deps for 209FindDepsForModule = \ 210 $(DEPS_$(strip $1)) 211 212# Finds transitive dependencies in 3 levels. 213# Param 1: Module to find transitive deps for 214FindTransitiveDepsForModule = \ 215 $(sort $(call FindDepsForModule, $1) \ 216 $(foreach m, $(call FindDepsForModule, $1), \ 217 $(call FindDepsForModule, $m) \ 218 $(foreach n, $(call FindDepsForModule, $m), \ 219 $(call FindDepsForModule, $n)))) 220 221################################################################################ 222 223# Param 1 - Name of module 224define ReadSingleImportMetaData 225 ifneq ($$(wildcard $(IMPORT_MODULES_MAKE)/$$(strip $1)/build.properties), ) 226 classloader := 227 include_in_jre := 228 include_in_jdk := 229 include $(IMPORT_MODULES_MAKE)/$$(strip $1)/build.properties 230 ifeq ($$(include_in_jre), true) 231 JRE_MODULES += $1 232 endif 233 ifeq ($$(include_in_jdk), true) 234 JDK_MODULES += $1 235 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