make/CreateJmods.gmk
branchihse-cflags-rewrite-branch
changeset 56726 3a9b7a1f9197
parent 50149 d93ae85b18c1
child 52804 28094715ae71
equal deleted inserted replaced
56313:d287dfac1304 56726:3a9b7a1f9197
    37 ################################################################################
    37 ################################################################################
    38 
    38 
    39 JMODS_DIR := $(IMAGES_OUTPUTDIR)/jmods
    39 JMODS_DIR := $(IMAGES_OUTPUTDIR)/jmods
    40 JMODS_TEMPDIR := $(SUPPORT_OUTPUTDIR)/jmods
    40 JMODS_TEMPDIR := $(SUPPORT_OUTPUTDIR)/jmods
    41 
    41 
    42 LIBS_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
    42 LIBS_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
    43     $(SUPPORT_OUTPUTDIR)/modules_libs $(IMPORT_MODULES_LIBS))))
    43     $(SUPPORT_OUTPUTDIR)/modules_libs $(IMPORT_MODULES_LIBS))))
    44 CMDS_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
    44 CMDS_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
    45     $(SUPPORT_OUTPUTDIR)/modules_cmds $(IMPORT_MODULES_CMDS))))
    45     $(SUPPORT_OUTPUTDIR)/modules_cmds $(IMPORT_MODULES_CMDS))))
    46 CONF_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
    46 CONF_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
    47     $(SUPPORT_OUTPUTDIR)/modules_conf $(IMPORT_MODULES_CONF))))
    47     $(SUPPORT_OUTPUTDIR)/modules_conf $(IMPORT_MODULES_CONF))))
    48 CLASSES_DIR := $(wildcard $(JDK_OUTPUTDIR)/modules/$(MODULE))
    48 CLASSES_DIR ?= $(wildcard $(JDK_OUTPUTDIR)/modules/$(MODULE))
    49 INCLUDE_HEADERS_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
    49 INCLUDE_HEADERS_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
    50     $(SUPPORT_OUTPUTDIR)/modules_include $(IMPORT_MODULES_INCLUDE_HEADERS))))
    50     $(SUPPORT_OUTPUTDIR)/modules_include $(IMPORT_MODULES_INCLUDE_HEADERS))))
    51 MAN_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
    51 MAN_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
    52     $(SUPPORT_OUTPUTDIR)/modules_man $(IMPORT_MODULES_MAN))))
    52     $(SUPPORT_OUTPUTDIR)/modules_man $(IMPORT_MODULES_MAN))))
    53 
    53 
    54 $(eval $(call FillCacheFind, \
    54 $(eval $(call FillCacheFind, \
    55     $(LIBS_DIR) $(CMDS_DIR) $(CONF_DIR) $(CLASSES_DIR) \
    55     $(LIBS_DIR) $(CMDS_DIR) $(CONF_DIR) $(CLASSES_DIR) \
    56 ))
    56 ))
    78 ifneq ($(MAN_DIR), )
    78 ifneq ($(MAN_DIR), )
    79   JMOD_FLAGS += --man-pages $(MAN_DIR)
    79   JMOD_FLAGS += --man-pages $(MAN_DIR)
    80   DEPS += $(call CacheFind, $(MAN_DIR))
    80   DEPS += $(call CacheFind, $(MAN_DIR))
    81 endif
    81 endif
    82 
    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.
    83 LEGAL_NOTICES := \
    86 LEGAL_NOTICES := \
    84     $(call uniq, $(SUPPORT_OUTPUTDIR)/modules_legal/java.base \
    87     $(SUPPORT_OUTPUTDIR)/modules_legal/common \
    85     $(call FindModuleLegalDirs, $(MODULE))) \
    88     $(if $(wildcard $(SUPPORT_OUTPUTDIR)/modules_legal/$(MODULE)), \
    86     #
    89       $(wildcard $(SUPPORT_OUTPUTDIR)/modules_legal/$(MODULE)), \
       
    90       $(call FindModuleLegalSrcDirs, $(MODULE)) \
       
    91     )
    87 
    92 
    88 LEGAL_NOTICES_PATH := $(call PathList, $(LEGAL_NOTICES))
    93 LEGAL_NOTICES_PATH := $(call PathList, $(LEGAL_NOTICES))
    89 DEPS += $(call CacheFind, $(LEGAL_NOTICES))
    94 DEPS += $(call CacheFind, $(LEGAL_NOTICES))
    90 
    95 
    91 JMOD_FLAGS += --legal-notices $(LEGAL_NOTICES_PATH)
    96 JMOD_FLAGS += --legal-notices $(LEGAL_NOTICES_PATH)
   110 
   115 
   111       JMOD_FLAGS += --module-path $(JMODS_DIR) \
   116       JMOD_FLAGS += --module-path $(JMODS_DIR) \
   112           --hash-modules '^(?!$(EXCLUDE_PATTERN)$$)'
   117           --hash-modules '^(?!$(EXCLUDE_PATTERN)$$)'
   113     endif
   118     endif
   114   endif
   119   endif
       
   120 else # not java.base
       
   121   ifeq ($(OPENJDK_TARGET_OS), windows)
       
   122     # Only java.base needs to include the MSVC*_DLLs. Make sure no other module
       
   123     # tries to include them (typically imported ones).
       
   124     ifneq ($(MSVCR_DLL), )
       
   125       ifneq ($(wildcard $(LIBS_DIR)/$(notdir $(MSVCR_DLL))), )
       
   126         JMOD_FLAGS += --exclude '$(notdir $(MSVCR_DLL))'
       
   127       endif
       
   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
   115 endif
   141 endif
   116 
   142 
   117 # Changes to the jmod tool itself should also trigger a rebuild of all jmods.
   143 # Changes to the jmod tool itself should also trigger a rebuild of all jmods.
   118 # The variable JMOD_CMD could contain an environment variable assignment before
   144 # The variable JMOD_CMD could contain an environment variable assignment before
   119 # the actual command. Filter that out using wildcard before adding to DEPS.
   145 # the actual command. Filter that out using wildcard before adding to DEPS.
   126 # to avoid false incremental rebuilds.
   152 # to avoid false incremental rebuilds.
   127 ifeq ($(INTERIM_JMOD), true)
   153 ifeq ($(INTERIM_JMOD), true)
   128   DEPS := $(filter-out $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/classlist, $(DEPS))
   154   DEPS := $(filter-out $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/classlist, $(DEPS))
   129 endif
   155 endif
   130 
   156 
       
   157 JMOD_FLAGS += --exclude '**{_the.*,_*.marker,*.diz,*.debuginfo,*.dSYM/**,*.dSYM,*.pdb,*.map}'
       
   158 
   131 # Create jmods in a temp dir and then move them into place to keep the
   159 # Create jmods in a temp dir and then move them into place to keep the
   132 # module path in $(IMAGES_OUTPUTDIR)/jmods valid at all times.
   160 # module path in $(IMAGES_OUTPUTDIR)/jmods valid at all times.
   133 $(JMODS_DIR)/$(MODULE).jmod: $(DEPS)
   161 $(JMODS_DIR)/$(MODULE).jmod: $(DEPS)
   134 	$(call LogWarn, Creating $(patsubst $(OUTPUTDIR)/%, %, $@))
   162 	$(call LogWarn, Creating $(patsubst $(OUTPUTDIR)/%, %, $@))
   135 	$(call MakeDir, $(JMODS_DIR) $(JMODS_TEMPDIR))
   163 	$(call MakeDir, $(JMODS_DIR) $(JMODS_TEMPDIR))
   136 	$(RM) $@ $(JMODS_TEMPDIR)/$(notdir $@)
   164 	$(RM) $@ $(JMODS_TEMPDIR)/$(notdir $@)
   137 	$(JMOD) create \
   165 	$(call ExecuteWithLog, $(SUPPORT_OUTPUTDIR)/jmods/$(MODULE).jmod, \
   138             --module-version $(VERSION_SHORT) \
   166 	    $(JMOD) create \
   139             --target-platform '$(OPENJDK_MODULE_TARGET_PLATFORM)' \
   167 	        --module-version $(VERSION_SHORT) \
   140             --module-path $(JMODS_DIR) \
   168 	        --target-platform '$(OPENJDK_MODULE_TARGET_PLATFORM)' \
   141 	    --exclude '**{_the.*,_*.marker,*.diz,*.debuginfo,*.dSYM/**,*.dSYM,*.pdb,*.map}' \
   169 	        --module-path $(JMODS_DIR) \
   142 	    $(JMOD_FLAGS) $(JMODS_TEMPDIR)/$(notdir $@)
   170 	        $(JMOD_FLAGS) $(JMODS_TEMPDIR)/$(notdir $@) \
       
   171 	)
   143 	$(MV) $(JMODS_TEMPDIR)/$(notdir $@) $@
   172 	$(MV) $(JMODS_TEMPDIR)/$(notdir $@) $@
   144 
   173 
   145 TARGETS += $(JMODS_DIR)/$(MODULE).jmod
   174 TARGETS += $(JMODS_DIR)/$(MODULE).jmod
   146 
   175 
   147 ################################################################################
   176 ################################################################################