at commit 2f46e80f

1 # SPDX-License-Identifier: GPL-2.0-only
2 # ==========================================================================
3 # Install unstripped copies of vDSO
4 # ==========================================================================
5
6 PHONY := __default
7 __default:
8 @:
9
10 include $(srctree)/scripts/Kbuild.include
11
12 install-dir := $(MODLIB)/vdso
13
14 define gen_install_rules
15
16 dest := $(install-dir)/$$(patsubst %.dbg,%,$$(notdir $(1)))
17
18 __default: $$(dest)
19 $$(dest): $(1) FORCE
20 $$(call cmd,install)
21
22 build-id-file := $$(shell $(READELF) -n $(1) 2>/dev/null | sed -n 's@^.*Build ID: \(..\)\(.*\)@\1/\2@p')
23
24 ifneq ($$(build-id-file),)
25 link := $(install-dir)/.build-id/$$(build-id-file).debug
26
27 __default: $$(link)
28 $$(link): $$(dest) FORCE
29 $$(call cmd,symlink)
30 endif
31
32 endef
33
34 $(foreach x, $(sort $(INSTALL_FILES)), $(eval $(call gen_install_rules,$(x))))
35
36 quiet_cmd_install = INSTALL $@
37 cmd_install = mkdir -p $(dir $@); cp $< $@
38
39 quiet_cmd_symlink = SYMLINK $@
40 cmd_symlink = mkdir -p $(dir $@); ln -sf --relative $< $@
41
42 PHONY += FORCE
43 FORCE:
44
45 .PHONY: $(PHONY)