2020-02-07 07:38:40 +00:00
|
|
|
#
|
2021-10-19 10:19:15 +00:00
|
|
|
# Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved.
|
2016-03-17 19:03:53 +00:00
|
|
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
#
|
|
|
|
# This code is free software; you can redistribute it and/or modify it
|
|
|
|
# under the terms of the GNU General Public License version 2 only, as
|
|
|
|
# published by the Free Software Foundation. Oracle designates this
|
|
|
|
# particular file as subject to the "Classpath" exception as provided
|
|
|
|
# by Oracle in the LICENSE file that accompanied this code.
|
|
|
|
#
|
|
|
|
# This code is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
# version 2 for more details (a copy is included in the LICENSE file that
|
|
|
|
# accompanied this code).
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License version
|
|
|
|
# 2 along with this work; if not, write to the Free Software Foundation,
|
|
|
|
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
#
|
|
|
|
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
|
|
# or visit www.oracle.com if you need additional information or have any
|
|
|
|
# questions.
|
|
|
|
#
|
|
|
|
|
|
|
|
default: all
|
|
|
|
|
|
|
|
include $(SPEC)
|
|
|
|
include MakeBase.gmk
|
2019-03-05 10:07:19 +00:00
|
|
|
include Execute.gmk
|
2016-03-17 19:03:53 +00:00
|
|
|
include Modules.gmk
|
|
|
|
|
|
|
|
ifeq ($(MODULE), )
|
|
|
|
$(error MODULE must be set when calling CreateJmods.gmk)
|
|
|
|
endif
|
|
|
|
|
2017-12-05 22:14:35 +00:00
|
|
|
$(eval $(call IncludeCustomExtension, CreateJmods.gmk))
|
|
|
|
|
2016-03-17 19:03:53 +00:00
|
|
|
################################################################################
|
|
|
|
|
2016-05-06 23:21:08 +00:00
|
|
|
JMODS_DIR := $(IMAGES_OUTPUTDIR)/jmods
|
2019-03-05 10:07:19 +00:00
|
|
|
JMODS_SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/images/jmods
|
|
|
|
JMOD_FILE := $(MODULE).jmod
|
2016-05-06 23:21:08 +00:00
|
|
|
|
2018-05-11 15:39:21 +00:00
|
|
|
LIBS_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
|
2016-10-05 08:49:21 +00:00
|
|
|
$(SUPPORT_OUTPUTDIR)/modules_libs $(IMPORT_MODULES_LIBS))))
|
2018-05-11 15:39:21 +00:00
|
|
|
CMDS_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
|
2016-10-05 08:49:21 +00:00
|
|
|
$(SUPPORT_OUTPUTDIR)/modules_cmds $(IMPORT_MODULES_CMDS))))
|
2018-05-11 15:39:21 +00:00
|
|
|
CONF_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
|
2016-03-17 19:03:53 +00:00
|
|
|
$(SUPPORT_OUTPUTDIR)/modules_conf $(IMPORT_MODULES_CONF))))
|
2018-05-11 15:39:21 +00:00
|
|
|
CLASSES_DIR ?= $(wildcard $(JDK_OUTPUTDIR)/modules/$(MODULE))
|
|
|
|
INCLUDE_HEADERS_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
|
2016-10-18 20:26:54 +00:00
|
|
|
$(SUPPORT_OUTPUTDIR)/modules_include $(IMPORT_MODULES_INCLUDE_HEADERS))))
|
2018-05-11 15:39:21 +00:00
|
|
|
MAN_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
|
2016-10-18 20:26:54 +00:00
|
|
|
$(SUPPORT_OUTPUTDIR)/modules_man $(IMPORT_MODULES_MAN))))
|
2016-03-17 19:03:53 +00:00
|
|
|
|
2017-10-24 08:41:45 +00:00
|
|
|
$(call FillFindCache, \
|
2016-03-17 19:03:53 +00:00
|
|
|
$(LIBS_DIR) $(CMDS_DIR) $(CONF_DIR) $(CLASSES_DIR) \
|
2017-10-24 08:41:45 +00:00
|
|
|
)
|
2016-03-17 19:03:53 +00:00
|
|
|
|
|
|
|
ifneq ($(LIBS_DIR), )
|
2017-10-24 08:41:45 +00:00
|
|
|
DEPS += $(call FindFiles, $(LIBS_DIR))
|
2020-02-07 07:38:40 +00:00
|
|
|
ifeq ($(call isTargetOs, windows)+$(SHIP_DEBUG_SYMBOLS), true+public)
|
|
|
|
# For public debug symbols on Windows, we have to use stripped pdbs and rename them
|
|
|
|
rename_stripped = $(patsubst %.stripped.pdb,%.pdb,$1)
|
|
|
|
LIBS_DIR_FILTERED := $(subst modules_libs,modules_libs_filtered, $(LIBS_DIR))
|
|
|
|
FILES_LIBS := $(filter-out %.pdb, $(call FindFiles, $(LIBS_DIR))) \
|
|
|
|
$(filter %.stripped.pdb, $(call FindFiles, $(LIBS_DIR)))
|
|
|
|
$(eval $(call SetupCopyFiles, COPY_FILTERED_LIBS, \
|
|
|
|
SRC := $(LIBS_DIR), \
|
|
|
|
DEST := $(LIBS_DIR_FILTERED), \
|
|
|
|
FILES := $(FILES_LIBS), \
|
|
|
|
NAME_MACRO := rename_stripped, \
|
|
|
|
))
|
|
|
|
DEPS += $(COPY_FILTERED_LIBS)
|
|
|
|
JMOD_FLAGS += --libs $(LIBS_DIR_FILTERED)
|
|
|
|
else
|
|
|
|
JMOD_FLAGS += --libs $(LIBS_DIR)
|
|
|
|
endif
|
2016-03-17 19:03:53 +00:00
|
|
|
endif
|
|
|
|
ifneq ($(CMDS_DIR), )
|
2017-10-24 08:41:45 +00:00
|
|
|
DEPS += $(call FindFiles, $(CMDS_DIR))
|
2020-02-07 07:38:40 +00:00
|
|
|
ifeq ($(call isTargetOs, windows)+$(SHIP_DEBUG_SYMBOLS), true+public)
|
|
|
|
# For public debug symbols on Windows, we have to use stripped pdbs, rename them
|
|
|
|
# and filter out a few launcher pdbs where there's a lib that goes by the same name
|
|
|
|
rename_stripped = $(patsubst %.stripped.pdb,%.pdb,$1)
|
|
|
|
CMDS_DIR_FILTERED := $(subst modules_cmds,modules_cmds_filtered, $(CMDS_DIR))
|
|
|
|
FILES_CMDS := $(filter-out %.pdb, $(call FindFiles, $(CMDS_DIR))) \
|
|
|
|
$(filter-out %jimage.stripped.pdb %jpackage.stripped.pdb %java.stripped.pdb, \
|
|
|
|
$(filter %.stripped.pdb, $(call FindFiles, $(CMDS_DIR))))
|
|
|
|
$(eval $(call SetupCopyFiles, COPY_FILTERED_CMDS, \
|
|
|
|
SRC := $(CMDS_DIR), \
|
|
|
|
DEST := $(CMDS_DIR_FILTERED), \
|
|
|
|
FILES := $(FILES_CMDS), \
|
|
|
|
NAME_MACRO := rename_stripped, \
|
|
|
|
))
|
|
|
|
DEPS += $(COPY_FILTERED_CMDS)
|
|
|
|
JMOD_FLAGS += --cmds $(CMDS_DIR_FILTERED)
|
|
|
|
else ifeq ($(call isTargetOs, windows)+$(SHIP_DEBUG_SYMBOLS), true+full)
|
|
|
|
# For full debug symbols on Windows, we have to filter out a few launcher pdbs
|
|
|
|
# where there's a lib that goes by the same name
|
|
|
|
CMDS_DIR_FILTERED := $(subst modules_cmds,modules_cmds_filtered, $(CMDS_DIR))
|
|
|
|
$(eval $(call SetupCopyFiles, COPY_FILTERED_CMDS, \
|
|
|
|
SRC := $(CMDS_DIR), \
|
|
|
|
DEST := $(CMDS_DIR_FILTERED), \
|
|
|
|
FILES := $(filter-out %jimage.pdb %jpackage.pdb %java.pdb, \
|
|
|
|
$(call FindFiles, $(CMDS_DIR))), \
|
|
|
|
))
|
|
|
|
DEPS += $(COPY_FILTERED_CMDS)
|
|
|
|
JMOD_FLAGS += --cmds $(CMDS_DIR_FILTERED)
|
|
|
|
else
|
|
|
|
JMOD_FLAGS += --cmds $(CMDS_DIR)
|
|
|
|
endif
|
2016-03-17 19:03:53 +00:00
|
|
|
endif
|
|
|
|
ifneq ($(CONF_DIR), )
|
|
|
|
JMOD_FLAGS += --config $(CONF_DIR)
|
2017-10-24 08:41:45 +00:00
|
|
|
DEPS += $(call FindFiles, $(CONF_DIR))
|
2016-03-17 19:03:53 +00:00
|
|
|
endif
|
|
|
|
ifneq ($(CLASSES_DIR), )
|
|
|
|
JMOD_FLAGS += --class-path $(CLASSES_DIR)
|
2017-10-24 08:41:45 +00:00
|
|
|
DEPS += $(call FindFiles, $(CLASSES_DIR))
|
2016-03-17 19:03:53 +00:00
|
|
|
endif
|
2016-10-18 20:26:54 +00:00
|
|
|
ifneq ($(INCLUDE_HEADERS_DIR), )
|
|
|
|
JMOD_FLAGS += --header-files $(INCLUDE_HEADERS_DIR)
|
2017-10-24 08:41:45 +00:00
|
|
|
DEPS += $(call FindFiles, $(INCLUDE_HEADERS_DIR))
|
2016-10-18 20:26:54 +00:00
|
|
|
endif
|
|
|
|
ifneq ($(MAN_DIR), )
|
|
|
|
JMOD_FLAGS += --man-pages $(MAN_DIR)
|
2017-10-24 08:41:45 +00:00
|
|
|
DEPS += $(call FindFiles, $(MAN_DIR))
|
2016-10-18 20:26:54 +00:00
|
|
|
endif
|
2016-03-17 19:03:53 +00:00
|
|
|
|
2018-04-05 21:46:05 +00:00
|
|
|
# If a specific modules_legal dir exists for this module, only pick up files
|
|
|
|
# from there. These files were explicitly filtered or modified in <module>-copy
|
|
|
|
# targets. For the rest, just pick up everything from the source legal dirs.
|
2016-12-13 02:56:32 +00:00
|
|
|
LEGAL_NOTICES := \
|
2019-10-09 16:23:22 +00:00
|
|
|
$(wildcard $(SUPPORT_OUTPUTDIR)/modules_legal/common) \
|
2018-04-05 21:46:05 +00:00
|
|
|
$(if $(wildcard $(SUPPORT_OUTPUTDIR)/modules_legal/$(MODULE)), \
|
|
|
|
$(wildcard $(SUPPORT_OUTPUTDIR)/modules_legal/$(MODULE)), \
|
|
|
|
$(call FindModuleLegalSrcDirs, $(MODULE)) \
|
|
|
|
)
|
2016-12-13 02:56:32 +00:00
|
|
|
|
2019-10-09 16:23:22 +00:00
|
|
|
ifneq ($(strip $(LEGAL_NOTICES)), )
|
|
|
|
LEGAL_NOTICES_PATH := $(call PathList, $(LEGAL_NOTICES))
|
|
|
|
DEPS += $(call FindFiles, $(LEGAL_NOTICES))
|
2016-12-13 02:56:32 +00:00
|
|
|
|
2019-10-09 16:23:22 +00:00
|
|
|
JMOD_FLAGS += --legal-notices $(LEGAL_NOTICES_PATH)
|
|
|
|
endif
|
2016-12-13 02:56:32 +00:00
|
|
|
|
2016-12-16 05:46:45 +00:00
|
|
|
ifeq ($(filter-out jdk.incubator.%, $(MODULE)), )
|
|
|
|
JMOD_FLAGS += --do-not-resolve-by-default
|
|
|
|
JMOD_FLAGS += --warn-if-resolved=incubating
|
|
|
|
endif
|
|
|
|
|
2016-05-03 08:09:07 +00:00
|
|
|
# Add dependencies on other jmod files. Only java.base needs access to other
|
|
|
|
# jmods.
|
|
|
|
ifeq ($(MODULE), java.base)
|
2016-05-06 23:21:08 +00:00
|
|
|
# When creating a BUILDJDK, we don't need to add hashes to java.base
|
|
|
|
ifneq ($(CREATING_BUILDJDK), true)
|
2016-11-07 12:25:18 +00:00
|
|
|
# When creating interim versions of jmods, skip hashes
|
|
|
|
ifneq ($(INTERIM_JMOD), true)
|
|
|
|
ALL_UPGRADEABLE_MODULES := $(call FindAllUpgradeableModules)
|
|
|
|
DEPS += $(patsubst %, $(JMODS_DIR)/%.jmod, \
|
|
|
|
$(filter-out java.base $(ALL_UPGRADEABLE_MODULES), $(call FindAllModules)))
|
2016-05-06 23:21:08 +00:00
|
|
|
|
2017-06-15 18:54:26 +00:00
|
|
|
EXCLUDE_PATTERN := $(strip $(subst $(SPACE),$$|,$(strip $(ALL_UPGRADEABLE_MODULES))))
|
2016-05-06 23:21:08 +00:00
|
|
|
|
2016-11-07 12:25:18 +00:00
|
|
|
JMOD_FLAGS += --module-path $(JMODS_DIR) \
|
2017-06-15 18:54:26 +00:00
|
|
|
--hash-modules '^(?!$(EXCLUDE_PATTERN)$$)'
|
2016-11-07 12:25:18 +00:00
|
|
|
endif
|
2016-05-06 23:21:08 +00:00
|
|
|
endif
|
2018-04-10 20:37:01 +00:00
|
|
|
else # not java.base
|
2019-02-07 11:35:45 +00:00
|
|
|
ifeq ($(call isTargetOs, windows), true)
|
2018-04-10 20:37:01 +00:00
|
|
|
# Only java.base needs to include the MSVC*_DLLs. Make sure no other module
|
|
|
|
# tries to include them (typically imported ones).
|
2018-05-09 17:50:30 +00:00
|
|
|
ifneq ($(MSVCR_DLL), )
|
|
|
|
ifneq ($(wildcard $(LIBS_DIR)/$(notdir $(MSVCR_DLL))), )
|
|
|
|
JMOD_FLAGS += --exclude '$(notdir $(MSVCR_DLL))'
|
|
|
|
endif
|
2018-04-10 20:37:01 +00:00
|
|
|
endif
|
2020-04-14 14:58:08 +00:00
|
|
|
ifneq ($(VCRUNTIME_1_DLL), )
|
|
|
|
ifneq ($(wildcard $(LIBS_DIR)/$(notdir $(VCRUNTIME_1_DLL))), )
|
|
|
|
JMOD_FLAGS += --exclude '$(notdir $(VCRUNTIME_1_DLL))'
|
|
|
|
endif
|
|
|
|
endif
|
2018-05-09 17:50:30 +00:00
|
|
|
ifneq ($(MSVCP_DLL), )
|
|
|
|
ifneq ($(wildcard $(LIBS_DIR)/$(notdir $(MSVCP_DLL))), )
|
|
|
|
JMOD_FLAGS += --exclude '$(notdir $(MSVCP_DLL))'
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
ifneq ($(UCRT_DLL_DIR), )
|
|
|
|
UCRT_DLL_FILES := $(notdir $(wildcard $(UCRT_DLL_DIR)/*.dll))
|
|
|
|
ifneq ($(wildcard $(LIBS_DIR)/$(firstword $(UCRT_DLL_FILES))), )
|
|
|
|
JMOD_FLAGS += $(patsubst %, --exclude '%', $(UCRT_DLL_FILES))
|
|
|
|
endif
|
2018-04-10 20:37:01 +00:00
|
|
|
endif
|
|
|
|
endif
|
2016-05-03 08:09:07 +00:00
|
|
|
endif
|
2016-03-17 19:03:53 +00:00
|
|
|
|
2021-10-19 10:19:15 +00:00
|
|
|
# Set main class of jdk.httpserver module
|
|
|
|
ifeq ($(MODULE), jdk.httpserver)
|
|
|
|
JMOD_FLAGS += --main-class sun.net.httpserver.simpleserver.Main
|
|
|
|
endif
|
|
|
|
|
2016-08-04 08:05:40 +00:00
|
|
|
# Changes to the jmod tool itself should also trigger a rebuild of all jmods.
|
|
|
|
# The variable JMOD_CMD could contain an environment variable assignment before
|
|
|
|
# the actual command. Filter that out using wildcard before adding to DEPS.
|
|
|
|
DEPS += $(wildcard $(JMOD_CMD))
|
2016-06-10 14:59:18 +00:00
|
|
|
ifeq ($(EXTERNAL_BUILDJDK), false)
|
2017-10-24 08:41:45 +00:00
|
|
|
DEPS += $(call FindFiles, $(JDK_OUTPUTDIR)/modules/jdk.jlink/jdk/tools/jmod)
|
2016-06-10 14:59:18 +00:00
|
|
|
endif
|
|
|
|
|
2016-11-07 12:25:18 +00:00
|
|
|
# If creating interim versions of jmods, certain files need to be filtered out
|
|
|
|
# to avoid false incremental rebuilds.
|
|
|
|
ifeq ($(INTERIM_JMOD), true)
|
|
|
|
DEPS := $(filter-out $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/classlist, $(DEPS))
|
2019-03-05 10:07:19 +00:00
|
|
|
INTERIM_MSG := interim$(SPACE)
|
2016-11-07 12:25:18 +00:00
|
|
|
endif
|
|
|
|
|
2020-02-07 07:38:40 +00:00
|
|
|
ifeq ($(call isTargetOs, windows), true)
|
|
|
|
ifeq ($(SHIP_DEBUG_SYMBOLS), )
|
2021-07-14 13:00:57 +00:00
|
|
|
JMOD_FLAGS += --exclude '**{_the.*,_*.marker*,*.diz,*.pdb,*.map}'
|
2020-02-07 07:38:40 +00:00
|
|
|
else
|
2021-07-14 13:00:57 +00:00
|
|
|
JMOD_FLAGS += --exclude '**{_the.*,_*.marker*,*.diz,*.map}'
|
2020-02-07 07:38:40 +00:00
|
|
|
endif
|
|
|
|
else
|
2021-07-14 13:00:57 +00:00
|
|
|
JMOD_FLAGS += --exclude '**{_the.*,_*.marker*,*.diz,*.debuginfo,*.dSYM/**,*.dSYM}'
|
2020-02-07 07:38:40 +00:00
|
|
|
endif
|
2018-04-10 20:37:01 +00:00
|
|
|
|
2019-03-05 10:07:19 +00:00
|
|
|
# Create jmods in the support dir and then move them into place to keep the
|
2016-03-17 19:03:53 +00:00
|
|
|
# module path in $(IMAGES_OUTPUTDIR)/jmods valid at all times.
|
2019-03-05 10:07:19 +00:00
|
|
|
$(eval $(call SetupExecute, create_$(JMOD_FILE), \
|
|
|
|
WARN := Creating $(INTERIM_MSG)$(JMOD_FILE), \
|
|
|
|
DEPS := $(DEPS), \
|
|
|
|
OUTPUT_FILE := $(JMODS_DIR)/$(JMOD_FILE), \
|
|
|
|
SUPPORT_DIR := $(JMODS_SUPPORT_DIR), \
|
|
|
|
PRE_COMMAND := $(RM) $(JMODS_DIR)/$(JMOD_FILE) $(JMODS_SUPPORT_DIR)/$(JMOD_FILE), \
|
|
|
|
COMMAND := $(JMOD) create --module-version $(VERSION_SHORT) \
|
|
|
|
--target-platform '$(OPENJDK_MODULE_TARGET_PLATFORM)' \
|
|
|
|
--module-path $(JMODS_DIR) $(JMOD_FLAGS) \
|
|
|
|
$(JMODS_SUPPORT_DIR)/$(JMOD_FILE), \
|
|
|
|
POST_COMMAND := $(MV) $(JMODS_SUPPORT_DIR)/$(JMOD_FILE) $(JMODS_DIR)/$(JMOD_FILE), \
|
|
|
|
))
|
|
|
|
|
|
|
|
TARGETS += $(create_$(JMOD_FILE))
|
2016-03-17 19:03:53 +00:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
all: $(TARGETS)
|
|
|
|
|
|
|
|
################################################################################
|