1# SPDX-License-Identifier: GPL-2.0 2out := arch/$(SRCARCH)/include/generated/asm 3uapi := arch/$(SRCARCH)/include/generated/uapi/asm 4 5# Create output directory if not already present 6_dummy := $(shell [ -d '$(out)' ] || mkdir -p '$(out)') \ 7 $(shell [ -d '$(uapi)' ] || mkdir -p '$(uapi)') 8 9syscall32 := $(src)/syscall_32.tbl 10syscall64 := $(src)/syscall_64.tbl 11 12syshdr := $(srctree)/scripts/syscallhdr.sh 13systbl := $(srctree)/scripts/syscalltbl.sh 14offset := 15prefix := 16 17quiet_cmd_syshdr = SYSHDR $@ 18 cmd_syshdr = $(CONFIG_SHELL) $(syshdr) --abis $(abis) --emit-nr \ 19 $(if $(offset),--offset $(offset)) \ 20 $(if $(prefix),--prefix $(prefix)) \ 21 $< $@ 22quiet_cmd_systbl = SYSTBL $@ 23 cmd_systbl = $(CONFIG_SHELL) $(systbl) --abis $(abis) $< $@ 24 25quiet_cmd_hypercalls = HYPERCALLS $@ 26 cmd_hypercalls = $(CONFIG_SHELL) '$<' $@ $(filter-out $<, $(real-prereqs)) 27 28$(uapi)/unistd_32.h: abis := i386 29$(uapi)/unistd_32.h: $(syscall32) $(syshdr) FORCE 30 $(call if_changed,syshdr) 31 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) 36 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) 41 42$(uapi)/unistd_64.h: abis := common,64 43$(uapi)/unistd_64.h: $(syscall64) $(syshdr) FORCE 44 $(call if_changed,syshdr) 45 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) 50 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) 60 61$(out)/xen-hypercalls.h: $(srctree)/scripts/xen-hypercalls.sh FORCE 62 $(call if_changed,hypercalls) 63 64$(out)/xen-hypercalls.h: $(srctree)/include/xen/interface/xen*.h 65 66uapisyshdr-y += unistd_32.h unistd_64.h unistd_x32.h 67syshdr-y += syscalls_32.h 68syshdr-$(CONFIG_X86_64) += unistd_32_ia32.h unistd_64_x32.h 69syshdr-$(CONFIG_X86_64) += syscalls_64.h 70syshdr-$(CONFIG_X86_X32_ABI) += syscalls_x32.h 71syshdr-$(CONFIG_XEN) += xen-hypercalls.h 72 73uapisyshdr-y := $(addprefix $(uapi)/, $(uapisyshdr-y)) 74syshdr-y := $(addprefix $(out)/, $(syshdr-y)) 75targets += $(addprefix ../../../../, $(uapisyshdr-y) $(syshdr-y)) 76 77PHONY += all 78all: $(uapisyshdr-y) $(syshdr-y) 79 @: 80