xref: /linux/arch/x86/entry/syscalls/Makefile (revision 29c5c3ac633161f4ae2f4bb5f278b3719391b20e)
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
9*29c5c3acSMasahiro Yamadasyscall32 := $(src)/syscall_32.tbl
10*29c5c3acSMasahiro Yamadasyscall64 := $(src)/syscall_64.tbl
111f57d5d8SIngo Molnar
121f57d5d8SIngo Molnarsyshdr := $(srctree)/$(src)/syscallhdr.sh
131f57d5d8SIngo Molnarsystbl := $(srctree)/$(src)/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  $@
211f57d5d8SIngo Molnar      cmd_systbl = $(CONFIG_SHELL) '$(systbl)' $< $@
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
49865fa29fSMasahiro Yamada$(out)/syscalls_32.h: $(syscall32) $(systbl) FORCE
501f57d5d8SIngo Molnar	$(call if_changed,systbl)
51865fa29fSMasahiro Yamada$(out)/syscalls_64.h: $(syscall64) $(systbl) FORCE
521f57d5d8SIngo Molnar	$(call if_changed,systbl)
531f57d5d8SIngo Molnar
54865fa29fSMasahiro Yamada$(out)/xen-hypercalls.h: $(srctree)/scripts/xen-hypercalls.sh FORCE
551f57d5d8SIngo Molnar	$(call if_changed,hypercalls)
561f57d5d8SIngo Molnar
571f57d5d8SIngo Molnar$(out)/xen-hypercalls.h: $(srctree)/include/xen/interface/xen*.h
581f57d5d8SIngo Molnar
591f57d5d8SIngo Molnaruapisyshdr-y			+= unistd_32.h unistd_64.h unistd_x32.h
601f57d5d8SIngo Molnarsyshdr-y			+= syscalls_32.h
611f57d5d8SIngo Molnarsyshdr-$(CONFIG_X86_64)		+= unistd_32_ia32.h unistd_64_x32.h
621f57d5d8SIngo Molnarsyshdr-$(CONFIG_X86_64)		+= syscalls_64.h
631f57d5d8SIngo Molnarsyshdr-$(CONFIG_XEN)		+= xen-hypercalls.h
641f57d5d8SIngo Molnar
65865fa29fSMasahiro Yamadauapisyshdr-y	:= $(addprefix $(uapi)/, $(uapisyshdr-y))
66865fa29fSMasahiro Yamadasyshdr-y	:= $(addprefix $(out)/, $(syshdr-y))
67865fa29fSMasahiro Yamadatargets		+= $(addprefix ../../../../, $(uapisyshdr-y) $(syshdr-y))
681f57d5d8SIngo Molnar
691f57d5d8SIngo MolnarPHONY += all
70865fa29fSMasahiro Yamadaall: $(uapisyshdr-y) $(syshdr-y)
711f57d5d8SIngo Molnar	@:
72