-
Notifications
You must be signed in to change notification settings - Fork 106
/
DebugImage.gmk
73 lines (63 loc) · 2.56 KB
/
DebugImage.gmk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# ===========================================================================
# (c) Copyright IBM Corp. 2020, 2020 All Rights Reserved
# ===========================================================================
# 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.
#
# IBM designates this particular file as subject to the "Classpath" exception
# as provided by IBM 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, see <http://www.gnu.org/licenses/>.
# ===========================================================================
all :
.PHONY : all
include $(SPEC)
include $(TOPDIR)/make/common/MakeBase.gmk
ifeq (true,$(ZIP_EXTERNAL_DEBUG_SYMBOLS))
DEBUG_SUFFIX_LIST := .diz
else ifeq (macosx,$(OPENJDK_TARGET_OS))
DEBUG_SUFFIX_LIST := .dSYM
else ifeq (windows,$(OPENJDK_TARGET_OS))
DEBUG_SUFFIX_LIST := .map .pdb
else
DEBUG_SUFFIX_LIST := .debuginfo
endif
DEBUG_IMAGE_DIR := $(IMAGES_OUTPUTDIR)/debug-image
# openj9_copy_rule
# ----------------
# $1 - source file path
# $2 - target file path
define openj9_copy_rule
all : $2
$2 : $1
$$(call install-file)
endef
# openj9_list_files
# -----------------
# $1 - source file path
ifeq (macosx,$(OPENJDK_TARGET_OS))
openj9_list_files = $(wildcard $1/Contents/Info.plist $1/Contents/Resources/DWARF/*)
else
openj9_list_files = $1
endif
# openj9_copy_files - copy a group of files into images/debug-image
# -----------------
# $1 - source folder
# $2 - target folder
openj9_copy_files = \
$(foreach module, $(wildcard $(strip $1)/*), \
$(foreach path, $(wildcard $(foreach prefix, $(addprefix $(module)/, * */*), $(addprefix $(prefix), $(DEBUG_SUFFIX_LIST)))), \
$(foreach file,$(call openj9_list_files,$(path)), \
$(eval $(call openj9_copy_rule,$(file),$(strip $2)/$(patsubst $(module)/%,%,$(file)))))))
# copy debug information files for executables
$(call openj9_copy_files, $(SUPPORT_OUTPUTDIR)/modules_cmds, $(DEBUG_IMAGE_DIR)/bin)
# copy debug information files for shared libraries
$(call openj9_copy_files, $(SUPPORT_OUTPUTDIR)/modules_libs, $(DEBUG_IMAGE_DIR)/lib)