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 42 # Hook to include the corresponding custom file, if present. 43 $(eval $(call IncludeCustomExtension, , common/Modules.gmk)) 44 45 UPGRADEABLE_MDOULES := 46 AGGREGATOR_MDOULES := 47 48 BOOT_MODULES += \ 49 java.base \ 50 java.datatransfer \ 51 java.desktop \ 52 java.httpclient \ 53 java.instrument \ 54 java.logging \ 55 java.management \ 56 java.naming \ 57 java.prefs \ 58 java.rmi \ 59 java.security.jgss \ 60 java.security.sasl \ 61 java.sql \ 62 java.xml \ 63 java.xml.crypto \ 64 jdk.httpserver \ 65 jdk.management \ 66 jdk.sctp \ 67 jdk.security.auth \ 68 jdk.security.jgss \ 69 jdk.vm.ci \ 70 # 71 72 # to be deprivileged 73 BOOT_MODULES += \ 74 java.compiler \ 75 java.scripting \ 76 java.sql.rowset \ 77 java.smartcardio \ 78 jdk.charsets \ 79 jdk.naming.rmi \ 80 # 81 82 UPGRADEABLE_MODULES += \ 83 java.activation \ 84 java.annotations.common \ 85 java.corba \ 86 java.transaction \ 87 java.xml.bind \ 88 java.xml.ws \ 89 # 90 91 AGGREGATOR_MODULES += \ 92 java.compact1 \ 93 java.compact2 \ 94 java.compact3 \ 95 java.se \ 96 java.se.ee \ 97 # 98 99 PLATFORM_MODULES += \ 100 $(UPGRADEABLE_MODULES) \ 101 $(AGGREGATOR_MODULES) 102 # 103 104 PLATFORM_MODULES += \ 105 jdk.accessibility \ 106 jdk.crypto.ec \ 107 jdk.crypto.pkcs11 \ 108 jdk.dynalink \ 109 jdk.jsobject \ 110 jdk.xml.dom \ 111 jdk.localedata \ 112 jdk.naming.dns \ 113 jdk.scripting.nashorn \ 114 jdk.zipfs \ 115 # 116 117 JRE_TOOL_MODULES += \ 118 jdk.pack200 \ 119 jdk.scripting.nashorn.shell \ 120 # 121 122 ifeq ($(OPENJDK_TARGET_OS), windows) 123 PLATFORM_MODULES += jdk.crypto.mscapi 124 endif 125 ifeq ($(OPENJDK_TARGET_OS), solaris) 126 PLATFORM_MODULES += jdk.crypto.ucrypto 127 endif 128 129 ################################################################################ 130 # Some platforms don't have the serviceability agent 131 132 ifeq ($(INCLUDE_SA), false) 133 MODULES_FILTER += jdk.hotspot.agent 134 endif 135 136 ################################################################################ 137 # Module list macros 138 139 # Use append so that the custom extension may add to this variable 140 141 ALL_TOP_SRC_DIRS += \ 142 $(HOTSPOT_TOPDIR)/src \ 143 $(JDK_TOPDIR)/src \ 144 $(LANGTOOLS_TOPDIR)/src \ 145 $(CORBA_TOPDIR)/src \ 146 $(JAXP_TOPDIR)/src \ 147 $(JAXWS_TOPDIR)/src \ 148 $(NASHORN_TOPDIR)/src \ 149 # 150 151 # Find all module-info.java files for the current build target platform and 152 # configuration. 153 # Param 1 - Module to find for, set to * for finding all 154 FindAllModuleInfos = \ 155 $(wildcard \ 156 $(patsubst %,%/$(strip $1)/$(OPENJDK_TARGET_OS)/classes/module-info.java, $(ALL_TOP_SRC_DIRS)) \ 157 $(patsubst %,%/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/classes/module-info.java, $(ALL_TOP_SRC_DIRS)) \ 158 $(patsubst %,%/$(strip $1)/share/classes/module-info.java, $(ALL_TOP_SRC_DIRS)) \ 159 $(patsubst %,%/$(strip $1)/module-info.java, $(IMPORT_MODULES_SRC))) 160 161 # Extract the module names from the paths of module-info.java files. The 162 # position of the module directory differs depending on if this is an imported 163 # src dir or not. 164 GetModuleNameFromModuleInfo = \ 165 $(strip $(foreach mi, $1, \ 166 $(if $(filter $(addsuffix %, $(IMPORT_MODULES_SRC)), $(mi)), \ 167 $(notdir $(patsubst %/,%, $(dir $(mi)))), \ 168 $(notdir $(patsubst %/,%, $(dir $(patsubst %/,%, $(dir $(patsubst %/,%, $(dir $(mi))))))))))) 169 170 # Find all modules by looking for module-info.java files and looking at parent 171 # directories. 172 FindAllModules = \ 173 $(sort $(filter-out $(MODULES_FILTER), \ 174 $(call GetModuleNameFromModuleInfo, $(MODULE_INFOS)))) 175 176 FindImportedModules = \ 177 $(if $(IMPORT_MODULES_CLASSES), $(notdir $(wildcard $(IMPORT_MODULES_CLASSES)/*))) 178 179 ################################################################################ 180 # Extract module dependencies from module-info.java files. 181 182 MODULE_DEPS_MAKEFILE := $(MAKESUPPORT_OUTPUTDIR)/module-deps.gmk 183 184 MODULE_INFOS := $(call FindAllModuleInfos, *) 185 186 $(MODULE_DEPS_MAKEFILE): $(MODULE_INFOS) \ 187 $(call DependOnVariable, MODULE_INFOS, $(MAKESUPPORT_OUTPUTDIR)/MODULE_INFOS.vardeps) 188 $(MKDIR) -p $(@D) 189 $(RM) $@ 190 $(foreach m, $(MODULE_INFOS), \ 191 ( $(PRINTF) "DEPS_$(call GetModuleNameFromModuleInfo, $m) :=" && \ 192 $(NAWK) -v MODULE=$(call GetModuleNameFromModuleInfo, $m) '\ 193 BEGIN { if (MODULE != "java.base") printf(" java.base"); } \ 194 /requires/ { sub(/;/, ""); \ 195 sub(/requires/, ""); \ 196 sub(/public/, ""); \ 197 sub(/\/\/.*/, ""); \ 198 sub(/\/\*.*\*\//, ""); \ 199 gsub(/ /, ""); \ 200 printf(" %s", $$0) } \ 201 END { printf("\n") }' $m \ 202 ) >> $@ $(NEWLINE)) 203 204 -include $(MODULE_DEPS_MAKEFILE) 205 206 # Param 1: Module to find deps for 207 FindDepsForModule = \ 208 $(DEPS_$(strip $1)) 209 210 # Finds transitive dependencies in 3 levels. 211 # Param 1: Module to find transitive deps for 212 FindTransitiveDepsForModule = \ 213 $(sort $(call FindDepsForModule, $1) \ 214 $(foreach m, $(call FindDepsForModule, $1), \ 215 $(call FindDepsForModule, $m) \ 216 $(foreach n, $(call FindDepsForModule, $m), \ 217 $(call FindDepsForModule, $n)))) 218 219 ################################################################################ 220 221 # Param 1 - Name of module 222 define ReadSingleImportMetaData 223 ifneq ($$(wildcard $(IMPORT_MODULES_MAKE)/$$(strip $1)/build.properties), ) 224 classloader := 225 include_in_jre := 226 include_in_jdk := 227 include $(IMPORT_MODULES_MAKE)/$$(strip $1)/build.properties 228 ifeq ($$(include_in_jre), true) 229 JRE_MODULES += $1 230 endif 231 ifeq ($$(include_in_jdk), true) 232 JDK_MODULES += $1 233 endif 234 ifeq ($$(classloader), boot) 235 BOOT_MODULES += $1 236 else ifeq ($$(classloader), ext) 237 PLATFORM_MODULES += $1 238 endif 239 else 240 # Default to include in all 241 JRE_MODULES += $1 242 JDK_MODULES += $1 243 endif 244 endef 245 246 # Reading the imported modules metadata has a cost, so to make it available, 247 # a makefile needs to eval-call this macro first. After calling this, the 248 # following variables are populated with data from the imported modules: 249 # * JRE_MODULES 250 # * JDK_MODULES 251 # * BOOT_MODULES 252 # * PLATFORM_MODULES 253 # * JRE_TOOL_MODULES 254 define ReadImportMetaData 255 IMPORTED_MODULES := $$(call FindImportedModules) 256 $$(foreach m, $$(IMPORTED_MODULES), \ 257 $$(eval $$(call ReadSingleImportMetaData, $$m))) 258 endef 259 260 ################################################################################ 261 262 endif # _MODULES_GMK