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