mirror of
https://github.com/torvalds/linux.git
synced 2026-05-12 16:18:45 +02:00
When building VDSO with CFI support, source files are copied from the main VDSO directory to the CFI build directory as part of the build process. However, these copied source files were not removed during 'make clean', leaving temporary files in the build directory. Add the clean-files variable to ensure that these copied .c and .S files are properly cleaned up. The notdir() function is used to strip the path prefix, as clean-files expects relative file names without directory components. This ensures the build directory is left in a clean state after make clean. Signed-off-by: Chen Pei <cp0613@linux.alibaba.com> Link: https://patch.msgid.link/20260320021850.1877-2-cp0613@linux.alibaba.com Signed-off-by: Paul Walmsley <pjw@kernel.org>
29 lines
1.0 KiB
Makefile
29 lines
1.0 KiB
Makefile
# SPDX-License-Identifier: GPL-2.0-only
|
|
# RISC-V VDSO CFI Makefile
|
|
# This Makefile builds the VDSO with CFI support when CONFIG_RISCV_USER_CFI is enabled
|
|
|
|
# setting VDSO_CFI_BUILD triggers build for vdso differently
|
|
VDSO_CFI_BUILD := 1
|
|
|
|
# Set the source directory to the main vdso directory
|
|
src := $(srctree)/arch/riscv/kernel/vdso
|
|
|
|
# Copy all .S and .c files from vdso directory to vdso_cfi object build directory
|
|
vdso_c_sources := $(wildcard $(src)/*.c)
|
|
vdso_S_sources := $(wildcard $(src)/*.S)
|
|
vdso_c_objects := $(addprefix $(obj)/, $(notdir $(vdso_c_sources)))
|
|
vdso_S_objects := $(addprefix $(obj)/, $(notdir $(vdso_S_sources)))
|
|
|
|
$(vdso_S_objects): $(obj)/%.S: $(src)/%.S
|
|
$(Q)cp $< $@
|
|
|
|
$(vdso_c_objects): $(obj)/%.c: $(src)/%.c
|
|
$(Q)cp $< $@
|
|
|
|
# Include the main VDSO Makefile which contains all the build rules and sources
|
|
# The VDSO_CFI_BUILD variable will be passed to it to enable CFI compilation
|
|
include $(src)/Makefile
|
|
|
|
# Clean rules - remove the copied source files
|
|
clean-files += $(notdir $(vdso_c_sources)) $(notdir $(vdso_S_sources))
|