1 # SPDX-License-Identifier: GPL-2.0 2 # include/asm-generic contains a lot of files 3 # verbatim by several architectures. 4 # 5 # This Makefile generates arch/$(SRCARCH)/incl 6 # headers from multiple sources: 7 # - a small wrapper to include the correspond 8 # is generated for each file listed as gene 9 # - uapi/asm/unistd_*.h files listed as sysca 10 # syscall.tbl with the __NR_* macros 11 # - Corresponding asm/syscall_table_*.h are g 12 13 PHONY := all 14 all: 15 16 src := $(srctree)/$(subst /generated,,$(obj)) 17 18 syscall_abis_32 += common,32 19 syscall_abis_64 += common,64 20 syscalltbl := $(srctree)/scripts/syscall.tbl 21 syshdr-args := --emit-nr 22 23 # let architectures override $(syscall_abis_%) 24 -include $(srctree)/arch/$(SRCARCH)/kernel/Mak 25 include $(srctree)/scripts/Kbuild.include 26 -include $(kbuild-file) 27 28 syshdr := $(srctree)/scripts/syscallhdr.sh 29 systbl := $(srctree)/scripts/syscalltbl.sh 30 31 # $(generic)/Kbuild lists mandatory-y. Exclude 32 ifneq ($(SRCARCH),um) 33 include $(srctree)/$(generic)/Kbuild 34 endif 35 36 redundant := $(filter $(mandatory-y) $(generat 37 redundant += $(foreach f, $(generic-y), $(if $ 38 redundant := $(sort $(redundant)) 39 $(if $(redundant),\ 40 $(warning redundant generic-y found in 41 42 # If arch does not implement mandatory headers 43 mandatory-y := $(filter-out $(generated-y), $( 44 generic-y += $(foreach f, $(mandatory-y), $( 45 46 generic-y := $(addprefix $(obj)/, $(generic- 47 syscall-y := $(addprefix $(obj)/, $(syscall- 48 generated-y := $(addprefix $(obj)/, $(generate 49 50 # Remove stale wrappers when the corresponding 51 old-headers := $(wildcard $(obj)/*.h) 52 unwanted := $(filter-out $(generic-y) $(gen 53 54 quiet_cmd_wrap = WRAP $@ 55 cmd_wrap = echo "\#include <asm-generic/ 56 57 quiet_cmd_remove = REMOVE $(unwanted) 58 cmd_remove = rm -f $(unwanted) 59 60 quiet_cmd_syshdr = SYSHDR $@ 61 cmd_syshdr = $(CONFIG_SHELL) $(syshdr) \ 62 $(if $(syshdr-args-$*),$(sy 63 $(if $(syscall_compat),--pr 64 --abis $(subst $(space),$(c 65 $< $@ 66 67 quiet_cmd_systbl = SYSTBL $@ 68 cmd_systbl = $(CONFIG_SHELL) $(systbl) \ 69 $(if $(systbl-args-$*),$(sy 70 --abis $(subst $(space),$(c 71 $< $@ 72 73 all: $(generic-y) $(syscall-y) 74 $(if $(unwanted),$(call cmd,remove)) 75 @: 76 77 $(obj)/%.h: $(srctree)/$(generic)/%.h 78 $(call cmd,wrap) 79 80 $(obj)/unistd_%.h: $(syscalltbl) $(syshdr) FOR 81 $(call if_changed,syshdr) 82 83 $(obj)/unistd_compat_%.h: syscall_compat:=1 84 $(obj)/unistd_compat_%.h: $(syscalltbl) $(sysh 85 $(call if_changed,syshdr) 86 87 $(obj)/syscall_table_%.h: $(syscalltbl) $(syst 88 $(call if_changed,systbl) 89 90 targets := $(syscall-y) 91 92 # Create output directory. Skip it if at least 93 # since we know the output directory already e 94 ifeq ($(old-headers),) 95 $(shell mkdir -p $(obj)) 96 endif 97 98 PHONY += FORCE 99 100 FORCE: 101 102 existing-targets := $(wildcard $(sort $(target 103 104 -include $(foreach f,$(existing-targets),$(dir 105 106 .PHONY: $(PHONY)
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.