blob: 8637fd14135f2cb6059c2a6b8d8da93c4c551718 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001# SPDX-License-Identifier: GPL-2.0
Sam Ravnborg86feeaa2005-09-09 19:28:28 +02002#
3# Kbuild for top-level directory of the kernel
Sam Ravnborg86feeaa2005-09-09 19:28:28 +02004
Masahiro Yamada39664e22015-01-05 15:57:15 +09005#####
Masahiro Yamada01d509a2019-02-19 18:33:03 +09006# Generate bounds.h
Masahiro Yamada39664e22015-01-05 15:57:15 +09007
8bounds-file := include/generated/bounds.h
9
10always := $(bounds-file)
Masahiro Yamada8a58e162015-03-26 20:59:52 +090011targets := kernel/bounds.s
Masahiro Yamada39664e22015-01-05 15:57:15 +090012
Masahiro Yamada11fda142018-12-22 18:50:35 +090013$(bounds-file): kernel/bounds.s FORCE
Michal Marek70a4fd62015-03-11 11:01:01 +010014 $(call filechk,offsets,__LINUX_BOUNDS_H__)
Masahiro Yamada39664e22015-01-05 15:57:15 +090015
16#####
Masahiro Yamada01d509a2019-02-19 18:33:03 +090017# Generate timeconst.h
Nicholas Mc Guire0a227982015-05-18 14:19:12 +020018
19timeconst-file := include/generated/timeconst.h
20
Nicholas Mc Guire0a227982015-05-18 14:19:12 +020021targets += $(timeconst-file)
22
Masahiro Yamadaba97df42019-01-03 10:16:54 +090023filechk_gentimeconst = echo $(CONFIG_HZ) | bc -q $<
Nicholas Mc Guire0a227982015-05-18 14:19:12 +020024
Masahiro Yamada11fda142018-12-22 18:50:35 +090025$(timeconst-file): kernel/time/timeconst.bc FORCE
Nicholas Mc Guire0a227982015-05-18 14:19:12 +020026 $(call filechk,gentimeconst)
27
28#####
Masahiro Yamada01d509a2019-02-19 18:33:03 +090029# Generate asm-offsets.h
Masahiro Yamada39664e22015-01-05 15:57:15 +090030
31offsets-file := include/generated/asm-offsets.h
32
33always += $(offsets-file)
Masahiro Yamada39664e22015-01-05 15:57:15 +090034targets += arch/$(SRCARCH)/kernel/asm-offsets.s
35
Masahiro Yamada11fda142018-12-22 18:50:35 +090036arch/$(SRCARCH)/kernel/asm-offsets.s: $(timeconst-file) $(bounds-file)
Sam Ravnborg86feeaa2005-09-09 19:28:28 +020037
Masahiro Yamada11fda142018-12-22 18:50:35 +090038$(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s FORCE
Michal Marek70a4fd62015-03-11 11:01:01 +010039 $(call filechk,offsets,__ASM_OFFSETS_H__)
Sam Ravnborg86feeaa2005-09-09 19:28:28 +020040
Sam Ravnborgc53aeca2007-03-27 22:50:29 +020041#####
Masahiro Yamada01d509a2019-02-19 18:33:03 +090042# Check for missing system calls
Sam Ravnborgc53aeca2007-03-27 22:50:29 +020043
Arnaud Lacombe5f7efb42011-08-24 21:03:30 -040044always += missing-syscalls
45targets += missing-syscalls
46
Sam Ravnborgc53aeca2007-03-27 22:50:29 +020047quiet_cmd_syscalls = CALL $<
David Daney44656fa2011-11-08 10:20:10 -080048 cmd_syscalls = $(CONFIG_SHELL) $< $(CC) $(c_flags) $(missing_syscalls_flags)
Sam Ravnborgc53aeca2007-03-27 22:50:29 +020049
Arnaud Lacombe5f7efb42011-08-24 21:03:30 -040050missing-syscalls: scripts/checksyscalls.sh $(offsets-file) FORCE
Sam Ravnborgc53aeca2007-03-27 22:50:29 +020051 $(call cmd,syscalls)
Christoph Lameter1cdf25d2008-04-28 02:12:44 -070052
Kieran Binghamf197d752016-05-23 16:24:40 -070053#####
Linus Torvaldsffd602e2019-03-10 17:48:21 -070054# Check atomic headers are up-to-date
Mark Rutland8d325882018-09-04 11:48:29 +010055
56always += old-atomics
57targets += old-atomics
58
59quiet_cmd_atomics = CALL $<
Borislav Petkovbdf37b42018-11-08 20:41:28 +010060 cmd_atomics = $(CONFIG_SHELL) $<
Mark Rutland8d325882018-09-04 11:48:29 +010061
62old-atomics: scripts/atomic/check-atomics.sh FORCE
63 $(call cmd,atomics)
64
Nicholas Mc Guire0a227982015-05-18 14:19:12 +020065# Keep these three files during make clean
66no-clean-files := $(bounds-file) $(offsets-file) $(timeconst-file)