xref: /openbmc/linux/arch/x86/entry/syscalls/Makefile (revision b2441318)
1b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0
21f57d5d8SIngo Molnarout := $(obj)/../../include/generated/asm
31f57d5d8SIngo Molnaruapi := $(obj)/../../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
91f57d5d8SIngo Molnarsyscall32 := $(srctree)/$(src)/syscall_32.tbl
101f57d5d8SIngo Molnarsyscall64 := $(srctree)/$(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 $@
241f57d5d8SIngo Molnar      cmd_hypercalls = $(CONFIG_SHELL) '$<' $@ $(filter-out $<,$^)
251f57d5d8SIngo Molnar
261f57d5d8SIngo Molnarsyshdr_abi_unistd_32 := i386
271f57d5d8SIngo Molnar$(uapi)/unistd_32.h: $(syscall32) $(syshdr)
281f57d5d8SIngo Molnar	$(call if_changed,syshdr)
291f57d5d8SIngo Molnar
301f57d5d8SIngo Molnarsyshdr_abi_unistd_32_ia32 := i386
311f57d5d8SIngo Molnarsyshdr_pfx_unistd_32_ia32 := ia32_
321f57d5d8SIngo Molnar$(out)/unistd_32_ia32.h: $(syscall32) $(syshdr)
331f57d5d8SIngo Molnar	$(call if_changed,syshdr)
341f57d5d8SIngo Molnar
351f57d5d8SIngo Molnarsyshdr_abi_unistd_x32 := common,x32
361f57d5d8SIngo Molnarsyshdr_offset_unistd_x32 := __X32_SYSCALL_BIT
371f57d5d8SIngo Molnar$(uapi)/unistd_x32.h: $(syscall64) $(syshdr)
381f57d5d8SIngo Molnar	$(call if_changed,syshdr)
391f57d5d8SIngo Molnar
401f57d5d8SIngo Molnarsyshdr_abi_unistd_64 := common,64
411f57d5d8SIngo Molnar$(uapi)/unistd_64.h: $(syscall64) $(syshdr)
421f57d5d8SIngo Molnar	$(call if_changed,syshdr)
431f57d5d8SIngo Molnar
441f57d5d8SIngo Molnarsyshdr_abi_unistd_64_x32 := x32
451f57d5d8SIngo Molnarsyshdr_pfx_unistd_64_x32 := x32_
461f57d5d8SIngo Molnar$(out)/unistd_64_x32.h: $(syscall64) $(syshdr)
471f57d5d8SIngo Molnar	$(call if_changed,syshdr)
481f57d5d8SIngo Molnar
491f57d5d8SIngo Molnar$(out)/syscalls_32.h: $(syscall32) $(systbl)
501f57d5d8SIngo Molnar	$(call if_changed,systbl)
511f57d5d8SIngo Molnar$(out)/syscalls_64.h: $(syscall64) $(systbl)
521f57d5d8SIngo Molnar	$(call if_changed,systbl)
531f57d5d8SIngo Molnar
541f57d5d8SIngo Molnar$(out)/xen-hypercalls.h: $(srctree)/scripts/xen-hypercalls.sh
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
651f57d5d8SIngo Molnartargets	+= $(uapisyshdr-y) $(syshdr-y)
661f57d5d8SIngo Molnar
671f57d5d8SIngo MolnarPHONY += all
681f57d5d8SIngo Molnarall: $(addprefix $(uapi)/,$(uapisyshdr-y))
691f57d5d8SIngo Molnarall: $(addprefix $(out)/,$(syshdr-y))
701f57d5d8SIngo Molnar	@:
71