< prev index next >

make/CreateJmods.gmk

Print this page
rev 52919 : 8189861: Refactor CacheFind
Reviewed-by: sgehwolf


  34 
  35 $(eval $(call IncludeCustomExtension, CreateJmods.gmk))
  36 
  37 ################################################################################
  38 
  39 JMODS_DIR := $(IMAGES_OUTPUTDIR)/jmods
  40 JMODS_TEMPDIR := $(SUPPORT_OUTPUTDIR)/jmods
  41 
  42 LIBS_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
  43     $(SUPPORT_OUTPUTDIR)/modules_libs $(IMPORT_MODULES_LIBS))))
  44 CMDS_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
  45     $(SUPPORT_OUTPUTDIR)/modules_cmds $(IMPORT_MODULES_CMDS))))
  46 CONF_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
  47     $(SUPPORT_OUTPUTDIR)/modules_conf $(IMPORT_MODULES_CONF))))
  48 CLASSES_DIR ?= $(wildcard $(JDK_OUTPUTDIR)/modules/$(MODULE))
  49 INCLUDE_HEADERS_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
  50     $(SUPPORT_OUTPUTDIR)/modules_include $(IMPORT_MODULES_INCLUDE_HEADERS))))
  51 MAN_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
  52     $(SUPPORT_OUTPUTDIR)/modules_man $(IMPORT_MODULES_MAN))))
  53 
  54 $(eval $(call FillCacheFind, \
  55     $(LIBS_DIR) $(CMDS_DIR) $(CONF_DIR) $(CLASSES_DIR) \
  56 ))
  57 
  58 ifneq ($(LIBS_DIR), )
  59   JMOD_FLAGS += --libs $(LIBS_DIR)
  60   DEPS += $(call CacheFind, $(LIBS_DIR))
  61 endif
  62 ifneq ($(CMDS_DIR), )
  63   JMOD_FLAGS += --cmds $(CMDS_DIR)
  64   DEPS += $(call CacheFind, $(CMDS_DIR))
  65 endif
  66 ifneq ($(CONF_DIR), )
  67   JMOD_FLAGS += --config $(CONF_DIR)
  68   DEPS += $(call CacheFind, $(CONF_DIR))
  69 endif
  70 ifneq ($(CLASSES_DIR), )
  71   JMOD_FLAGS += --class-path $(CLASSES_DIR)
  72   DEPS += $(call CacheFind, $(CLASSES_DIR))
  73 endif
  74 ifneq ($(INCLUDE_HEADERS_DIR), )
  75   JMOD_FLAGS += --header-files $(INCLUDE_HEADERS_DIR)
  76   DEPS += $(call CacheFind, $(INCLUDE_HEADERS_DIR))
  77 endif
  78 ifneq ($(MAN_DIR), )
  79   JMOD_FLAGS += --man-pages $(MAN_DIR)
  80   DEPS += $(call CacheFind, $(MAN_DIR))
  81 endif
  82 
  83 # If a specific modules_legal dir exists for this module, only pick up files
  84 # from there. These files were explicitly filtered or modified in <module>-copy
  85 # targets. For the rest, just pick up everything from the source legal dirs.
  86 LEGAL_NOTICES := \
  87     $(SUPPORT_OUTPUTDIR)/modules_legal/common \
  88     $(if $(wildcard $(SUPPORT_OUTPUTDIR)/modules_legal/$(MODULE)), \
  89       $(wildcard $(SUPPORT_OUTPUTDIR)/modules_legal/$(MODULE)), \
  90       $(call FindModuleLegalSrcDirs, $(MODULE)) \
  91     )
  92 
  93 LEGAL_NOTICES_PATH := $(call PathList, $(LEGAL_NOTICES))
  94 DEPS += $(call CacheFind, $(LEGAL_NOTICES))
  95 
  96 JMOD_FLAGS += --legal-notices $(LEGAL_NOTICES_PATH)
  97 
  98 ifeq ($(filter-out jdk.incubator.%, $(MODULE)), )
  99   JMOD_FLAGS += --do-not-resolve-by-default
 100   JMOD_FLAGS += --warn-if-resolved=incubating
 101 endif
 102 
 103 # Add dependencies on other jmod files. Only java.base needs access to other
 104 # jmods.
 105 ifeq ($(MODULE), java.base)
 106   # When creating a BUILDJDK, we don't need to add hashes to java.base
 107   ifneq ($(CREATING_BUILDJDK), true)
 108     # When creating interim versions of jmods, skip hashes
 109     ifneq ($(INTERIM_JMOD), true)
 110       ALL_UPGRADEABLE_MODULES := $(call FindAllUpgradeableModules)
 111       DEPS += $(patsubst %, $(JMODS_DIR)/%.jmod, \
 112           $(filter-out java.base $(ALL_UPGRADEABLE_MODULES), $(call FindAllModules)))
 113 
 114       EXCLUDE_PATTERN := $(strip $(subst $(SPACE),$$|,$(strip $(ALL_UPGRADEABLE_MODULES))))


 128     endif
 129     ifneq ($(MSVCP_DLL), )
 130       ifneq ($(wildcard $(LIBS_DIR)/$(notdir $(MSVCP_DLL))), )
 131         JMOD_FLAGS += --exclude '$(notdir $(MSVCP_DLL))'
 132       endif
 133     endif
 134     ifneq ($(UCRT_DLL_DIR), )
 135       UCRT_DLL_FILES := $(notdir $(wildcard $(UCRT_DLL_DIR)/*.dll))
 136       ifneq ($(wildcard $(LIBS_DIR)/$(firstword $(UCRT_DLL_FILES))), )
 137         JMOD_FLAGS += $(patsubst %, --exclude '%', $(UCRT_DLL_FILES))
 138       endif
 139     endif
 140   endif
 141 endif
 142 
 143 # Changes to the jmod tool itself should also trigger a rebuild of all jmods.
 144 # The variable JMOD_CMD could contain an environment variable assignment before
 145 # the actual command. Filter that out using wildcard before adding to DEPS.
 146 DEPS += $(wildcard $(JMOD_CMD))
 147 ifeq ($(EXTERNAL_BUILDJDK), false)
 148   DEPS += $(call CacheFind, $(JDK_OUTPUTDIR)/modules/jdk.jlink/jdk/tools/jmod)
 149 endif
 150 
 151 # If creating interim versions of jmods, certain files need to be filtered out
 152 # to avoid false incremental rebuilds.
 153 ifeq ($(INTERIM_JMOD), true)
 154   DEPS := $(filter-out $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/classlist, $(DEPS))
 155 endif
 156 
 157 JMOD_FLAGS += --exclude '**{_the.*,_*.marker,*.diz,*.debuginfo,*.dSYM/**,*.dSYM,*.pdb,*.map}'
 158 
 159 # Create jmods in a temp dir and then move them into place to keep the
 160 # module path in $(IMAGES_OUTPUTDIR)/jmods valid at all times.
 161 $(JMODS_DIR)/$(MODULE).jmod: $(DEPS)
 162         $(call LogWarn, Creating $(patsubst $(OUTPUTDIR)/%, %, $@))
 163         $(call MakeDir, $(JMODS_DIR) $(JMODS_TEMPDIR))
 164         $(RM) $@ $(JMODS_TEMPDIR)/$(notdir $@)
 165         $(call ExecuteWithLog, $(SUPPORT_OUTPUTDIR)/jmods/$(MODULE).jmod, \
 166             $(JMOD) create \
 167                 --module-version $(VERSION_SHORT) \
 168                 --target-platform '$(OPENJDK_MODULE_TARGET_PLATFORM)' \


  34 
  35 $(eval $(call IncludeCustomExtension, CreateJmods.gmk))
  36 
  37 ################################################################################
  38 
  39 JMODS_DIR := $(IMAGES_OUTPUTDIR)/jmods
  40 JMODS_TEMPDIR := $(SUPPORT_OUTPUTDIR)/jmods
  41 
  42 LIBS_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
  43     $(SUPPORT_OUTPUTDIR)/modules_libs $(IMPORT_MODULES_LIBS))))
  44 CMDS_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
  45     $(SUPPORT_OUTPUTDIR)/modules_cmds $(IMPORT_MODULES_CMDS))))
  46 CONF_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
  47     $(SUPPORT_OUTPUTDIR)/modules_conf $(IMPORT_MODULES_CONF))))
  48 CLASSES_DIR ?= $(wildcard $(JDK_OUTPUTDIR)/modules/$(MODULE))
  49 INCLUDE_HEADERS_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
  50     $(SUPPORT_OUTPUTDIR)/modules_include $(IMPORT_MODULES_INCLUDE_HEADERS))))
  51 MAN_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
  52     $(SUPPORT_OUTPUTDIR)/modules_man $(IMPORT_MODULES_MAN))))
  53 
  54 $(call FillFindCache, \
  55     $(LIBS_DIR) $(CMDS_DIR) $(CONF_DIR) $(CLASSES_DIR) \
  56 )
  57 
  58 ifneq ($(LIBS_DIR), )
  59   JMOD_FLAGS += --libs $(LIBS_DIR)
  60   DEPS += $(call FindFiles, $(LIBS_DIR))
  61 endif
  62 ifneq ($(CMDS_DIR), )
  63   JMOD_FLAGS += --cmds $(CMDS_DIR)
  64   DEPS += $(call FindFiles, $(CMDS_DIR))
  65 endif
  66 ifneq ($(CONF_DIR), )
  67   JMOD_FLAGS += --config $(CONF_DIR)
  68   DEPS += $(call FindFiles, $(CONF_DIR))
  69 endif
  70 ifneq ($(CLASSES_DIR), )
  71   JMOD_FLAGS += --class-path $(CLASSES_DIR)
  72   DEPS += $(call FindFiles, $(CLASSES_DIR))
  73 endif
  74 ifneq ($(INCLUDE_HEADERS_DIR), )
  75   JMOD_FLAGS += --header-files $(INCLUDE_HEADERS_DIR)
  76   DEPS += $(call FindFiles, $(INCLUDE_HEADERS_DIR))
  77 endif
  78 ifneq ($(MAN_DIR), )
  79   JMOD_FLAGS += --man-pages $(MAN_DIR)
  80   DEPS += $(call FindFiles, $(MAN_DIR))
  81 endif
  82 
  83 # If a specific modules_legal dir exists for this module, only pick up files
  84 # from there. These files were explicitly filtered or modified in <module>-copy
  85 # targets. For the rest, just pick up everything from the source legal dirs.
  86 LEGAL_NOTICES := \
  87     $(SUPPORT_OUTPUTDIR)/modules_legal/common \
  88     $(if $(wildcard $(SUPPORT_OUTPUTDIR)/modules_legal/$(MODULE)), \
  89       $(wildcard $(SUPPORT_OUTPUTDIR)/modules_legal/$(MODULE)), \
  90       $(call FindModuleLegalSrcDirs, $(MODULE)) \
  91     )
  92 
  93 LEGAL_NOTICES_PATH := $(call PathList, $(LEGAL_NOTICES))
  94 DEPS += $(call FindFiles, $(LEGAL_NOTICES))
  95 
  96 JMOD_FLAGS += --legal-notices $(LEGAL_NOTICES_PATH)
  97 
  98 ifeq ($(filter-out jdk.incubator.%, $(MODULE)), )
  99   JMOD_FLAGS += --do-not-resolve-by-default
 100   JMOD_FLAGS += --warn-if-resolved=incubating
 101 endif
 102 
 103 # Add dependencies on other jmod files. Only java.base needs access to other
 104 # jmods.
 105 ifeq ($(MODULE), java.base)
 106   # When creating a BUILDJDK, we don't need to add hashes to java.base
 107   ifneq ($(CREATING_BUILDJDK), true)
 108     # When creating interim versions of jmods, skip hashes
 109     ifneq ($(INTERIM_JMOD), true)
 110       ALL_UPGRADEABLE_MODULES := $(call FindAllUpgradeableModules)
 111       DEPS += $(patsubst %, $(JMODS_DIR)/%.jmod, \
 112           $(filter-out java.base $(ALL_UPGRADEABLE_MODULES), $(call FindAllModules)))
 113 
 114       EXCLUDE_PATTERN := $(strip $(subst $(SPACE),$$|,$(strip $(ALL_UPGRADEABLE_MODULES))))


 128     endif
 129     ifneq ($(MSVCP_DLL), )
 130       ifneq ($(wildcard $(LIBS_DIR)/$(notdir $(MSVCP_DLL))), )
 131         JMOD_FLAGS += --exclude '$(notdir $(MSVCP_DLL))'
 132       endif
 133     endif
 134     ifneq ($(UCRT_DLL_DIR), )
 135       UCRT_DLL_FILES := $(notdir $(wildcard $(UCRT_DLL_DIR)/*.dll))
 136       ifneq ($(wildcard $(LIBS_DIR)/$(firstword $(UCRT_DLL_FILES))), )
 137         JMOD_FLAGS += $(patsubst %, --exclude '%', $(UCRT_DLL_FILES))
 138       endif
 139     endif
 140   endif
 141 endif
 142 
 143 # Changes to the jmod tool itself should also trigger a rebuild of all jmods.
 144 # The variable JMOD_CMD could contain an environment variable assignment before
 145 # the actual command. Filter that out using wildcard before adding to DEPS.
 146 DEPS += $(wildcard $(JMOD_CMD))
 147 ifeq ($(EXTERNAL_BUILDJDK), false)
 148   DEPS += $(call FindFiles, $(JDK_OUTPUTDIR)/modules/jdk.jlink/jdk/tools/jmod)
 149 endif
 150 
 151 # If creating interim versions of jmods, certain files need to be filtered out
 152 # to avoid false incremental rebuilds.
 153 ifeq ($(INTERIM_JMOD), true)
 154   DEPS := $(filter-out $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/classlist, $(DEPS))
 155 endif
 156 
 157 JMOD_FLAGS += --exclude '**{_the.*,_*.marker,*.diz,*.debuginfo,*.dSYM/**,*.dSYM,*.pdb,*.map}'
 158 
 159 # Create jmods in a temp dir and then move them into place to keep the
 160 # module path in $(IMAGES_OUTPUTDIR)/jmods valid at all times.
 161 $(JMODS_DIR)/$(MODULE).jmod: $(DEPS)
 162         $(call LogWarn, Creating $(patsubst $(OUTPUTDIR)/%, %, $@))
 163         $(call MakeDir, $(JMODS_DIR) $(JMODS_TEMPDIR))
 164         $(RM) $@ $(JMODS_TEMPDIR)/$(notdir $@)
 165         $(call ExecuteWithLog, $(SUPPORT_OUTPUTDIR)/jmods/$(MODULE).jmod, \
 166             $(JMOD) create \
 167                 --module-version $(VERSION_SHORT) \
 168                 --target-platform '$(OPENJDK_MODULE_TARGET_PLATFORM)' \
< prev index next >