xref: /openbmc/linux/arch/x86/entry/syscalls/Makefile (revision 1eb8a498)
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
61f57d5d8SIngo Molnar_dummy := $(shell [ -d '$(out)' ] || mkdir -p '$(out)') \
71f57d5d8SIngo Molnar	  $(shell [ -d '$(uapi)' ] || mkdir -p '$(uapi)')
81f57d5d8SIngo Molnar
929c5c3acSMasahiro Yamadasyscall32 := $(src)/syscall_32.tbl
1029c5c3acSMasahiro Yamadasyscall64 := $(src)/syscall_64.tbl
111f57d5d8SIngo Molnar
123cba325bSMasahiro Yamadasyshdr := $(srctree)/scripts/syscallhdr.sh
136218d0f6SMasahiro Yamadasystbl := $(srctree)/scripts/syscalltbl.sh
14*1eb8a498SMasahiro Yamadaoffset :=
15*1eb8a498SMasahiro Yamadaprefix :=
161f57d5d8SIngo Molnar
171f57d5d8SIngo Molnarquiet_cmd_syshdr = SYSHDR  $@
183cba325bSMasahiro Yamada      cmd_syshdr = $(CONFIG_SHELL) $(syshdr) --abis $(abis) --emit-nr \
193cba325bSMasahiro Yamada		$(if $(offset),--offset $(offset)) \
203cba325bSMasahiro Yamada		$(if $(prefix),--prefix $(prefix)) \
213cba325bSMasahiro Yamada		$< $@
221f57d5d8SIngo Molnarquiet_cmd_systbl = SYSTBL  $@
236218d0f6SMasahiro Yamada      cmd_systbl = $(CONFIG_SHELL) $(systbl) --abis $(abis) $< $@
241f57d5d8SIngo Molnar
251f57d5d8SIngo Molnarquiet_cmd_hypercalls = HYPERCALLS $@
26865fa29fSMasahiro Yamada      cmd_hypercalls = $(CONFIG_SHELL) '$<' $@ $(filter-out $<, $(real-prereqs))
271f57d5d8SIngo Molnar
283cba325bSMasahiro Yamada$(uapi)/unistd_32.h: abis := i386
29865fa29fSMasahiro Yamada$(uapi)/unistd_32.h: $(syscall32) $(syshdr) FORCE
301f57d5d8SIngo Molnar	$(call if_changed,syshdr)
311f57d5d8SIngo Molnar
323cba325bSMasahiro Yamada$(out)/unistd_32_ia32.h: abis := i386
333cba325bSMasahiro Yamada$(out)/unistd_32_ia32.h: prefix := ia32_
34865fa29fSMasahiro Yamada$(out)/unistd_32_ia32.h: $(syscall32) $(syshdr) FORCE
351f57d5d8SIngo Molnar	$(call if_changed,syshdr)
361f57d5d8SIngo Molnar
373cba325bSMasahiro Yamada$(uapi)/unistd_x32.h: abis := common,x32
383cba325bSMasahiro Yamada$(uapi)/unistd_x32.h: offset := __X32_SYSCALL_BIT
39865fa29fSMasahiro Yamada$(uapi)/unistd_x32.h: $(syscall64) $(syshdr) FORCE
401f57d5d8SIngo Molnar	$(call if_changed,syshdr)
411f57d5d8SIngo Molnar
423cba325bSMasahiro Yamada$(uapi)/unistd_64.h: abis := common,64
43865fa29fSMasahiro Yamada$(uapi)/unistd_64.h: $(syscall64) $(syshdr) FORCE
441f57d5d8SIngo Molnar	$(call if_changed,syshdr)
451f57d5d8SIngo Molnar
463cba325bSMasahiro Yamada$(out)/unistd_64_x32.h: abis := x32
473cba325bSMasahiro Yamada$(out)/unistd_64_x32.h: prefix := x32_
48865fa29fSMasahiro Yamada$(out)/unistd_64_x32.h: $(syscall64) $(syshdr) FORCE
491f57d5d8SIngo Molnar	$(call if_changed,syshdr)
501f57d5d8SIngo Molnar
516218d0f6SMasahiro Yamada$(out)/syscalls_32.h: abis := i386
52865fa29fSMasahiro Yamada$(out)/syscalls_32.h: $(syscall32) $(systbl) FORCE
531f57d5d8SIngo Molnar	$(call if_changed,systbl)
546218d0f6SMasahiro Yamada$(out)/syscalls_64.h: abis := common,64
55865fa29fSMasahiro Yamada$(out)/syscalls_64.h: $(syscall64) $(systbl) FORCE
561f57d5d8SIngo Molnar	$(call if_changed,systbl)
576218d0f6SMasahiro Yamada$(out)/syscalls_x32.h: abis := common,x32
586218d0f6SMasahiro Yamada$(out)/syscalls_x32.h: $(syscall64) $(systbl) FORCE
596218d0f6SMasahiro Yamada	$(call if_changed,systbl)
601f57d5d8SIngo Molnar
61865fa29fSMasahiro Yamada$(out)/xen-hypercalls.h: $(srctree)/scripts/xen-hypercalls.sh FORCE
621f57d5d8SIngo Molnar	$(call if_changed,hypercalls)
631f57d5d8SIngo Molnar
641f57d5d8SIngo Molnar$(out)/xen-hypercalls.h: $(srctree)/include/xen/interface/xen*.h
651f57d5d8SIngo Molnar
661f57d5d8SIngo Molnaruapisyshdr-y			+= unistd_32.h unistd_64.h unistd_x32.h
671f57d5d8SIngo Molnarsyshdr-y			+= syscalls_32.h
681f57d5d8SIngo Molnarsyshdr-$(CONFIG_X86_64)		+= unistd_32_ia32.h unistd_64_x32.h
691f57d5d8SIngo Molnarsyshdr-$(CONFIG_X86_64)		+= syscalls_64.h
706218d0f6SMasahiro Yamadasyshdr-$(CONFIG_X86_X32)	+= syscalls_x32.h
711f57d5d8SIngo Molnarsyshdr-$(CONFIG_XEN)		+= xen-hypercalls.h
721f57d5d8SIngo Molnar
73865fa29fSMasahiro Yamadauapisyshdr-y	:= $(addprefix $(uapi)/, $(uapisyshdr-y))
74865fa29fSMasahiro Yamadasyshdr-y	:= $(addprefix $(out)/, $(syshdr-y))
75865fa29fSMasahiro Yamadatargets		+= $(addprefix ../../../../, $(uapisyshdr-y) $(syshdr-y))
761f57d5d8SIngo Molnar
771f57d5d8SIngo MolnarPHONY += all
78865fa29fSMasahiro Yamadaall: $(uapisyshdr-y) $(syshdr-y)
791f57d5d8SIngo Molnar	@:
80