Files
linux/tools/perf/scripts/Makefile.syscalls
T
Charlie Jenkins 4a73aff8c5 perf tools: Create generic syscall table support
Currently each architecture in perf independently generates syscall
headers.

Adapt the work that has gone into unifying syscall header
implementations in the kernel to work with perf tools.

Introduce this framework with riscv at first. riscv previously relied on
libaudit, but with this change, perf tools for riscv no longer needs
this external dependency.

Signed-off-by: Charlie Jenkins <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Christian Brauner <[email protected]>
Cc: Guo Ren <[email protected]>
Cc: Günther Noack <[email protected]>
Cc: Ian Rogers <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: James Clark <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: John Garry <[email protected]>
Cc: Jonathan Corbet <[email protected]>
Cc: Leo Yan <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Mickaël Salaün <[email protected]>
Cc: Mike Leach <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Palmer Dabbelt <[email protected]>
Cc: Paul Walmsley <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Will Deacon <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2025-01-09 12:49:49 -03:00

62 lines
1.8 KiB
Makefile

# SPDX-License-Identifier: GPL-2.0
# This Makefile generates headers in
# tools/perf/arch/$(SRCARCH)/include/generated/asm from the architecture's
# syscall table. This will either be from the generic syscall table, or from a
# table that is specific to that architecture.
PHONY := all
all:
obj := $(OUTPUT)arch/$(SRCARCH)/include/generated/asm
syscall_abis_32 := common,32
syscall_abis_64 := common,64
syscalltbl := $(srctree)/tools/scripts/syscall.tbl
# let architectures override $(syscall_abis_%) and $(syscalltbl)
-include $(srctree)/tools/perf/arch/$(SRCARCH)/entry/syscalls/Makefile.syscalls
include $(srctree)/tools/build/Build.include
-include $(srctree)/tools/perf/arch/$(SRCARCH)/entry/syscalls/Kbuild
systbl := $(srctree)/tools/perf/scripts/syscalltbl.sh
syscall-y := $(addprefix $(obj)/, $(syscall-y))
# Remove stale wrappers when the corresponding files are removed from generic-y
old-headers := $(wildcard $(obj)/*.h)
unwanted := $(filter-out $(syscall-y),$(old-headers))
quiet_cmd_remove = REMOVE $(unwanted)
cmd_remove = rm -f $(unwanted)
quiet_cmd_systbl = SYSTBL $@
cmd_systbl = $(CONFIG_SHELL) $(systbl) \
$(if $(systbl-args-$*),$(systbl-args-$*),$(systbl-args)) \
--abis $(subst $(space),$(comma),$(strip $(syscall_abis_$*))) \
$< $@
all: $(syscall-y)
$(if $(unwanted),$(call cmd,remove))
@:
$(obj)/syscalls_%.h: $(syscalltbl) $(systbl) FORCE
$(call if_changed,systbl)
targets := $(syscall-y)
# Create output directory. Skip it if at least one old header exists
# since we know the output directory already exists.
ifeq ($(old-headers),)
$(shell mkdir -p $(obj))
endif
PHONY += FORCE
FORCE:
existing-targets := $(wildcard $(sort $(targets)))
-include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
.PHONY: $(PHONY)