2017-11-01 15:07:57 +01:00
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
2005-09-09 19:28:28 +02:00
|
|
|
#
|
|
|
|
|
# Kbuild for top-level directory of the kernel
|
|
|
|
|
|
2022-08-20 18:15:28 +09:00
|
|
|
# Prepare global headers and check sanity before descending into sub-directories
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
|
|
|
|
2019-02-19 18:33:03 +09:00
|
|
|
# Generate bounds.h
|
2015-01-05 15:57:15 +09:00
|
|
|
|
|
|
|
|
bounds-file := include/generated/bounds.h
|
|
|
|
|
|
2015-03-26 20:59:52 +09:00
|
|
|
targets := kernel/bounds.s
|
2015-01-05 15:57:15 +09:00
|
|
|
|
2018-12-22 18:50:35 +09:00
|
|
|
$(bounds-file): kernel/bounds.s FORCE
|
2015-03-11 11:01:01 +01:00
|
|
|
$(call filechk,offsets,__LINUX_BOUNDS_H__)
|
2015-01-05 15:57:15 +09:00
|
|
|
|
2019-02-19 18:33:03 +09:00
|
|
|
# Generate timeconst.h
|
2015-05-18 14:19:12 +02:00
|
|
|
|
|
|
|
|
timeconst-file := include/generated/timeconst.h
|
|
|
|
|
|
2019-01-03 10:16:54 +09:00
|
|
|
filechk_gentimeconst = echo $(CONFIG_HZ) | bc -q $<
|
2015-05-18 14:19:12 +02:00
|
|
|
|
2018-12-22 18:50:35 +09:00
|
|
|
$(timeconst-file): kernel/time/timeconst.bc FORCE
|
2015-05-18 14:19:12 +02:00
|
|
|
$(call filechk,gentimeconst)
|
|
|
|
|
|
2019-02-19 18:33:03 +09:00
|
|
|
# Generate asm-offsets.h
|
2015-01-05 15:57:15 +09:00
|
|
|
|
|
|
|
|
offsets-file := include/generated/asm-offsets.h
|
|
|
|
|
|
|
|
|
|
targets += arch/$(SRCARCH)/kernel/asm-offsets.s
|
|
|
|
|
|
2018-12-22 18:50:35 +09:00
|
|
|
arch/$(SRCARCH)/kernel/asm-offsets.s: $(timeconst-file) $(bounds-file)
|
2005-09-09 19:28:28 +02:00
|
|
|
|
2018-12-22 18:50:35 +09:00
|
|
|
$(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s FORCE
|
2015-03-11 11:01:01 +01:00
|
|
|
$(call filechk,offsets,__ASM_OFFSETS_H__)
|
2005-09-09 19:28:28 +02:00
|
|
|
|
2019-02-19 18:33:03 +09:00
|
|
|
# Check for missing system calls
|
2007-03-27 22:50:29 +02:00
|
|
|
|
|
|
|
|
quiet_cmd_syscalls = CALL $<
|
2011-11-08 10:20:10 -08:00
|
|
|
cmd_syscalls = $(CONFIG_SHELL) $< $(CC) $(c_flags) $(missing_syscalls_flags)
|
2007-03-27 22:50:29 +02:00
|
|
|
|
2022-08-20 18:15:28 +09:00
|
|
|
PHONY += missing-syscalls
|
|
|
|
|
missing-syscalls: scripts/checksyscalls.sh $(offsets-file)
|
2007-03-27 22:50:29 +02:00
|
|
|
$(call cmd,syscalls)
|
2008-04-28 02:12:44 -07:00
|
|
|
|
2022-08-20 18:15:29 +09:00
|
|
|
# Check the manual modification of atomic headers
|
2018-09-04 11:48:29 +01:00
|
|
|
|
2022-08-20 18:15:29 +09:00
|
|
|
quiet_cmd_check_sha1 = CHKSHA1 $<
|
|
|
|
|
cmd_check_sha1 = \
|
|
|
|
|
if ! command -v sha1sum >/dev/null; then \
|
|
|
|
|
echo "warning: cannot check the header due to sha1sum missing"; \
|
|
|
|
|
exit 0; \
|
|
|
|
|
fi; \
|
|
|
|
|
if [ "$$(sed -n '$$s:// ::p' $<)" != \
|
|
|
|
|
"$$(sed '$$d' $< | sha1sum | sed 's/ .*//')" ]; then \
|
|
|
|
|
echo "error: $< has been modified." >&2; \
|
|
|
|
|
exit 1; \
|
|
|
|
|
fi; \
|
|
|
|
|
touch $@
|
2018-09-04 11:48:29 +01:00
|
|
|
|
2022-08-20 18:15:29 +09:00
|
|
|
atomic-checks += $(addprefix $(obj)/.checked-, \
|
|
|
|
|
atomic-arch-fallback.h \
|
|
|
|
|
atomic-instrumented.h \
|
|
|
|
|
atomic-long.h)
|
2018-09-04 11:48:29 +01:00
|
|
|
|
2022-08-20 18:15:29 +09:00
|
|
|
targets += $(atomic-checks)
|
|
|
|
|
$(atomic-checks): $(obj)/.checked-%: include/linux/atomic/% FORCE
|
|
|
|
|
$(call if_changed,check_sha1)
|
2022-08-20 18:15:28 +09:00
|
|
|
|
|
|
|
|
# A phony target that depends on all the preparation targets
|
|
|
|
|
|
|
|
|
|
PHONY += prepare
|
2022-08-20 18:15:29 +09:00
|
|
|
prepare: $(offsets-file) missing-syscalls $(atomic-checks)
|
2022-08-20 18:15:28 +09:00
|
|
|
@:
|
2022-09-25 03:19:10 +09:00
|
|
|
|
|
|
|
|
# Ordinary directory descending
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
obj-y += init/
|
|
|
|
|
obj-y += usr/
|
|
|
|
|
obj-y += arch/$(SRCARCH)/
|
|
|
|
|
obj-y += $(ARCH_CORE)
|
|
|
|
|
obj-y += kernel/
|
|
|
|
|
obj-y += certs/
|
|
|
|
|
obj-y += mm/
|
|
|
|
|
obj-y += fs/
|
|
|
|
|
obj-y += ipc/
|
|
|
|
|
obj-y += security/
|
|
|
|
|
obj-y += crypto/
|
|
|
|
|
obj-$(CONFIG_BLOCK) += block/
|
|
|
|
|
obj-$(CONFIG_IO_URING) += io_uring/
|
2022-10-10 12:00:45 -07:00
|
|
|
obj-$(CONFIG_RUST) += rust/
|
2022-09-25 03:19:10 +09:00
|
|
|
obj-y += $(ARCH_LIB)
|
|
|
|
|
obj-y += drivers/
|
|
|
|
|
obj-y += sound/
|
|
|
|
|
obj-$(CONFIG_SAMPLES) += samples/
|
|
|
|
|
obj-$(CONFIG_NET) += net/
|
|
|
|
|
obj-y += virt/
|
|
|
|
|
obj-y += $(ARCH_DRIVERS)
|