mirror of
https://github.com/darlinghq/darling-openjdk.git
synced 2024-11-27 06:10:37 +00:00
208c58c862
Reviewed-by: erikj
257 lines
8.5 KiB
Plaintext
257 lines
8.5 KiB
Plaintext
#
|
|
# Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
|
|
# 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
|
|
include Modules.gmk
|
|
|
|
TOOL_TARGETS :=
|
|
JDK_TARGETS :=
|
|
JRE_TARGETS :=
|
|
|
|
# Hook to include the corresponding custom file, if present.
|
|
$(eval $(call IncludeCustomExtension, Images-pre.gmk))
|
|
|
|
################################################################################
|
|
|
|
# All modules for the current target platform.
|
|
ALL_MODULES := $(call FindAllModules)
|
|
|
|
$(eval $(call ReadImportMetaData))
|
|
|
|
JRE_MODULES += $(filter $(ALL_MODULES), $(BOOT_MODULES) \
|
|
$(PLATFORM_MODULES) $(JRE_TOOL_MODULES))
|
|
JDK_MODULES += $(ALL_MODULES)
|
|
|
|
JRE_MODULES_LIST := $(call CommaList, $(JRE_MODULES))
|
|
JDK_MODULES_LIST := $(call CommaList, $(JDK_MODULES))
|
|
|
|
################################################################################
|
|
|
|
BASE_RELEASE_FILE := $(JDK_OUTPUTDIR)/release
|
|
|
|
JMODS := $(wildcard $(IMAGES_OUTPUTDIR)/jmods/*.jmod)
|
|
|
|
# Use this file inside the image as target for make rule
|
|
JIMAGE_TARGET_FILE := release
|
|
|
|
JLINK_ORDER_RESOURCES := **module-info.class
|
|
JLINK_JLI_CLASSES :=
|
|
ifeq ($(ENABLE_GENERATE_CLASSLIST), true)
|
|
JLINK_ORDER_RESOURCES += @$(SUPPORT_OUTPUTDIR)/link_opt/classlist
|
|
JLINK_JLI_CLASSES := --generate-jli-classes=@$(SUPPORT_OUTPUTDIR)/link_opt/default_jli_trace.txt
|
|
endif
|
|
JLINK_ORDER_RESOURCES += \
|
|
/java.base/java/** \
|
|
/java.base/jdk/** \
|
|
/java.base/sun/** \
|
|
/java.base/com/** \
|
|
/jdk.localedata/** \
|
|
#
|
|
|
|
JLINK_TOOL := $(JLINK) -J-Djlink.debug=true \
|
|
--module-path $(IMAGES_OUTPUTDIR)/jmods \
|
|
--endian $(OPENJDK_TARGET_CPU_ENDIAN) \
|
|
--release-info $(BASE_RELEASE_FILE) \
|
|
--order-resources=$(call CommaList, $(JLINK_ORDER_RESOURCES)) \
|
|
--dedup-legal-notices=error-if-not-same-content \
|
|
$(JLINK_JLI_CLASSES) \
|
|
#
|
|
|
|
JLINK_JRE_EXTRA_OPTS := --no-man-pages --no-header-files --strip-debug
|
|
|
|
ifeq ($(JLINK_KEEP_PACKAGED_MODULES), true)
|
|
JLINK_JDK_EXTRA_OPTS := --keep-packaged-modules $(JDK_IMAGE_DIR)/jmods
|
|
endif
|
|
|
|
$(JDK_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(JMODS) \
|
|
$(call DependOnVariable, JDK_MODULES_LIST) $(BASE_RELEASE_FILE)
|
|
$(call LogWarn, Creating jdk image)
|
|
$(RM) -r $(JDK_IMAGE_DIR)
|
|
$(call ExecuteWithLog, $(SUPPORT_OUTPUTDIR)/images/jdk, \
|
|
$(JLINK_TOOL) --add-modules $(JDK_MODULES_LIST) \
|
|
$(JLINK_JDK_EXTRA_OPTS) \
|
|
--output $(JDK_IMAGE_DIR) \
|
|
)
|
|
ifeq ($(BUILD_CDS_ARCHIVE), true)
|
|
$(call LogWarn, Creating CDS archive for jdk image)
|
|
$(FIXPATH) $(JDK_IMAGE_DIR)/bin/java \
|
|
-Xshare:dump -Xmx128M -Xms128M $(LOG_INFO)
|
|
endif
|
|
$(TOUCH) $@
|
|
|
|
$(JRE_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(JMODS) \
|
|
$(call DependOnVariable, JRE_MODULES_LIST) $(BASE_RELEASE_FILE)
|
|
$(call LogWarn, Creating legacy jre image)
|
|
$(RM) -r $(JRE_IMAGE_DIR)
|
|
$(call ExecuteWithLog, $(SUPPORT_OUTPUTDIR)/images/jre, \
|
|
$(JLINK_TOOL) --add-modules $(JRE_MODULES_LIST) \
|
|
$(JLINK_JRE_EXTRA_OPTS) \
|
|
--output $(JRE_IMAGE_DIR) \
|
|
)
|
|
ifeq ($(BUILD_CDS_ARCHIVE), true)
|
|
$(call LogWarn, Creating CDS archive for jre image)
|
|
$(FIXPATH) $(JRE_IMAGE_DIR)/bin/java \
|
|
-Xshare:dump -Xmx128M -Xms128M $(LOG_INFO)
|
|
endif
|
|
$(TOUCH) $@
|
|
|
|
TOOL_JRE_TARGETS := $(JRE_IMAGE_DIR)/$(JIMAGE_TARGET_FILE)
|
|
TOOL_JDK_TARGETS := $(JDK_IMAGE_DIR)/$(JIMAGE_TARGET_FILE)
|
|
|
|
################################################################################
|
|
# src.zip
|
|
|
|
$(JDK_IMAGE_DIR)/lib/src.zip: $(SUPPORT_OUTPUTDIR)/src.zip
|
|
$(call LogInfo, Copying $(patsubst $(OUTPUTDIR)/%,%,$@))
|
|
$(install-file)
|
|
|
|
JDK_TARGETS += $(JDK_IMAGE_DIR)/lib/src.zip
|
|
|
|
################################################################################
|
|
# /demo dir
|
|
# Avoid doing the expensive find unless called with "jdk" as target.
|
|
ifneq ($(filter jdk, $(MAKECMDGOALS)), )
|
|
|
|
DEMO_FILES := \
|
|
$(if $(wildcard $(SUPPORT_OUTPUTDIR)/demos/image), \
|
|
$(shell $(FIND) $(SUPPORT_OUTPUTDIR)/demos/image \
|
|
-type f -a ! \( -name "_the*" -o -name "javac_state" \) ) \
|
|
)
|
|
|
|
ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), true)
|
|
ifeq ($(call isTargetOs, macosx), true)
|
|
DEMO_FILES := $(call not-containing, .dSYM, $(DEMO_FILES))
|
|
else
|
|
DEMO_FILES := $(filter-out %.debuginfo %.pdb %.map, $(DEMO_FILES))
|
|
endif
|
|
endif
|
|
|
|
$(eval $(call SetupCopyFiles, JDK_COPY_DEMOS, \
|
|
SRC := $(SUPPORT_OUTPUTDIR)/demos/image, \
|
|
DEST := $(JDK_IMAGE_DIR)/demo, \
|
|
FILES := $(DEMO_FILES), \
|
|
))
|
|
|
|
JDK_TARGETS += $(JDK_COPY_DEMOS)
|
|
endif
|
|
|
|
################################################################################
|
|
# Code coverage data files
|
|
|
|
ifeq ($(GCOV_ENABLED), true)
|
|
|
|
GCOV_FIND_EXPR := -type f -name "*.gcno"
|
|
|
|
$(eval $(call SetupCopyFiles,COPY_HOTSPOT_GCOV_GCNO, \
|
|
SRC := $(OUTPUTDIR), \
|
|
DEST := $(SYMBOLS_IMAGE_DIR)/gcov, \
|
|
FILES := $(shell $(FIND) $(HOTSPOT_OUTPUTDIR) $(GCOV_FIND_EXPR))))
|
|
|
|
SYMBOLS_TARGETS += $(COPY_HOTSPOT_GCOV_GCNO)
|
|
|
|
$(eval $(call SetupCopyFiles,COPY_JDK_GCOV_GCNO, \
|
|
SRC := $(OUTPUTDIR), \
|
|
DEST := $(SYMBOLS_IMAGE_DIR)/gcov, \
|
|
FILES := $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/native $(GCOV_FIND_EXPR))))
|
|
|
|
SYMBOLS_TARGETS += $(COPY_JDK_GCOV_GCNO)
|
|
|
|
endif
|
|
|
|
################################################################################
|
|
# Debug symbols
|
|
# Since debug symbols are not included in the jmod files, they need to be copied
|
|
# in manually after generating the images.
|
|
|
|
ALL_JDK_MODULES := $(JDK_MODULES)
|
|
ALL_JRE_MODULES := $(sort $(JRE_MODULES), $(foreach m, $(JRE_MODULES), \
|
|
$(call FindTransitiveDepsForModule, $m)))
|
|
|
|
ifeq ($(call isTargetOs, windows), true)
|
|
LIBS_TARGET_SUBDIR := bin
|
|
else
|
|
LIBS_TARGET_SUBDIR := lib
|
|
endif
|
|
|
|
# Param 1 - dir to find debuginfo files in
|
|
FindDebuginfoFiles = \
|
|
$(wildcard $(addprefix $1/*, $(DEBUGINFO_SUFFIXES)) \
|
|
$(addprefix $1/*/*, $(DEBUGINFO_SUFFIXES)) \
|
|
$(addprefix $1/*/*/*, $(DEBUGINFO_SUFFIXES)))
|
|
|
|
# Pick the correct debug info files to copy, either zipped or not.
|
|
ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), true)
|
|
DEBUGINFO_SUFFIXES += .diz
|
|
else
|
|
DEBUGINFO_SUFFIXES := .debuginfo .pdb .map
|
|
# On Macosx, if debug symbols have not been zipped, find all files inside *.dSYM
|
|
# dirs.
|
|
ifeq ($(call isTargetOs, macosx), true)
|
|
$(eval $(call FillCacheFind, \
|
|
$(SUPPORT_OUTPUTDIR)/modules_cmds $(SUPPORT_OUTPUTDIR)/modules_libs))
|
|
FindDebuginfoFiles = \
|
|
$(if $(wildcard $1), $(call containing, .dSYM/, $(call CacheFind, $1)))
|
|
endif
|
|
endif
|
|
|
|
# Param 1 - either JDK or JRE
|
|
SetupCopyDebuginfo = \
|
|
$(foreach m, $(ALL_$1_MODULES), \
|
|
$(eval $(call SetupCopyFiles, COPY_$1_LIBS_DEBUGINFO_$m, \
|
|
SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/$m, \
|
|
DEST := $($1_IMAGE_DIR)/$(LIBS_TARGET_SUBDIR), \
|
|
FILES := $(call FindDebuginfoFiles, \
|
|
$(SUPPORT_OUTPUTDIR)/modules_libs/$m), \
|
|
)) \
|
|
$(eval $1_TARGETS += $$(COPY_$1_LIBS_DEBUGINFO_$m)) \
|
|
)
|
|
|
|
# No space before argument to avoid having to put $(strip ) everywhere in
|
|
# implementation above.
|
|
$(call SetupCopyDebuginfo,JDK)
|
|
$(call SetupCopyDebuginfo,JRE)
|
|
|
|
################################################################################
|
|
|
|
# Include custom post hook here to make it possible to augment the target lists
|
|
# before actual target prerequisites are declared.
|
|
$(eval $(call IncludeCustomExtension, Images-post.gmk))
|
|
|
|
################################################################################
|
|
|
|
$(JRE_TARGETS): $(TOOL_JRE_TARGETS)
|
|
$(JDK_TARGETS): $(TOOL_JDK_TARGETS)
|
|
|
|
jdk: $(TOOL_JDK_TARGETS) $(JDK_TARGETS)
|
|
jre: $(TOOL_JRE_TARGETS) $(JRE_TARGETS)
|
|
symbols: $(SYMBOLS_TARGETS)
|
|
|
|
all: jdk jre symbols
|
|
|
|
.PHONY: default all jdk jre symbols
|