2018-12-13 14:37:38 +05:30
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
kapi := arch/$(SRCARCH)/include/generated/asm
|
|
|
|
uapi := arch/$(SRCARCH)/include/generated/uapi/asm
|
|
|
|
|
2022-02-27 18:10:24 +09:00
|
|
|
$(shell mkdir -p $(uapi) $(kapi))
|
2018-12-13 14:37:38 +05:30
|
|
|
|
2021-03-01 23:48:25 +09:00
|
|
|
syshdr := $(srctree)/scripts/syscallhdr.sh
|
kbuild: use $(src) instead of $(srctree)/$(src) for source directory
Kbuild conventionally uses $(obj)/ for generated files, and $(src)/ for
checked-in source files. It is merely a convention without any functional
difference. In fact, $(obj) and $(src) are exactly the same, as defined
in scripts/Makefile.build:
src := $(obj)
When the kernel is built in a separate output directory, $(src) does
not accurately reflect the source directory location. While Kbuild
resolves this discrepancy by specifying VPATH=$(srctree) to search for
source files, it does not cover all cases. For example, when adding a
header search path for local headers, -I$(srctree)/$(src) is typically
passed to the compiler.
This introduces inconsistency between upstream and downstream Makefiles
because $(src) is used instead of $(srctree)/$(src) for the latter.
To address this inconsistency, this commit changes the semantics of
$(src) so that it always points to the directory in the source tree.
Going forward, the variables used in Makefiles will have the following
meanings:
$(obj) - directory in the object tree
$(src) - directory in the source tree (changed by this commit)
$(objtree) - the top of the kernel object tree
$(srctree) - the top of the kernel source tree
Consequently, $(srctree)/$(src) in upstream Makefiles need to be replaced
with $(src).
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
2024-04-27 23:55:02 +09:00
|
|
|
sysnr := $(src)/syscallnr.sh
|
2021-03-01 23:48:24 +09:00
|
|
|
systbl := $(srctree)/scripts/syscalltbl.sh
|
2018-12-13 14:37:38 +05:30
|
|
|
|
|
|
|
quiet_cmd_syshdr = SYSHDR $@
|
2021-03-01 23:48:25 +09:00
|
|
|
cmd_syshdr = $(CONFIG_SHELL) $(syshdr) --offset __NR_Linux $< $@
|
2018-12-13 14:37:38 +05:30
|
|
|
|
2020-01-17 17:02:09 +03:00
|
|
|
quiet_cmd_sysnr = SYSNR $@
|
2018-12-13 14:37:38 +05:30
|
|
|
cmd_sysnr = $(CONFIG_SHELL) '$(sysnr)' '$<' '$@' \
|
|
|
|
'$(sysnr_abis_$(basetarget))' \
|
2021-05-28 12:46:14 +09:00
|
|
|
'$(sysnr_pfx_$(basetarget))'
|
2018-12-13 14:37:38 +05:30
|
|
|
|
|
|
|
quiet_cmd_systbl = SYSTBL $@
|
2021-03-01 23:48:24 +09:00
|
|
|
cmd_systbl = $(CONFIG_SHELL) $(systbl) $< $@
|
2018-12-13 14:37:38 +05:30
|
|
|
|
2021-05-28 12:46:15 +09:00
|
|
|
$(uapi)/unistd_%.h: $(src)/syscall_%.tbl $(syshdr) FORCE
|
2018-12-13 14:37:38 +05:30
|
|
|
$(call if_changed,syshdr)
|
|
|
|
|
|
|
|
sysnr_pfx_unistd_nr_n32 := N32
|
|
|
|
sysnr_pfx_unistd_nr_n64 := 64
|
|
|
|
sysnr_pfx_unistd_nr_o32 := O32
|
|
|
|
|
2021-05-28 12:46:15 +09:00
|
|
|
$(kapi)/unistd_nr_%.h: $(src)/syscall_%.tbl $(sysnr) FORCE
|
|
|
|
$(call if_changed,sysnr)
|
2018-12-13 14:37:38 +05:30
|
|
|
|
2021-05-28 12:46:15 +09:00
|
|
|
$(kapi)/syscall_table_%.h: $(src)/syscall_%.tbl $(systbl) FORCE
|
2018-12-13 14:37:38 +05:30
|
|
|
$(call if_changed,systbl)
|
|
|
|
|
|
|
|
uapisyshdr-y += unistd_n32.h \
|
|
|
|
unistd_n64.h \
|
2021-01-04 15:41:48 +00:00
|
|
|
unistd_o32.h
|
2021-03-01 23:48:24 +09:00
|
|
|
kapisyshdr-y += syscall_table_n32.h \
|
|
|
|
syscall_table_n64.h \
|
|
|
|
syscall_table_o32.h \
|
2021-01-04 15:41:48 +00:00
|
|
|
unistd_nr_n32.h \
|
|
|
|
unistd_nr_n64.h \
|
|
|
|
unistd_nr_o32.h
|
2018-12-13 14:37:38 +05:30
|
|
|
|
2021-02-15 09:48:22 +09:00
|
|
|
uapisyshdr-y := $(addprefix $(uapi)/, $(uapisyshdr-y))
|
|
|
|
kapisyshdr-y := $(addprefix $(kapi)/, $(kapisyshdr-y))
|
|
|
|
targets += $(addprefix ../../../../, $(uapisyshdr-y) $(kapisyshdr-y))
|
2018-12-13 14:37:38 +05:30
|
|
|
|
|
|
|
PHONY += all
|
2021-02-15 09:48:22 +09:00
|
|
|
all: $(uapisyshdr-y) $(kapisyshdr-y)
|
2018-12-13 14:37:38 +05:30
|
|
|
@:
|