@@ -24,76 +24,54 @@ endif
24
24
25
25
EXE_DST_DIR := $(call FindExecutableDirForModule, $(MODULE))
26
26
27
+ # openj9_debuginfo_sources
28
+ # ------------------------
29
+ # $1 - representative path
27
30
ifeq (macosx,$(OPENJDK_TARGET_OS))
28
- DEBUGINFO_SRC_SUFFIX := .dSYM
31
+ openj9_debuginfo_sources = $(wildcard $1 .dSYM/Contents/Info.plist $1.dSYM/Contents/Resources/DWARF/$(notdir $1))
29
32
else ifeq (windows,$(OPENJDK_TARGET_OS))
30
- DEBUGINFO_SRC_SUFFIX := . pdb
33
+ openj9_debuginfo_sources = $(wildcard $(addprefix $(basename $1),.map . pdb))
31
34
else
32
- DEBUGINFO_SRC_SUFFIX := .debuginfo
35
+ openj9_debuginfo_sources = $(wildcard $(basename $1) .debuginfo)
33
36
endif
34
37
35
38
ifeq (true,$(ZIP_EXTERNAL_DEBUG_SYMBOLS))
36
- DEBUGINFO_DST_SUFFIX := .diz
37
- else
38
- DEBUGINFO_DST_SUFFIX := $(DEBUGINFO_SRC_SUFFIX)
39
- endif
40
39
41
- # openj9_make_debuginfo_paths
42
- # ---------------------------
43
- # $1 - required suffix
44
- # $2 - input paths
45
- openj9_make_debuginfo_paths = \
46
- $(if $(filter .dSYM, $1), \
47
- $(addsuffix .dSYM, $2), \
48
- $(foreach path, $2, $(path:$(suffix $(path))=$1)))
49
-
50
- # openj9_copy_debuginfo_rule
51
- # --------------------------
52
- # $1 - source file path
53
- # $2 - target file path
54
- define openj9_copy_debuginfo_rule
55
- TARGETS += $2
56
- $2 : $1
57
- ifneq (,$(and $(filter %$(DEBUGINFO_SRC_SUFFIX),$1),$(filter %.diz,$2)))
40
+ # openj9_copy_debuginfos
41
+ # ----------------------
42
+ # $1 - sequence of file paths
43
+ openj9_copy_debuginfos = \
44
+ $(if $(call openj9_debuginfo_sources,$(word 1,$1)), \
45
+ $(eval $(call openj9_zip_files,$(dir $(word 1,$1)),$(call openj9_debuginfo_sources,$(word 1,$1)),$(basename $(word 2,$1)).diz)) \
46
+ $(if $(word 3,$1),$(call openj9_copy_files,,$(addsuffix .diz,$(basename $(wordlist 2,$(words $1),$1))))))
47
+
48
+ # openj9_zip_files
49
+ # ----------------
50
+ # $1 - working directory
51
+ # $2 - source file paths
52
+ # $3 - target file path
53
+ define openj9_zip_files
54
+ TARGETS += $3
55
+ $3 : $2
58
56
$(call MakeTargetDir)
59
- ($(CD) $$(<D) && $(ZIPEXE) -Dqr $$@ $$(<F))
60
- else
61
- $$(call install-file)
62
- endif
57
+ ($(CD) $1 && $(ZIPEXE) -Dq $$@ $(patsubst $1%,%,$2))
63
58
endef
64
59
65
- # openj9_copy_debuginfo_helper
66
- # ----------------------------
67
- # $1 - sequence of file paths
68
- openj9_copy_debuginfo_helper = \
69
- $(eval $(call openj9_copy_debuginfo_rule,$(word 1,$1),$(word 2,$1))) \
70
- $(if $(word 3,$1),$(call openj9_copy_debuginfo_helper,$(wordlist 2,$(words $1),$1)))
71
-
72
- # openj9_copy_debuginfo_paths*
73
- # ----------------------------
74
- # $1 - source suffix
75
- # $2 - sequence of file paths
76
- ifeq (macosx/.dSYM,$(OPENJDK_TARGET_OS)/$(DEBUGINFO_DST_SUFFIX))
77
- # When not zipping on MacOSX, there are multiple files to copy; openj9_copy_debuginfo_paths_list
78
- # names the functions that produce the sequence for each file.
79
- openj9_copy_debuginfo_paths_list = openj9_copy_debuginfo_paths_a openj9_copy_debuginfo_paths_b
80
- openj9_copy_debuginfo_paths_a = $(foreach path, $2, $(path).dSYM/Contents/Info.plist)
81
- openj9_copy_debuginfo_paths_b = $(foreach path, $2, $(path).dSYM/Contents/Resources/DWARF/$(notdir $(path)))
82
- else
83
- openj9_copy_debuginfo_paths_list = openj9_copy_debuginfo_paths
84
- openj9_copy_debuginfo_paths = \
85
- $(call openj9_make_debuginfo_paths,$(DEBUGINFO_SRC_SUFFIX),$(word 1,$2)) \
86
- $(call openj9_make_debuginfo_paths,$(DEBUGINFO_DST_SUFFIX),$(wordlist 2,$(words $2),$2))
87
- endif # macosx
60
+ else # ZIP_EXTERNAL_DEBUG_SYMBOLS
88
61
89
62
# openj9_copy_debuginfos
90
63
# ----------------------
91
- # $1 - source suffix
92
- # $2 - sequence of file paths
64
+ # $1 - sequence of file paths
93
65
openj9_copy_debuginfos = \
94
- $(if $(wildcard $(call openj9_make_debuginfo_paths,$(DEBUGINFO_SRC_SUFFIX),$(word 1,$2))), \
95
- $(foreach paths, $(openj9_copy_debuginfo_paths_list), \
96
- $(call openj9_copy_debuginfo_helper, $(call $(paths),$1,$2))))
66
+ $(foreach suffix, $(call openj9_debuginfo_suffixes,$(word 1,$1)), \
67
+ $(call openj9_copy_files,,$(addsuffix $(suffix),$(basename $1))))
68
+
69
+ # openj9_debuginfo_suffixes
70
+ # -------------------------
71
+ # $1 - sequence of file paths
72
+ openj9_debuginfo_suffixes = $(patsubst $(basename $1)%,%,$(call openj9_debuginfo_sources,$1))
73
+
74
+ endif # ZIP_EXTERNAL_DEBUG_SYMBOLS
97
75
98
76
define openj9_copy_only
99
77
$(call install-file)
@@ -128,7 +106,7 @@ openj9_copy_files = \
128
106
# $1 - sequence of file paths
129
107
openj9_copy_files_and_debuginfos = \
130
108
$(call openj9_copy_files,and_sign,$1) \
131
- $(call openj9_copy_debuginfos,$(suffix $(word 1,$1)),$ 1)
109
+ $(call openj9_copy_debuginfos,$1)
132
110
133
111
# openj9_copy_exes
134
112
# ----------------
0 commit comments