xref: /linux/arch/riscv/kernel/vdso_cfi/Makefile (revision d30c1683aaecb93d2ab95685dc4300a33d3cea7a)
1# SPDX-License-Identifier: GPL-2.0-only
2# RISC-V VDSO CFI Makefile
3# This Makefile builds the VDSO with CFI support when CONFIG_RISCV_USER_CFI is enabled
4
5# setting VDSO_CFI_BUILD triggers build for vdso differently
6VDSO_CFI_BUILD := 1
7
8# Set the source directory to the main vdso directory
9src := $(srctree)/arch/riscv/kernel/vdso
10
11# Copy all .S and .c files from vdso directory to vdso_cfi object build directory
12vdso_c_sources := $(wildcard $(src)/*.c)
13vdso_S_sources := $(wildcard $(src)/*.S)
14vdso_c_objects := $(addprefix $(obj)/, $(notdir $(vdso_c_sources)))
15vdso_S_objects := $(addprefix $(obj)/, $(notdir $(vdso_S_sources)))
16
17$(vdso_S_objects): $(obj)/%.S: $(src)/%.S
18	$(Q)cp $< $@
19
20$(vdso_c_objects): $(obj)/%.c: $(src)/%.c
21	$(Q)cp $< $@
22
23# Include the main VDSO Makefile which contains all the build rules and sources
24# The VDSO_CFI_BUILD variable will be passed to it to enable CFI compilation
25include $(src)/Makefile
26