xref: /openbmc/linux/arch/x86/entry/syscalls/Makefile (revision bbc90bc1)
1b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0
2af8e9470SMasahiro Yamadaout := arch/$(SRCARCH)/include/generated/asm
3af8e9470SMasahiro Yamadauapi := arch/$(SRCARCH)/include/generated/uapi/asm
41f57d5d8SIngo Molnar
51f57d5d8SIngo Molnar# Create output directory if not already present
6*bbc90bc1SMasahiro Yamada$(shell mkdir -p $(out) $(uapi))
71f57d5d8SIngo Molnar
829c5c3acSMasahiro Yamadasyscall32 := $(src)/syscall_32.tbl
929c5c3acSMasahiro Yamadasyscall64 := $(src)/syscall_64.tbl
101f57d5d8SIngo Molnar
113cba325bSMasahiro Yamadasyshdr := $(srctree)/scripts/syscallhdr.sh
126218d0f6SMasahiro Yamadasystbl := $(srctree)/scripts/syscalltbl.sh
131eb8a498SMasahiro Yamadaoffset :=
141eb8a498SMasahiro Yamadaprefix :=
151f57d5d8SIngo Molnar
161f57d5d8SIngo Molnarquiet_cmd_syshdr = SYSHDR  $@
173cba325bSMasahiro Yamada      cmd_syshdr = $(CONFIG_SHELL) $(syshdr) --abis $(abis) --emit-nr \
183cba325bSMasahiro Yamada		$(if $(offset),--offset $(offset)) \
193cba325bSMasahiro Yamada		$(if $(prefix),--prefix $(prefix)) \
203cba325bSMasahiro Yamada		$< $@
211f57d5d8SIngo Molnarquiet_cmd_systbl = SYSTBL  $@
226218d0f6SMasahiro Yamada      cmd_systbl = $(CONFIG_SHELL) $(systbl) --abis $(abis) $< $@
231f57d5d8SIngo Molnar
241f57d5d8SIngo Molnarquiet_cmd_hypercalls = HYPERCALLS $@
25865fa29fSMasahiro Yamada      cmd_hypercalls = $(CONFIG_SHELL) '$<' $@ $(filter-out $<, $(real-prereqs))
261f57d5d8SIngo Molnar
273cba325bSMasahiro Yamada$(uapi)/unistd_32.h: abis := i386
28865fa29fSMasahiro Yamada$(uapi)/unistd_32.h: $(syscall32) $(syshdr) FORCE
291f57d5d8SIngo Molnar	$(call if_changed,syshdr)
301f57d5d8SIngo Molnar
313cba325bSMasahiro Yamada$(out)/unistd_32_ia32.h: abis := i386
323cba325bSMasahiro Yamada$(out)/unistd_32_ia32.h: prefix := ia32_
33865fa29fSMasahiro Yamada$(out)/unistd_32_ia32.h: $(syscall32) $(syshdr) FORCE
341f57d5d8SIngo Molnar	$(call if_changed,syshdr)
351f57d5d8SIngo Molnar
363cba325bSMasahiro Yamada$(uapi)/unistd_x32.h: abis := common,x32
373cba325bSMasahiro Yamada$(uapi)/unistd_x32.h: offset := __X32_SYSCALL_BIT
38865fa29fSMasahiro Yamada$(uapi)/unistd_x32.h: $(syscall64) $(syshdr) FORCE
391f57d5d8SIngo Molnar	$(call if_changed,syshdr)
401f57d5d8SIngo Molnar
413cba325bSMasahiro Yamada$(uapi)/unistd_64.h: abis := common,64
42865fa29fSMasahiro Yamada$(uapi)/unistd_64.h: $(syscall64) $(syshdr) FORCE
431f57d5d8SIngo Molnar	$(call if_changed,syshdr)
441f57d5d8SIngo Molnar
453cba325bSMasahiro Yamada$(out)/unistd_64_x32.h: abis := x32
463cba325bSMasahiro Yamada$(out)/unistd_64_x32.h: prefix := x32_
47865fa29fSMasahiro Yamada$(out)/unistd_64_x32.h: $(syscall64) $(syshdr) FORCE
481f57d5d8SIngo Molnar	$(call if_changed,syshdr)
491f57d5d8SIngo Molnar
506218d0f6SMasahiro Yamada$(out)/syscalls_32.h: abis := i386
51865fa29fSMasahiro Yamada$(out)/syscalls_32.h: $(syscall32) $(systbl) FORCE
521f57d5d8SIngo Molnar	$(call if_changed,systbl)
536218d0f6SMasahiro Yamada$(out)/syscalls_64.h: abis := common,64
54865fa29fSMasahiro Yamada$(out)/syscalls_64.h: $(syscall64) $(systbl) FORCE
551f57d5d8SIngo Molnar	$(call if_changed,systbl)
566218d0f6SMasahiro Yamada$(out)/syscalls_x32.h: abis := common,x32
576218d0f6SMasahiro Yamada$(out)/syscalls_x32.h: $(syscall64) $(systbl) FORCE
586218d0f6SMasahiro Yamada	$(call if_changed,systbl)
591f57d5d8SIngo Molnar
60865fa29fSMasahiro Yamada$(out)/xen-hypercalls.h: $(srctree)/scripts/xen-hypercalls.sh FORCE
611f57d5d8SIngo Molnar	$(call if_changed,hypercalls)
621f57d5d8SIngo Molnar
631f57d5d8SIngo Molnar$(out)/xen-hypercalls.h: $(srctree)/include/xen/interface/xen*.h
641f57d5d8SIngo Molnar
651f57d5d8SIngo Molnaruapisyshdr-y			+= unistd_32.h unistd_64.h unistd_x32.h
661f57d5d8SIngo Molnarsyshdr-y			+= syscalls_32.h
671f57d5d8SIngo Molnarsyshdr-$(CONFIG_X86_64)		+= unistd_32_ia32.h unistd_64_x32.h
681f57d5d8SIngo Molnarsyshdr-$(CONFIG_X86_64)		+= syscalls_64.h
696218d0f6SMasahiro Yamadasyshdr-$(CONFIG_X86_X32_ABI)	+= syscalls_x32.h
701f57d5d8SIngo Molnarsyshdr-$(CONFIG_XEN)		+= xen-hypercalls.h
711f57d5d8SIngo Molnar
72865fa29fSMasahiro Yamadauapisyshdr-y	:= $(addprefix $(uapi)/, $(uapisyshdr-y))
73865fa29fSMasahiro Yamadasyshdr-y	:= $(addprefix $(out)/, $(syshdr-y))
74865fa29fSMasahiro Yamadatargets		+= $(addprefix ../../../../, $(uapisyshdr-y) $(syshdr-y))
751f57d5d8SIngo Molnar
761f57d5d8SIngo MolnarPHONY += all
77865fa29fSMasahiro Yamadaall: $(uapisyshdr-y) $(syshdr-y)
781f57d5d8SIngo Molnar	@:
79