18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci#
38c2ecf20Sopenharmony_ci# linux/arch/arm/tools/Makefile
48c2ecf20Sopenharmony_ci#
58c2ecf20Sopenharmony_ci# Copyright (C) 2001 Russell King
68c2ecf20Sopenharmony_ci#
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_cigen := arch/$(ARCH)/include/generated
98c2ecf20Sopenharmony_cikapi := $(gen)/asm
108c2ecf20Sopenharmony_ciuapi := $(gen)/uapi/asm
118c2ecf20Sopenharmony_cisyshdr := $(srctree)/$(src)/syscallhdr.sh
128c2ecf20Sopenharmony_cisysnr := $(srctree)/$(src)/syscallnr.sh
138c2ecf20Sopenharmony_cisystbl := $(srctree)/$(src)/syscalltbl.sh
148c2ecf20Sopenharmony_cisyscall := $(srctree)/$(src)/syscall.tbl
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_cigen-y := $(gen)/calls-oabi.S
178c2ecf20Sopenharmony_cigen-y += $(gen)/calls-eabi.S
188c2ecf20Sopenharmony_cikapi-hdrs-y := $(kapi)/unistd-nr.h
198c2ecf20Sopenharmony_cikapi-hdrs-y += $(kapi)/mach-types.h
208c2ecf20Sopenharmony_ciuapi-hdrs-y := $(uapi)/unistd-common.h
218c2ecf20Sopenharmony_ciuapi-hdrs-y += $(uapi)/unistd-oabi.h
228c2ecf20Sopenharmony_ciuapi-hdrs-y += $(uapi)/unistd-eabi.h
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_citargets += $(addprefix ../../../,$(gen-y) $(kapi-hdrs-y) $(uapi-hdrs-y))
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ciPHONY += kapi uapi
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_cikapi:	$(kapi-hdrs-y) $(gen-y)
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ciuapi:	$(uapi-hdrs-y)
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci# Create output directory if not already present
338c2ecf20Sopenharmony_ci_dummy := $(shell [ -d '$(kapi)' ] || mkdir -p '$(kapi)') \
348c2ecf20Sopenharmony_ci          $(shell [ -d '$(uapi)' ] || mkdir -p '$(uapi)')
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ciquiet_cmd_gen_mach = GEN     $@
378c2ecf20Sopenharmony_ci      cmd_gen_mach = mkdir -p $(dir $@) && \
388c2ecf20Sopenharmony_ci		     $(AWK) -f $(filter-out $(PHONY),$^) > $@
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci$(kapi)/mach-types.h: $(src)/gen-mach-types $(src)/mach-types FORCE
418c2ecf20Sopenharmony_ci	$(call if_changed,gen_mach)
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ciquiet_cmd_syshdr = SYSHDR  $@
448c2ecf20Sopenharmony_ci      cmd_syshdr = $(CONFIG_SHELL) '$(syshdr)' '$<' '$@' \
458c2ecf20Sopenharmony_ci		   '$(syshdr_abi_$(basetarget))' \
468c2ecf20Sopenharmony_ci		   '$(syshdr_pfx_$(basetarget))' \
478c2ecf20Sopenharmony_ci		   '__NR_SYSCALL_BASE'
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ciquiet_cmd_systbl = SYSTBL  $@
508c2ecf20Sopenharmony_ci      cmd_systbl = $(CONFIG_SHELL) '$(systbl)' '$<' '$@' \
518c2ecf20Sopenharmony_ci		   '$(systbl_abi_$(basetarget))'
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ciquiet_cmd_sysnr  = SYSNR   $@
548c2ecf20Sopenharmony_ci      cmd_sysnr  = $(CONFIG_SHELL) '$(sysnr)' '$<' '$@' \
558c2ecf20Sopenharmony_ci		   '$(syshdr_abi_$(basetarget))'
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_cisyshdr_abi_unistd-common := common
588c2ecf20Sopenharmony_ci$(uapi)/unistd-common.h: $(syscall) $(syshdr) FORCE
598c2ecf20Sopenharmony_ci	$(call if_changed,syshdr)
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_cisyshdr_abi_unistd-oabi := oabi
628c2ecf20Sopenharmony_ci$(uapi)/unistd-oabi.h: $(syscall) $(syshdr) FORCE
638c2ecf20Sopenharmony_ci	$(call if_changed,syshdr)
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_cisyshdr_abi_unistd-eabi := eabi
668c2ecf20Sopenharmony_ci$(uapi)/unistd-eabi.h: $(syscall) $(syshdr) FORCE
678c2ecf20Sopenharmony_ci	$(call if_changed,syshdr)
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_cisysnr_abi_unistd-nr := common,oabi,eabi,compat
708c2ecf20Sopenharmony_ci$(kapi)/unistd-nr.h: $(syscall) $(sysnr) FORCE
718c2ecf20Sopenharmony_ci	$(call if_changed,sysnr)
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_cisystbl_abi_calls-oabi := common,oabi
748c2ecf20Sopenharmony_ci$(gen)/calls-oabi.S: $(syscall) $(systbl) FORCE
758c2ecf20Sopenharmony_ci	$(call if_changed,systbl)
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_cisystbl_abi_calls-eabi := common,eabi
788c2ecf20Sopenharmony_ci$(gen)/calls-eabi.S: $(syscall) $(systbl) FORCE
798c2ecf20Sopenharmony_ci	$(call if_changed,systbl)
80