xref: /openbmc/linux/arch/s390/kernel/syscalls/Makefile (revision bacf743e)
1# SPDX-License-Identifier: GPL-2.0
2
3gen	:= arch/$(ARCH)/include/generated
4kapi	:= $(gen)/asm
5uapi	:= $(gen)/uapi/asm
6
7syscall	:= $(srctree)/$(src)/syscall.tbl
8systbl	:= $(srctree)/$(src)/syscalltbl
9
10gen-y := $(kapi)/syscall_table.h
11kapi-hdrs-y := $(kapi)/unistd_nr.h
12uapi-hdrs-y := $(uapi)/unistd_32.h
13uapi-hdrs-y += $(uapi)/unistd_64.h
14
15targets += $(addprefix ../../../,$(gen-y) $(kapi-hdrs-y) $(uapi-hdrs-y))
16
17PHONY += kapi uapi
18
19kapi:	$(gen-y) $(kapi-hdrs-y)
20uapi:	$(uapi-hdrs-y)
21
22
23# Create output directory if not already present
24$(shell mkdir -p $(uapi) $(kapi))
25
26filechk_syshdr = $(CONFIG_SHELL) '$(systbl)' -H -a $(syshdr_abi_$(basetarget)) -f "$2" < $<
27
28filechk_sysnr = $(CONFIG_SHELL) '$(systbl)' -N -a $(sysnr_abi_$(basetarget)) < $<
29
30filechk_syscalls = $(CONFIG_SHELL) '$(systbl)' -S < $<
31
32syshdr_abi_unistd_32 := common,32
33$(uapi)/unistd_32.h: $(syscall) FORCE
34	$(call filechk,syshdr,$@)
35
36syshdr_abi_unistd_64 := common,64
37$(uapi)/unistd_64.h: $(syscall) FORCE
38	$(call filechk,syshdr,$@)
39
40$(kapi)/syscall_table.h: $(syscall) FORCE
41	$(call filechk,syscalls)
42
43sysnr_abi_unistd_nr := common,32,64
44$(kapi)/unistd_nr.h: $(syscall) FORCE
45	$(call filechk,sysnr)
46