]> Git Repo - linux.git/blob - tools/perf/scripts/Makefile.syscalls
Linux 6.14-rc3
[linux.git] / tools / perf / scripts / Makefile.syscalls
1 # SPDX-License-Identifier: GPL-2.0
2 # This Makefile generates headers in
3 # tools/perf/arch/$(SRCARCH)/include/generated/asm from the architecture's
4 # syscall table. This will either be from the generic syscall table, or from a
5 # table that is specific to that architecture.
6
7 PHONY := all
8 all:
9
10 obj := $(OUTPUT)arch/$(SRCARCH)/include/generated/asm
11
12 syscall_abis_32  := common,32
13 syscall_abis_64  := common,64
14 syscalltbl := $(srctree)/tools/scripts/syscall.tbl
15
16 # let architectures override $(syscall_abis_%) and $(syscalltbl)
17 -include $(srctree)/tools/perf/arch/$(SRCARCH)/entry/syscalls/Makefile.syscalls
18 include $(srctree)/tools/build/Build.include
19 -include $(srctree)/tools/perf/arch/$(SRCARCH)/entry/syscalls/Kbuild
20
21 systbl := $(srctree)/tools/perf/scripts/syscalltbl.sh
22
23 syscall-y   := $(addprefix $(obj)/, $(syscall-y))
24
25 # Remove stale wrappers when the corresponding files are removed from generic-y
26 old-headers := $(wildcard $(obj)/*.h)
27 unwanted    := $(filter-out $(syscall-y),$(old-headers))
28
29 quiet_cmd_remove = REMOVE  $(unwanted)
30       cmd_remove = rm -f $(unwanted)
31
32 quiet_cmd_systbl = SYSTBL  $@
33       cmd_systbl = $(CONFIG_SHELL) $(systbl) \
34                    $(if $(systbl-args-$*),$(systbl-args-$*),$(systbl-args)) \
35                    --abis $(subst $(space),$(comma),$(strip $(syscall_abis_$*))) \
36                    $< $@
37
38 all: $(syscall-y)
39         $(if $(unwanted),$(call cmd,remove))
40         @:
41
42 $(obj)/syscalls_%.h: $(syscalltbl) $(systbl) FORCE
43         $(call if_changed,systbl)
44
45 targets := $(syscall-y)
46
47 # Create output directory. Skip it if at least one old header exists
48 # since we know the output directory already exists.
49 ifeq ($(old-headers),)
50 $(shell mkdir -p $(obj))
51 endif
52
53 PHONY += FORCE
54
55 FORCE:
56
57 existing-targets := $(wildcard $(sort $(targets)))
58
59 -include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
60
61 .PHONY: $(PHONY)
This page took 0.032543 seconds and 4 git commands to generate.