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 |
Kieran Bingham | f197d75 | 2016-05-23 16:24:40 -0700 | [diff] [blame] | 9 | # 5) Generate constants.py (may need bounds.h) |
Sam Ravnborg | 86feeaa | 2005-09-09 19:28:28 +0200 | [diff] [blame] | 10 | |
Masahiro Yamada | 39664e2 | 2015-01-05 15:57:15 +0900 | [diff] [blame] | 11 | ##### |
| 12 | # 1) Generate bounds.h |
| 13 | |
| 14 | bounds-file := include/generated/bounds.h |
| 15 | |
| 16 | always := $(bounds-file) |
Masahiro Yamada | 8a58e16 | 2015-03-26 20:59:52 +0900 | [diff] [blame] | 17 | targets := kernel/bounds.s |
Masahiro Yamada | 39664e2 | 2015-01-05 15:57:15 +0900 | [diff] [blame] | 18 | |
Masahiro Yamada | 11fda14 | 2018-12-22 18:50:35 +0900 | [diff] [blame] | 19 | $(bounds-file): kernel/bounds.s FORCE |
Michal Marek | 70a4fd6 | 2015-03-11 11:01:01 +0100 | [diff] [blame] | 20 | $(call filechk,offsets,__LINUX_BOUNDS_H__) |
Masahiro Yamada | 39664e2 | 2015-01-05 15:57:15 +0900 | [diff] [blame] | 21 | |
| 22 | ##### |
Nicholas Mc Guire | 0a22798 | 2015-05-18 14:19:12 +0200 | [diff] [blame] | 23 | # 2) Generate timeconst.h |
| 24 | |
| 25 | timeconst-file := include/generated/timeconst.h |
| 26 | |
Nicholas Mc Guire | 0a22798 | 2015-05-18 14:19:12 +0200 | [diff] [blame] | 27 | targets += $(timeconst-file) |
| 28 | |
Masahiro Yamada | ba97df4 | 2019-01-03 10:16:54 +0900 | [diff] [blame] | 29 | filechk_gentimeconst = echo $(CONFIG_HZ) | bc -q $< |
Nicholas Mc Guire | 0a22798 | 2015-05-18 14:19:12 +0200 | [diff] [blame] | 30 | |
Masahiro Yamada | 11fda14 | 2018-12-22 18:50:35 +0900 | [diff] [blame] | 31 | $(timeconst-file): kernel/time/timeconst.bc FORCE |
Nicholas Mc Guire | 0a22798 | 2015-05-18 14:19:12 +0200 | [diff] [blame] | 32 | $(call filechk,gentimeconst) |
| 33 | |
| 34 | ##### |
| 35 | # 3) Generate asm-offsets.h |
Masahiro Yamada | 39664e2 | 2015-01-05 15:57:15 +0900 | [diff] [blame] | 36 | # |
| 37 | |
| 38 | offsets-file := include/generated/asm-offsets.h |
| 39 | |
| 40 | always += $(offsets-file) |
Masahiro Yamada | 39664e2 | 2015-01-05 15:57:15 +0900 | [diff] [blame] | 41 | targets += arch/$(SRCARCH)/kernel/asm-offsets.s |
| 42 | |
Masahiro Yamada | 11fda14 | 2018-12-22 18:50:35 +0900 | [diff] [blame] | 43 | arch/$(SRCARCH)/kernel/asm-offsets.s: $(timeconst-file) $(bounds-file) |
Sam Ravnborg | 86feeaa | 2005-09-09 19:28:28 +0200 | [diff] [blame] | 44 | |
Masahiro Yamada | 11fda14 | 2018-12-22 18:50:35 +0900 | [diff] [blame] | 45 | $(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s FORCE |
Michal Marek | 70a4fd6 | 2015-03-11 11:01:01 +0100 | [diff] [blame] | 46 | $(call filechk,offsets,__ASM_OFFSETS_H__) |
Sam Ravnborg | 86feeaa | 2005-09-09 19:28:28 +0200 | [diff] [blame] | 47 | |
Sam Ravnborg | c53aeca | 2007-03-27 22:50:29 +0200 | [diff] [blame] | 48 | ##### |
Nicholas Mc Guire | 0a22798 | 2015-05-18 14:19:12 +0200 | [diff] [blame] | 49 | # 4) Check for missing system calls |
Sam Ravnborg | c53aeca | 2007-03-27 22:50:29 +0200 | [diff] [blame] | 50 | # |
| 51 | |
Arnaud Lacombe | 5f7efb4 | 2011-08-24 21:03:30 -0400 | [diff] [blame] | 52 | always += missing-syscalls |
| 53 | targets += missing-syscalls |
| 54 | |
Sam Ravnborg | c53aeca | 2007-03-27 22:50:29 +0200 | [diff] [blame] | 55 | quiet_cmd_syscalls = CALL $< |
David Daney | 44656fa | 2011-11-08 10:20:10 -0800 | [diff] [blame] | 56 | cmd_syscalls = $(CONFIG_SHELL) $< $(CC) $(c_flags) $(missing_syscalls_flags) |
Sam Ravnborg | c53aeca | 2007-03-27 22:50:29 +0200 | [diff] [blame] | 57 | |
Arnaud Lacombe | 5f7efb4 | 2011-08-24 21:03:30 -0400 | [diff] [blame] | 58 | missing-syscalls: scripts/checksyscalls.sh $(offsets-file) FORCE |
Sam Ravnborg | c53aeca | 2007-03-27 22:50:29 +0200 | [diff] [blame] | 59 | $(call cmd,syscalls) |
Christoph Lameter | 1cdf25d | 2008-04-28 02:12:44 -0700 | [diff] [blame] | 60 | |
Kieran Bingham | f197d75 | 2016-05-23 16:24:40 -0700 | [diff] [blame] | 61 | ##### |
| 62 | # 5) Generate constants for Python GDB integration |
| 63 | # |
| 64 | |
| 65 | extra-$(CONFIG_GDB_SCRIPTS) += build_constants_py |
| 66 | |
Masahiro Yamada | 11fda14 | 2018-12-22 18:50:35 +0900 | [diff] [blame] | 67 | build_constants_py: $(timeconst-file) $(bounds-file) |
Kieran Bingham | f197d75 | 2016-05-23 16:24:40 -0700 | [diff] [blame] | 68 | @$(MAKE) $(build)=scripts/gdb/linux $@ |
| 69 | |
Nicholas Mc Guire | 0a22798 | 2015-05-18 14:19:12 +0200 | [diff] [blame] | 70 | # Keep these three files during make clean |
| 71 | no-clean-files := $(bounds-file) $(offsets-file) $(timeconst-file) |