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