1 # SPDX-License-Identifier: GPL-2.0
2 out := arch/$(SRCARCH)/include/generated/asm
3 uapi := arch/$(SRCARCH)/include/generated/uapi/asm
5 # Create output directory if not already present
6 _dummy := $(shell [ -d '$(out)' ] || mkdir -p '$(out)') \
7 $(shell [ -d '$(uapi)' ] || mkdir -p '$(uapi)')
9 syscall32 := $(src)/syscall_32.tbl
10 syscall64 := $(src)/syscall_64.tbl
12 syshdr := $(srctree)/scripts/syscallhdr.sh
13 systbl := $(srctree)/scripts/syscalltbl.sh
17 quiet_cmd_syshdr = SYSHDR $@
18 cmd_syshdr = $(CONFIG_SHELL) $(syshdr) --abis $(abis) --emit-nr \
19 $(if $(offset),--offset $(offset)) \
20 $(if $(prefix),--prefix $(prefix)) \
22 quiet_cmd_systbl = SYSTBL $@
23 cmd_systbl = $(CONFIG_SHELL) $(systbl) --abis $(abis) $< $@
25 quiet_cmd_hypercalls = HYPERCALLS $@
26 cmd_hypercalls = $(CONFIG_SHELL) '$<' $@ $(filter-out $<, $(real-prereqs))
28 $(uapi)/unistd_32.h: abis := i386
29 $(uapi)/unistd_32.h: $(syscall32) $(syshdr) FORCE
30 $(call if_changed,syshdr)
32 $(out)/unistd_32_ia32.h: abis := i386
33 $(out)/unistd_32_ia32.h: prefix := ia32_
34 $(out)/unistd_32_ia32.h: $(syscall32) $(syshdr) FORCE
35 $(call if_changed,syshdr)
37 $(uapi)/unistd_x32.h: abis := common,x32
38 $(uapi)/unistd_x32.h: offset := __X32_SYSCALL_BIT
39 $(uapi)/unistd_x32.h: $(syscall64) $(syshdr) FORCE
40 $(call if_changed,syshdr)
42 $(uapi)/unistd_64.h: abis := common,64
43 $(uapi)/unistd_64.h: $(syscall64) $(syshdr) FORCE
44 $(call if_changed,syshdr)
46 $(out)/unistd_64_x32.h: abis := x32
47 $(out)/unistd_64_x32.h: prefix := x32_
48 $(out)/unistd_64_x32.h: $(syscall64) $(syshdr) FORCE
49 $(call if_changed,syshdr)
51 $(out)/syscalls_32.h: abis := i386
52 $(out)/syscalls_32.h: $(syscall32) $(systbl) FORCE
53 $(call if_changed,systbl)
54 $(out)/syscalls_64.h: abis := common,64
55 $(out)/syscalls_64.h: $(syscall64) $(systbl) FORCE
56 $(call if_changed,systbl)
57 $(out)/syscalls_x32.h: abis := common,x32
58 $(out)/syscalls_x32.h: $(syscall64) $(systbl) FORCE
59 $(call if_changed,systbl)
61 $(out)/xen-hypercalls.h: $(srctree)/scripts/xen-hypercalls.sh FORCE
62 $(call if_changed,hypercalls)
64 $(out)/xen-hypercalls.h: $(srctree)/include/xen/interface/xen*.h
66 uapisyshdr-y += unistd_32.h unistd_64.h unistd_x32.h
67 syshdr-y += syscalls_32.h
68 syshdr-$(CONFIG_X86_64) += unistd_32_ia32.h unistd_64_x32.h
69 syshdr-$(CONFIG_X86_64) += syscalls_64.h
70 syshdr-$(CONFIG_X86_X32) += syscalls_x32.h
71 syshdr-$(CONFIG_XEN) += xen-hypercalls.h
73 uapisyshdr-y := $(addprefix $(uapi)/, $(uapisyshdr-y))
74 syshdr-y := $(addprefix $(out)/, $(syshdr-y))
75 targets += $(addprefix ../../../../, $(uapisyshdr-y) $(syshdr-y))
78 all: $(uapisyshdr-y) $(syshdr-y)