1 # 2 # Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 # 5 # This code is free software; you can redistribute it and/or modify it 6 # under the terms of the GNU General Public License version 2 only, as 7 # published by the Free Software Foundation. Oracle designates this 8 # particular file as subject to the "Classpath" exception as provided 9 # by Oracle in the LICENSE file that accompanied this code. 10 # 11 # This code is distributed in the hope that it will be useful, but WITHOUT 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 # version 2 for more details (a copy is included in the LICENSE file that 15 # accompanied this code). 16 # 17 # You should have received a copy of the GNU General Public License version 18 # 2 along with this work; if not, write to the Free Software Foundation, 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 # 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 # or visit www.oracle.com if you need additional information or have any 23 # questions. 24 # 25 26 ifndef _MODULES_GMK 27 _MODULES_GMK := 1 28 29 ################################################################################ 30 # 31 # BOOT_MODULES are modules defined by the boot loader 32 # PLATFORM_MODULES are modules defined by the platform loader 33 # JRE_TOOL_MODULES are tools included in JRE and defined by the application loader 34 # 35 # All other modules not declared below are defined by the application loader 36 # and are not included in JRE. 37 38 BOOT_MODULES := 39 PLATFORM_MODULES := 40 JRE_TOOL_MODULES := 41 UPGRADEABLE_MODULES := 42 AGGREGATOR_MODULES := 43 44 # Hook to include the corresponding custom file, if present. 45 $(eval $(call IncludeCustomExtension, , common/Modules.gmk)) 46 47 BOOT_MODULES += \ 48 java.base \ 49 java.datatransfer \ 50 java.desktop \ 51 java.httpclient \ 52 java.instrument \ 53 java.logging \ 54 java.management \ 55 java.naming \ 56 java.prefs \ 57 java.rmi \ 58 java.security.jgss \ 59 java.security.sasl \ 60 java.sql \ 61 java.xml \ 62 java.xml.crypto \ 63 jdk.httpserver \ 64 jdk.management \ 65 jdk.net \ 66 jdk.sctp \ 67 jdk.security.auth \ 68 jdk.security.jgss \ 69 jdk.unsupported \ 70 jdk.vm.ci \ 71 # 72 73 # to be deprivileged 74 BOOT_MODULES += \ 75 java.compiler \ 76 java.scripting \ 77 java.sql.rowset \ 78 java.smartcardio \ 79 jdk.charsets \ 80 jdk.naming.rmi \ 81 # 82 83 UPGRADEABLE_MODULES += \ 84 java.activation \ 85 java.annotations.common \ 86 java.corba \ 87 java.transaction \ 88 java.xml.bind \ 89 java.xml.ws \ 90 # 91 92 AGGREGATOR_MODULES += \ 93 java.compact1 \ 94 java.compact2 \ 95 java.compact3 \ 96 java.se \ 97 java.se.ee \ 98 # 99 100 PLATFORM_MODULES += \ 101 $(UPGRADEABLE_MODULES) \ 102 $(AGGREGATOR_MODULES) 103 # 104 105 PLATFORM_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 118 JRE_TOOL_MODULES += \ 119 jdk.jdwp.agent \ 120 jdk.pack200 \ 121 jdk.scripting.nashorn.shell \ 122 # 123 124 ifeq ($(OPENJDK_TARGET_OS), windows) 125 PLATFORM_MODULES += jdk.crypto.mscapi 126 endif 127 ifeq ($(OPENJDK_TARGET_OS), solaris) 128 PLATFORM_MODULES += jdk.crypto.ucrypto 129 endif 130 131 ################################################################################ 132 # Some platforms don't have the serviceability agent 133 134 ifeq ($(INCLUDE_SA), false) 135 MODULES_FILTER += jdk.hotspot.agent 136 endif 137 138 ################################################################################ 139 # Module list macros 140 141 # Use append so that the custom extension may add to these variables 142 143 GENERATED_SRC_DIRS += \ 144 $(SUPPORT_OUTPUTDIR)/gensrc \ 145 # 146 147 TOP_SRC_DIRS += \ 148 $(CORBA_TOPDIR)/src \ 149 $(HOTSPOT_TOPDIR)/src \ 150 $(JDK_TOPDIR)/src \ 151 $(LANGTOOLS_TOPDIR)/src \ 152 $(JAXP_TOPDIR)/src \ 153 $(JAXWS_TOPDIR)/src \ 154 $(NASHORN_TOPDIR)/src \ 155 # 156 157 SRC_SUBDIRS += $(OPENJDK_TARGET_OS)/classes 158 ifneq ($(OPENJDK_TARGET_OS), $(OPENJDK_TARGET_OS_TYPE)) 159 SRC_SUBDIRS += $(OPENJDK_TARGET_OS_TYPE)/classes 160 endif 161 SRC_SUBDIRS += share/classes 162 163 # Find all module-info.java files for the current build target platform and 164 # configuration. 165 # Param 1 - Module to find for, set to * for finding all 166 FindAllModuleInfos = \ 167 $(wildcard \ 168 $(foreach sub, $(SRC_SUBDIRS), \ 169 $(patsubst %,%/$(strip $1)/$(sub)/module-info.java, $(TOP_SRC_DIRS))) \ 170 $(patsubst %,%/$(strip $1)/module-info.java, $(IMPORT_MODULES_SRC))) 171 172 # Extract the module names from the paths of module-info.java files. The 173 # position of the module directory differs depending on if this is an imported 174 # src dir or not. 175 GetModuleNameFromModuleInfo = \ 176 $(strip $(foreach mi, $1, \ 177 $(if $(filter $(addsuffix %, $(IMPORT_MODULES_SRC)), $(mi)), \ 178 $(notdir $(patsubst %/,%, $(dir $(mi)))), \ 179 $(notdir $(patsubst %/,%, $(dir $(patsubst %/,%, $(dir $(patsubst %/,%, $(dir $(mi))))))))))) 180 181 # Find all modules by looking for module-info.java files and looking at parent 182 # directories. 183 FindAllModules = \ 184 $(sort $(filter-out $(MODULES_FILTER), \ 185 $(call GetModuleNameFromModuleInfo, $(MODULE_INFOS)))) 186 187 FindImportedModules = \ 188 $(filter-out $(MODULES_FILTER), \ 189 $(if $(IMPORT_MODULES_CLASSES), $(notdir $(wildcard $(IMPORT_MODULES_CLASSES)/*)))) 190 191 # Find all source dirs for a particular module 192 # $1 - Module to find source dirs for 193 FindModuleSrcDirs = \ 194 $(strip $(wildcard \ 195 $(addsuffix /$(strip $1), $(GENERATED_SRC_DIRS) $(IMPORT_MODULES_SRC)) \ 196 $(foreach sub, $(SRC_SUBDIRS), $(addsuffix /$(strip $1)/$(sub), $(TOP_SRC_DIRS))))) 197 198 # Construct the complete module source path 199 GetModuleSrcPath = \ 200 $(call PathList, \ 201 $(addsuffix /*, $(GENERATED_SRC_DIRS) $(IMPORT_MODULES_SRC)) \ 202 $(foreach sub, $(SRC_SUBDIRS), $(addsuffix /*/$(sub), $(TOP_SRC_DIRS)))) 203 204 ################################################################################ 205 # Extract module dependencies from module-info.java files. 206 207 MODULE_DEPS_MAKEFILE := $(MAKESUPPORT_OUTPUTDIR)/module-deps.gmk 208 209 MODULE_INFOS := $(call FindAllModuleInfos, *) 210 211 $(MODULE_DEPS_MAKEFILE): $(MODULE_INFOS) \ 212 $(call DependOnVariable, MODULE_INFOS, $(MAKESUPPORT_OUTPUTDIR)/MODULE_INFOS.vardeps) 213 $(MKDIR) -p $(@D) 214 $(RM) $@ 215 $(foreach m, $(MODULE_INFOS), \ 216 ( $(PRINTF) "DEPS_$(call GetModuleNameFromModuleInfo, $m) :=" && \ 217 $(NAWK) -v MODULE=$(call GetModuleNameFromModuleInfo, $m) '\ 218 BEGIN { if (MODULE != "java.base") printf(" java.base"); } \ 219 /requires/ { sub(/;/, ""); \ 220 sub(/requires/, ""); \ 221 sub(/public/, ""); \ 222 sub(/\/\/.*/, ""); \ 223 sub(/\/\*.*\*\//, ""); \ 224 gsub(/ /, ""); \ 225 printf(" %s", $$0) } \ 226 END { printf("\n") }' $m \ 227 ) >> $@ $(NEWLINE)) 228 229 -include $(MODULE_DEPS_MAKEFILE) 230 231 # Param 1: Module to find deps for 232 FindDepsForModule = \ 233 $(DEPS_$(strip $1)) 234 235 # Finds transitive dependencies in 3 levels. 236 # Param 1: Module to find transitive deps for 237 FindTransitiveDepsForModule = \ 238 $(sort $(call FindDepsForModule, $1) \ 239 $(foreach m, $(call FindDepsForModule, $1), \ 240 $(call FindDepsForModule, $m) \ 241 $(foreach n, $(call FindDepsForModule, $m), \ 242 $(call FindDepsForModule, $n)))) 243 244 ################################################################################ 245 246 # Param 1 - Name of module 247 define ReadSingleImportMetaData 248 ifneq ($$(wildcard $(IMPORT_MODULES_MAKE)/$$(strip $1)/build.properties), ) 249 classloader := 250 include_in_jre := 251 include_in_jdk := 252 include $(IMPORT_MODULES_MAKE)/$$(strip $1)/build.properties 253 ifeq ($$(include_in_jre), true) 254 JRE_MODULES += $1 255 endif 256 ifeq ($$(include_in_jdk), true) 257 JDK_MODULES += $1 258 endif 259 ifeq ($$(classloader), boot) 260 BOOT_MODULES += $1 261 else ifeq ($$(classloader), ext) 262 PLATFORM_MODULES += $1 263 endif 264 else 265 # Default to include in all 266 JRE_MODULES += $1 267 JDK_MODULES += $1 268 endif 269 endef 270 271 # Reading the imported modules metadata has a cost, so to make it available, 272 # a makefile needs to eval-call this macro first. After calling this, the 273 # following variables are populated with data from the imported modules: 274 # * JRE_MODULES 275 # * JDK_MODULES 276 # * BOOT_MODULES 277 # * PLATFORM_MODULES 278 # * JRE_TOOL_MODULES 279 define ReadImportMetaData 280 IMPORTED_MODULES := $$(call FindImportedModules) 281 $$(foreach m, $$(IMPORTED_MODULES), \ 282 $$(eval $$(call ReadSingleImportMetaData, $$m))) 283 endef 284 285 ################################################################################ 286 287 endif # _MODULES_GMK