18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ciout := arch/$(SRCARCH)/include/generated/asm
38c2ecf20Sopenharmony_ciuapi := arch/$(SRCARCH)/include/generated/uapi/asm
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci# Create output directory if not already present
68c2ecf20Sopenharmony_ci_dummy := $(shell [ -d '$(out)' ] || mkdir -p '$(out)') \
78c2ecf20Sopenharmony_ci	  $(shell [ -d '$(uapi)' ] || mkdir -p '$(uapi)')
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_cisyscall32 := $(srctree)/$(src)/syscall_32.tbl
108c2ecf20Sopenharmony_cisyscall64 := $(srctree)/$(src)/syscall_64.tbl
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_cisyshdr := $(srctree)/$(src)/syscallhdr.sh
138c2ecf20Sopenharmony_cisystbl := $(srctree)/$(src)/syscalltbl.sh
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ciquiet_cmd_syshdr = SYSHDR  $@
168c2ecf20Sopenharmony_ci      cmd_syshdr = $(CONFIG_SHELL) '$(syshdr)' '$<' '$@' \
178c2ecf20Sopenharmony_ci		   '$(syshdr_abi_$(basetarget))' \
188c2ecf20Sopenharmony_ci		   '$(syshdr_pfx_$(basetarget))' \
198c2ecf20Sopenharmony_ci		   '$(syshdr_offset_$(basetarget))'
208c2ecf20Sopenharmony_ciquiet_cmd_systbl = SYSTBL  $@
218c2ecf20Sopenharmony_ci      cmd_systbl = $(CONFIG_SHELL) '$(systbl)' $< $@
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ciquiet_cmd_hypercalls = HYPERCALLS $@
248c2ecf20Sopenharmony_ci      cmd_hypercalls = $(CONFIG_SHELL) '$<' $@ $(filter-out $<,$^)
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_cisyshdr_abi_unistd_32 := i386
278c2ecf20Sopenharmony_ci$(uapi)/unistd_32.h: $(syscall32) $(syshdr)
288c2ecf20Sopenharmony_ci	$(call if_changed,syshdr)
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_cisyshdr_abi_unistd_32_ia32 := i386
318c2ecf20Sopenharmony_cisyshdr_pfx_unistd_32_ia32 := ia32_
328c2ecf20Sopenharmony_ci$(out)/unistd_32_ia32.h: $(syscall32) $(syshdr)
338c2ecf20Sopenharmony_ci	$(call if_changed,syshdr)
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_cisyshdr_abi_unistd_x32 := common,x32
368c2ecf20Sopenharmony_cisyshdr_offset_unistd_x32 := __X32_SYSCALL_BIT
378c2ecf20Sopenharmony_ci$(uapi)/unistd_x32.h: $(syscall64) $(syshdr)
388c2ecf20Sopenharmony_ci	$(call if_changed,syshdr)
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_cisyshdr_abi_unistd_64 := common,64
418c2ecf20Sopenharmony_ci$(uapi)/unistd_64.h: $(syscall64) $(syshdr)
428c2ecf20Sopenharmony_ci	$(call if_changed,syshdr)
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_cisyshdr_abi_unistd_64_x32 := x32
458c2ecf20Sopenharmony_cisyshdr_pfx_unistd_64_x32 := x32_
468c2ecf20Sopenharmony_ci$(out)/unistd_64_x32.h: $(syscall64) $(syshdr)
478c2ecf20Sopenharmony_ci	$(call if_changed,syshdr)
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci$(out)/syscalls_32.h: $(syscall32) $(systbl)
508c2ecf20Sopenharmony_ci	$(call if_changed,systbl)
518c2ecf20Sopenharmony_ci$(out)/syscalls_64.h: $(syscall64) $(systbl)
528c2ecf20Sopenharmony_ci	$(call if_changed,systbl)
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci$(out)/xen-hypercalls.h: $(srctree)/scripts/xen-hypercalls.sh
558c2ecf20Sopenharmony_ci	$(call if_changed,hypercalls)
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci$(out)/xen-hypercalls.h: $(srctree)/include/xen/interface/xen*.h
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ciuapisyshdr-y			+= unistd_32.h unistd_64.h unistd_x32.h
608c2ecf20Sopenharmony_cisyshdr-y			+= syscalls_32.h
618c2ecf20Sopenharmony_cisyshdr-$(CONFIG_X86_64)		+= unistd_32_ia32.h unistd_64_x32.h
628c2ecf20Sopenharmony_cisyshdr-$(CONFIG_X86_64)		+= syscalls_64.h
638c2ecf20Sopenharmony_cisyshdr-$(CONFIG_XEN)		+= xen-hypercalls.h
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_citargets	+= $(uapisyshdr-y) $(syshdr-y)
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ciPHONY += all
688c2ecf20Sopenharmony_ciall: $(addprefix $(uapi)/,$(uapisyshdr-y))
698c2ecf20Sopenharmony_ciall: $(addprefix $(out)/,$(syshdr-y))
708c2ecf20Sopenharmony_ci	@:
71