annotate make/CreateJmods.gmk @ 50910:3506855c6b86

8195630: [Graal] vmTestbase/nsk/jvmti/AttachOnDemand/attach024/TestDescription.java fails with Graal Reviewed-by: kvn
author epavlova
date Thu, 28 Jun 2018 19:33:00 -0700
parents f348e5d4769b 35b22ca681d1
children 28094715ae71
rev   line source
erikj@48069 1 # Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
alanb@36506 2 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
alanb@36506 3 #
alanb@36506 4 # This code is free software; you can redistribute it and/or modify it
alanb@36506 5 # under the terms of the GNU General Public License version 2 only, as
alanb@36506 6 # published by the Free Software Foundation. Oracle designates this
alanb@36506 7 # particular file as subject to the "Classpath" exception as provided
alanb@36506 8 # by Oracle in the LICENSE file that accompanied this code.
alanb@36506 9 #
alanb@36506 10 # This code is distributed in the hope that it will be useful, but WITHOUT
alanb@36506 11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
alanb@36506 12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
alanb@36506 13 # version 2 for more details (a copy is included in the LICENSE file that
alanb@36506 14 # accompanied this code).
alanb@36506 15 #
alanb@36506 16 # You should have received a copy of the GNU General Public License version
alanb@36506 17 # 2 along with this work; if not, write to the Free Software Foundation,
alanb@36506 18 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
alanb@36506 19 #
alanb@36506 20 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
alanb@36506 21 # or visit www.oracle.com if you need additional information or have any
alanb@36506 22 # questions.
alanb@36506 23 #
alanb@36506 24
alanb@36506 25 default: all
alanb@36506 26
alanb@36506 27 include $(SPEC)
alanb@36506 28 include MakeBase.gmk
alanb@36506 29 include Modules.gmk
alanb@36506 30
alanb@36506 31 ifeq ($(MODULE), )
alanb@36506 32 $(error MODULE must be set when calling CreateJmods.gmk)
alanb@36506 33 endif
alanb@36506 34
erikj@48069 35 $(eval $(call IncludeCustomExtension, CreateJmods.gmk))
erikj@48069 36
alanb@36506 37 ################################################################################
alanb@36506 38
redestad@37770 39 JMODS_DIR := $(IMAGES_OUTPUTDIR)/jmods
erikj@41874 40 JMODS_TEMPDIR := $(SUPPORT_OUTPUTDIR)/jmods
redestad@37770 41
erikj@50142 42 LIBS_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
erikj@41260 43 $(SUPPORT_OUTPUTDIR)/modules_libs $(IMPORT_MODULES_LIBS))))
erikj@50142 44 CMDS_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
erikj@41260 45 $(SUPPORT_OUTPUTDIR)/modules_cmds $(IMPORT_MODULES_CMDS))))
erikj@50142 46 CONF_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
alanb@36506 47 $(SUPPORT_OUTPUTDIR)/modules_conf $(IMPORT_MODULES_CONF))))
erikj@50142 48 CLASSES_DIR ?= $(wildcard $(JDK_OUTPUTDIR)/modules/$(MODULE))
erikj@50142 49 INCLUDE_HEADERS_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
mchung@41532 50 $(SUPPORT_OUTPUTDIR)/modules_include $(IMPORT_MODULES_INCLUDE_HEADERS))))
erikj@50142 51 MAN_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
mchung@41532 52 $(SUPPORT_OUTPUTDIR)/modules_man $(IMPORT_MODULES_MAN))))
alanb@36506 53
alanb@36506 54 $(eval $(call FillCacheFind, \
alanb@36506 55 $(LIBS_DIR) $(CMDS_DIR) $(CONF_DIR) $(CLASSES_DIR) \
alanb@36506 56 ))
alanb@36506 57
alanb@36506 58 ifneq ($(LIBS_DIR), )
alanb@36506 59 JMOD_FLAGS += --libs $(LIBS_DIR)
alanb@36506 60 DEPS += $(call CacheFind, $(LIBS_DIR))
alanb@36506 61 endif
alanb@36506 62 ifneq ($(CMDS_DIR), )
alanb@36506 63 JMOD_FLAGS += --cmds $(CMDS_DIR)
alanb@36506 64 DEPS += $(call CacheFind, $(CMDS_DIR))
alanb@36506 65 endif
alanb@36506 66 ifneq ($(CONF_DIR), )
alanb@36506 67 JMOD_FLAGS += --config $(CONF_DIR)
alanb@36506 68 DEPS += $(call CacheFind, $(CONF_DIR))
alanb@36506 69 endif
alanb@36506 70 ifneq ($(CLASSES_DIR), )
alanb@36506 71 JMOD_FLAGS += --class-path $(CLASSES_DIR)
alanb@36506 72 DEPS += $(call CacheFind, $(CLASSES_DIR))
alanb@36506 73 endif
mchung@41532 74 ifneq ($(INCLUDE_HEADERS_DIR), )
mchung@41532 75 JMOD_FLAGS += --header-files $(INCLUDE_HEADERS_DIR)
mchung@41532 76 DEPS += $(call CacheFind, $(INCLUDE_HEADERS_DIR))
mchung@41532 77 endif
mchung@41532 78 ifneq ($(MAN_DIR), )
mchung@41532 79 JMOD_FLAGS += --man-pages $(MAN_DIR)
mchung@41532 80 DEPS += $(call CacheFind, $(MAN_DIR))
mchung@41532 81 endif
alanb@36506 82
erikj@49537 83 # If a specific modules_legal dir exists for this module, only pick up files
erikj@49537 84 # from there. These files were explicitly filtered or modified in <module>-copy
erikj@49537 85 # targets. For the rest, just pick up everything from the source legal dirs.
mchung@42505 86 LEGAL_NOTICES := \
erikj@49537 87 $(SUPPORT_OUTPUTDIR)/modules_legal/common \
erikj@49537 88 $(if $(wildcard $(SUPPORT_OUTPUTDIR)/modules_legal/$(MODULE)), \
erikj@49537 89 $(wildcard $(SUPPORT_OUTPUTDIR)/modules_legal/$(MODULE)), \
erikj@49537 90 $(call FindModuleLegalSrcDirs, $(MODULE)) \
erikj@49537 91 )
mchung@42505 92
mchung@42505 93 LEGAL_NOTICES_PATH := $(call PathList, $(LEGAL_NOTICES))
mchung@42505 94 DEPS += $(call CacheFind, $(LEGAL_NOTICES))
mchung@42505 95
mchung@42505 96 JMOD_FLAGS += --legal-notices $(LEGAL_NOTICES_PATH)
mchung@42505 97
alanb@42517 98 ifeq ($(filter-out jdk.incubator.%, $(MODULE)), )
alanb@42517 99 JMOD_FLAGS += --do-not-resolve-by-default
alanb@42517 100 JMOD_FLAGS += --warn-if-resolved=incubating
alanb@42517 101 endif
alanb@42517 102
alanb@37764 103 # Add dependencies on other jmod files. Only java.base needs access to other
alanb@37764 104 # jmods.
alanb@37764 105 ifeq ($(MODULE), java.base)
redestad@37770 106 # When creating a BUILDJDK, we don't need to add hashes to java.base
redestad@37770 107 ifneq ($(CREATING_BUILDJDK), true)
erikj@41874 108 # When creating interim versions of jmods, skip hashes
erikj@41874 109 ifneq ($(INTERIM_JMOD), true)
erikj@41874 110 ALL_UPGRADEABLE_MODULES := $(call FindAllUpgradeableModules)
erikj@41874 111 DEPS += $(patsubst %, $(JMODS_DIR)/%.jmod, \
erikj@41874 112 $(filter-out java.base $(ALL_UPGRADEABLE_MODULES), $(call FindAllModules)))
alanb@37764 113
mchung@45612 114 EXCLUDE_PATTERN := $(strip $(subst $(SPACE),$$|,$(strip $(ALL_UPGRADEABLE_MODULES))))
alanb@37764 115
erikj@41874 116 JMOD_FLAGS += --module-path $(JMODS_DIR) \
mchung@45612 117 --hash-modules '^(?!$(EXCLUDE_PATTERN)$$)'
erikj@41874 118 endif
redestad@37770 119 endif
erikj@49566 120 else # not java.base
erikj@49566 121 ifeq ($(OPENJDK_TARGET_OS), windows)
erikj@49566 122 # Only java.base needs to include the MSVC*_DLLs. Make sure no other module
erikj@49566 123 # tries to include them (typically imported ones).
erikj@50073 124 ifneq ($(MSVCR_DLL), )
erikj@50073 125 ifneq ($(wildcard $(LIBS_DIR)/$(notdir $(MSVCR_DLL))), )
erikj@50073 126 JMOD_FLAGS += --exclude '$(notdir $(MSVCR_DLL))'
erikj@50073 127 endif
erikj@49566 128 endif
erikj@50073 129 ifneq ($(MSVCP_DLL), )
erikj@50073 130 ifneq ($(wildcard $(LIBS_DIR)/$(notdir $(MSVCP_DLL))), )
erikj@50073 131 JMOD_FLAGS += --exclude '$(notdir $(MSVCP_DLL))'
erikj@50073 132 endif
erikj@50073 133 endif
erikj@50073 134 ifneq ($(UCRT_DLL_DIR), )
erikj@50073 135 UCRT_DLL_FILES := $(notdir $(wildcard $(UCRT_DLL_DIR)/*.dll))
erikj@50073 136 ifneq ($(wildcard $(LIBS_DIR)/$(firstword $(UCRT_DLL_FILES))), )
erikj@50073 137 JMOD_FLAGS += $(patsubst %, --exclude '%', $(UCRT_DLL_FILES))
erikj@50073 138 endif
erikj@49566 139 endif
erikj@49566 140 endif
alanb@37764 141 endif
alanb@36506 142
erikj@39929 143 # Changes to the jmod tool itself should also trigger a rebuild of all jmods.
erikj@39929 144 # The variable JMOD_CMD could contain an environment variable assignment before
erikj@39929 145 # the actual command. Filter that out using wildcard before adding to DEPS.
erikj@39929 146 DEPS += $(wildcard $(JMOD_CMD))
erikj@38848 147 ifeq ($(EXTERNAL_BUILDJDK), false)
erikj@38848 148 DEPS += $(call CacheFind, $(JDK_OUTPUTDIR)/modules/jdk.jlink/jdk/tools/jmod)
erikj@38848 149 endif
erikj@38848 150
erikj@41874 151 # If creating interim versions of jmods, certain files need to be filtered out
erikj@41874 152 # to avoid false incremental rebuilds.
erikj@41874 153 ifeq ($(INTERIM_JMOD), true)
erikj@41874 154 DEPS := $(filter-out $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/classlist, $(DEPS))
erikj@41874 155 endif
erikj@41874 156
erikj@49566 157 JMOD_FLAGS += --exclude '**{_the.*,_*.marker,*.diz,*.debuginfo,*.dSYM/**,*.dSYM,*.pdb,*.map}'
erikj@49566 158
alanb@36506 159 # Create jmods in a temp dir and then move them into place to keep the
alanb@36506 160 # module path in $(IMAGES_OUTPUTDIR)/jmods valid at all times.
redestad@37770 161 $(JMODS_DIR)/$(MODULE).jmod: $(DEPS)
ihse@47253 162 $(call LogWarn, Creating $(patsubst $(OUTPUTDIR)/%, %, $@))
erikj@41874 163 $(call MakeDir, $(JMODS_DIR) $(JMODS_TEMPDIR))
erikj@41874 164 $(RM) $@ $(JMODS_TEMPDIR)/$(notdir $@)
erikj@49566 165 $(call ExecuteWithLog, $(SUPPORT_OUTPUTDIR)/jmods/$(MODULE).jmod, \
erikj@49566 166 $(JMOD) create \
erikj@49566 167 --module-version $(VERSION_SHORT) \
erikj@49566 168 --target-platform '$(OPENJDK_MODULE_TARGET_PLATFORM)' \
erikj@49566 169 --module-path $(JMODS_DIR) \
erikj@49566 170 $(JMOD_FLAGS) $(JMODS_TEMPDIR)/$(notdir $@) \
erikj@49566 171 )
erikj@41874 172 $(MV) $(JMODS_TEMPDIR)/$(notdir $@) $@
alanb@36506 173
erikj@41874 174 TARGETS += $(JMODS_DIR)/$(MODULE).jmod
alanb@36506 175
alanb@36506 176 ################################################################################
alanb@36506 177
alanb@36506 178 all: $(TARGETS)
alanb@36506 179
alanb@36506 180 ################################################################################