Modules.gmk revision 2563:a09f8a1f40ef
11541Srgrimes# 210940Swollman# Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. 31541Srgrimes# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 41541Srgrimes# 51541Srgrimes# This code is free software; you can redistribute it and/or modify it 61541Srgrimes# under the terms of the GNU General Public License version 2 only, as 71541Srgrimes# published by the Free Software Foundation. Oracle designates this 81541Srgrimes# particular file as subject to the "Classpath" exception as provided 91541Srgrimes# by Oracle in the LICENSE file that accompanied this code. 101541Srgrimes# 111541Srgrimes# This code is distributed in the hope that it will be useful, but WITHOUT 121541Srgrimes# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 131541Srgrimes# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 141541Srgrimes# version 2 for more details (a copy is included in the LICENSE file that 151541Srgrimes# accompanied this code). 161541Srgrimes# 171541Srgrimes# You should have received a copy of the GNU General Public License version 181541Srgrimes# 2 along with this work; if not, write to the Free Software Foundation, 191541Srgrimes# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 201541Srgrimes# 211541Srgrimes# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 221541Srgrimes# or visit www.oracle.com if you need additional information or have any 231541Srgrimes# questions. 241541Srgrimes# 251541Srgrimes 261541Srgrimesifndef _MODULES_GMK 271541Srgrimes_MODULES_GMK := 1 281541Srgrimes 291541Srgrimes################################################################################ 301541Srgrimes# 311541Srgrimes# BOOT_MODULES are modules defined by the boot loader 321541Srgrimes# PLATFORM_MODULES are modules defined by the platform loader 3310940Swollman# JRE_TOOL_MODULES are tools included in JRE and defined by the application loader 3434881Swollman# 351541Srgrimes# All other modules not declared below are defined by the application loader 361541Srgrimes# and are not included in JRE. 371541Srgrimes 381541SrgrimesBOOT_MODULES := 391541SrgrimesPLATFORM_MODULES := 401541SrgrimesJRE_TOOL_MODULES := 411541SrgrimesUPGRADEABLE_MODULES := 421541SrgrimesAGGREGATOR_MODULES := 431541SrgrimesDOCS_MODULES := 441541Srgrimes 4513491Speter# Hook to include the corresponding custom file, if present. 4613491Speter$(eval $(call IncludeCustomExtension, , common/Modules.gmk)) 4734881Swollman 481541SrgrimesBOOT_MODULES += \ 491541Srgrimes java.base \ 501541Srgrimes java.datatransfer \ 511541Srgrimes java.desktop \ 521541Srgrimes java.instrument \ 531541Srgrimes java.logging \ 541541Srgrimes java.management \ 551541Srgrimes java.management.rmi \ 561541Srgrimes java.naming \ 571541Srgrimes java.prefs \ 581541Srgrimes java.rmi \ 5932821Sdg java.security.sasl \ 6032821Sdg java.xml \ 6117541Speter jdk.httpserver \ 6213491Speter jdk.internal.vm.ci \ 6313491Speter jdk.management \ 6413491Speter jdk.management.agent \ 6513491Speter jdk.net \ 6617541Speter jdk.sctp \ 6717541Speter jdk.unsupported \ 6814195Speter # 6914195Speter 7014195Speter# to be deprivileged 7114195SpeterBOOT_MODULES += \ 7213491Speter jdk.naming.rmi \ 7317541Speter # 7417541Speter 7517541SpeterUPGRADEABLE_MODULES += \ 7617541Speter java.activation \ 7717541Speter java.corba \ 7817541Speter java.transaction \ 7917541Speter java.xml.bind \ 8017541Speter java.xml.ws \ 8117541Speter java.xml.ws.annotation \ 8217541Speter jdk.internal.vm.compiler \ 8317541Speter # 8417541Speter 8517541Speter# Modules explicitly declared as not being upgradeable even though they require 8617541Speter# an upgradeable module. 8717541SpeterNON_UPGRADEABLE_MODULES += \ 8817541Speter jdk.aot \ 8917541Speter # 9017541Speter 9117541SpeterAGGREGATOR_MODULES += \ 9217541Speter java.se \ 9317541Speter java.se.ee \ 9417541Speter # 9514195Speter 9614195SpeterPLATFORM_MODULES += \ 9717541Speter $(UPGRADEABLE_MODULES) \ 9817541Speter $(AGGREGATOR_MODULES) 9917541Speter # 10017541Speter 10117541SpeterPLATFORM_MODULES += \ 10217541Speter java.compiler \ 10317541Speter java.scripting \ 10417541Speter java.security.jgss \ 10517541Speter java.smartcardio \ 10617541Speter java.sql \ 10717541Speter java.sql.rowset \ 10817541Speter java.xml.crypto \ 10913491Speter jdk.accessibility \ 11032821Sdg jdk.charsets \ 11132821Sdg jdk.crypto.cryptoki \ 11232821Sdg jdk.crypto.ec \ 11332821Sdg jdk.dynalink \ 11432821Sdg jdk.incubator.httpclient \ 11532821Sdg jdk.jsobject \ 11632821Sdg jdk.localedata \ 11732821Sdg jdk.naming.dns \ 11832821Sdg jdk.scripting.nashorn \ 11932821Sdg jdk.security.auth \ 12032821Sdg jdk.security.jgss \ 1211541Srgrimes jdk.xml.dom \ 12225201Swollman jdk.zipfs \ 1231541Srgrimes # 1247684Sdg 12525201Swollmanifeq ($(OPENJDK_TARGET_OS), windows) 1261541Srgrimes PLATFORM_MODULES += jdk.crypto.mscapi 1271541Srgrimesendif 1281541Srgrimes 12934881Swollmanifeq ($(OPENJDK_TARGET_OS), solaris) 1301541Srgrimes PLATFORM_MODULES += jdk.crypto.ucrypto 1311541Srgrimesendif 1321541Srgrimes 13334881SwollmanJRE_TOOL_MODULES += \ 1347684Sdg jdk.jdwp.agent \ 1351541Srgrimes jdk.pack \ 1367684Sdg jdk.scripting.nashorn.shell \ 13734881Swollman # 1381541Srgrimes 1391541Srgrimes################################################################################ 1401541Srgrimes 1411541Srgrimes# DOCS_MODULES defines the root modules for javadoc generation. 1421541Srgrimes# All of their `require transitive` modules directly and indirectly will be included. 14325201SwollmanDOCS_MODULES += \ 1441541Srgrimes java.se.ee \ 14528270Swollman java.smartcardio \ 14625201Swollman jdk.accessibility \ 1471541Srgrimes jdk.attach \ 1481541Srgrimes jdk.charsets \ 14919262Speter jdk.compiler \ 1507684Sdg jdk.crypto.cryptoki \ 15132821Sdg jdk.crypto.ec \ 1521541Srgrimes jdk.dynalink \ 1531541Srgrimes jdk.editpad \ 1541541Srgrimes jdk.httpserver \ 1551541Srgrimes jdk.incubator.httpclient \ 15620407Swollman jdk.jartool \ 1571541Srgrimes jdk.javadoc \ 1581541Srgrimes jdk.jcmd \ 1591541Srgrimes jdk.jconsole \ 16032821Sdg jdk.jdeps \ 16118795Sdg jdk.jdi \ 1621541Srgrimes jdk.jdwp.agent \ 16328270Swollman jdk.jlink \ 16428270Swollman jdk.jsobject \ 1651541Srgrimes jdk.jshell \ 1661541Srgrimes jdk.jstatd \ 1671541Srgrimes jdk.localedata \ 1681541Srgrimes jdk.management \ 1691541Srgrimes jdk.management.agent \ 1701541Srgrimes jdk.naming.dns \ 1711541Srgrimes jdk.naming.rmi \ 1721541Srgrimes jdk.net \ 1731541Srgrimes jdk.pack \ 1741541Srgrimes jdk.policytool \ 1751541Srgrimes jdk.rmic \ 1761541Srgrimes jdk.scripting.nashorn \ 1771541Srgrimes jdk.sctp \ 1781541Srgrimes jdk.security.auth \ 1791541Srgrimes jdk.security.jgss \ 1801541Srgrimes jdk.xml.dom \ 1811541Srgrimes jdk.zipfs \ 1821541Srgrimes # 1831541Srgrimes 1841541Srgrimes# These modules are included in the interim image which is used to run profiling 1851541Srgrimes# before building the real images. 1861541SrgrimesINTERIM_IMAGE_MODULES := java.base java.logging 1871541Srgrimes 1881541Srgrimes################################################################################ 1891541Srgrimes# Some platforms don't have the serviceability agent 1901541Srgrimes 1911541Srgrimesifeq ($(INCLUDE_SA), false) 1921541Srgrimes MODULES_FILTER += jdk.hotspot.agent 1931541Srgrimesendif 19428270Swollman 19531941Salex################################################################################ 19610940Swollman# Filter out Graal specific modules if Graal build is disabled 19733955Sguido 19833955Sguidoifeq ($(INCLUDE_GRAAL), false) 19933955Sguido MODULES_FILTER += jdk.internal.vm.compiler 20033955Sguidoendif 20133955Sguido 20233955Sguido################################################################################ 20332821Sdg# Filter out aot specific modules if aot is disabled 20432821Sdg 2051541Srgrimesifeq ($(ENABLE_AOT), false) 2061541Srgrimes MODULES_FILTER += jdk.aot 2071541Srgrimesendif 2081541Srgrimes 2091541Srgrimes################################################################################ 21014195Speter# Module list macros 21114195Speter 21214195Speter# Use append so that the custom extension may add to these variables 21314195Speter 21417795SphkGENERATED_SRC_DIRS += \ 21517795Sphk $(SUPPORT_OUTPUTDIR)/gensrc \ 21614195Speter # 21714195Speter 21814195SpeterTOP_SRC_DIRS += \ 21932821Sdg $(CORBA_TOPDIR)/src \ 22014195Speter $(HOTSPOT_TOPDIR)/src \ 22128270Swollman $(JDK_TOPDIR)/src \ 22225201Swollman $(LANGTOOLS_TOPDIR)/src \ 22317541Speter $(JAXP_TOPDIR)/src \ 22417541Speter $(JAXWS_TOPDIR)/src \ 22532821Sdg $(NASHORN_TOPDIR)/src \ 22614195Speter # 22714195Speter 22814195SpeterSRC_SUBDIRS += $(OPENJDK_TARGET_OS)/classes 22932821Sdgifneq ($(OPENJDK_TARGET_OS), $(OPENJDK_TARGET_OS_TYPE)) 23014195Speter SRC_SUBDIRS += $(OPENJDK_TARGET_OS_TYPE)/classes 23114195Speterendif 23214195SpeterSRC_SUBDIRS += share/classes 23314195Speter 23414195SpeterSPEC_SUBDIRS += share/specs 23514195Speter 23614195Speter# Find all module-info.java files for the current build target platform and 23714195Speter# configuration. 23814195Speter# Param 1 - Module to find for, set to * for finding all 23914195SpeterFindAllModuleInfos = \ 24014195Speter $(wildcard \ 24114195Speter $(foreach sub, $(SRC_SUBDIRS), \ 24214195Speter $(patsubst %,%/$(strip $1)/$(sub)/module-info.java, $(TOP_SRC_DIRS))) \ 24314195Speter $(patsubst %,%/$(strip $1)/module-info.java, $(IMPORT_MODULES_SRC))) 24414195Speter 24532821Sdg# Find module-info.java files in the specific source dir 24632821Sdg# Param 1 - Src dir to find module-info.java files in 24732821SdgFindModuleInfosForSrcDir = \ 24832821Sdg $(wildcard \ 24932821Sdg $(foreach sub, $(SRC_SUBDIRS), \ 25032821Sdg $(patsubst %,%/*/$(sub)/module-info.java, $(strip $1)) \ 25132821Sdg ) \ 25232821Sdg $(patsubst %,%/*/module-info.java, $(strip $1)) \ 25314195Speter ) 25414195Speter 25514195Speter# Extract the module names from the paths of module-info.java files. The 25614195Speter# position of the module directory differs depending on if this is an imported 25732821Sdg# src dir or not. 25832821SdgGetModuleNameFromModuleInfo = \ 25914195Speter $(strip $(foreach mi, $1, \ 26014195Speter $(if $(filter $(addsuffix %, $(IMPORT_MODULES_SRC)), $(mi)), \ 26114195Speter $(notdir $(patsubst %/,%, $(dir $(mi)))), \ 26214195Speter $(notdir $(patsubst %/,%, $(dir $(patsubst %/,%, $(dir $(patsubst %/,%, $(dir $(mi))))))))))) 26314195Speter 26414195Speter# Find all modules by looking for module-info.java files and looking at parent 26514195Speter# directories. 26632821SdgFindAllModules = \ 26732821Sdg $(sort $(filter-out $(MODULES_FILTER), \ 26832821Sdg $(call GetModuleNameFromModuleInfo, $(MODULE_INFOS)))) 26932821Sdg 27032821Sdg# Find all modules in a specific src dir 27132821Sdg# Param 1 - Src dir to find modules in 27232821SdgFindModulesForSrcDir = \ 27332821Sdg $(sort $(filter-out $(MODULES_FILTER), \ 27414195Speter $(call GetModuleNameFromModuleInfo, $(call FindModuleInfosForSrcDir, $1)) \ 27514195Speter )) 27614195Speter 27714195SpeterFindImportedModules = \ 27832821Sdg $(filter-out $(MODULES_FILTER), \ 27932821Sdg $(if $(IMPORT_MODULES_CLASSES), $(notdir $(wildcard $(IMPORT_MODULES_CLASSES)/*)))) 28014195Speter 28114195Speter# Find all source dirs for a particular module 2821541Srgrimes# $1 - Module to find source dirs for 28332821SdgFindModuleSrcDirs = \ 28432821Sdg $(strip $(wildcard \ 28532821Sdg $(addsuffix /$(strip $1), $(GENERATED_SRC_DIRS) $(IMPORT_MODULES_SRC)) \ 28632821Sdg $(foreach sub, $(SRC_SUBDIRS), $(addsuffix /$(strip $1)/$(sub), $(TOP_SRC_DIRS))))) 28732821Sdg 2881541Srgrimes# Find all specs dirs for a particular module 2891541Srgrimes# $1 - Module to find specs dirs for 2901541SrgrimesFindModuleSpecsDirs = \ 2911541Srgrimes $(strip $(wildcard \ 2926248Swollman $(foreach sub, $(SPEC_SUBDIRS), $(addsuffix /$(strip $1)/$(sub), $(TOP_SRC_DIRS))))) 2936248Swollman 2946248Swollman# Construct the complete module source path 2956248SwollmanGetModuleSrcPath = \ 2966248Swollman $(call PathList, \ 2976248Swollman $(addsuffix /*, $(GENERATED_SRC_DIRS) $(IMPORT_MODULES_SRC)) \ 2986248Swollman $(foreach sub, $(SRC_SUBDIRS), $(addsuffix /*/$(sub), $(TOP_SRC_DIRS)))) 2996248Swollman 3006248Swollman################################################################################ 3016248Swollman# Extract module dependencies from module-info.java files. 3026248Swollman 3036248SwollmanMODULE_DEPS_MAKEFILE := $(MAKESUPPORT_OUTPUTDIR)/module-deps.gmk 3046248Swollman 3056248SwollmanMODULE_INFOS := $(call FindAllModuleInfos, *) 30628270Swollman 3076248Swollman$(MODULE_DEPS_MAKEFILE): $(MODULE_INFOS) \ 3086248Swollman $(call DependOnVariable, MODULE_INFOS, $(MAKESUPPORT_OUTPUTDIR)/MODULE_INFOS.vardeps) 3091541Srgrimes $(MKDIR) -p $(@D) 31028270Swollman $(RM) $@ 3111541Srgrimes $(foreach m, $(MODULE_INFOS), \ 31228270Swollman ( $(PRINTF) "DEPS_$(call GetModuleNameFromModuleInfo, $m) :=" && \ 3131541Srgrimes $(NAWK) -v MODULE=$(call GetModuleNameFromModuleInfo, $m) '\ 3141541Srgrimes BEGIN { if (MODULE != "java.base") printf(" java.base"); } \ 3151541Srgrimes /^ *requires/ { sub(/;/, ""); \ 3161541Srgrimes sub(/requires/, ""); \ 3171541Srgrimes sub(/transitive/, ""); \ 31820407Swollman sub(/\/\/.*/, ""); \ 3191541Srgrimes sub(/\/\*.*\*\//, ""); \ 3201541Srgrimes gsub(/^ +\*.*/, ""); \ 3211541Srgrimes gsub(/ /, ""); \ 3221541Srgrimes printf(" %s", $$0) } \ 3231541Srgrimes END { printf("\n") }' $m \ 3241541Srgrimes ) >> $@ $(NEWLINE)) 3251541Srgrimes 3261541Srgrimes-include $(MODULE_DEPS_MAKEFILE) 3271541Srgrimes 3281541Srgrimes# Param 1: Module to find deps for 3291541SrgrimesFindDepsForModule = \ 33020407Swollman $(DEPS_$(strip $1)) 3311541Srgrimes 33220407Swollman# Finds transitive dependencies in 3 levels. 33320407Swollman# Param 1: Module to find transitive deps for 3341541SrgrimesFindTransitiveDepsForModule = \ 3351541Srgrimes $(sort $(call FindDepsForModule, $1) \ 3361541Srgrimes $(foreach m, $(call FindDepsForModule, $1), \ 3371541Srgrimes $(call FindDepsForModule, $m) \ 3381541Srgrimes $(foreach n, $(call FindDepsForModule, $m), \ 3398876Srgrimes $(call FindDepsForModule, $n)))) 3401541Srgrimes 3411541Srgrimes# Finds transitive dependencies in 3 levels for a set of modules. 3421541Srgrimes# Param 1: List of modules to find transitive deps for 3431541SrgrimesFindTransitiveDepsForModules = \ 3441541Srgrimes $(sort $(foreach m, $1, $(call FindTransitiveDepsForModule, $m))) 3451541Srgrimes 3468876Srgrimes# Upgradeable modules are those that are either defined as upgradeable or that 3471541Srgrimes# require an upradeable module. 3481541SrgrimesFindAllUpgradeableModules = \ 3491541Srgrimes $(filter-out $(MODULES_FILTER) $(NON_UPGRADEABLE_MODULES), \ 3501541Srgrimes $(sort $(UPGRADEABLE_MODULES) $(foreach m, \ 3511541Srgrimes $(filter-out $(UPGRADEABLE_MODULES), $(call FindAllModules)), \ 3521541Srgrimes $(if $(filter $(UPGRADEABLE_MODULES), \ 3531541Srgrimes $(call FindTransitiveDepsForModule, $m)), \ 3541541Srgrimes $m \ 3551541Srgrimes ) \ 3561541Srgrimes )) \ 3571541Srgrimes ) 3581541Srgrimes 3591541Srgrimes################################################################################ 3601541Srgrimes 3611541SrgrimesLEGAL_SUBDIRS += $(OPENJDK_TARGET_OS)/legal 3621541Srgrimesifneq ($(OPENJDK_TARGET_OS), $(OPENJDK_TARGET_OS_TYPE)) 3631541Srgrimes LEGAL_SUBDIRS += $(OPENJDK_TARGET_OS_TYPE)/legal 3641541Srgrimesendif 3651541SrgrimesLEGAL_SUBDIRS += share/legal 3661541Srgrimes 3671541Srgrimes# Find all legal dirs for a particular module 3681541Srgrimes# $1 - Module to find legal dirs for 3691541SrgrimesFindModuleLegalDirs = \ 3701541Srgrimes $(strip $(wildcard \ 3711541Srgrimes $(addsuffix /$(strip $1), $(IMPORT_MODULES_LEGAL)) \ 3721541Srgrimes $(foreach sub, $(LEGAL_SUBDIRS), $(addsuffix /$(strip $1)/$(sub), $(TOP_SRC_DIRS))))) 3731541Srgrimes 3741541Srgrimes################################################################################ 3751541Srgrimes 3761541Srgrimes# Param 1 - Name of module 3771541Srgrimesdefine ReadSingleImportMetaData 37820407Swollman ifneq ($$(wildcard $(IMPORT_MODULES_MAKE)/$$(strip $1)/build.properties), ) 3791541Srgrimes classloader := 3801541Srgrimes include_in_jre := 3811541Srgrimes include_in_jdk := 3821541Srgrimes include $(IMPORT_MODULES_MAKE)/$$(strip $1)/build.properties 3831541Srgrimes ifeq ($$(include_in_jre), true) 3841541Srgrimes JRE_MODULES += $1 3851541Srgrimes endif 3861541Srgrimes ifeq ($$(include_in_jdk), true) 3871541Srgrimes JDK_MODULES += $1 3881541Srgrimes endif 3891541Srgrimes ifeq ($$(classloader), boot) 3901541Srgrimes BOOT_MODULES += $1 3911541Srgrimes else ifeq ($$(classloader), ext) 3921541Srgrimes PLATFORM_MODULES += $1 3931541Srgrimes endif 3941541Srgrimes DOCS_MODULES += $1 39520407Swollman else 39620407Swollman # Default to include in all 3971541Srgrimes JRE_MODULES += $1 3981541Srgrimes JDK_MODULES += $1 3991541Srgrimes endif 4001541Srgrimesendef 4011541Srgrimes 4021541Srgrimes# Reading the imported modules metadata has a cost, so to make it available, 4036248Swollman# a makefile needs to eval-call this macro first. After calling this, the 4046248Swollman# following variables are populated with data from the imported modules: 4056248Swollman# * JRE_MODULES 4066248Swollman# * JDK_MODULES 4076248Swollman# * BOOT_MODULES 4088876Srgrimes# * PLATFORM_MODULES 4096248Swollman# * JRE_TOOL_MODULES 4106248Swollmandefine ReadImportMetaData 4116248Swollman IMPORTED_MODULES := $$(call FindImportedModules) 4126248Swollman $$(foreach m, $$(IMPORTED_MODULES), \ 4136248Swollman $$(eval $$(call ReadSingleImportMetaData, $$m))) 4146248Swollmanendef 4156248Swollman 4166248Swollman################################################################################ 4176248Swollman 4186248Swollmanendif # _MODULES_GMK 4196248Swollman