xref: /openbmc/linux/arch/x86/entry/syscalls/Makefile (revision 6218d0f6)
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
121f57d5d8SIngo Molnarsyshdr := $(srctree)/$(src)/syscallhdr.sh
13*6218d0f6SMasahiro Yamadasystbl := $(srctree)/scripts/syscalltbl.sh
141f57d5d8SIngo Molnar
151f57d5d8SIngo Molnarquiet_cmd_syshdr = SYSHDR  $@
161f57d5d8SIngo Molnar      cmd_syshdr = $(CONFIG_SHELL) '$(syshdr)' '$<' '$@' \
171f57d5d8SIngo Molnar		   '$(syshdr_abi_$(basetarget))' \
181f57d5d8SIngo Molnar		   '$(syshdr_pfx_$(basetarget))' \
191f57d5d8SIngo Molnar		   '$(syshdr_offset_$(basetarget))'
201f57d5d8SIngo Molnarquiet_cmd_systbl = SYSTBL  $@
21*6218d0f6SMasahiro Yamada      cmd_systbl = $(CONFIG_SHELL) $(systbl) --abis $(abis) $< $@
221f57d5d8SIngo Molnar
231f57d5d8SIngo Molnarquiet_cmd_hypercalls = HYPERCALLS $@
24865fa29fSMasahiro Yamada      cmd_hypercalls = $(CONFIG_SHELL) '$<' $@ $(filter-out $<, $(real-prereqs))
251f57d5d8SIngo Molnar
261f57d5d8SIngo Molnarsyshdr_abi_unistd_32 := i386
27865fa29fSMasahiro Yamada$(uapi)/unistd_32.h: $(syscall32) $(syshdr) FORCE
281f57d5d8SIngo Molnar	$(call if_changed,syshdr)
291f57d5d8SIngo Molnar
301f57d5d8SIngo Molnarsyshdr_abi_unistd_32_ia32 := i386
311f57d5d8SIngo Molnarsyshdr_pfx_unistd_32_ia32 := ia32_
32865fa29fSMasahiro Yamada$(out)/unistd_32_ia32.h: $(syscall32) $(syshdr) FORCE
331f57d5d8SIngo Molnar	$(call if_changed,syshdr)
341f57d5d8SIngo Molnar
351f57d5d8SIngo Molnarsyshdr_abi_unistd_x32 := common,x32
361f57d5d8SIngo Molnarsyshdr_offset_unistd_x32 := __X32_SYSCALL_BIT
37865fa29fSMasahiro Yamada$(uapi)/unistd_x32.h: $(syscall64) $(syshdr) FORCE
381f57d5d8SIngo Molnar	$(call if_changed,syshdr)
391f57d5d8SIngo Molnar
401f57d5d8SIngo Molnarsyshdr_abi_unistd_64 := common,64
41865fa29fSMasahiro Yamada$(uapi)/unistd_64.h: $(syscall64) $(syshdr) FORCE
421f57d5d8SIngo Molnar	$(call if_changed,syshdr)
431f57d5d8SIngo Molnar
441f57d5d8SIngo Molnarsyshdr_abi_unistd_64_x32 := x32
451f57d5d8SIngo Molnarsyshdr_pfx_unistd_64_x32 := x32_
46865fa29fSMasahiro Yamada$(out)/unistd_64_x32.h: $(syscall64) $(syshdr) FORCE
471f57d5d8SIngo Molnar	$(call if_changed,syshdr)
481f57d5d8SIngo Molnar
49*6218d0f6SMasahiro Yamada$(out)/syscalls_32.h: abis := i386
50865fa29fSMasahiro Yamada$(out)/syscalls_32.h: $(syscall32) $(systbl) FORCE
511f57d5d8SIngo Molnar	$(call if_changed,systbl)
52*6218d0f6SMasahiro Yamada$(out)/syscalls_64.h: abis := common,64
53865fa29fSMasahiro Yamada$(out)/syscalls_64.h: $(syscall64) $(systbl) FORCE
541f57d5d8SIngo Molnar	$(call if_changed,systbl)
55*6218d0f6SMasahiro Yamada$(out)/syscalls_x32.h: abis := common,x32
56*6218d0f6SMasahiro Yamada$(out)/syscalls_x32.h: $(syscall64) $(systbl) FORCE
57*6218d0f6SMasahiro Yamada	$(call if_changed,systbl)
581f57d5d8SIngo Molnar
59865fa29fSMasahiro Yamada$(out)/xen-hypercalls.h: $(srctree)/scripts/xen-hypercalls.sh FORCE
601f57d5d8SIngo Molnar	$(call if_changed,hypercalls)
611f57d5d8SIngo Molnar
621f57d5d8SIngo Molnar$(out)/xen-hypercalls.h: $(srctree)/include/xen/interface/xen*.h
631f57d5d8SIngo Molnar
641f57d5d8SIngo Molnaruapisyshdr-y			+= unistd_32.h unistd_64.h unistd_x32.h
651f57d5d8SIngo Molnarsyshdr-y			+= syscalls_32.h
661f57d5d8SIngo Molnarsyshdr-$(CONFIG_X86_64)		+= unistd_32_ia32.h unistd_64_x32.h
671f57d5d8SIngo Molnarsyshdr-$(CONFIG_X86_64)		+= syscalls_64.h
68*6218d0f6SMasahiro Yamadasyshdr-$(CONFIG_X86_X32)	+= syscalls_x32.h
691f57d5d8SIngo Molnarsyshdr-$(CONFIG_XEN)		+= xen-hypercalls.h
701f57d5d8SIngo Molnar
71865fa29fSMasahiro Yamadauapisyshdr-y	:= $(addprefix $(uapi)/, $(uapisyshdr-y))
72865fa29fSMasahiro Yamadasyshdr-y	:= $(addprefix $(out)/, $(syshdr-y))
73865fa29fSMasahiro Yamadatargets		+= $(addprefix ../../../../, $(uapisyshdr-y) $(syshdr-y))
741f57d5d8SIngo Molnar
751f57d5d8SIngo MolnarPHONY += all
76865fa29fSMasahiro Yamadaall: $(uapisyshdr-y) $(syshdr-y)
771f57d5d8SIngo Molnar	@:
78