summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/Makefile.syscalls
blob: 8bf55333262e400c2dc6a96ef59219d383b88dfe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# 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)