mirror of
https://github.com/darlinghq/darling-openjdk.git
synced 2024-11-30 07:40:37 +00:00
3474e9a9fe
Reviewed-by: erikj, tbell
291 lines
11 KiB
Plaintext
291 lines
11 KiB
Plaintext
#
|
|
# Copyright (c) 2016, 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
|
|
|
|
PRODUCT_TARGETS :=
|
|
TEST_TARGETS :=
|
|
DOCS_TARGETS :=
|
|
|
|
# On Windows tar frequently complains that "file changed as we read it" for
|
|
# some random source files. This seems to be cause by anti virus scanners and
|
|
# is most likely safe to ignore. When it happens, tar returns '1'.
|
|
ifeq ($(OPENJDK_BUILD_OS), windows)
|
|
TAR_IGNORE_EXIT_VALUE := || test "$$$$?" = "1"
|
|
endif
|
|
|
|
# Hook to include the corresponding custom file, if present.
|
|
$(eval $(call IncludeCustomExtension, Bundles-pre.gmk))
|
|
################################################################################
|
|
# BUNDLE : Name of bundle to create
|
|
# FILES : Files in BASE_DIRS to add to bundle
|
|
# SPECIAL_INCLUDES : List of directories inside BASE_DIRS to look for additional
|
|
# files in. These files will not get proper dependency handling. Use when
|
|
# files or directories may contain spaces.
|
|
# BASE_DIRS : Base directories for the root dir in the bundle.
|
|
# SUBDIR : Optional name of root dir in bundle.
|
|
SetupBundleFile = $(NamedParamsMacroTemplate)
|
|
define SetupBundleFileBody
|
|
|
|
$$(foreach d, $$($1_BASE_DIRS), \
|
|
$$(eval $1_$$d_RELATIVE_FILES := $$$$(patsubst $$d/%, %, \
|
|
$$$$(filter $$d/%, $$$$($1_FILES)))) \
|
|
$$(eval $1_$$d_LIST_FILE := \
|
|
$(SUPPORT_OUTPUTDIR)/bundles/_$1_$$$$(subst /,_,$$$$(patsubst $(OUTPUTDIR)/%,%,$$d)_files)) \
|
|
)
|
|
|
|
ifneq ($$(filter %.tar.gz, $$($1_BUNDLE_NAME)), )
|
|
$1_TYPE := tar.gz
|
|
else ifneq ($$(filter %.zip, $$($1_BUNDLE_NAME)), )
|
|
$1_TYPE := zip
|
|
else
|
|
$$(error Unknown bundle type $$($1_BUNDLE_NAME))
|
|
endif
|
|
|
|
$$(call SetIfEmpty, $1_UNZIP_DEBUGINFO, false)
|
|
|
|
$(BUNDLES_OUTPUTDIR)/$$($1_BUNDLE_NAME): $$($1_FILES)
|
|
$$(call MakeTargetDir)
|
|
# If any of the files contain a space in the file name, CacheFind
|
|
# will have replaced it with ?. Tar does not accept that so need to
|
|
# switch it back.
|
|
$$(foreach d, $$($1_BASE_DIRS), \
|
|
$$(eval $$(call ListPathsSafely, \
|
|
$1_$$d_RELATIVE_FILES, $$($1_$$d_LIST_FILE))) \
|
|
$$(CAT) $$($1_$$d_LIST_FILE) | $$(TR) '?' ' ' > $$($1_$$d_LIST_FILE).tmp \
|
|
&& $(MV) $$($1_$$d_LIST_FILE).tmp $$($1_$$d_LIST_FILE) $$(NEWLINE) \
|
|
)
|
|
ifneq ($$($1_SPECIAL_INCLUDES), )
|
|
$$(foreach i, $$($1_SPECIAL_INCLUDES), \
|
|
$$(foreach d, $$($1_BASE_DIRS), \
|
|
($(CD) $$d && $(FIND) $$i >> $$($1_$$d_LIST_FILE)) ; ))
|
|
endif
|
|
ifeq ($$($1_SUBDIR)-$$($1_TYPE)-$$($1_UNZIP_DEBUGINFO), .-zip-false)
|
|
# If no subdir is specified, zip can be done directly from BASE_DIRS.
|
|
$$(foreach d, $$($1_BASE_DIRS), \
|
|
( $(CD) $$d \
|
|
&& $(ZIPEXE) -qru $$@ . -i@$$($1_$$d_LIST_FILE) \
|
|
|| test "$$$$?" = "12" )$$(NEWLINE))
|
|
else ifeq ($$($1_SUBDIR)-$$($1_TYPE)-$$($1_UNZIP_DEBUGINFO)-$$(words $$($1_BASE_DIRS)), \
|
|
.-tar.gz-false-1)
|
|
# If no subdir is specified and only one BASE_DIR, tar.gz can be done
|
|
# directly from BASE_DIR.
|
|
$(CD) $$($1_BASE_DIRS) \
|
|
&& ( $(TAR) cf - $(TAR_CREATE_EXTRA_PARAM) \
|
|
-$(TAR_INCLUDE_PARAM) $$($1_$$($1_BASE_DIRS)_LIST_FILE) \
|
|
$(TAR_IGNORE_EXIT_VALUE) ) \
|
|
| $(GZIP) > $$@
|
|
else ifeq ($$($1_TYPE)-$(TAR_SUPPORTS_TRANSFORM)-$$($1_UNZIP_DEBUGINFO)-$$(words $$($1_BASE_DIRS)), \
|
|
tar.gz-true-false-1)
|
|
# If only one BASE_DIR, but with a SUBDIR set, tar.gz can use the
|
|
# transform option to create bundle directly from the BASE_DIR.
|
|
$(CD) $$($1_BASE_DIRS) \
|
|
&& ( $(TAR) cf - $(TAR_CREATE_EXTRA_PARAM) \
|
|
-$(TAR_INCLUDE_PARAM) $$($1_$$($1_BASE_DIRS)_LIST_FILE) \
|
|
$$(if $$($1_SUBDIR), --transform 's|^|$$($1_SUBDIR)/|S') \
|
|
$(TAR_IGNORE_EXIT_VALUE) ) \
|
|
| $(GZIP) > $$@
|
|
else
|
|
# In all other cases, need to copy all files into a temporary location
|
|
# before creation bundle.
|
|
$(RM) -r $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR)
|
|
$(MKDIR) -p $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR)
|
|
$$(foreach d, $$($1_BASE_DIRS), \
|
|
( $(CD) $$d \
|
|
&& $(TAR) cf - -$(TAR_INCLUDE_PARAM) $$($1_$$d_LIST_FILE) \
|
|
$(TAR_IGNORE_EXIT_VALUE) ) \
|
|
| ( $(CD) $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR) && $(TAR) xf - )$$(NEWLINE) )
|
|
# Unzip any zipped debuginfo files
|
|
ifeq ($$($1_UNZIP_DEBUGINFO), true)
|
|
for f in `$(FIND) $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR) -name "*.diz"`; do \
|
|
$(CD) $$$${f%/*} && $(UNZIP) -q $$$${f} && $(RM) $$$${f}; \
|
|
done
|
|
endif
|
|
ifeq ($$($1_TYPE), tar.gz)
|
|
$(CD) $(SUPPORT_OUTPUTDIR)/bundles/$1 && \
|
|
( $(TAR) cf - $(TAR_CREATE_EXTRA_PARAM) \
|
|
$$(if $$($1_SUBDIR), $$($1_SUBDIR), .) $(TAR_IGNORE_EXIT_VALUE) ) \
|
|
| $(GZIP) > $$@
|
|
else ifeq ($$($1_TYPE), zip)
|
|
$(CD) $(SUPPORT_OUTPUTDIR)/bundles/$1 && $(ZIPEXE) -qr $$@ .
|
|
endif
|
|
endif
|
|
|
|
$1 += $(BUNDLES_OUTPUTDIR)/$$($1_BUNDLE_NAME)
|
|
|
|
endef
|
|
|
|
################################################################################
|
|
|
|
# On Macosx, we bundle up the macosx specific images which already have the
|
|
# correct base directories.
|
|
ifeq ($(OPENJDK_TARGET_OS)-$(DEBUG_LEVEL), macosx-release)
|
|
JDK_IMAGE_DIR := $(JDK_MACOSX_BUNDLE_DIR)
|
|
JDK_IMAGE_HOMEDIR := $(JDK_MACOSX_CONTENTS_DIR)/Home
|
|
JDK_BUNDLE_SUBDIR :=
|
|
else
|
|
JDK_IMAGE_HOMEDIR := $(JDK_IMAGE_DIR)
|
|
JDK_BUNDLE_SUBDIR := jdk-$(VERSION_NUMBER)
|
|
ifneq ($(DEBUG_LEVEL), release)
|
|
JDK_BUNDLE_SUBDIR := $(JDK_BUNDLE_SUBDIR)/$(DEBUG_LEVEL)
|
|
endif
|
|
endif
|
|
|
|
################################################################################
|
|
|
|
ifneq ($(filter product-bundles, $(MAKECMDGOALS)), )
|
|
$(eval $(call FillCacheFind, $(IMAGES_OUTPUTDIR)))
|
|
|
|
SYMBOLS_EXCLUDE_PATTERN := %.debuginfo %.diz %.pdb %.map
|
|
|
|
ALL_JDK_FILES := $(call CacheFind, $(JDK_IMAGE_DIR))
|
|
|
|
# Create special filter rules when dealing with unzipped .dSYM directories on
|
|
# macosx
|
|
ifeq ($(OPENJDK_TARGET_OS), macosx)
|
|
ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), false)
|
|
JDK_SYMBOLS_EXCLUDE_PATTERN := $(addprefix %, \
|
|
$(call containing, .dSYM/, $(patsubst $(JDK_IMAGE_DIR)/%, %, $(ALL_JDK_FILES))))
|
|
endif
|
|
endif
|
|
|
|
JDK_BUNDLE_FILES := \
|
|
$(filter-out \
|
|
$(JDK_SYMBOLS_EXCLUDE_PATTERN) \
|
|
$(JDK_EXTRA_EXCLUDES) \
|
|
$(SYMBOLS_EXCLUDE_PATTERN) \
|
|
$(JDK_IMAGE_HOMEDIR)/demo/% \
|
|
, \
|
|
$(ALL_JDK_FILES) \
|
|
)
|
|
JDK_SYMBOLS_BUNDLE_FILES := \
|
|
$(filter \
|
|
$(JDK_SYMBOLS_EXCLUDE_PATTERN) \
|
|
$(SYMBOLS_EXCLUDE_PATTERN) \
|
|
, \
|
|
$(filter-out \
|
|
$(JDK_IMAGE_HOMEDIR)/demo/% \
|
|
, \
|
|
$(ALL_JDK_FILES) \
|
|
) \
|
|
) \
|
|
$(call CacheFind, $(SYMBOLS_IMAGE_DIR))
|
|
|
|
TEST_DEMOS_BUNDLE_FILES := $(filter $(JDK_IMAGE_HOMEDIR)/demo/%, $(ALL_JDK_FILES))
|
|
|
|
$(eval $(call SetupBundleFile, BUILD_JDK_BUNDLE, \
|
|
BUNDLE_NAME := $(JDK_BUNDLE_NAME), \
|
|
FILES := $(JDK_BUNDLE_FILES), \
|
|
SPECIAL_INCLUDES := $(JDK_SPECIAL_INCLUDES), \
|
|
BASE_DIRS := $(JDK_IMAGE_DIR), \
|
|
SUBDIR := $(JDK_BUNDLE_SUBDIR), \
|
|
))
|
|
|
|
PRODUCT_TARGETS += $(BUILD_JDK_BUNDLE)
|
|
|
|
$(eval $(call SetupBundleFile, BUILD_JDK_SYMBOLS_BUNDLE, \
|
|
BUNDLE_NAME := $(JDK_SYMBOLS_BUNDLE_NAME), \
|
|
FILES := $(JDK_SYMBOLS_BUNDLE_FILES), \
|
|
BASE_DIRS := $(JDK_IMAGE_DIR) $(wildcard $(SYMBOLS_IMAGE_DIR)), \
|
|
SUBDIR := $(JDK_BUNDLE_SUBDIR), \
|
|
UNZIP_DEBUGINFO := true, \
|
|
))
|
|
|
|
PRODUCT_TARGETS += $(BUILD_JDK_SYMBOLS_BUNDLE)
|
|
|
|
# The demo bundle is only created to support client tests. Ideally it should
|
|
# be built with the main test bundle, but since the prerequisites match
|
|
# better with the product build, it makes more sense to keep it there for now.
|
|
$(eval $(call SetupBundleFile, BUILD_TEST_DEMOS_BUNDLE, \
|
|
BUNDLE_NAME := $(TEST_DEMOS_BUNDLE_NAME), \
|
|
FILES := $(TEST_DEMOS_BUNDLE_FILES), \
|
|
BASE_DIRS := $(JDK_IMAGE_DIR), \
|
|
SUBDIR := $(JDK_BUNDLE_SUBDIR), \
|
|
))
|
|
|
|
PRODUCT_TARGETS += $(BUILD_TEST_DEMOS_BUNDLE)
|
|
endif
|
|
|
|
################################################################################
|
|
|
|
ifneq ($(filter test-bundles, $(MAKECMDGOALS)), )
|
|
TEST_BUNDLE_FILES := $(call CacheFind, $(TEST_IMAGE_DIR))
|
|
|
|
$(eval $(call SetupBundleFile, BUILD_TEST_BUNDLE, \
|
|
BUNDLE_NAME := $(TEST_BUNDLE_NAME), \
|
|
FILES := $(TEST_BUNDLE_FILES), \
|
|
BASE_DIRS := $(TEST_IMAGE_DIR), \
|
|
))
|
|
|
|
TEST_TARGETS += $(BUILD_TEST_BUNDLE)
|
|
endif
|
|
|
|
################################################################################
|
|
|
|
ifneq ($(filter docs-bundles, $(MAKECMDGOALS)), )
|
|
DOCS_BUNDLE_FILES := $(call CacheFind, $(DOCS_IMAGE_DIR))
|
|
|
|
$(eval $(call SetupBundleFile, BUILD_DOCS_BUNDLE, \
|
|
BUNDLE_NAME := $(DOCS_BUNDLE_NAME), \
|
|
FILES := $(DOCS_BUNDLE_FILES), \
|
|
BASE_DIRS := $(DOCS_IMAGE_DIR), \
|
|
SUBDIR := docs, \
|
|
))
|
|
|
|
DOCS_TARGETS += $(BUILD_DOCS_BUNDLE)
|
|
endif
|
|
|
|
################################################################################
|
|
|
|
ifneq ($(filter jcov-bundles, $(MAKECMDGOALS)), )
|
|
JCOV_BUNDLE_FILES := $(call CacheFind, $(JCOV_IMAGE_DIR))
|
|
|
|
$(eval $(call SetupBundleFile, BUILD_JCOV_BUNDLE, \
|
|
BUNDLE_NAME := $(JCOV_BUNDLE_NAME), \
|
|
FILES := $(JCOV_BUNDLE_FILES), \
|
|
BASE_DIRS := $(JCOV_IMAGE_DIR), \
|
|
SUBDIR := $(JDK_BUNDLE_SUBDIR), \
|
|
))
|
|
|
|
JCOV_TARGETS += $(BUILD_JCOV_BUNDLE)
|
|
endif
|
|
|
|
################################################################################
|
|
|
|
# Hook to include the corresponding custom file, if present.
|
|
$(eval $(call IncludeCustomExtension, Bundles.gmk))
|
|
|
|
################################################################################
|
|
|
|
product-bundles: $(PRODUCT_TARGETS)
|
|
test-bundles: $(TEST_TARGETS)
|
|
docs-bundles: $(DOCS_TARGETS)
|
|
jcov-bundles: $(JCOV_TARGETS)
|
|
|
|
.PHONY: all default product-bundles test-bundles docs-bundles jcov-bundles
|