File Index
Files and directories
Sign in
FILE

Kbuild

File preview with syntax highlighting.

linux-6.19.14/Kbuild PLAIN TEXT
  1# SPDX-License-Identifier: GPL-2.0
  2#
  3# Kbuild for top-level directory of the kernel
  4
  5# Prepare global headers and check sanity before descending into sub-directories
  6# ---------------------------------------------------------------------------
  7
  8# Generate bounds.h
  9
 10bounds-file := include/generated/bounds.h
 11
 12targets := kernel/bounds.s
 13
 14$(bounds-file): kernel/bounds.s FORCE
 15	$(call filechk,offsets,__LINUX_BOUNDS_H__)
 16
 17# Generate timeconst.h
 18
 19timeconst-file := include/generated/timeconst.h
 20
 21filechk_gentimeconst = echo $(CONFIG_HZ) | bc -q $<
 22
 23$(timeconst-file): kernel/time/timeconst.bc FORCE
 24	$(call filechk,gentimeconst)
 25
 26# Generate asm-offsets.h
 27
 28offsets-file := include/generated/asm-offsets.h
 29
 30targets += arch/$(SRCARCH)/kernel/asm-offsets.s
 31
 32arch/$(SRCARCH)/kernel/asm-offsets.s: $(timeconst-file) $(bounds-file)
 33
 34$(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s FORCE
 35	$(call filechk,offsets,__ASM_OFFSETS_H__)
 36
 37# Generate rq-offsets.h
 38
 39rq-offsets-file := include/generated/rq-offsets.h
 40
 41targets += kernel/sched/rq-offsets.s
 42
 43kernel/sched/rq-offsets.s: $(offsets-file)
 44
 45$(rq-offsets-file): kernel/sched/rq-offsets.s FORCE
 46	$(call filechk,offsets,__RQ_OFFSETS_H__)
 47
 48# Check for missing system calls
 49
 50quiet_cmd_syscalls = CALL    $<
 51      cmd_syscalls = $(CONFIG_SHELL) $< $(CC) $(c_flags) $(missing_syscalls_flags)
 52
 53PHONY += missing-syscalls
 54missing-syscalls: scripts/checksyscalls.sh $(rq-offsets-file)
 55	$(call cmd,syscalls)
 56
 57# Check the manual modification of atomic headers
 58
 59quiet_cmd_check_sha1 = CHKSHA1 $<
 60      cmd_check_sha1 = \
 61	if ! command -v sha1sum >/dev/null; then \
 62		echo "warning: cannot check the header due to sha1sum missing"; \
 63		exit 0; \
 64	fi; \
 65	if [ "$$(sed -n '$$s:// ::p' $<)" != \
 66	     "$$(sed '$$d' $< | sha1sum | sed 's/ .*//')" ]; then \
 67		echo "error: $< has been modified." >&2; \
 68		exit 1; \
 69	fi; \
 70	touch $@
 71
 72atomic-checks += $(addprefix $(obj)/.checked-, \
 73	  atomic-arch-fallback.h \
 74	  atomic-instrumented.h \
 75	  atomic-long.h)
 76
 77targets += $(atomic-checks)
 78$(atomic-checks): $(obj)/.checked-%: include/linux/atomic/%  FORCE
 79	$(call if_changed,check_sha1)
 80
 81# A phony target that depends on all the preparation targets
 82
 83PHONY += prepare
 84prepare: $(offsets-file) missing-syscalls $(atomic-checks)
 85	@:
 86
 87# Ordinary directory descending
 88# ---------------------------------------------------------------------------
 89
 90obj-y			+= init/
 91obj-y			+= usr/
 92obj-y			+= arch/$(SRCARCH)/
 93obj-y			+= $(ARCH_CORE)
 94obj-y			+= kernel/
 95obj-y			+= certs/
 96obj-y			+= mm/
 97obj-y			+= fs/
 98obj-y			+= ipc/
 99obj-y			+= security/
100obj-y			+= crypto/
101obj-$(CONFIG_BLOCK)	+= block/
102obj-$(CONFIG_IO_URING)	+= io_uring/
103obj-$(CONFIG_RUST)	+= rust/
104obj-y			+= $(ARCH_LIB)
105obj-y			+= drivers/
106obj-y			+= sound/
107obj-$(CONFIG_SAMPLES)	+= samples/
108obj-$(CONFIG_NET)	+= net/
109obj-y			+= virt/
110obj-y			+= $(ARCH_DRIVERS)
111obj-$(CONFIG_DRM_HEADER_TEST)	+= include/
~/ Read-only file preview.