xref: /openbmc/linux/arch/x86/entry/syscalls/Makefile (revision 3cba325b)
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
12*3cba325bSMasahiro Yamadasyshdr := $(srctree)/scripts/syscallhdr.sh
136218d0f6SMasahiro Yamadasystbl := $(srctree)/scripts/syscalltbl.sh
141f57d5d8SIngo Molnar
151f57d5d8SIngo Molnarquiet_cmd_syshdr = SYSHDR  $@
16*3cba325bSMasahiro Yamada      cmd_syshdr = $(CONFIG_SHELL) $(syshdr) --abis $(abis) --emit-nr \
17*3cba325bSMasahiro Yamada		$(if $(offset),--offset $(offset)) \
18*3cba325bSMasahiro Yamada		$(if $(prefix),--prefix $(prefix)) \
19*3cba325bSMasahiro Yamada		$< $@
201f57d5d8SIngo Molnarquiet_cmd_systbl = SYSTBL  $@
216218d0f6SMasahiro 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
26*3cba325bSMasahiro Yamada$(uapi)/unistd_32.h: abis := i386
27865fa29fSMasahiro Yamada$(uapi)/unistd_32.h: $(syscall32) $(syshdr) FORCE
281f57d5d8SIngo Molnar	$(call if_changed,syshdr)
291f57d5d8SIngo Molnar
30*3cba325bSMasahiro Yamada$(out)/unistd_32_ia32.h: abis := i386
31*3cba325bSMasahiro Yamada$(out)/unistd_32_ia32.h: prefix := ia32_
32865fa29fSMasahiro Yamada$(out)/unistd_32_ia32.h: $(syscall32) $(syshdr) FORCE
331f57d5d8SIngo Molnar	$(call if_changed,syshdr)
341f57d5d8SIngo Molnar
35*3cba325bSMasahiro Yamada$(uapi)/unistd_x32.h: abis := common,x32
36*3cba325bSMasahiro Yamada$(uapi)/unistd_x32.h: offset := __X32_SYSCALL_BIT
37865fa29fSMasahiro Yamada$(uapi)/unistd_x32.h: $(syscall64) $(syshdr) FORCE
381f57d5d8SIngo Molnar	$(call if_changed,syshdr)
391f57d5d8SIngo Molnar
40*3cba325bSMasahiro Yamada$(uapi)/unistd_64.h: abis := common,64
41865fa29fSMasahiro Yamada$(uapi)/unistd_64.h: $(syscall64) $(syshdr) FORCE
421f57d5d8SIngo Molnar	$(call if_changed,syshdr)
431f57d5d8SIngo Molnar
44*3cba325bSMasahiro Yamada$(out)/unistd_64_x32.h: abis := x32
45*3cba325bSMasahiro Yamada$(out)/unistd_64_x32.h: prefix := x32_
46865fa29fSMasahiro Yamada$(out)/unistd_64_x32.h: $(syscall64) $(syshdr) FORCE
471f57d5d8SIngo Molnar	$(call if_changed,syshdr)
481f57d5d8SIngo Molnar
496218d0f6SMasahiro Yamada$(out)/syscalls_32.h: abis := i386
50865fa29fSMasahiro Yamada$(out)/syscalls_32.h: $(syscall32) $(systbl) FORCE
511f57d5d8SIngo Molnar	$(call if_changed,systbl)
526218d0f6SMasahiro Yamada$(out)/syscalls_64.h: abis := common,64
53865fa29fSMasahiro Yamada$(out)/syscalls_64.h: $(syscall64) $(systbl) FORCE
541f57d5d8SIngo Molnar	$(call if_changed,systbl)
556218d0f6SMasahiro Yamada$(out)/syscalls_x32.h: abis := common,x32
566218d0f6SMasahiro Yamada$(out)/syscalls_x32.h: $(syscall64) $(systbl) FORCE
576218d0f6SMasahiro 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
686218d0f6SMasahiro 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