Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0 |
Sam Ravnborg | 86feeaa | 2005-09-09 19:28:28 +0200 | [diff] [blame] | 2 | # |
| 3 | # Kbuild for top-level directory of the kernel |
| 4 | # This file takes care of the following: |
Christoph Lameter | 1cdf25d | 2008-04-28 02:12:44 -0700 | [diff] [blame] | 5 | # 1) Generate bounds.h |
Nicholas Mc Guire | 0a22798 | 2015-05-18 14:19:12 +0200 | [diff] [blame] | 6 | # 2) Generate timeconst.h |
| 7 | # 3) Generate asm-offsets.h (may need bounds.h and timeconst.h) |
| 8 | # 4) Check for missing system calls |
Mark Rutland | 8d32588 | 2018-09-04 11:48:29 +0100 | [diff] [blame] | 9 | # 5) check atomics headers are up-to-date |
| 10 | # 6) Generate constants.py (may need bounds.h) |
Sam Ravnborg | 86feeaa | 2005-09-09 19:28:28 +0200 | [diff] [blame] | 11 | |
Masahiro Yamada | 39664e2 | 2015-01-05 15:57:15 +0900 | [diff] [blame] | 12 | ##### |
| 13 | # 1) Generate bounds.h |
| 14 | |
| 15 | bounds-file := include/generated/bounds.h |
| 16 | |
| 17 | always := $(bounds-file) |
Masahiro Yamada | 8a58e16 | 2015-03-26 20:59:52 +0900 | [diff] [blame] | 18 | targets := kernel/bounds.s |
Masahiro Yamada | 39664e2 | 2015-01-05 15:57:15 +0900 | [diff] [blame] | 19 | |
Masahiro Yamada | 11fda14 | 2018-12-22 18:50:35 +0900 | [diff] [blame] | 20 | $(bounds-file): kernel/bounds.s FORCE |
Michal Marek | 70a4fd6 | 2015-03-11 11:01:01 +0100 | [diff] [blame] | 21 | $(call filechk,offsets,__LINUX_BOUNDS_H__) |
Masahiro Yamada | 39664e2 | 2015-01-05 15:57:15 +0900 | [diff] [blame] | 22 | |
| 23 | ##### |
Nicholas Mc Guire | 0a22798 | 2015-05-18 14:19:12 +0200 | [diff] [blame] | 24 | # 2) Generate timeconst.h |
| 25 | |
| 26 | timeconst-file := include/generated/timeconst.h |
| 27 | |
Nicholas Mc Guire | 0a22798 | 2015-05-18 14:19:12 +0200 | [diff] [blame] | 28 | targets += $(timeconst-file) |
| 29 | |
Masahiro Yamada | ba97df4 | 2019-01-03 10:16:54 +0900 | [diff] [blame] | 30 | filechk_gentimeconst = echo $(CONFIG_HZ) | bc -q $< |
Nicholas Mc Guire | 0a22798 | 2015-05-18 14:19:12 +0200 | [diff] [blame] | 31 | |
Masahiro Yamada | 11fda14 | 2018-12-22 18:50:35 +0900 | [diff] [blame] | 32 | $(timeconst-file): kernel/time/timeconst.bc FORCE |
Nicholas Mc Guire | 0a22798 | 2015-05-18 14:19:12 +0200 | [diff] [blame] | 33 | $(call filechk,gentimeconst) |
| 34 | |
| 35 | ##### |
| 36 | # 3) Generate asm-offsets.h |
Masahiro Yamada | 39664e2 | 2015-01-05 15:57:15 +0900 | [diff] [blame] | 37 | # |
| 38 | |
| 39 | offsets-file := include/generated/asm-offsets.h |
| 40 | |
| 41 | always += $(offsets-file) |
Masahiro Yamada | 39664e2 | 2015-01-05 15:57:15 +0900 | [diff] [blame] | 42 | targets += arch/$(SRCARCH)/kernel/asm-offsets.s |
| 43 | |
Masahiro Yamada | 11fda14 | 2018-12-22 18:50:35 +0900 | [diff] [blame] | 44 | arch/$(SRCARCH)/kernel/asm-offsets.s: $(timeconst-file) $(bounds-file) |
Sam Ravnborg | 86feeaa | 2005-09-09 19:28:28 +0200 | [diff] [blame] | 45 | |
Masahiro Yamada | 11fda14 | 2018-12-22 18:50:35 +0900 | [diff] [blame] | 46 | $(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s FORCE |
Michal Marek | 70a4fd6 | 2015-03-11 11:01:01 +0100 | [diff] [blame] | 47 | $(call filechk,offsets,__ASM_OFFSETS_H__) |
Sam Ravnborg | 86feeaa | 2005-09-09 19:28:28 +0200 | [diff] [blame] | 48 | |
Sam Ravnborg | c53aeca | 2007-03-27 22:50:29 +0200 | [diff] [blame] | 49 | ##### |
Nicholas Mc Guire | 0a22798 | 2015-05-18 14:19:12 +0200 | [diff] [blame] | 50 | # 4) Check for missing system calls |
Sam Ravnborg | c53aeca | 2007-03-27 22:50:29 +0200 | [diff] [blame] | 51 | # |
| 52 | |
Arnaud Lacombe | 5f7efb4 | 2011-08-24 21:03:30 -0400 | [diff] [blame] | 53 | always += missing-syscalls |
| 54 | targets += missing-syscalls |
| 55 | |
Sam Ravnborg | c53aeca | 2007-03-27 22:50:29 +0200 | [diff] [blame] | 56 | quiet_cmd_syscalls = CALL $< |
David Daney | 44656fa | 2011-11-08 10:20:10 -0800 | [diff] [blame] | 57 | cmd_syscalls = $(CONFIG_SHELL) $< $(CC) $(c_flags) $(missing_syscalls_flags) |
Sam Ravnborg | c53aeca | 2007-03-27 22:50:29 +0200 | [diff] [blame] | 58 | |
Arnaud Lacombe | 5f7efb4 | 2011-08-24 21:03:30 -0400 | [diff] [blame] | 59 | missing-syscalls: scripts/checksyscalls.sh $(offsets-file) FORCE |
Sam Ravnborg | c53aeca | 2007-03-27 22:50:29 +0200 | [diff] [blame] | 60 | $(call cmd,syscalls) |
Christoph Lameter | 1cdf25d | 2008-04-28 02:12:44 -0700 | [diff] [blame] | 61 | |
Kieran Bingham | f197d75 | 2016-05-23 16:24:40 -0700 | [diff] [blame] | 62 | ##### |
Mark Rutland | 8d32588 | 2018-09-04 11:48:29 +0100 | [diff] [blame] | 63 | # 5) Check atomic headers are up-to-date |
| 64 | # |
| 65 | |
| 66 | always += old-atomics |
| 67 | targets += old-atomics |
| 68 | |
| 69 | quiet_cmd_atomics = CALL $< |
Borislav Petkov | bdf37b4 | 2018-11-08 20:41:28 +0100 | [diff] [blame] | 70 | cmd_atomics = $(CONFIG_SHELL) $< |
Mark Rutland | 8d32588 | 2018-09-04 11:48:29 +0100 | [diff] [blame] | 71 | |
| 72 | old-atomics: scripts/atomic/check-atomics.sh FORCE |
| 73 | $(call cmd,atomics) |
| 74 | |
| 75 | ##### |
| 76 | # 6) Generate constants for Python GDB integration |
Kieran Bingham | f197d75 | 2016-05-23 16:24:40 -0700 | [diff] [blame] | 77 | # |
| 78 | |
| 79 | extra-$(CONFIG_GDB_SCRIPTS) += build_constants_py |
| 80 | |
Masahiro Yamada | 11fda14 | 2018-12-22 18:50:35 +0900 | [diff] [blame] | 81 | build_constants_py: $(timeconst-file) $(bounds-file) |
Kieran Bingham | f197d75 | 2016-05-23 16:24:40 -0700 | [diff] [blame] | 82 | @$(MAKE) $(build)=scripts/gdb/linux $@ |
| 83 | |
Nicholas Mc Guire | 0a22798 | 2015-05-18 14:19:12 +0200 | [diff] [blame] | 84 | # Keep these three files during make clean |
| 85 | no-clean-files := $(bounds-file) $(offsets-file) $(timeconst-file) |