xref: /linux/arch/s390/kernel/syscalls/Makefile (revision a4eb44a6435d6d8f9e642407a4a06f65eb90ca04)
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
27filechk_syshdr = $(CONFIG_SHELL) '$(systbl)' -H -a $(syshdr_abi_$(basetarget)) -f "$2" < $<
28
29filechk_sysnr = $(CONFIG_SHELL) '$(systbl)' -N -a $(sysnr_abi_$(basetarget)) < $<
30
31filechk_syscalls = $(CONFIG_SHELL) '$(systbl)' -S < $<
32
33syshdr_abi_unistd_32 := common,32
34$(uapi)/unistd_32.h: $(syscall) FORCE
35	$(call filechk,syshdr,$@)
36
37syshdr_abi_unistd_64 := common,64
38$(uapi)/unistd_64.h: $(syscall) FORCE
39	$(call filechk,syshdr,$@)
40
41$(kapi)/syscall_table.h: $(syscall) FORCE
42	$(call filechk,syscalls)
43
44sysnr_abi_unistd_nr := common,32,64
45$(kapi)/unistd_nr.h: $(syscall) FORCE
46	$(call filechk,sysnr)
47