xref: /openbmc/linux/arch/s390/kernel/syscalls/Makefile (revision 09d62154)
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_dummy := $(shell [ -d '$(uapi)' ] || mkdir -p '$(uapi)') \
25	  $(shell [ -d '$(kapi)' ] || mkdir -p '$(kapi)')
26
27define filechk_syshdr
28	$(CONFIG_SHELL) '$(systbl)' -H -a $(syshdr_abi_$(basetarget)) -f "$2" < $<
29endef
30
31define filechk_sysnr
32	$(CONFIG_SHELL) '$(systbl)' -N -a $(sysnr_abi_$(basetarget)) < $<
33endef
34
35define filechk_syscalls
36	$(CONFIG_SHELL) '$(systbl)' -S < $<
37endef
38
39syshdr_abi_unistd_32 := common,32
40$(uapi)/unistd_32.h: $(syscall) FORCE
41	$(call filechk,syshdr,$@)
42
43syshdr_abi_unistd_64 := common,64
44$(uapi)/unistd_64.h: $(syscall) FORCE
45	$(call filechk,syshdr,$@)
46
47$(kapi)/syscall_table.h: $(syscall) FORCE
48	$(call filechk,syscalls)
49
50sysnr_abi_unistd_nr := common,32,64
51$(kapi)/unistd_nr.h: $(syscall) FORCE
52	$(call filechk,sysnr)
53