VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   34 Branches   58 Tags
b24413180f560 (Greg Kroah-Hartman       2017-11-01 15:07:57 +0100    1) # SPDX-License-Identifier: GPL-2.0
bfeffd1552837 (Linus Torvalds           2019-01-06 17:08:20 -0800    2) VERSION = 5
fa55b7dcdc43c (Linus Torvalds           2021-11-14 13:56:52 -0800    3) PATCHLEVEL = 16
b90df4ec299a1 (Greg Kroah-Hartman       2022-03-23 09:18:50 +0100    4) SUBLEVEL = 17
df0cc57e057f1 (Linus Torvalds           2022-01-09 14:55:34 -0800    5) EXTRAVERSION =
a4849f6000e29 (Linus Torvalds           2021-11-25 18:21:20 -0800    6) NAME = Gobble Gobble
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700    7) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700    8) # *DOCUMENTATION*
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700    9) # To see a list of typical targets execute "make help"
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700   10) # More info can be located in ./README
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700   11) # Comments in this file are targeted only to the developer, do not
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700   12) # expect to learn how to build the kernel reading this file.
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700   13) 
121c2a137767d (Masahiro Yamada          2020-05-11 12:50:13 +0900   14) $(if $(filter __%, $(MAKECMDGOALS)), \
121c2a137767d (Masahiro Yamada          2020-05-11 12:50:13 +0900   15) 	$(error targets prefixed with '__' are only for internal use))
121c2a137767d (Masahiro Yamada          2020-05-11 12:50:13 +0900   16) 
ba634eceb535d (Masahiro Yamada          2017-10-04 12:56:05 +0900   17) # That's our default target when none is given on the command line
121c2a137767d (Masahiro Yamada          2020-05-11 12:50:13 +0900   18) PHONY := __all
121c2a137767d (Masahiro Yamada          2020-05-11 12:50:13 +0900   19) __all:
ba634eceb535d (Masahiro Yamada          2017-10-04 12:56:05 +0900   20) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700   21) # We are using a recursive build, so we need to do a little thinking
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700   22) # to get the ordering right.
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700   23) #
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700   24) # Most importantly: sub-Makefiles should only ever modify files in
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700   25) # their own directory. If in some directory we have a dependency on
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700   26) # a file in another dir (which doesn't happen often, but it's often
f49821ee32b76 (Nicholas Piggin          2018-02-11 00:25:04 +1000   27) # unavoidable when linking the built-in.a targets which finally
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700   28) # turn into vmlinux), we will call a sub make in that other dir, and
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700   29) # after that we are sure that everything which is in that other dir
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700   30) # is now up to date.
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700   31) #
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700   32) # The only cases where we need to modify files which have global
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700   33) # effects are thus separated out and done before the recursive
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700   34) # descending is started. They are now explicitly listed as the
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700   35) # prepare rule.
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700   36) 
221cc2d27ddc4 (Masahiro Yamada          2019-03-26 13:02:19 +0900   37) ifneq ($(sub_make_done),1)
3812b8c5c5d52 (Masahiro Yamada          2019-02-22 16:40:07 +0900   38) 
3812b8c5c5d52 (Masahiro Yamada          2019-02-22 16:40:07 +0900   39) # Do not use make's built-in rules and variables
3812b8c5c5d52 (Masahiro Yamada          2019-02-22 16:40:07 +0900   40) # (this increases performance and avoids hard-to-debug behaviour)
3812b8c5c5d52 (Masahiro Yamada          2019-02-22 16:40:07 +0900   41) MAKEFLAGS += -rR
3812b8c5c5d52 (Masahiro Yamada          2019-02-22 16:40:07 +0900   42) 
3812b8c5c5d52 (Masahiro Yamada          2019-02-22 16:40:07 +0900   43) # Avoid funny character set dependencies
3812b8c5c5d52 (Masahiro Yamada          2019-02-22 16:40:07 +0900   44) unexport LC_ALL
3812b8c5c5d52 (Masahiro Yamada          2019-02-22 16:40:07 +0900   45) LC_COLLATE=C
3812b8c5c5d52 (Masahiro Yamada          2019-02-22 16:40:07 +0900   46) LC_NUMERIC=C
3812b8c5c5d52 (Masahiro Yamada          2019-02-22 16:40:07 +0900   47) export LC_COLLATE LC_NUMERIC
3812b8c5c5d52 (Masahiro Yamada          2019-02-22 16:40:07 +0900   48) 
3812b8c5c5d52 (Masahiro Yamada          2019-02-22 16:40:07 +0900   49) # Avoid interference with shell env settings
3812b8c5c5d52 (Masahiro Yamada          2019-02-22 16:40:07 +0900   50) unexport GREP_OPTIONS
3812b8c5c5d52 (Masahiro Yamada          2019-02-22 16:40:07 +0900   51) 
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200   52) # Beautify output
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200   53) # ---------------------------------------------------------------------------
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200   54) #
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200   55) # Normally, we echo the whole command before executing it. By making
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200   56) # that echo $($(quiet)$(cmd)), we now have the possibility to set
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200   57) # $(quiet) to choose other forms of output instead, e.g.
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200   58) #
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200   59) #         quiet_cmd_cc_o_c = Compiling $(RELDIR)/$@
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200   60) #         cmd_cc_o_c       = $(CC) $(c_flags) -c -o $@ $<
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200   61) #
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200   62) # If $(quiet) is empty, the whole command will be printed.
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200   63) # If it is set to "quiet_", only the short version will be printed.
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200   64) # If it is set to "silent_", nothing will be printed at all, since
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200   65) # the variable $(silent_cmd_cc_o_c) doesn't exist.
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200   66) #
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200   67) # A simple variant is to prefix commands with $(Q) - that's useful
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200   68) # for commands that shall be hidden in non-verbose mode.
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200   69) #
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200   70) #	$(Q)ln $@ :<
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200   71) #
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200   72) # If KBUILD_VERBOSE equals 0 then the above command will be hidden.
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200   73) # If KBUILD_VERBOSE equals 1 then the above command is displayed.
505b12b3861bc (Randy Dunlap             2020-02-12 20:40:57 -0800   74) # If KBUILD_VERBOSE equals 2 then give the reason why each target is rebuilt.
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200   75) #
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700   76) # To put more focus on warnings, be less verbose as default
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700   77) # Use 'make V=1' to see the full commands
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700   78) 
b8b0618cf6fab (Cheng Renquan            2009-05-26 16:03:07 +0800   79) ifeq ("$(origin V)", "command line")
b8b0618cf6fab (Cheng Renquan            2009-05-26 16:03:07 +0800   80)   KBUILD_VERBOSE = $(V)
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700   81) endif
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700   82) ifndef KBUILD_VERBOSE
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700   83)   KBUILD_VERBOSE = 0
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700   84) endif
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700   85) 
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200   86) ifeq ($(KBUILD_VERBOSE),1)
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200   87)   quiet =
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200   88)   Q =
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200   89) else
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200   90)   quiet=quiet_
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200   91)   Q = @
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200   92) endif
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200   93) 
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200   94) # If the user is running make -s (silent mode), suppress echoing of
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200   95) # commands
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200   96) 
6f0fa58e45964 (Masahiro Yamada          2017-05-19 20:42:30 +0900   97) ifneq ($(findstring s,$(filter-out --%,$(MAKEFLAGS))),)
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200   98)   quiet=silent_
2214945422c14 (Masahiro Yamada          2021-02-27 15:26:20 +0900   99)   KBUILD_VERBOSE = 0
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200  100) endif
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200  101) 
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200  102) export quiet Q KBUILD_VERBOSE
066b7ed955808 (Michal Marek             2014-07-04 14:29:30 +0200  103) 
bcf637f54f6d2 (Masahiro Yamada          2021-02-22 01:53:06 +0900  104) # Call a source code checker (by default, "sparse") as part of the
bcf637f54f6d2 (Masahiro Yamada          2021-02-22 01:53:06 +0900  105) # C compilation.
bcf637f54f6d2 (Masahiro Yamada          2021-02-22 01:53:06 +0900  106) #
bcf637f54f6d2 (Masahiro Yamada          2021-02-22 01:53:06 +0900  107) # Use 'make C=1' to enable checking of only re-compiled files.
bcf637f54f6d2 (Masahiro Yamada          2021-02-22 01:53:06 +0900  108) # Use 'make C=2' to enable checking of *all* source files, regardless
bcf637f54f6d2 (Masahiro Yamada          2021-02-22 01:53:06 +0900  109) # of whether they are re-compiled or not.
bcf637f54f6d2 (Masahiro Yamada          2021-02-22 01:53:06 +0900  110) #
bcf637f54f6d2 (Masahiro Yamada          2021-02-22 01:53:06 +0900  111) # See the file "Documentation/dev-tools/sparse.rst" for more details,
bcf637f54f6d2 (Masahiro Yamada          2021-02-22 01:53:06 +0900  112) # including where to get the "sparse" utility.
bcf637f54f6d2 (Masahiro Yamada          2021-02-22 01:53:06 +0900  113) 
bcf637f54f6d2 (Masahiro Yamada          2021-02-22 01:53:06 +0900  114) ifeq ("$(origin C)", "command line")
bcf637f54f6d2 (Masahiro Yamada          2021-02-22 01:53:06 +0900  115)   KBUILD_CHECKSRC = $(C)
bcf637f54f6d2 (Masahiro Yamada          2021-02-22 01:53:06 +0900  116) endif
bcf637f54f6d2 (Masahiro Yamada          2021-02-22 01:53:06 +0900  117) ifndef KBUILD_CHECKSRC
bcf637f54f6d2 (Masahiro Yamada          2021-02-22 01:53:06 +0900  118)   KBUILD_CHECKSRC = 0
bcf637f54f6d2 (Masahiro Yamada          2021-02-22 01:53:06 +0900  119) endif
bcf637f54f6d2 (Masahiro Yamada          2021-02-22 01:53:06 +0900  120) 
bcf637f54f6d2 (Masahiro Yamada          2021-02-22 01:53:06 +0900  121) export KBUILD_CHECKSRC
bcf637f54f6d2 (Masahiro Yamada          2021-02-22 01:53:06 +0900  122) 
bcf637f54f6d2 (Masahiro Yamada          2021-02-22 01:53:06 +0900  123) # Use make M=dir or set the environment variable KBUILD_EXTMOD to specify the
bcf637f54f6d2 (Masahiro Yamada          2021-02-22 01:53:06 +0900  124) # directory of external module to build. Setting M= takes precedence.
bcf637f54f6d2 (Masahiro Yamada          2021-02-22 01:53:06 +0900  125) ifeq ("$(origin M)", "command line")
bcf637f54f6d2 (Masahiro Yamada          2021-02-22 01:53:06 +0900  126)   KBUILD_EXTMOD := $(M)
bcf637f54f6d2 (Masahiro Yamada          2021-02-22 01:53:06 +0900  127) endif
bcf637f54f6d2 (Masahiro Yamada          2021-02-22 01:53:06 +0900  128) 
bcf637f54f6d2 (Masahiro Yamada          2021-02-22 01:53:06 +0900  129) $(if $(word 2, $(KBUILD_EXTMOD)), \
bcf637f54f6d2 (Masahiro Yamada          2021-02-22 01:53:06 +0900  130) 	$(error building multiple external modules is not supported))
bcf637f54f6d2 (Masahiro Yamada          2021-02-22 01:53:06 +0900  131) 
74ee585b7eecd (Masahiro Yamada          2021-06-02 23:02:13 +0900  132) # Remove trailing slashes
74ee585b7eecd (Masahiro Yamada          2021-06-02 23:02:13 +0900  133) ifneq ($(filter %/, $(KBUILD_EXTMOD)),)
74ee585b7eecd (Masahiro Yamada          2021-06-02 23:02:13 +0900  134) KBUILD_EXTMOD := $(shell dirname $(KBUILD_EXTMOD).)
74ee585b7eecd (Masahiro Yamada          2021-06-02 23:02:13 +0900  135) endif
74ee585b7eecd (Masahiro Yamada          2021-06-02 23:02:13 +0900  136) 
bcf637f54f6d2 (Masahiro Yamada          2021-02-22 01:53:06 +0900  137) export KBUILD_EXTMOD
bcf637f54f6d2 (Masahiro Yamada          2021-02-22 01:53:06 +0900  138) 
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  139) # Kbuild will save output files in the current working directory.
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  140) # This does not need to match to the root of the kernel source tree.
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  141) #
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  142) # For example, you can do this:
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  143) #
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  144) #  cd /dir/to/store/output/files; make -f /dir/to/kernel/source/Makefile
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  145) #
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  146) # If you want to save output files in a different location, there are
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  147) # two syntaxes to specify it.
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  148) #
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  149) # 1) O=
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  150) # Use "make O=dir/to/store/output/files/"
070b98bfda3d2 (Sam Ravnborg             2006-06-25 00:07:55 +0200  151) #
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  152) # 2) Set KBUILD_OUTPUT
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  153) # Set the environment variable KBUILD_OUTPUT to point to the output directory.
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  154) # export KBUILD_OUTPUT=dir/to/store/output/files/; make
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  155) #
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  156) # The O= assignment takes precedence over the KBUILD_OUTPUT environment
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  157) # variable.
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  158) 
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  159) # Do we want to change the working directory?
b8b0618cf6fab (Cheng Renquan            2009-05-26 16:03:07 +0800  160) ifeq ("$(origin O)", "command line")
b8b0618cf6fab (Cheng Renquan            2009-05-26 16:03:07 +0800  161)   KBUILD_OUTPUT := $(O)
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  162) endif
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  163) 
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  164) ifneq ($(KBUILD_OUTPUT),)
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  165) # Make's built-in functions such as $(abspath ...), $(realpath ...) cannot
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  166) # expand a shell special character '~'. We use a somewhat tedious way here.
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  167) abs_objtree := $(shell mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) && pwd)
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  168) $(if $(abs_objtree),, \
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  169)      $(error failed to create output directory "$(KBUILD_OUTPUT)"))
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  170) 
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  171) # $(realpath ...) resolves symlinks
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  172) abs_objtree := $(realpath $(abs_objtree))
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  173) else
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  174) abs_objtree := $(CURDIR)
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  175) endif # ifneq ($(KBUILD_OUTPUT),)
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  176) 
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  177) ifeq ($(abs_objtree),$(CURDIR))
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  178) # Suppress "Entering directory ..." unless we are changing the work directory.
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  179) MAKEFLAGS += --no-print-directory
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  180) else
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  181) need-sub-make := 1
51193b76bfff5 (Robert Jarzmik           2016-04-02 21:38:53 +0200  182) endif
51193b76bfff5 (Robert Jarzmik           2016-04-02 21:38:53 +0200  183) 
30cef68d2d19e (Masahiro Yamada          2021-02-22 01:50:19 +0900  184) this-makefile := $(lastword $(MAKEFILE_LIST))
30cef68d2d19e (Masahiro Yamada          2021-02-22 01:50:19 +0900  185) abs_srctree := $(realpath $(dir $(this-makefile)))
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  186) 
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  187) ifneq ($(words $(subst :, ,$(abs_srctree))), 1)
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  188) $(error source directory cannot contain spaces or colons)
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  189) endif
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  190) 
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  191) ifneq ($(abs_srctree),$(abs_objtree))
80463f1b7bf9f (Masahiro Yamada          2018-09-14 15:33:23 +0900  192) # Look for make include files relative to root of kernel src
80463f1b7bf9f (Masahiro Yamada          2018-09-14 15:33:23 +0900  193) #
d828563955057 (Masahiro Yamada          2021-07-25 03:35:56 +0900  194) # --included-dir is added for backward compatibility, but you should not rely on
d828563955057 (Masahiro Yamada          2021-07-25 03:35:56 +0900  195) # it. Please add $(srctree)/ prefix to include Makefiles in the source tree.
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  196) MAKEFLAGS += --include-dir=$(abs_srctree)
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  197) endif
3812b8c5c5d52 (Masahiro Yamada          2019-02-22 16:40:07 +0900  198) 
688931a5ad4e5 (Masahiro Yamada          2019-03-19 13:02:36 +0900  199) ifneq ($(filter 3.%,$(MAKE_VERSION)),)
688931a5ad4e5 (Masahiro Yamada          2019-03-19 13:02:36 +0900  200) # 'MAKEFLAGS += -rR' does not immediately become effective for GNU Make 3.x
688931a5ad4e5 (Masahiro Yamada          2019-03-19 13:02:36 +0900  201) # We need to invoke sub-make to avoid implicit rules in the top Makefile.
688931a5ad4e5 (Masahiro Yamada          2019-03-19 13:02:36 +0900  202) need-sub-make := 1
688931a5ad4e5 (Masahiro Yamada          2019-03-19 13:02:36 +0900  203) # Cancel implicit rules for this Makefile.
93fdddfefc831 (Masahiro Yamada          2020-05-11 12:50:12 +0900  204) $(this-makefile): ;
688931a5ad4e5 (Masahiro Yamada          2019-03-19 13:02:36 +0900  205) endif
688931a5ad4e5 (Masahiro Yamada          2019-03-19 13:02:36 +0900  206) 
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  207) export abs_srctree abs_objtree
221cc2d27ddc4 (Masahiro Yamada          2019-03-26 13:02:19 +0900  208) export sub_make_done := 1
221cc2d27ddc4 (Masahiro Yamada          2019-03-26 13:02:19 +0900  209) 
688931a5ad4e5 (Masahiro Yamada          2019-03-19 13:02:36 +0900  210) ifeq ($(need-sub-make),1)
688931a5ad4e5 (Masahiro Yamada          2019-03-19 13:02:36 +0900  211) 
121c2a137767d (Masahiro Yamada          2020-05-11 12:50:13 +0900  212) PHONY += $(MAKECMDGOALS) __sub-make
0b35786d77ba4 (Milton Miller            2007-09-21 18:09:02 -0500  213) 
121c2a137767d (Masahiro Yamada          2020-05-11 12:50:13 +0900  214) $(filter-out $(this-makefile), $(MAKECMDGOALS)) __all: __sub-make
16f890988114a (Charles Keepax           2012-10-15 13:49:12 +0100  215) 	@:
0b35786d77ba4 (Milton Miller            2007-09-21 18:09:02 -0500  216) 
c4e6fff1ae572 (Cao jin                  2017-06-30 10:45:43 +0800  217) # Invoke a second make in the output directory, passing relevant variables
121c2a137767d (Masahiro Yamada          2020-05-11 12:50:13 +0900  218) __sub-make:
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  219) 	$(Q)$(MAKE) -C $(abs_objtree) -f $(abs_srctree)/Makefile $(MAKECMDGOALS)
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  220) 
688931a5ad4e5 (Masahiro Yamada          2019-03-19 13:02:36 +0900  221) endif # need-sub-make
221cc2d27ddc4 (Masahiro Yamada          2019-03-26 13:02:19 +0900  222) endif # sub_make_done
688931a5ad4e5 (Masahiro Yamada          2019-03-19 13:02:36 +0900  223) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  224) # We process the rest of the Makefile if this is the final invocation of make
688931a5ad4e5 (Masahiro Yamada          2019-03-19 13:02:36 +0900  225) ifeq ($(need-sub-make),)
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  226) 
7ff525712acf9 (Masahiro Yamada          2014-09-09 20:02:22 +0900  227) # Do not print "Entering directory ...",
7ff525712acf9 (Masahiro Yamada          2014-09-09 20:02:22 +0900  228) # but we want to display it when entering to the output directory
7ff525712acf9 (Masahiro Yamada          2014-09-09 20:02:22 +0900  229) # so that IDEs/editors are able to understand relative filenames.
7ff525712acf9 (Masahiro Yamada          2014-09-09 20:02:22 +0900  230) MAKEFLAGS += --no-print-directory
7ff525712acf9 (Masahiro Yamada          2014-09-09 20:02:22 +0900  231) 
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  232) ifeq ($(abs_srctree),$(abs_objtree))
9da0763bdd825 (Michal Marek             2014-04-25 23:25:18 +0200  233)         # building in the source tree
9da0763bdd825 (Michal Marek             2014-04-25 23:25:18 +0200  234)         srctree := .
051f278e9d81b (Masahiro Yamada          2019-07-06 12:07:12 +0900  235) 	building_out_of_srctree :=
9da0763bdd825 (Michal Marek             2014-04-25 23:25:18 +0200  236) else
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  237)         ifeq ($(abs_srctree)/,$(dir $(abs_objtree)))
9da0763bdd825 (Michal Marek             2014-04-25 23:25:18 +0200  238)                 # building in a subdirectory of the source tree
9da0763bdd825 (Michal Marek             2014-04-25 23:25:18 +0200  239)                 srctree := ..
9da0763bdd825 (Michal Marek             2014-04-25 23:25:18 +0200  240)         else
25b146c5b8cee (Masahiro Yamada          2019-03-30 21:04:14 +0900  241)                 srctree := $(abs_srctree)
9da0763bdd825 (Michal Marek             2014-04-25 23:25:18 +0200  242)         endif
051f278e9d81b (Masahiro Yamada          2019-07-06 12:07:12 +0900  243) 	building_out_of_srctree := 1
9da0763bdd825 (Michal Marek             2014-04-25 23:25:18 +0200  244) endif
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  245) 
95fd3f87bfbe8 (Masahiro Yamada          2019-07-06 12:07:13 +0900  246) ifneq ($(KBUILD_ABS_SRCTREE),)
95fd3f87bfbe8 (Masahiro Yamada          2019-07-06 12:07:13 +0900  247) srctree := $(abs_srctree)
95fd3f87bfbe8 (Masahiro Yamada          2019-07-06 12:07:13 +0900  248) endif
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  249) 
7e1c04779efd5 (Michal Marek             2014-04-25 17:29:45 +0200  250) objtree		:= .
6b12de69ad82c (Masahiro Yamada          2019-02-22 16:40:09 +0900  251) VPATH		:= $(srctree)
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  252) 
051f278e9d81b (Masahiro Yamada          2019-07-06 12:07:12 +0900  253) export building_out_of_srctree srctree objtree VPATH
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  254) 
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  255) # To make sure we do not include .config for any of the *config targets
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  256) # catch them early, and hand them over to scripts/kconfig/Makefile
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  257) # It is allowed to specify more targets when calling make, including
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  258) # mixing *config targets and build targets.
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  259) # For example 'make oldconfig all'.
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  260) # Detect when mixed targets is specified, and make a second invocation
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  261) # of make so .config is not included in this case either (for *config).
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  262) 
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  263) version_h := include/generated/uapi/linux/version.h
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  264) 
22340a06534a1 (Masahiro Yamada          2018-02-11 17:40:29 +0900  265) clean-targets := %clean mrproper cleandocs
22340a06534a1 (Masahiro Yamada          2018-02-11 17:40:29 +0900  266) no-dot-config-targets := $(clean-targets) \
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  267) 			 cscope gtags TAGS tags help% %docs check% coccicheck \
59b2bd05f5f4d (Masahiro Yamada          2019-06-04 19:14:02 +0900  268) 			 $(version_h) headers headers_% archheaders archscripts \
4623980dea7c6 (David Engraf             2020-03-26 20:29:33 +0100  269) 			 %asm-generic kernelversion %src-pkg dt_binding_check \
4623980dea7c6 (David Engraf             2020-03-26 20:29:33 +0100  270) 			 outputmakefile
805b2e1d427aa (Masahiro Yamada          2021-02-28 15:10:28 +0900  271) # Installation targets should not require compiler. Unfortunately, vdso_install
805b2e1d427aa (Masahiro Yamada          2021-02-28 15:10:28 +0900  272) # is an exception where build artifacts may be updated. This must be fixed.
805b2e1d427aa (Masahiro Yamada          2021-02-28 15:10:28 +0900  273) no-compiler-targets := $(no-dot-config-targets) install dtbs_install \
805b2e1d427aa (Masahiro Yamada          2021-02-28 15:10:28 +0900  274) 			headers_install modules_install kernelrelease image_name
993bdde945478 (Masahiro Yamada          2021-02-28 15:10:25 +0900  275) no-sync-config-targets := $(no-dot-config-targets) %install kernelrelease \
993bdde945478 (Masahiro Yamada          2021-02-28 15:10:25 +0900  276) 			  image_name
394053f4a4b3e (Masahiro Yamada          2019-08-15 00:19:18 +0900  277) single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.s %.symtypes %/
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  278) 
2042b5486bd31 (Masahiro Yamada          2019-08-11 00:53:03 +0900  279) config-build	:=
2042b5486bd31 (Masahiro Yamada          2019-08-11 00:53:03 +0900  280) mixed-build	:=
2042b5486bd31 (Masahiro Yamada          2019-08-11 00:53:03 +0900  281) need-config	:= 1
805b2e1d427aa (Masahiro Yamada          2021-02-28 15:10:28 +0900  282) need-compiler	:= 1
2042b5486bd31 (Masahiro Yamada          2019-08-11 00:53:03 +0900  283) may-sync-config	:= 1
394053f4a4b3e (Masahiro Yamada          2019-08-15 00:19:18 +0900  284) single-build	:=
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  285) 
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  286) ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  287) 	ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
2042b5486bd31 (Masahiro Yamada          2019-08-11 00:53:03 +0900  288) 		need-config :=
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  289) 	endif
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  290) endif
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  291) 
805b2e1d427aa (Masahiro Yamada          2021-02-28 15:10:28 +0900  292) ifneq ($(filter $(no-compiler-targets), $(MAKECMDGOALS)),)
805b2e1d427aa (Masahiro Yamada          2021-02-28 15:10:28 +0900  293) 	ifeq ($(filter-out $(no-compiler-targets), $(MAKECMDGOALS)),)
805b2e1d427aa (Masahiro Yamada          2021-02-28 15:10:28 +0900  294) 		need-compiler :=
805b2e1d427aa (Masahiro Yamada          2021-02-28 15:10:28 +0900  295) 	endif
805b2e1d427aa (Masahiro Yamada          2021-02-28 15:10:28 +0900  296) endif
805b2e1d427aa (Masahiro Yamada          2021-02-28 15:10:28 +0900  297) 
d79424137a731 (Masahiro Yamada          2018-07-20 16:46:34 +0900  298) ifneq ($(filter $(no-sync-config-targets), $(MAKECMDGOALS)),)
d79424137a731 (Masahiro Yamada          2018-07-20 16:46:34 +0900  299) 	ifeq ($(filter-out $(no-sync-config-targets), $(MAKECMDGOALS)),)
2042b5486bd31 (Masahiro Yamada          2019-08-11 00:53:03 +0900  300) 		may-sync-config :=
d79424137a731 (Masahiro Yamada          2018-07-20 16:46:34 +0900  301) 	endif
d79424137a731 (Masahiro Yamada          2018-07-20 16:46:34 +0900  302) endif
d79424137a731 (Masahiro Yamada          2018-07-20 16:46:34 +0900  303) 
d79424137a731 (Masahiro Yamada          2018-07-20 16:46:34 +0900  304) ifneq ($(KBUILD_EXTMOD),)
2042b5486bd31 (Masahiro Yamada          2019-08-11 00:53:03 +0900  305) 	may-sync-config :=
d79424137a731 (Masahiro Yamada          2018-07-20 16:46:34 +0900  306) endif
d79424137a731 (Masahiro Yamada          2018-07-20 16:46:34 +0900  307) 
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  308) ifeq ($(KBUILD_EXTMOD),)
efbf97265f9fc (Masahiro Yamada          2020-08-12 23:49:23 +0900  309)         ifneq ($(filter %config,$(MAKECMDGOALS)),)
2042b5486bd31 (Masahiro Yamada          2019-08-11 00:53:03 +0900  310) 		config-build := 1
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  311)                 ifneq ($(words $(MAKECMDGOALS)),1)
2042b5486bd31 (Masahiro Yamada          2019-08-11 00:53:03 +0900  312) 			mixed-build := 1
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  313)                 endif
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  314)         endif
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  315) endif
22340a06534a1 (Masahiro Yamada          2018-02-11 17:40:29 +0900  316) 
394053f4a4b3e (Masahiro Yamada          2019-08-15 00:19:18 +0900  317) # We cannot build single targets and the others at the same time
394053f4a4b3e (Masahiro Yamada          2019-08-15 00:19:18 +0900  318) ifneq ($(filter $(single-targets), $(MAKECMDGOALS)),)
394053f4a4b3e (Masahiro Yamada          2019-08-15 00:19:18 +0900  319) 	single-build := 1
394053f4a4b3e (Masahiro Yamada          2019-08-15 00:19:18 +0900  320) 	ifneq ($(filter-out $(single-targets), $(MAKECMDGOALS)),)
394053f4a4b3e (Masahiro Yamada          2019-08-15 00:19:18 +0900  321) 		mixed-build := 1
394053f4a4b3e (Masahiro Yamada          2019-08-15 00:19:18 +0900  322) 	endif
394053f4a4b3e (Masahiro Yamada          2019-08-15 00:19:18 +0900  323) endif
394053f4a4b3e (Masahiro Yamada          2019-08-15 00:19:18 +0900  324) 
22340a06534a1 (Masahiro Yamada          2018-02-11 17:40:29 +0900  325) # For "make -j clean all", "make -j mrproper defconfig all", etc.
22340a06534a1 (Masahiro Yamada          2018-02-11 17:40:29 +0900  326) ifneq ($(filter $(clean-targets),$(MAKECMDGOALS)),)
22340a06534a1 (Masahiro Yamada          2018-02-11 17:40:29 +0900  327)         ifneq ($(filter-out $(clean-targets),$(MAKECMDGOALS)),)
2042b5486bd31 (Masahiro Yamada          2019-08-11 00:53:03 +0900  328) 		mixed-build := 1
22340a06534a1 (Masahiro Yamada          2018-02-11 17:40:29 +0900  329)         endif
22340a06534a1 (Masahiro Yamada          2018-02-11 17:40:29 +0900  330) endif
22340a06534a1 (Masahiro Yamada          2018-02-11 17:40:29 +0900  331) 
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  332) # install and modules_install need also be processed one by one
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  333) ifneq ($(filter install,$(MAKECMDGOALS)),)
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  334)         ifneq ($(filter modules_install,$(MAKECMDGOALS)),)
2042b5486bd31 (Masahiro Yamada          2019-08-11 00:53:03 +0900  335) 		mixed-build := 1
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  336)         endif
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  337) endif
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  338) 
2042b5486bd31 (Masahiro Yamada          2019-08-11 00:53:03 +0900  339) ifdef mixed-build
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  340) # ===========================================================================
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  341) # We're called with mixed targets (*config and build targets).
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  342) # Handle them one by one.
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  343) 
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  344) PHONY += $(MAKECMDGOALS) __build_one_by_one
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  345) 
121c2a137767d (Masahiro Yamada          2020-05-11 12:50:13 +0900  346) $(MAKECMDGOALS): __build_one_by_one
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  347) 	@:
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  348) 
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  349) __build_one_by_one:
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  350) 	$(Q)set -e; \
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  351) 	for i in $(MAKECMDGOALS); do \
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  352) 		$(MAKE) -f $(srctree)/Makefile $$i; \
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  353) 	done
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  354) 
2042b5486bd31 (Masahiro Yamada          2019-08-11 00:53:03 +0900  355) else # !mixed-build
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  356) 
3204a7fb98a3b (Masahiro Yamada          2021-02-28 15:10:26 +0900  357) include $(srctree)/scripts/Kbuild.include
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  358) 
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  359) # Read KERNELRELEASE from include/config/kernel.release (if it exists)
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  360) KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  361) KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  362) export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  363) 
3204a7fb98a3b (Masahiro Yamada          2021-02-28 15:10:26 +0900  364) include $(srctree)/scripts/subarch.include
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  365) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  366) # Cross compiling and selecting different set of gcc/bin-utils
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  367) # ---------------------------------------------------------------------------
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  368) #
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  369) # When performing cross compilation for other architectures ARCH shall be set
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  370) # to the target architecture. (See arch/* for the possibilities).
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  371) # ARCH can be set during invocation of make:
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  372) # make ARCH=ia64
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  373) # Another way is to have ARCH set in the environment.
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  374) # The default ARCH is the host where make is executed.
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  375) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  376) # CROSS_COMPILE specify the prefix used for all executables used
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  377) # during compilation. Only gcc and related bin-utils executables
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  378) # are prefixed with $(CROSS_COMPILE).
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  379) # CROSS_COMPILE can be set on the command line
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  380) # make CROSS_COMPILE=ia64-linux-
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  381) # Alternatively CROSS_COMPILE can be set in the environment.
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  382) # Default value for CROSS_COMPILE is not to prefix executables
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  383) # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
2331d1a6cd3d6 (Sam Ravnborg             2009-10-11 23:22:58 +0200  384) ARCH		?= $(SUBARCH)
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  385) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  386) # Architecture as present in compile.h
6752ed90da032 (Thomas Gleixner          2007-10-11 11:11:36 +0200  387) UTS_MACHINE 	:= $(ARCH)
6752ed90da032 (Thomas Gleixner          2007-10-11 11:11:36 +0200  388) SRCARCH 	:= $(ARCH)
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  389) 
d746d647f31bd (Sam Ravnborg             2007-11-12 20:14:19 +0100  390) # Additional ARCH settings for x86
d746d647f31bd (Sam Ravnborg             2007-11-12 20:14:19 +0100  391) ifeq ($(ARCH),i386)
d746d647f31bd (Sam Ravnborg             2007-11-12 20:14:19 +0100  392)         SRCARCH := x86
d746d647f31bd (Sam Ravnborg             2007-11-12 20:14:19 +0100  393) endif
d746d647f31bd (Sam Ravnborg             2007-11-12 20:14:19 +0100  394) ifeq ($(ARCH),x86_64)
d746d647f31bd (Sam Ravnborg             2007-11-12 20:14:19 +0100  395)         SRCARCH := x86
d746d647f31bd (Sam Ravnborg             2007-11-12 20:14:19 +0100  396) endif
74b469f2e6b15 (Sam Ravnborg             2007-10-25 19:42:04 +0200  397) 
5e53879008b9a (Sam Ravnborg             2008-12-02 23:17:12 -0800  398) # Additional ARCH settings for sparc
e69f58c037ab5 (Namhyung Kim             2010-10-25 05:48:23 +0000  399) ifeq ($(ARCH),sparc32)
e69f58c037ab5 (Namhyung Kim             2010-10-25 05:48:23 +0000  400)        SRCARCH := sparc
e69f58c037ab5 (Namhyung Kim             2010-10-25 05:48:23 +0000  401) endif
a439fe51a1f8e (Sam Ravnborg             2008-07-27 23:00:59 +0200  402) ifeq ($(ARCH),sparc64)
5e53879008b9a (Sam Ravnborg             2008-12-02 23:17:12 -0800  403)        SRCARCH := sparc
a439fe51a1f8e (Sam Ravnborg             2008-07-27 23:00:59 +0200  404) endif
2fb9b1bd9dd7f (Sam Ravnborg             2008-06-21 00:24:17 +0200  405) 
5f6e0fe01b6b3 (Masahiro Yamada          2021-06-10 11:03:31 +0900  406) # Additional ARCH settings for parisc
5f6e0fe01b6b3 (Masahiro Yamada          2021-06-10 11:03:31 +0900  407) ifeq ($(ARCH),parisc64)
5f6e0fe01b6b3 (Masahiro Yamada          2021-06-10 11:03:31 +0900  408)        SRCARCH := parisc
5f6e0fe01b6b3 (Masahiro Yamada          2021-06-10 11:03:31 +0900  409) endif
5f6e0fe01b6b3 (Masahiro Yamada          2021-06-10 11:03:31 +0900  410) 
f02aa48dde8b9 (Masahiro Yamada          2021-04-10 23:31:58 +0900  411) export cross_compiling :=
f02aa48dde8b9 (Masahiro Yamada          2021-04-10 23:31:58 +0900  412) ifneq ($(SRCARCH),$(SUBARCH))
f02aa48dde8b9 (Masahiro Yamada          2021-04-10 23:31:58 +0900  413) cross_compiling := 1
f02aa48dde8b9 (Masahiro Yamada          2021-04-10 23:31:58 +0900  414) endif
f02aa48dde8b9 (Masahiro Yamada          2021-04-10 23:31:58 +0900  415) 
14cdd3c402bf7 (Roman Zippel             2006-06-08 22:12:51 -0700  416) KCONFIG_CONFIG	?= .config
41263fc6716de (Ben Gardiner             2010-12-14 11:39:44 -0500  417) export KCONFIG_CONFIG
14cdd3c402bf7 (Roman Zippel             2006-06-08 22:12:51 -0700  418) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  419) # SHELL used by kbuild
858805b336be1 (Masahiro Yamada          2019-08-25 22:28:37 +0900  420) CONFIG_SHELL := sh
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  421) 
6d79a7b424a56 (Masahiro Yamada          2018-07-12 19:38:36 +0900  422) HOST_LFS_CFLAGS := $(shell getconf LFS_CFLAGS 2>/dev/null)
6d79a7b424a56 (Masahiro Yamada          2018-07-12 19:38:36 +0900  423) HOST_LFS_LDFLAGS := $(shell getconf LFS_LDFLAGS 2>/dev/null)
6d79a7b424a56 (Masahiro Yamada          2018-07-12 19:38:36 +0900  424) HOST_LFS_LIBS := $(shell getconf LFS_LIBS 2>/dev/null)
d7f14c66c273b (Uwe Kleine-König         2017-07-09 20:02:36 +0200  425) 
a0d1c951ef08e (Masahiro Yamada          2020-04-08 10:36:23 +0900  426) ifneq ($(LLVM),)
a0d1c951ef08e (Masahiro Yamada          2020-04-08 10:36:23 +0900  427) HOSTCC	= clang
a0d1c951ef08e (Masahiro Yamada          2020-04-08 10:36:23 +0900  428) HOSTCXX	= clang++
a0d1c951ef08e (Masahiro Yamada          2020-04-08 10:36:23 +0900  429) else
a0d1c951ef08e (Masahiro Yamada          2020-04-08 10:36:23 +0900  430) HOSTCC	= gcc
a0d1c951ef08e (Masahiro Yamada          2020-04-08 10:36:23 +0900  431) HOSTCXX	= g++
a0d1c951ef08e (Masahiro Yamada          2020-04-08 10:36:23 +0900  432) endif
7f3a59db274c3 (Masahiro Yamada          2020-04-29 12:45:14 +0900  433) 
7f3a59db274c3 (Masahiro Yamada          2020-04-29 12:45:14 +0900  434) export KBUILD_USERCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes \
7f3a59db274c3 (Masahiro Yamada          2020-04-29 12:45:14 +0900  435) 			      -O2 -fomit-frame-pointer -std=gnu89
7f3a59db274c3 (Masahiro Yamada          2020-04-29 12:45:14 +0900  436) export KBUILD_USERLDFLAGS :=
7f3a59db274c3 (Masahiro Yamada          2020-04-29 12:45:14 +0900  437) 
7f3a59db274c3 (Masahiro Yamada          2020-04-29 12:45:14 +0900  438) KBUILD_HOSTCFLAGS   := $(KBUILD_USERCFLAGS) $(HOST_LFS_CFLAGS) $(HOSTCFLAGS)
735aab1e008b6 (Masahiro Yamada          2020-03-25 12:14:32 +0900  439) KBUILD_HOSTCXXFLAGS := -Wall -O2 $(HOST_LFS_CFLAGS) $(HOSTCXXFLAGS)
f92d19e0ef9bb (Laura Abbott             2018-07-09 17:46:02 -0700  440) KBUILD_HOSTLDFLAGS  := $(HOST_LFS_LDFLAGS) $(HOSTLDFLAGS)
f92d19e0ef9bb (Laura Abbott             2018-07-09 17:46:02 -0700  441) KBUILD_HOSTLDLIBS   := $(HOST_LFS_LIBS) $(HOSTLDLIBS)
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  442) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  443) # Make variables (CC, etc...)
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  444) CPP		= $(CC) -E
a0d1c951ef08e (Masahiro Yamada          2020-04-08 10:36:23 +0900  445) ifneq ($(LLVM),)
a0d1c951ef08e (Masahiro Yamada          2020-04-08 10:36:23 +0900  446) CC		= clang
a0d1c951ef08e (Masahiro Yamada          2020-04-08 10:36:23 +0900  447) LD		= ld.lld
a0d1c951ef08e (Masahiro Yamada          2020-04-08 10:36:23 +0900  448) AR		= llvm-ar
a0d1c951ef08e (Masahiro Yamada          2020-04-08 10:36:23 +0900  449) NM		= llvm-nm
a0d1c951ef08e (Masahiro Yamada          2020-04-08 10:36:23 +0900  450) OBJCOPY		= llvm-objcopy
a0d1c951ef08e (Masahiro Yamada          2020-04-08 10:36:23 +0900  451) OBJDUMP		= llvm-objdump
a0d1c951ef08e (Masahiro Yamada          2020-04-08 10:36:23 +0900  452) READELF		= llvm-readelf
a0d1c951ef08e (Masahiro Yamada          2020-04-08 10:36:23 +0900  453) STRIP		= llvm-strip
a0d1c951ef08e (Masahiro Yamada          2020-04-08 10:36:23 +0900  454) else
a0d1c951ef08e (Masahiro Yamada          2020-04-08 10:36:23 +0900  455) CC		= $(CROSS_COMPILE)gcc
a0d1c951ef08e (Masahiro Yamada          2020-04-08 10:36:23 +0900  456) LD		= $(CROSS_COMPILE)ld
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  457) AR		= $(CROSS_COMPILE)ar
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  458) NM		= $(CROSS_COMPILE)nm
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  459) OBJCOPY		= $(CROSS_COMPILE)objcopy
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  460) OBJDUMP		= $(CROSS_COMPILE)objdump
eefb8c124fd96 (Dmitry Golovin           2019-12-05 00:54:41 +0200  461) READELF		= $(CROSS_COMPILE)readelf
a0d1c951ef08e (Masahiro Yamada          2020-04-08 10:36:23 +0900  462) STRIP		= $(CROSS_COMPILE)strip
a0d1c951ef08e (Masahiro Yamada          2020-04-08 10:36:23 +0900  463) endif
e83b9f55448af (Andrii Nakryiko          2019-04-02 09:49:50 -0700  464) PAHOLE		= pahole
c9a0f3b85e09d (Jiri Olsa                2020-07-11 23:53:24 +0200  465) RESOLVE_BTFIDS	= $(objtree)/tools/bpf/resolve_btfids/resolve_btfids
73a4f6dbe70a1 (Masahiro Yamada          2017-12-10 01:02:28 +0900  466) LEX		= flex
73a4f6dbe70a1 (Masahiro Yamada          2017-12-10 01:02:28 +0900  467) YACC		= bison
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  468) AWK		= awk
caa27b66bd718 (Sam Ravnborg             2009-07-20 21:37:11 +0200  469) INSTALLKERNEL  := installkernel
436e980e2ed52 (Dominique Martinet       2020-12-01 14:17:30 +0100  470) DEPMOD		= depmod
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  471) PERL		= perl
e9781b52d4e0e (Masahiro Yamada          2018-03-13 18:12:02 +0900  472) PYTHON3		= python3
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  473) CHECK		= sparse
858805b336be1 (Masahiro Yamada          2019-08-25 22:28:37 +0900  474) BASH		= bash
e4a42c82e943b (Denis Efremov            2020-06-08 12:59:44 +0300  475) KGZIP		= gzip
e4a42c82e943b (Denis Efremov            2020-06-08 12:59:44 +0300  476) KBZIP2		= bzip2
e4a42c82e943b (Denis Efremov            2020-06-08 12:59:44 +0300  477) KLZOP		= lzop
8dfb61dcbaceb (Denis Efremov            2020-06-05 10:39:55 +0300  478) LZMA		= lzma
8dfb61dcbaceb (Denis Efremov            2020-06-05 10:39:55 +0300  479) LZ4		= lz4c
8dfb61dcbaceb (Denis Efremov            2020-06-05 10:39:55 +0300  480) XZ		= xz
48f7ddf785af2 (Nick Terrell             2020-07-30 12:08:36 -0700  481) ZSTD		= zstd
8dfb61dcbaceb (Denis Efremov            2020-06-05 10:39:55 +0300  482) 
9741e07ece7c2 (Jiri Olsa                2021-10-29 14:57:29 +0200  483) PAHOLE_FLAGS	= $(shell PAHOLE=$(PAHOLE) $(srctree)/scripts/pahole-flags.sh)
9741e07ece7c2 (Jiri Olsa                2021-10-29 14:57:29 +0200  484) 
80a7d1d991e35 (Hannes Eder              2008-12-27 22:38:44 +0100  485) CHECKFLAGS     := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
6c49f359ca14f (Luc Van Oostenryck       2018-02-15 22:07:50 +0100  486) 		  -Wbitwise -Wno-return-void -Wno-unknown-attribute $(CF)
0c22be0712b87 (Douglas Anderson         2019-03-14 16:41:59 -0700  487) NOSTDINC_FLAGS :=
6588169d51656 (Sam Ravnborg             2010-07-28 17:33:09 +0200  488) CFLAGS_MODULE   =
6588169d51656 (Sam Ravnborg             2010-07-28 17:33:09 +0200  489) AFLAGS_MODULE   =
6588169d51656 (Sam Ravnborg             2010-07-28 17:33:09 +0200  490) LDFLAGS_MODULE  =
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  491) CFLAGS_KERNEL	=
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  492) AFLAGS_KERNEL	=
b36fad65d61ff (Michal Marek             2016-06-07 11:57:02 +0200  493) LDFLAGS_vmlinux =
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  494) 
abbf1590de22a (David Howells            2012-10-02 18:01:26 +0100  495) # Use USERINCLUDE when you must reference the UAPI directories only.
abbf1590de22a (David Howells            2012-10-02 18:01:26 +0100  496) USERINCLUDE    := \
9d022c540606a (Masahiro Yamada          2017-10-04 12:56:04 +0900  497) 		-I$(srctree)/arch/$(SRCARCH)/include/uapi \
9d022c540606a (Masahiro Yamada          2017-10-04 12:56:04 +0900  498) 		-I$(objtree)/arch/$(SRCARCH)/include/generated/uapi \
abbf1590de22a (David Howells            2012-10-02 18:01:26 +0100  499) 		-I$(srctree)/include/uapi \
3308b28569ba3 (Arnd Bergmann            2016-06-15 17:45:45 +0200  500) 		-I$(objtree)/include/generated/uapi \
ce6ed1c4c9876 (Masahiro Yamada          2021-03-04 20:37:08 +0900  501)                 -include $(srctree)/include/linux/compiler-version.h \
abbf1590de22a (David Howells            2012-10-02 18:01:26 +0100  502)                 -include $(srctree)/include/linux/kconfig.h
abbf1590de22a (David Howells            2012-10-02 18:01:26 +0100  503) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  504) # Use LINUXINCLUDE when you must reference the include/ directory.
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  505) # Needed to be compatible with the O= option
abbf1590de22a (David Howells            2012-10-02 18:01:26 +0100  506) LINUXINCLUDE    := \
9d022c540606a (Masahiro Yamada          2017-10-04 12:56:04 +0900  507) 		-I$(srctree)/arch/$(SRCARCH)/include \
9d022c540606a (Masahiro Yamada          2017-10-04 12:56:04 +0900  508) 		-I$(objtree)/arch/$(SRCARCH)/include/generated \
051f278e9d81b (Masahiro Yamada          2019-07-06 12:07:12 +0900  509) 		$(if $(building_out_of_srctree),-I$(srctree)/include) \
f8224f7f48017 (Masahiro Yamada          2017-06-06 16:15:28 +0900  510) 		-I$(objtree)/include \
f8224f7f48017 (Masahiro Yamada          2017-06-06 16:15:28 +0900  511) 		$(USERINCLUDE)
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  512) 
42a92bccd213c (Masahiro Yamada          2018-12-14 17:05:37 +0900  513) KBUILD_AFLAGS   := -D__ASSEMBLY__ -fno-PIE
eeb5687a71396 (Masahiro Yamada          2018-12-14 17:05:38 +0900  514) KBUILD_CFLAGS   := -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs \
42a92bccd213c (Masahiro Yamada          2018-12-14 17:05:37 +0900  515) 		   -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE \
b89f25ea78920 (Luc Van Oostenryck       2019-03-04 13:55:20 +0100  516) 		   -Werror=implicit-function-declaration -Werror=implicit-int \
172aad81a8824 (Olaf Hering              2020-10-11 20:54:31 +0200  517) 		   -Werror=return-type -Wno-format-security \
433dc2ebe7d17 (Masahiro Yamada          2017-10-12 18:22:25 +0900  518) 		   -std=gnu89
433dc2ebe7d17 (Masahiro Yamada          2017-10-12 18:22:25 +0900  519) KBUILD_CPPFLAGS := -D__KERNEL__
80c00ba942ee3 (Sam Ravnborg             2010-07-28 19:11:27 +0200  520) KBUILD_AFLAGS_KERNEL :=
80c00ba942ee3 (Sam Ravnborg             2010-07-28 19:11:27 +0200  521) KBUILD_CFLAGS_KERNEL :=
6588169d51656 (Sam Ravnborg             2010-07-28 17:33:09 +0200  522) KBUILD_AFLAGS_MODULE  := -DMODULE
6588169d51656 (Sam Ravnborg             2010-07-28 17:33:09 +0200  523) KBUILD_CFLAGS_MODULE  := -DMODULE
10df063855822 (Masahiro Yamada          2019-08-15 01:06:22 +0900  524) KBUILD_LDFLAGS_MODULE :=
d503ac531a524 (Masahiro Yamada          2018-08-24 08:20:39 +0900  525) KBUILD_LDFLAGS :=
5241ab4cf42d3 (Masahiro Yamada          2019-07-29 18:15:17 +0900  526) CLANG_FLAGS :=
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  527) 
aa824e0c962b5 (Masahiro Yamada          2020-03-26 14:57:18 +0900  528) export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC
d9b5665fb3c82 (Vasily Gorbik            2020-10-23 13:57:32 +0200  529) export CPP AR NM STRIP OBJCOPY OBJDUMP READELF PAHOLE RESOLVE_BTFIDS LEX YACC AWK INSTALLKERNEL
d8d2d38275c1b (Masahiro Yamada          2021-02-01 10:00:24 +0900  530) export PERL PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX
48f7ddf785af2 (Nick Terrell             2020-07-30 12:08:36 -0700  531) export KGZIP KBZIP2 KLZOP LZMA LZ4 XZ ZSTD
7bac98707f65b (Vasily Gorbik            2019-01-21 13:54:39 +0100  532) export KBUILD_HOSTCXXFLAGS KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS LDFLAGS_MODULE
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  533) 
d503ac531a524 (Masahiro Yamada          2018-08-24 08:20:39 +0900  534) export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS KBUILD_LDFLAGS
0e410e158e5ba (Andrey Konovalov         2018-02-06 15:36:00 -0800  535) export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
222d394d30e74 (Sam Ravnborg             2007-10-15 21:59:31 +0200  536) export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
6588169d51656 (Sam Ravnborg             2010-07-28 17:33:09 +0200  537) export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE
80c00ba942ee3 (Sam Ravnborg             2010-07-28 19:11:27 +0200  538) export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL
9741e07ece7c2 (Jiri Olsa                2021-10-29 14:57:29 +0200  539) export PAHOLE_FLAGS
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  540) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  541) # Files to ignore in find ... statements
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  542) 
ae63b2d7bdd9b (Prarit Bhargava          2014-02-06 07:51:42 -0500  543) export RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o    \
ae63b2d7bdd9b (Prarit Bhargava          2014-02-06 07:51:42 -0500  544) 			  -name CVS -o -name .pc -o -name .hg -o -name .git \) \
ae63b2d7bdd9b (Prarit Bhargava          2014-02-06 07:51:42 -0500  545) 			  -prune -o
450c6076a79eb (Jesper Juhl              2012-02-16 22:49:15 +0100  546) export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn \
450c6076a79eb (Jesper Juhl              2012-02-16 22:49:15 +0100  547) 			 --exclude CVS --exclude .pc --exclude .hg --exclude .git
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  548) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  549) # ===========================================================================
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  550) # Rules shared between *config targets and build targets
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  551) 
312a3d0918bb7 (Cao jin                  2017-08-02 10:31:06 +0800  552) # Basic helpers built in scripts/basic/
4f1933620f571 (Paul Smith               2006-03-05 17:14:10 -0500  553) PHONY += scripts_basic
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  554) scripts_basic:
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  555) 	$(Q)$(MAKE) $(build)=scripts/basic
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  556) 
4f1933620f571 (Paul Smith               2006-03-05 17:14:10 -0500  557) PHONY += outputmakefile
2728fcfa4fcc0 (Masahiro Yamada          2021-05-17 16:03:11 +0900  558) ifdef building_out_of_srctree
e8e83a236d36d (Masahiro Yamada          2019-08-22 13:46:11 +0900  559) # Before starting out-of-tree build, make sure the source tree is clean.
fd5f0cd6b0cef (Jan Beulich              2006-05-02 12:33:20 +0200  560) # outputmakefile generates a Makefile in the output directory, if using a
fd5f0cd6b0cef (Jan Beulich              2006-05-02 12:33:20 +0200  561) # separate output directory. This allows convenient use of make in the
fd5f0cd6b0cef (Jan Beulich              2006-05-02 12:33:20 +0200  562) # output directory.
3a51ff344204e (Vladimir Kondratiev      2019-02-03 10:48:40 +0200  563) # At the same time when output Makefile generated, generate .gitignore to
3a51ff344204e (Vladimir Kondratiev      2019-02-03 10:48:40 +0200  564) # ignore whole output directory
2728fcfa4fcc0 (Masahiro Yamada          2021-05-17 16:03:11 +0900  565) 
2728fcfa4fcc0 (Masahiro Yamada          2021-05-17 16:03:11 +0900  566) quiet_cmd_makefile = GEN     Makefile
2728fcfa4fcc0 (Masahiro Yamada          2021-05-17 16:03:11 +0900  567)       cmd_makefile = { \
2728fcfa4fcc0 (Masahiro Yamada          2021-05-17 16:03:11 +0900  568) 	echo "\# Automatically generated by $(srctree)/Makefile: don't edit"; \
2728fcfa4fcc0 (Masahiro Yamada          2021-05-17 16:03:11 +0900  569) 	echo "include $(srctree)/Makefile"; \
2728fcfa4fcc0 (Masahiro Yamada          2021-05-17 16:03:11 +0900  570) 	} > Makefile
2728fcfa4fcc0 (Masahiro Yamada          2021-05-17 16:03:11 +0900  571) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  572) outputmakefile:
e8e83a236d36d (Masahiro Yamada          2019-08-22 13:46:11 +0900  573) 	$(Q)if [ -f $(srctree)/.config -o \
e8e83a236d36d (Masahiro Yamada          2019-08-22 13:46:11 +0900  574) 		 -d $(srctree)/include/config -o \
e8e83a236d36d (Masahiro Yamada          2019-08-22 13:46:11 +0900  575) 		 -d $(srctree)/arch/$(SRCARCH)/include/generated ]; then \
e8e83a236d36d (Masahiro Yamada          2019-08-22 13:46:11 +0900  576) 		echo >&2 "***"; \
e8e83a236d36d (Masahiro Yamada          2019-08-22 13:46:11 +0900  577) 		echo >&2 "*** The source tree is not clean, please run 'make$(if $(findstring command line, $(origin ARCH)), ARCH=$(ARCH)) mrproper'"; \
e8e83a236d36d (Masahiro Yamada          2019-08-22 13:46:11 +0900  578) 		echo >&2 "*** in $(abs_srctree)";\
e8e83a236d36d (Masahiro Yamada          2019-08-22 13:46:11 +0900  579) 		echo >&2 "***"; \
e8e83a236d36d (Masahiro Yamada          2019-08-22 13:46:11 +0900  580) 		false; \
e8e83a236d36d (Masahiro Yamada          2019-08-22 13:46:11 +0900  581) 	fi
929799973ba4a (Andi Kleen               2009-01-10 04:56:13 +0100  582) 	$(Q)ln -fsn $(srctree) source
2728fcfa4fcc0 (Masahiro Yamada          2021-05-17 16:03:11 +0900  583) 	$(call cmd,makefile)
156e7cbb3ef50 (Masahiro Yamada          2019-03-26 13:26:58 +0900  584) 	$(Q)test -e .gitignore || \
156e7cbb3ef50 (Masahiro Yamada          2019-03-26 13:26:58 +0900  585) 	{ echo "# this is build directory, ignore it"; echo "*"; } > .gitignore
fd5f0cd6b0cef (Jan Beulich              2006-05-02 12:33:20 +0200  586) endif
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  587) 
db07562aeac77 (Nick Desaulniers         2021-02-05 14:01:25 -0800  588) # The expansion should be delayed until arch/$(SRCARCH)/Makefile is included.
db07562aeac77 (Nick Desaulniers         2021-02-05 14:01:25 -0800  589) # Some architectures define CROSS_COMPILE in arch/$(SRCARCH)/Makefile.
db07562aeac77 (Nick Desaulniers         2021-02-05 14:01:25 -0800  590) # CC_VERSION_TEXT is referenced from Kconfig (so it needs export),
db07562aeac77 (Nick Desaulniers         2021-02-05 14:01:25 -0800  591) # and from include/config/auto.conf.cmd to detect the compiler upgrade.
6072b2c49d23e (Masahiro Yamada          2021-08-01 11:53:46 +0900  592) CC_VERSION_TEXT = $(subst $(pound),,$(shell LC_ALL=C $(CC) --version 2>/dev/null | head -n 1))
db07562aeac77 (Nick Desaulniers         2021-02-05 14:01:25 -0800  593) 
db07562aeac77 (Nick Desaulniers         2021-02-05 14:01:25 -0800  594) ifneq ($(findstring clang,$(CC_VERSION_TEXT)),)
6f5b41a2f5a63 (Nick Desaulniers         2021-08-02 11:39:08 -0700  595) include $(srctree)/scripts/Makefile.clang
ae6b289a37890 (Chris Fries              2017-11-07 11:46:13 -0800  596) endif
ae6b289a37890 (Chris Fries              2017-11-07 11:46:13 -0800  597) 
57fd251c78964 (Masahiro Yamada          2021-02-28 15:10:27 +0900  598) # Include this also for config targets because some architectures need
57fd251c78964 (Masahiro Yamada          2021-02-28 15:10:27 +0900  599) # cc-cross-prefix to determine CROSS_COMPILE.
805b2e1d427aa (Masahiro Yamada          2021-02-28 15:10:28 +0900  600) ifdef need-compiler
57fd251c78964 (Masahiro Yamada          2021-02-28 15:10:27 +0900  601) include $(srctree)/scripts/Makefile.compiler
805b2e1d427aa (Masahiro Yamada          2021-02-28 15:10:28 +0900  602) endif
57fd251c78964 (Masahiro Yamada          2021-02-28 15:10:27 +0900  603) 
2042b5486bd31 (Masahiro Yamada          2019-08-11 00:53:03 +0900  604) ifdef config-build
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  605) # ===========================================================================
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  606) # *config targets only - make sure prerequisites are updated, and descend
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  607) # in scripts/kconfig to make the *config target
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  608) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  609) # Read arch specific Makefile to set KBUILD_DEFCONFIG as needed.
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  610) # KBUILD_DEFCONFIG may point out an alternative default configuration
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  611) # used for 'make defconfig'
3204a7fb98a3b (Masahiro Yamada          2021-02-28 15:10:26 +0900  612) include $(srctree)/arch/$(SRCARCH)/Makefile
315bab4e972d9 (Masahiro Yamada          2018-06-08 09:21:43 +0900  613) export KBUILD_DEFCONFIG KBUILD_KCONFIG CC_VERSION_TEXT
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  614) 
36de077b20d05 (Masahiro Yamada          2019-08-22 13:46:13 +0900  615) config: outputmakefile scripts_basic FORCE
31110ebbec868 (Sam Ravnborg             2008-12-13 23:00:45 +0100  616) 	$(Q)$(MAKE) $(build)=scripts/kconfig $@
31110ebbec868 (Sam Ravnborg             2008-12-13 23:00:45 +0100  617) 
36de077b20d05 (Masahiro Yamada          2019-08-22 13:46:13 +0900  618) %config: outputmakefile scripts_basic FORCE
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  619) 	$(Q)$(MAKE) $(build)=scripts/kconfig $@
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  620) 
2042b5486bd31 (Masahiro Yamada          2019-08-11 00:53:03 +0900  621) else #!config-build
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  622) # ===========================================================================
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  623) # Build targets only - this includes vmlinux, arch specific targets, clean
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  624) # targets and others. In general all targets except *config targets.
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  625) 
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  626) # If building an external module we do not care about the all: rule
121c2a137767d (Masahiro Yamada          2020-05-11 12:50:13 +0900  627) # but instead __all depend on modules
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  628) PHONY += all
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  629) ifeq ($(KBUILD_EXTMOD),)
121c2a137767d (Masahiro Yamada          2020-05-11 12:50:13 +0900  630) __all: all
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  631) else
121c2a137767d (Masahiro Yamada          2020-05-11 12:50:13 +0900  632) __all: modules
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  633) endif
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  634) 
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  635) # Decide whether to build built-in, modular, or both.
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  636) # Normally, just do built-in.
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  637) 
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  638) KBUILD_MODULES :=
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  639) KBUILD_BUILTIN := 1
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  640) 
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  641) # If we have only "make modules", don't compile built-in objects.
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  642) ifeq ($(MAKECMDGOALS),modules)
4b50c8c4eaf06 (Masahiro Yamada          2020-05-31 17:47:06 +0900  643)   KBUILD_BUILTIN :=
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  644) endif
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  645) 
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  646) # If we have "make <whatever> modules", compile modules
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  647) # in addition to whatever we do anyway.
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  648) # Just "make" or "make all" shall build modules as well
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  649) 
6ad7cbc015272 (Nathan Huckleberry       2020-08-22 23:56:18 +0900  650) ifneq ($(filter all modules nsdeps %compile_commands.json clang-%,$(MAKECMDGOALS)),)
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  651)   KBUILD_MODULES := 1
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  652) endif
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  653) 
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  654) ifeq ($(MAKECMDGOALS),)
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  655)   KBUILD_MODULES := 1
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  656) endif
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  657) 
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  658) export KBUILD_MODULES KBUILD_BUILTIN
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900  659) 
2042b5486bd31 (Masahiro Yamada          2019-08-11 00:53:03 +0900  660) ifdef need-config
d93a18f27e370 (Masahiro Yamada          2019-04-27 12:33:36 +0900  661) include include/config/auto.conf
d93a18f27e370 (Masahiro Yamada          2019-04-27 12:33:36 +0900  662) endif
d93a18f27e370 (Masahiro Yamada          2019-04-27 12:33:36 +0900  663) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  664) ifeq ($(KBUILD_EXTMOD),)
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  665) # Objects we will link into vmlinux / subdirs we need to visit
d92cc4d516439 (Masahiro Yamada          2021-05-12 16:57:25 +0900  666) core-y		:= init/ usr/ arch/$(SRCARCH)/
f96182e959a41 (Masahiro Yamada          2019-01-11 18:52:00 +0900  667) drivers-y	:= drivers/ sound/
d93a18f27e370 (Masahiro Yamada          2019-04-27 12:33:36 +0900  668) drivers-$(CONFIG_SAMPLES) += samples/
8b5f4eb3ab700 (Masahiro Yamada          2021-01-26 08:16:55 +0900  669) drivers-$(CONFIG_NET) += net/
8b5f4eb3ab700 (Masahiro Yamada          2021-01-26 08:16:55 +0900  670) drivers-y	+= virt/
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  671) libs-y		:= lib/
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  672) endif # KBUILD_EXTMOD
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  673) 
315bab4e972d9 (Masahiro Yamada          2018-06-08 09:21:43 +0900  674) # The all: target is the default when no target is given on the
315bab4e972d9 (Masahiro Yamada          2018-06-08 09:21:43 +0900  675) # command line.
315bab4e972d9 (Masahiro Yamada          2018-06-08 09:21:43 +0900  676) # This allow a user to issue only 'make' to build a kernel including modules
315bab4e972d9 (Masahiro Yamada          2018-06-08 09:21:43 +0900  677) # Defaults to vmlinux, but the arch makefile usually adds further targets
315bab4e972d9 (Masahiro Yamada          2018-06-08 09:21:43 +0900  678) all: vmlinux
315bab4e972d9 (Masahiro Yamada          2018-06-08 09:21:43 +0900  679) 
7d73c3e9c5140 (Nick Desaulniers         2021-08-16 13:25:01 -0700  680) CFLAGS_GCOV	:= -fprofile-arcs -ftest-coverage
7d73c3e9c5140 (Nick Desaulniers         2021-08-16 13:25:01 -0700  681) ifdef CONFIG_CC_IS_GCC
7d73c3e9c5140 (Nick Desaulniers         2021-08-16 13:25:01 -0700  682) CFLAGS_GCOV	+= -fno-tree-loop-im
7d73c3e9c5140 (Nick Desaulniers         2021-08-16 13:25:01 -0700  683) endif
5aadfdeb8de00 (Masahiro Yamada          2018-05-28 18:22:04 +0900  684) export CFLAGS_GCOV
315bab4e972d9 (Masahiro Yamada          2018-06-08 09:21:43 +0900  685) 
b1f4ff74fcb0e (Paulo Zanoni             2018-09-10 10:59:56 -0700  686) # The arch Makefiles can override CC_FLAGS_FTRACE. We may also append it later.
b1f4ff74fcb0e (Paulo Zanoni             2018-09-10 10:59:56 -0700  687) ifdef CONFIG_FUNCTION_TRACER
b1f4ff74fcb0e (Paulo Zanoni             2018-09-10 10:59:56 -0700  688)   CC_FLAGS_FTRACE := -pg
b1f4ff74fcb0e (Paulo Zanoni             2018-09-10 10:59:56 -0700  689) endif
b1f4ff74fcb0e (Paulo Zanoni             2018-09-10 10:59:56 -0700  690) 
7d73c3e9c5140 (Nick Desaulniers         2021-08-16 13:25:01 -0700  691) ifdef CONFIG_CC_IS_GCC
7d73c3e9c5140 (Nick Desaulniers         2021-08-16 13:25:01 -0700  692) RETPOLINE_CFLAGS	:= $(call cc-option,-mindirect-branch=thunk-extern -mindirect-branch-register)
7d73c3e9c5140 (Nick Desaulniers         2021-08-16 13:25:01 -0700  693) RETPOLINE_VDSO_CFLAGS	:= $(call cc-option,-mindirect-branch=thunk-inline -mindirect-branch-register)
7d73c3e9c5140 (Nick Desaulniers         2021-08-16 13:25:01 -0700  694) endif
7d73c3e9c5140 (Nick Desaulniers         2021-08-16 13:25:01 -0700  695) ifdef CONFIG_CC_IS_CLANG
7d73c3e9c5140 (Nick Desaulniers         2021-08-16 13:25:01 -0700  696) RETPOLINE_CFLAGS	:= -mretpoline-external-thunk
7d73c3e9c5140 (Nick Desaulniers         2021-08-16 13:25:01 -0700  697) RETPOLINE_VDSO_CFLAGS	:= -mretpoline
7d73c3e9c5140 (Nick Desaulniers         2021-08-16 13:25:01 -0700  698) endif
669e06b19de8f (Masahiro Yamada          2019-03-26 15:11:12 +0900  699) export RETPOLINE_CFLAGS
669e06b19de8f (Masahiro Yamada          2019-03-26 15:11:12 +0900  700) export RETPOLINE_VDSO_CFLAGS
669e06b19de8f (Masahiro Yamada          2019-03-26 15:11:12 +0900  701) 
3204a7fb98a3b (Masahiro Yamada          2021-02-28 15:10:26 +0900  702) include $(srctree)/arch/$(SRCARCH)/Makefile
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  703) 
2042b5486bd31 (Masahiro Yamada          2019-08-11 00:53:03 +0900  704) ifdef need-config
2042b5486bd31 (Masahiro Yamada          2019-08-11 00:53:03 +0900  705) ifdef may-sync-config
315bab4e972d9 (Masahiro Yamada          2018-06-08 09:21:43 +0900  706) # Read in dependencies to all Kconfig* files, make sure to run syncconfig if
315bab4e972d9 (Masahiro Yamada          2018-06-08 09:21:43 +0900  707) # changes are detected. This should be included after arch/$(SRCARCH)/Makefile
315bab4e972d9 (Masahiro Yamada          2018-06-08 09:21:43 +0900  708) # because some architectures define CROSS_COMPILE there.
d2f8ae0e4c5c7 (Masahiro Yamada          2019-05-12 11:13:48 +0900  709) include include/config/auto.conf.cmd
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  710) 
058507195b534 (Masahiro Yamada          2019-02-22 16:40:11 +0900  711) $(KCONFIG_CONFIG):
058507195b534 (Masahiro Yamada          2019-02-22 16:40:11 +0900  712) 	@echo >&2 '***'
058507195b534 (Masahiro Yamada          2019-02-22 16:40:11 +0900  713) 	@echo >&2 '*** Configuration file "$@" not found!'
058507195b534 (Masahiro Yamada          2019-02-22 16:40:11 +0900  714) 	@echo >&2 '***'
058507195b534 (Masahiro Yamada          2019-02-22 16:40:11 +0900  715) 	@echo >&2 '*** Please run some configurator (e.g. "make oldconfig" or'
058507195b534 (Masahiro Yamada          2019-02-22 16:40:11 +0900  716) 	@echo >&2 '*** "make menuconfig" or "make xconfig").'
058507195b534 (Masahiro Yamada          2019-02-22 16:40:11 +0900  717) 	@echo >&2 '***'
058507195b534 (Masahiro Yamada          2019-02-22 16:40:11 +0900  718) 	@/bin/false
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  719) 
61277981dd535 (Ulf Magnusson            2018-02-13 08:58:20 +0100  720) # The actual configuration files used during the build are stored in
61277981dd535 (Ulf Magnusson            2018-02-13 08:58:20 +0100  721) # include/generated/ and include/config/. Update them if .config is newer than
61277981dd535 (Ulf Magnusson            2018-02-13 08:58:20 +0100  722) # include/config/auto.conf (which mirrors .config).
9390dff66a52d (Masahiro Yamada          2019-02-22 16:40:10 +0900  723) #
9390dff66a52d (Masahiro Yamada          2019-02-22 16:40:10 +0900  724) # This exploits the 'multi-target pattern rule' trick.
9390dff66a52d (Masahiro Yamada          2019-02-22 16:40:10 +0900  725) # The syncconfig should be executed only once to make all the targets.
f463c3510d44a (Masahiro Yamada          2020-03-25 12:16:30 +0900  726) # (Note: use the grouped target '&:' when we bump to GNU Make 4.3)
d952cfaf0cffd (Masahiro Yamada          2021-07-14 13:23:49 +0900  727) #
d952cfaf0cffd (Masahiro Yamada          2021-07-14 13:23:49 +0900  728) # Do not use $(call cmd,...) here. That would suppress prompts from syncconfig,
d952cfaf0cffd (Masahiro Yamada          2021-07-14 13:23:49 +0900  729) # so you cannot notice that Kconfig is waiting for the user input.
3044dd05289d6 (Masahiro Yamada          2020-05-01 15:01:41 +0900  730) %/config/auto.conf %/config/auto.conf.cmd %/generated/autoconf.h: $(KCONFIG_CONFIG)
d952cfaf0cffd (Masahiro Yamada          2021-07-14 13:23:49 +0900  731) 	$(Q)$(kecho) "  SYNC    $@"
d952cfaf0cffd (Masahiro Yamada          2021-07-14 13:23:49 +0900  732) 	$(Q)$(MAKE) -f $(srctree)/Makefile syncconfig
2042b5486bd31 (Masahiro Yamada          2019-08-11 00:53:03 +0900  733) else # !may-sync-config
d79424137a731 (Masahiro Yamada          2018-07-20 16:46:34 +0900  734) # External modules and some install targets need include/generated/autoconf.h
d79424137a731 (Masahiro Yamada          2018-07-20 16:46:34 +0900  735) # and include/config/auto.conf but do not care if they are up-to-date.
d79424137a731 (Masahiro Yamada          2018-07-20 16:46:34 +0900  736) # Use auto.conf to trigger the test
9ee4e3365dd0d (Sam Ravnborg             2006-08-07 21:01:36 +0200  737) PHONY += include/config/auto.conf
9ee4e3365dd0d (Sam Ravnborg             2006-08-07 21:01:36 +0200  738) 
9ee4e3365dd0d (Sam Ravnborg             2006-08-07 21:01:36 +0200  739) include/config/auto.conf:
264a26838056f (Sam Ravnborg             2009-10-18 00:49:24 +0200  740) 	$(Q)test -e include/generated/autoconf.h -a -e $@ || (		\
5369f55021feb (Michal Marek             2012-07-07 23:04:40 +0200  741) 	echo >&2;							\
5369f55021feb (Michal Marek             2012-07-07 23:04:40 +0200  742) 	echo >&2 "  ERROR: Kernel configuration is invalid.";		\
5369f55021feb (Michal Marek             2012-07-07 23:04:40 +0200  743) 	echo >&2 "         include/generated/autoconf.h or $@ are missing.";\
5369f55021feb (Michal Marek             2012-07-07 23:04:40 +0200  744) 	echo >&2 "         Run 'make oldconfig && make prepare' on kernel src to fix it.";	\
5369f55021feb (Michal Marek             2012-07-07 23:04:40 +0200  745) 	echo >&2 ;							\
9ee4e3365dd0d (Sam Ravnborg             2006-08-07 21:01:36 +0200  746) 	/bin/false)
9ee4e3365dd0d (Sam Ravnborg             2006-08-07 21:01:36 +0200  747) 
d79424137a731 (Masahiro Yamada          2018-07-20 16:46:34 +0900  748) endif # may-sync-config
2042b5486bd31 (Masahiro Yamada          2019-08-11 00:53:03 +0900  749) endif # need-config
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  750) 
7d73c3e9c5140 (Nick Desaulniers         2021-08-16 13:25:01 -0700  751) KBUILD_CFLAGS	+= -fno-delete-null-pointer-checks
ef6000b4c6706 (Linus Torvalds           2016-10-12 10:23:41 -0700  752) KBUILD_CFLAGS	+= $(call cc-disable-warning,frame-address,)
bd664f6b3e376 (Linus Torvalds           2017-07-12 19:25:47 -0700  753) KBUILD_CFLAGS	+= $(call cc-disable-warning, format-truncation)
bd664f6b3e376 (Linus Torvalds           2017-07-12 19:25:47 -0700  754) KBUILD_CFLAGS	+= $(call cc-disable-warning, format-overflow)
6f303d60534c4 (Linus Torvalds           2019-05-01 11:05:41 -0700  755) KBUILD_CFLAGS	+= $(call cc-disable-warning, address-of-packed-member)
a1c48bb160f83 (Geert Uytterhoeven       2014-05-27 09:54:12 +0200  756) 
15f5db60a1374 (Masahiro Yamada          2019-08-21 02:09:40 +0900  757) ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE
15f5db60a1374 (Masahiro Yamada          2019-08-21 02:09:40 +0900  758) KBUILD_CFLAGS += -O2
15f5db60a1374 (Masahiro Yamada          2019-08-21 02:09:40 +0900  759) else ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3
15f5db60a1374 (Masahiro Yamada          2019-08-21 02:09:40 +0900  760) KBUILD_CFLAGS += -O3
15f5db60a1374 (Masahiro Yamada          2019-08-21 02:09:40 +0900  761) else ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
15f5db60a1374 (Masahiro Yamada          2019-08-21 02:09:40 +0900  762) KBUILD_CFLAGS += -Os
815eb71e7149e (Arnd Bergmann            2016-04-25 17:35:28 +0200  763) endif
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  764) 
69102311a57d1 (Jiri Kosina              2014-08-06 16:08:43 -0700  765) # Tell gcc to never replace conditional load with a non-conditional one
7d73c3e9c5140 (Nick Desaulniers         2021-08-16 13:25:01 -0700  766) ifdef CONFIG_CC_IS_GCC
7d73c3e9c5140 (Nick Desaulniers         2021-08-16 13:25:01 -0700  767) # gcc-10 renamed --param=allow-store-data-races=0 to
7d73c3e9c5140 (Nick Desaulniers         2021-08-16 13:25:01 -0700  768) # -fno-allow-store-data-races.
69102311a57d1 (Jiri Kosina              2014-08-06 16:08:43 -0700  769) KBUILD_CFLAGS	+= $(call cc-option,--param=allow-store-data-races=0)
b1112139a103b (Sergei Trofimovich       2020-03-17 00:07:18 +0000  770) KBUILD_CFLAGS	+= $(call cc-option,-fno-allow-store-data-races)
7d73c3e9c5140 (Nick Desaulniers         2021-08-16 13:25:01 -0700  771) endif
69102311a57d1 (Jiri Kosina              2014-08-06 16:08:43 -0700  772) 
1873e870fd63e (Andi Kleen               2012-03-28 11:51:18 -0700  773) ifdef CONFIG_READABLE_ASM
1873e870fd63e (Andi Kleen               2012-03-28 11:51:18 -0700  774) # Disable optimizations that make assembler listings hard to read.
1873e870fd63e (Andi Kleen               2012-03-28 11:51:18 -0700  775) # reorder blocks reorders the control in the function
1873e870fd63e (Andi Kleen               2012-03-28 11:51:18 -0700  776) # ipa clone creates specialized cloned functions
1873e870fd63e (Andi Kleen               2012-03-28 11:51:18 -0700  777) # partial inlining inlines only parts of functions
7d73c3e9c5140 (Nick Desaulniers         2021-08-16 13:25:01 -0700  778) KBUILD_CFLAGS += -fno-reorder-blocks -fno-ipa-cp-clone -fno-partial-inlining
1873e870fd63e (Andi Kleen               2012-03-28 11:51:18 -0700  779) endif
1873e870fd63e (Andi Kleen               2012-03-28 11:51:18 -0700  780) 
08f67461c609a (Mike Frysinger           2009-06-04 16:29:08 -0700  781) ifneq ($(CONFIG_FRAME_WARN),0)
a83e4ca26af8f (Masahiro Yamada          2020-02-17 00:19:36 +0900  782) KBUILD_CFLAGS += -Wframe-larger-than=$(CONFIG_FRAME_WARN)
35bb5b1e0e84c (Andi Kleen               2008-02-22 15:15:03 +0100  783) endif
35bb5b1e0e84c (Andi Kleen               2008-02-22 15:15:03 +0100  784) 
893ab00439a45 (Masahiro Yamada          2020-06-27 03:59:12 +0900  785) stackp-flags-y                                    := -fno-stack-protector
050e9baa9dc9f (Linus Torvalds           2018-06-14 12:21:18 +0900  786) stackp-flags-$(CONFIG_STACKPROTECTOR)             := -fstack-protector
050e9baa9dc9f (Linus Torvalds           2018-06-14 12:21:18 +0900  787) stackp-flags-$(CONFIG_STACKPROTECTOR_STRONG)      := -fstack-protector-strong
2a61f4747eeaa (Masahiro Yamada          2018-05-28 18:22:00 +0900  788) 
2a61f4747eeaa (Masahiro Yamada          2018-05-28 18:22:00 +0900  789) KBUILD_CFLAGS += $(stackp-flags-y)
e06b8b98da071 (Sam Ravnborg             2008-02-13 22:43:28 +0100  790) 
3fe617ccafd6f (Linus Torvalds           2021-09-05 11:24:05 -0700  791) KBUILD_CFLAGS-$(CONFIG_WERROR) += -Werror
cd8c917a56f20 (Salvatore Bonaccorso     2021-12-06 21:42:01 +0100  792) KBUILD_CFLAGS += $(KBUILD_CFLAGS-y) $(CONFIG_CC_IMPLICIT_FALLTHROUGH:"%"=%)
3fe617ccafd6f (Linus Torvalds           2021-09-05 11:24:05 -0700  793) 
076f421da5d45 (Masahiro Yamada          2018-10-30 22:26:33 +0900  794) ifdef CONFIG_CC_IS_CLANG
a1494304346a3 (Masahiro Yamada          2019-05-10 23:10:09 +0900  795) KBUILD_CPPFLAGS += -Qunused-arguments
5c6ae0efca8d7 (Nathan Chancellor        2021-08-16 13:20:55 -0700  796) # The kernel builds with '-std=gnu89' so use of GNU extensions is acceptable.
a1494304346a3 (Masahiro Yamada          2019-05-10 23:10:09 +0900  797) KBUILD_CFLAGS += -Wno-gnu
cfe17c9bbe6a6 (Masahiro Yamada          2017-11-27 21:15:13 +0900  798) # CLANG uses a _MergedGlobals as optimization, but this breaks modpost, as the
cfe17c9bbe6a6 (Masahiro Yamada          2017-11-27 21:15:13 +0900  799) # source of a reference will be _MergedGlobals and not on of the whitelisted names.
cfe17c9bbe6a6 (Masahiro Yamada          2017-11-27 21:15:13 +0900  800) # See modpost pattern 2
a1494304346a3 (Masahiro Yamada          2019-05-10 23:10:09 +0900  801) KBUILD_CFLAGS += -mno-global-merge
d936eb2387443 (Linus Torvalds           2021-07-15 18:05:31 -0700  802) else
d936eb2387443 (Linus Torvalds           2021-07-15 18:05:31 -0700  803) 
49832c819ab85 (Randy Dunlap             2021-09-07 15:42:02 -0700  804) # gcc inanely warns about local variables called 'main'
49832c819ab85 (Randy Dunlap             2021-09-07 15:42:02 -0700  805) KBUILD_CFLAGS += -Wno-main
cfe17c9bbe6a6 (Masahiro Yamada          2017-11-27 21:15:13 +0900  806) endif
cfe17c9bbe6a6 (Masahiro Yamada          2017-11-27 21:15:13 +0900  807) 
885480b084696 (Nathan Chancellor        2021-04-28 18:23:50 -0700  808) # These warnings generated too much noise in a regular build.
885480b084696 (Nathan Chancellor        2021-04-28 18:23:50 -0700  809) # Use make W=1 to enable them (see scripts/Makefile.extrawarn)
885480b084696 (Nathan Chancellor        2021-04-28 18:23:50 -0700  810) KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
0a5f41767444c (Prasad Sodagudi          2018-02-06 15:46:51 -0800  811) KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable)
6272cc389fec7 (Nathan Chancellor        2021-08-16 13:20:56 -0700  812) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  813) ifdef CONFIG_FRAME_POINTER
a0f97e06a43cf (Sam Ravnborg             2007-10-14 22:21:35 +0200  814) KBUILD_CFLAGS	+= -fno-omit-frame-pointer -fno-optimize-sibling-calls
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  815) else
7e9501fdecdee (Rabin Vincent            2010-08-10 19:20:53 +0100  816) # Some targets (ARM with Thumb2, for example), can't be built with frame
7e9501fdecdee (Rabin Vincent            2010-08-10 19:20:53 +0100  817) # pointers.  For those, we don't have FUNCTION_TRACER automatically
7e9501fdecdee (Rabin Vincent            2010-08-10 19:20:53 +0100  818) # select FRAME_POINTER.  However, FUNCTION_TRACER adds -pg, and this is
7e9501fdecdee (Rabin Vincent            2010-08-10 19:20:53 +0100  819) # incompatible with -fomit-frame-pointer with current GCC, so we don't use
7e9501fdecdee (Rabin Vincent            2010-08-10 19:20:53 +0100  820) # -fomit-frame-pointer with FUNCTION_TRACER.
7e9501fdecdee (Rabin Vincent            2010-08-10 19:20:53 +0100  821) ifndef CONFIG_FUNCTION_TRACER
a0f97e06a43cf (Sam Ravnborg             2007-10-14 22:21:35 +0200  822) KBUILD_CFLAGS	+= -fomit-frame-pointer
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  823) endif
7e9501fdecdee (Rabin Vincent            2010-08-10 19:20:53 +0100  824) endif
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  825) 
f0fe00d4972a8 (glider@google.com        2020-06-16 10:34:35 +0200  826) # Initialize all stack variables with a 0xAA pattern.
f0fe00d4972a8 (glider@google.com        2020-06-16 10:34:35 +0200  827) ifdef CONFIG_INIT_STACK_ALL_PATTERN
709a972efb01e (Kees Cook                2019-04-10 08:48:31 -0700  828) KBUILD_CFLAGS	+= -ftrivial-auto-var-init=pattern
709a972efb01e (Kees Cook                2019-04-10 08:48:31 -0700  829) endif
709a972efb01e (Kees Cook                2019-04-10 08:48:31 -0700  830) 
f0fe00d4972a8 (glider@google.com        2020-06-16 10:34:35 +0200  831) # Initialize all stack variables with a zero value.
f0fe00d4972a8 (glider@google.com        2020-06-16 10:34:35 +0200  832) ifdef CONFIG_INIT_STACK_ALL_ZERO
f0fe00d4972a8 (glider@google.com        2020-06-16 10:34:35 +0200  833) KBUILD_CFLAGS	+= -ftrivial-auto-var-init=zero
f02003c860d92 (Kees Cook                2021-09-14 12:49:03 -0700  834) ifdef CONFIG_CC_IS_CLANG
f02003c860d92 (Kees Cook                2021-09-14 12:49:03 -0700  835) # https://bugs.llvm.org/show_bug.cgi?id=45497
f0fe00d4972a8 (glider@google.com        2020-06-16 10:34:35 +0200  836) KBUILD_CFLAGS	+= -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
f0fe00d4972a8 (glider@google.com        2020-06-16 10:34:35 +0200  837) endif
f02003c860d92 (Kees Cook                2021-09-14 12:49:03 -0700  838) endif
f0fe00d4972a8 (glider@google.com        2020-06-16 10:34:35 +0200  839) 
39218ff4c625d (Kees Cook                2021-04-01 16:23:44 -0700  840) # While VLAs have been removed, GCC produces unreachable stack probes
39218ff4c625d (Kees Cook                2021-04-01 16:23:44 -0700  841) # for the randomize_kstack_offset feature. Disable it for all compilers.
39218ff4c625d (Kees Cook                2021-04-01 16:23:44 -0700  842) KBUILD_CFLAGS	+= $(call cc-option, -fno-stack-clash-protection)
39218ff4c625d (Kees Cook                2021-04-01 16:23:44 -0700  843) 
a82adfd5c7cb4 (Kees Cook                2021-04-12 19:56:54 -0700  844) # Clear used registers at func exit (to reduce data lifetime and ROP gadgets).
a82adfd5c7cb4 (Kees Cook                2021-04-12 19:56:54 -0700  845) ifdef CONFIG_ZERO_CALL_USED_REGS
a82adfd5c7cb4 (Kees Cook                2021-04-12 19:56:54 -0700  846) KBUILD_CFLAGS	+= -fzero-call-used-regs=used-gpr
a82adfd5c7cb4 (Kees Cook                2021-04-12 19:56:54 -0700  847) endif
a82adfd5c7cb4 (Kees Cook                2021-04-12 19:56:54 -0700  848) 
606576ce81660 (Steven Rostedt           2008-10-06 19:06:12 -0400  849) ifdef CONFIG_FUNCTION_TRACER
3b15cdc159566 (Sami Tolvanen            2020-12-11 10:46:18 -0800  850) ifdef CONFIG_FTRACE_MCOUNT_USE_CC
3b15cdc159566 (Sami Tolvanen            2020-12-11 10:46:18 -0800  851)   CC_FLAGS_FTRACE	+= -mrecord-mcount
2f4df0017baed (Vasily Gorbik            2018-08-06 15:17:46 +0200  852)   ifdef CONFIG_HAVE_NOP_MCOUNT
2f4df0017baed (Vasily Gorbik            2018-08-06 15:17:46 +0200  853)     ifeq ($(call cc-option-yn, -mnop-mcount),y)
2f4df0017baed (Vasily Gorbik            2018-08-06 15:17:46 +0200  854)       CC_FLAGS_FTRACE	+= -mnop-mcount
2f4df0017baed (Vasily Gorbik            2018-08-06 15:17:46 +0200  855)       CC_FLAGS_USING	+= -DCC_USING_NOP_MCOUNT
2f4df0017baed (Vasily Gorbik            2018-08-06 15:17:46 +0200  856)     endif
2f4df0017baed (Vasily Gorbik            2018-08-06 15:17:46 +0200  857)   endif
07d0408120216 (Vasily Gorbik            2018-08-06 15:17:44 +0200  858) endif
22c8542d7b220 (Sami Tolvanen            2020-09-25 16:43:53 -0700  859) ifdef CONFIG_FTRACE_MCOUNT_USE_OBJTOOL
22c8542d7b220 (Sami Tolvanen            2020-09-25 16:43:53 -0700  860)   CC_FLAGS_USING	+= -DCC_USING_NOP_MCOUNT
22c8542d7b220 (Sami Tolvanen            2020-09-25 16:43:53 -0700  861) endif
3b15cdc159566 (Sami Tolvanen            2020-12-11 10:46:18 -0800  862) ifdef CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT
3b15cdc159566 (Sami Tolvanen            2020-12-11 10:46:18 -0800  863)   ifdef CONFIG_HAVE_C_RECORDMCOUNT
3b15cdc159566 (Sami Tolvanen            2020-12-11 10:46:18 -0800  864)     BUILD_C_RECORDMCOUNT := y
3b15cdc159566 (Sami Tolvanen            2020-12-11 10:46:18 -0800  865)     export BUILD_C_RECORDMCOUNT
3b15cdc159566 (Sami Tolvanen            2020-12-11 10:46:18 -0800  866)   endif
3b15cdc159566 (Sami Tolvanen            2020-12-11 10:46:18 -0800  867) endif
a2546fae01124 (Steven Rostedt           2011-02-09 13:15:59 -0500  868) ifdef CONFIG_HAVE_FENTRY
7d73c3e9c5140 (Nick Desaulniers         2021-08-16 13:25:01 -0700  869)   # s390-linux-gnu-gcc did not support -mfentry until gcc-9.
f28bc3c32c059 (Vasily Gorbik            2018-08-06 15:17:42 +0200  870)   ifeq ($(call cc-option-yn, -mfentry),y)
f28bc3c32c059 (Vasily Gorbik            2018-08-06 15:17:42 +0200  871)     CC_FLAGS_FTRACE	+= -mfentry
f28bc3c32c059 (Vasily Gorbik            2018-08-06 15:17:42 +0200  872)     CC_FLAGS_USING	+= -DCC_USING_FENTRY
f28bc3c32c059 (Vasily Gorbik            2018-08-06 15:17:42 +0200  873)   endif
a2546fae01124 (Steven Rostedt           2011-02-09 13:15:59 -0500  874) endif
f28bc3c32c059 (Vasily Gorbik            2018-08-06 15:17:42 +0200  875) export CC_FLAGS_FTRACE
f28bc3c32c059 (Vasily Gorbik            2018-08-06 15:17:42 +0200  876) KBUILD_CFLAGS	+= $(CC_FLAGS_FTRACE) $(CC_FLAGS_USING)
f28bc3c32c059 (Vasily Gorbik            2018-08-06 15:17:42 +0200  877) KBUILD_AFLAGS	+= $(CC_FLAGS_USING)
16444a8a40d4c (Arnaldo Carvalho de Melo 2008-05-12 21:20:42 +0200  878) endif
16444a8a40d4c (Arnaldo Carvalho de Melo 2008-05-12 21:20:42 +0200  879) 
91341d4b2c196 (Sam Ravnborg             2008-01-21 21:31:44 +0100  880) # We trigger additional mismatches with less inlining
91341d4b2c196 (Sam Ravnborg             2008-01-21 21:31:44 +0100  881) ifdef CONFIG_DEBUG_SECTION_MISMATCH
7d73c3e9c5140 (Nick Desaulniers         2021-08-16 13:25:01 -0700  882) KBUILD_CFLAGS += -fno-inline-functions-called-once
91341d4b2c196 (Sam Ravnborg             2008-01-21 21:31:44 +0100  883) endif
91341d4b2c196 (Sam Ravnborg             2008-01-21 21:31:44 +0100  884) 
90ad4052e85ce (Masahiro Yamada          2017-04-14 15:17:26 +0900  885) ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
e85d1d65cd8a9 (Masahiro Yamada          2018-08-22 22:51:09 +0900  886) KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections
e85d1d65cd8a9 (Masahiro Yamada          2018-08-22 22:51:09 +0900  887) LDFLAGS_vmlinux += --gc-sections
90ad4052e85ce (Masahiro Yamada          2017-04-14 15:17:26 +0900  888) endif
90ad4052e85ce (Masahiro Yamada          2017-04-14 15:17:26 +0900  889) 
d08b9f0ca6605 (Sami Tolvanen            2020-04-27 09:00:07 -0700  890) ifdef CONFIG_SHADOW_CALL_STACK
d08b9f0ca6605 (Sami Tolvanen            2020-04-27 09:00:07 -0700  891) CC_FLAGS_SCS	:= -fsanitize=shadow-call-stack
d08b9f0ca6605 (Sami Tolvanen            2020-04-27 09:00:07 -0700  892) KBUILD_CFLAGS	+= $(CC_FLAGS_SCS)
d08b9f0ca6605 (Sami Tolvanen            2020-04-27 09:00:07 -0700  893) export CC_FLAGS_SCS
d08b9f0ca6605 (Sami Tolvanen            2020-04-27 09:00:07 -0700  894) endif
d08b9f0ca6605 (Sami Tolvanen            2020-04-27 09:00:07 -0700  895) 
dc5723b02e523 (Sami Tolvanen            2020-12-11 10:46:19 -0800  896) ifdef CONFIG_LTO_CLANG
dc5723b02e523 (Sami Tolvanen            2020-12-11 10:46:19 -0800  897) ifdef CONFIG_LTO_CLANG_THIN
2b86895205201 (Alexander Lobakin        2021-01-21 18:45:55 +0000  898) CC_FLAGS_LTO	:= -flto=thin -fsplit-lto-unit
7f69180b8e905 (Masahiro Yamada          2021-03-31 22:38:06 +0900  899) KBUILD_LDFLAGS	+= --thinlto-cache-dir=$(extmod_prefix).thinlto-cache
dc5723b02e523 (Sami Tolvanen            2020-12-11 10:46:19 -0800  900) else
2b86895205201 (Alexander Lobakin        2021-01-21 18:45:55 +0000  901) CC_FLAGS_LTO	:= -flto
dc5723b02e523 (Sami Tolvanen            2020-12-11 10:46:19 -0800  902) endif
dc5723b02e523 (Sami Tolvanen            2020-12-11 10:46:19 -0800  903) CC_FLAGS_LTO	+= -fvisibility=hidden
22d429e75f24d (Sami Tolvanen            2020-12-11 10:46:21 -0800  904) 
22d429e75f24d (Sami Tolvanen            2020-12-11 10:46:21 -0800  905) # Limit inlining across translation units to reduce binary size
22d429e75f24d (Sami Tolvanen            2020-12-11 10:46:21 -0800  906) KBUILD_LDFLAGS += -mllvm -import-instr-limit=5
24845dcb170e1 (Nick Desaulniers         2021-03-11 17:09:41 -0800  907) 
0236526d76b87 (Tor Vic                  2021-06-13 13:07:49 +0000  908) # Check for frame size exceeding threshold during prolog/epilog insertion
0236526d76b87 (Tor Vic                  2021-06-13 13:07:49 +0000  909) # when using lld < 13.0.0.
24845dcb170e1 (Nick Desaulniers         2021-03-11 17:09:41 -0800  910) ifneq ($(CONFIG_FRAME_WARN),0)
0236526d76b87 (Tor Vic                  2021-06-13 13:07:49 +0000  911) ifeq ($(shell test $(CONFIG_LLD_VERSION) -lt 130000; echo $$?),0)
24845dcb170e1 (Nick Desaulniers         2021-03-11 17:09:41 -0800  912) KBUILD_LDFLAGS	+= -plugin-opt=-warn-stack-size=$(CONFIG_FRAME_WARN)
24845dcb170e1 (Nick Desaulniers         2021-03-11 17:09:41 -0800  913) endif
dc5723b02e523 (Sami Tolvanen            2020-12-11 10:46:19 -0800  914) endif
0236526d76b87 (Tor Vic                  2021-06-13 13:07:49 +0000  915) endif
dc5723b02e523 (Sami Tolvanen            2020-12-11 10:46:19 -0800  916) 
dc5723b02e523 (Sami Tolvanen            2020-12-11 10:46:19 -0800  917) ifdef CONFIG_LTO
5e95325fbbbde (Sami Tolvanen            2021-02-23 13:59:52 -0800  918) KBUILD_CFLAGS	+= -fno-lto $(CC_FLAGS_LTO)
5e95325fbbbde (Sami Tolvanen            2021-02-23 13:59:52 -0800  919) KBUILD_AFLAGS	+= -fno-lto
dc5723b02e523 (Sami Tolvanen            2020-12-11 10:46:19 -0800  920) export CC_FLAGS_LTO
dc5723b02e523 (Sami Tolvanen            2020-12-11 10:46:19 -0800  921) endif
dc5723b02e523 (Sami Tolvanen            2020-12-11 10:46:19 -0800  922) 
cf68fffb66d60 (Sami Tolvanen            2021-04-08 11:28:26 -0700  923) ifdef CONFIG_CFI_CLANG
cf68fffb66d60 (Sami Tolvanen            2021-04-08 11:28:26 -0700  924) CC_FLAGS_CFI	:= -fsanitize=cfi \
cf68fffb66d60 (Sami Tolvanen            2021-04-08 11:28:26 -0700  925) 		   -fsanitize-cfi-cross-dso \
cf68fffb66d60 (Sami Tolvanen            2021-04-08 11:28:26 -0700  926) 		   -fno-sanitize-cfi-canonical-jump-tables \
cf68fffb66d60 (Sami Tolvanen            2021-04-08 11:28:26 -0700  927) 		   -fno-sanitize-trap=cfi \
cf68fffb66d60 (Sami Tolvanen            2021-04-08 11:28:26 -0700  928) 		   -fno-sanitize-blacklist
cf68fffb66d60 (Sami Tolvanen            2021-04-08 11:28:26 -0700  929) 
cf68fffb66d60 (Sami Tolvanen            2021-04-08 11:28:26 -0700  930) ifdef CONFIG_CFI_PERMISSIVE
cf68fffb66d60 (Sami Tolvanen            2021-04-08 11:28:26 -0700  931) CC_FLAGS_CFI	+= -fsanitize-recover=cfi
cf68fffb66d60 (Sami Tolvanen            2021-04-08 11:28:26 -0700  932) endif
cf68fffb66d60 (Sami Tolvanen            2021-04-08 11:28:26 -0700  933) 
cf68fffb66d60 (Sami Tolvanen            2021-04-08 11:28:26 -0700  934) # If LTO flags are filtered out, we must also filter out CFI.
cf68fffb66d60 (Sami Tolvanen            2021-04-08 11:28:26 -0700  935) CC_FLAGS_LTO	+= $(CC_FLAGS_CFI)
cf68fffb66d60 (Sami Tolvanen            2021-04-08 11:28:26 -0700  936) KBUILD_CFLAGS	+= $(CC_FLAGS_CFI)
cf68fffb66d60 (Sami Tolvanen            2021-04-08 11:28:26 -0700  937) export CC_FLAGS_CFI
cf68fffb66d60 (Sami Tolvanen            2021-04-08 11:28:26 -0700  938) endif
cf68fffb66d60 (Sami Tolvanen            2021-04-08 11:28:26 -0700  939) 
cf536e185869d (Feng Tang                2021-05-06 15:34:59 +0800  940) ifdef CONFIG_DEBUG_FORCE_FUNCTION_ALIGN_64B
cf536e185869d (Feng Tang                2021-05-06 15:34:59 +0800  941) KBUILD_CFLAGS += -falign-functions=64
09c60546f04f7 (Feng Tang                2020-08-11 18:34:13 -0700  942) endif
09c60546f04f7 (Feng Tang                2020-08-11 18:34:13 -0700  943) 
e8e6993178344 (Sam Ravnborg             2005-04-30 16:51:42 -0700  944) # arch Makefile may override CC so keep this after arch Makefile is included
04e85bbf71c90 (Alexey Dobriyan          2021-08-02 23:43:15 +0300  945) NOSTDINC_FLAGS += -nostdinc
e8e6993178344 (Sam Ravnborg             2005-04-30 16:51:42 -0700  946) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  947) # warn about C99 declaration after statement
a33e7ae295d5b (Masahiro Yamada          2018-10-01 18:44:37 +0900  948) KBUILD_CFLAGS += -Wdeclaration-after-statement
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  949) 
0bb95f80a38f8 (Kees Cook                2018-06-25 15:59:34 -0700  950) # Variable Length Arrays (VLAs) should not be used anywhere in the kernel
8289f913fe126 (Masahiro Yamada          2019-05-09 15:45:49 +0900  951) KBUILD_CFLAGS += -Wvla
0bb95f80a38f8 (Kees Cook                2018-06-25 15:59:34 -0700  952) 
070b98bfda3d2 (Sam Ravnborg             2006-06-25 00:07:55 +0200  953) # disable pointer signed / unsigned warnings in gcc 4.0
fb073a4b473e5 (Masahiro Yamada          2018-10-01 18:44:36 +0900  954) KBUILD_CFLAGS += -Wno-pointer-sign
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700  955) 
217c3e0196758 (Stephen Rothwell         2018-08-31 07:47:28 +1000  956) # disable stringop warnings in gcc 8+
217c3e0196758 (Stephen Rothwell         2018-08-31 07:47:28 +1000  957) KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation)
217c3e0196758 (Stephen Rothwell         2018-08-31 07:47:28 +1000  958) 
5c45de21a2223 (Linus Torvalds           2020-05-09 14:30:29 -0700  959) # We'll want to enable this eventually, but it's not going away for 5.7 at least
5c45de21a2223 (Linus Torvalds           2020-05-09 14:30:29 -0700  960) KBUILD_CFLAGS += $(call cc-disable-warning, zero-length-bounds)
7d73c3e9c5140 (Nick Desaulniers         2021-08-16 13:25:01 -0700  961) KBUILD_CFLAGS += -Wno-array-bounds
5a76021c2eff7 (Linus Torvalds           2020-05-09 15:40:52 -0700  962) KBUILD_CFLAGS += $(call cc-disable-warning, stringop-overflow)
5c45de21a2223 (Linus Torvalds           2020-05-09 14:30:29 -0700  963) 
adc7192096987 (Linus Torvalds           2020-05-09 15:45:21 -0700  964) # Another good warning that we'll want to enable eventually
adc7192096987 (Linus Torvalds           2020-05-09 15:45:21 -0700  965) KBUILD_CFLAGS += $(call cc-disable-warning, restrict)
adc7192096987 (Linus Torvalds           2020-05-09 15:45:21 -0700  966) 
78a5255ffb6a1 (Linus Torvalds           2020-05-09 13:57:10 -0700  967) # Enabled with W=2, disabled by default as noisy
7d73c3e9c5140 (Nick Desaulniers         2021-08-16 13:25:01 -0700  968) ifdef CONFIG_CC_IS_GCC
7d73c3e9c5140 (Nick Desaulniers         2021-08-16 13:25:01 -0700  969) KBUILD_CFLAGS += -Wno-maybe-uninitialized
7d73c3e9c5140 (Nick Desaulniers         2021-08-16 13:25:01 -0700  970) endif
78a5255ffb6a1 (Linus Torvalds           2020-05-09 13:57:10 -0700  971) 
86cffecdeaa27 (Kees Cook                2021-11-05 13:36:19 -0700  972) ifdef CONFIG_CC_IS_GCC
86cffecdeaa27 (Kees Cook                2021-11-05 13:36:19 -0700  973) # The allocators already balk at large sizes, so silence the compiler
86cffecdeaa27 (Kees Cook                2021-11-05 13:36:19 -0700  974) # warnings for bounds checks involving those possible values. While
86cffecdeaa27 (Kees Cook                2021-11-05 13:36:19 -0700  975) # -Wno-alloc-size-larger-than would normally be used here, earlier versions
86cffecdeaa27 (Kees Cook                2021-11-05 13:36:19 -0700  976) # of gcc (<9.1) weirdly don't handle the option correctly when _other_
86cffecdeaa27 (Kees Cook                2021-11-05 13:36:19 -0700  977) # warnings are produced (?!). Using -Walloc-size-larger-than=SIZE_MAX
86cffecdeaa27 (Kees Cook                2021-11-05 13:36:19 -0700  978) # doesn't work (as it is documented to), silently resolving to "0" prior to
86cffecdeaa27 (Kees Cook                2021-11-05 13:36:19 -0700  979) # version 9.1 (and producing an error more recently). Numeric values larger
86cffecdeaa27 (Kees Cook                2021-11-05 13:36:19 -0700  980) # than PTRDIFF_MAX also don't work prior to version 9.1, which are silently
86cffecdeaa27 (Kees Cook                2021-11-05 13:36:19 -0700  981) # ignored, continuing to default to PTRDIFF_MAX. So, left with no other
86cffecdeaa27 (Kees Cook                2021-11-05 13:36:19 -0700  982) # choice, we must perform a versioned check to disable this warning.
86cffecdeaa27 (Kees Cook                2021-11-05 13:36:19 -0700  983) # https://lore.kernel.org/lkml/20210824115859.187f272f@canb.auug.org.au
86cffecdeaa27 (Kees Cook                2021-11-05 13:36:19 -0700  984) KBUILD_CFLAGS += $(call cc-ifversion, -ge, 0901, -Wno-alloc-size-larger-than)
86cffecdeaa27 (Kees Cook                2021-11-05 13:36:19 -0700  985) endif
86cffecdeaa27 (Kees Cook                2021-11-05 13:36:19 -0700  986) 
fe8d0a41081d6 (Kirill Smelkov           2009-04-09 15:34:34 +0400  987) # disable invalid "can't wrap" optimizations for signed / pointers
8b42cf2fde0ee (Masahiro Yamada          2020-09-10 22:51:17 +0900  988) KBUILD_CFLAGS	+= -fno-strict-overflow
d0115552cdb0b (Linus Torvalds           2009-03-19 15:53:19 -0700  989) 
3ce120b16cc54 (Linus Torvalds           2017-12-29 17:34:43 -0800  990) # Make sure -fstack-check isn't enabled (like gentoo apparently did)
7d4eb0d8e229f (Masahiro Yamada          2020-09-10 22:51:19 +0900  991) KBUILD_CFLAGS  += -fno-stack-check
3ce120b16cc54 (Linus Torvalds           2017-12-29 17:34:43 -0800  992) 
8f7f5c9fc2966 (Andi Kleen               2009-09-18 12:49:37 -0700  993) # conserve stack if available
7d73c3e9c5140 (Nick Desaulniers         2021-08-16 13:25:01 -0700  994) ifdef CONFIG_CC_IS_GCC
7d73c3e9c5140 (Nick Desaulniers         2021-08-16 13:25:01 -0700  995) KBUILD_CFLAGS   += -fconserve-stack
7d73c3e9c5140 (Nick Desaulniers         2021-08-16 13:25:01 -0700  996) endif
8f7f5c9fc2966 (Andi Kleen               2009-09-18 12:49:37 -0700  997) 
fe7c36c7bde12 (Josh Triplett            2013-12-23 13:56:06 -0800  998) # Prohibit date/time macros, which would make the build non-deterministic
87de84c9140e1 (Masahiro Yamada          2020-09-10 22:51:20 +0900  999) KBUILD_CFLAGS   += -Werror=date-time
fe7c36c7bde12 (Josh Triplett            2013-12-23 13:56:06 -0800 1000) 
ea8daa7b97842 (Daniel Wagner            2016-03-08 09:29:09 +0100 1001) # enforce correct pointer usage
ea8daa7b97842 (Daniel Wagner            2016-03-08 09:29:09 +0100 1002) KBUILD_CFLAGS   += $(call cc-option,-Werror=incompatible-pointer-types)
ea8daa7b97842 (Daniel Wagner            2016-03-08 09:29:09 +0100 1003) 
c834f0e8a8bb3 (Kees Cook                2017-03-20 17:14:11 -0700 1004) # Require designated initializers for all marked structures
c834f0e8a8bb3 (Kees Cook                2017-03-20 17:14:11 -0700 1005) KBUILD_CFLAGS   += $(call cc-option,-Werror=designated-init)
c834f0e8a8bb3 (Kees Cook                2017-03-20 17:14:11 -0700 1006) 
a73619a845d56 (Masahiro Yamada          2018-03-30 13:15:26 +0900 1007) # change __FILE__ to the relative path from the srctree
a716bd7432106 (Denys Zagorui            2020-11-02 04:08:53 -0800 1008) KBUILD_CPPFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=)
a73619a845d56 (Masahiro Yamada          2018-03-30 13:15:26 +0900 1009) 
e0fe0bbe57b8d (Masahiro Yamada          2020-08-02 00:00:49 +0900 1010) # include additional Makefiles when needed
e0fe0bbe57b8d (Masahiro Yamada          2020-08-02 00:00:49 +0900 1011) include-y			:= scripts/Makefile.extrawarn
6947fd96ae9bb (Masahiro Yamada          2021-10-12 12:25:03 +0900 1012) include-$(CONFIG_DEBUG_INFO)	+= scripts/Makefile.debug
e0fe0bbe57b8d (Masahiro Yamada          2020-08-02 00:00:49 +0900 1013) include-$(CONFIG_KASAN)		+= scripts/Makefile.kasan
e0fe0bbe57b8d (Masahiro Yamada          2020-08-02 00:00:49 +0900 1014) include-$(CONFIG_KCSAN)		+= scripts/Makefile.kcsan
e0fe0bbe57b8d (Masahiro Yamada          2020-08-02 00:00:49 +0900 1015) include-$(CONFIG_UBSAN)		+= scripts/Makefile.ubsan
e0fe0bbe57b8d (Masahiro Yamada          2020-08-02 00:00:49 +0900 1016) include-$(CONFIG_KCOV)		+= scripts/Makefile.kcov
e0fe0bbe57b8d (Masahiro Yamada          2020-08-02 00:00:49 +0900 1017) include-$(CONFIG_GCC_PLUGINS)	+= scripts/Makefile.gcc-plugins
e0fe0bbe57b8d (Masahiro Yamada          2020-08-02 00:00:49 +0900 1018) 
e0fe0bbe57b8d (Masahiro Yamada          2020-08-02 00:00:49 +0900 1019) include $(addprefix $(srctree)/, $(include-y))
a86fe35373506 (Masahiro Yamada          2014-04-14 18:27:10 +0900 1020) 
132305b3b474a (Masahiro Yamada          2020-08-02 00:00:50 +0900 1021) # scripts/Makefile.gcc-plugins is intentionally included last.
132305b3b474a (Masahiro Yamada          2020-08-02 00:00:50 +0900 1022) # Do not add $(call cc-option,...) below this line. When you build the kernel
132305b3b474a (Masahiro Yamada          2020-08-02 00:00:50 +0900 1023) # from the clean source tree, the GCC plugins do not exist at this point.
a86fe35373506 (Masahiro Yamada          2014-04-14 18:27:10 +0900 1024) 
8cc7af751443f (Masahiro Yamada          2019-08-21 02:09:41 +0900 1025) # Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments
8cc7af751443f (Masahiro Yamada          2019-08-21 02:09:41 +0900 1026) KBUILD_CPPFLAGS += $(KCPPFLAGS)
8cc7af751443f (Masahiro Yamada          2019-08-21 02:09:41 +0900 1027) KBUILD_AFLAGS   += $(KAFLAGS)
8cc7af751443f (Masahiro Yamada          2019-08-21 02:09:41 +0900 1028) KBUILD_CFLAGS   += $(KCFLAGS)
52bcc3308ae33 (Sam Ravnborg             2007-10-15 22:03:58 +0200 1029) 
a968433723310 (Bill Wendling            2020-09-22 16:21:40 -0700 1030) KBUILD_LDFLAGS_MODULE += --build-id=sha1
a968433723310 (Bill Wendling            2020-09-22 16:21:40 -0700 1031) LDFLAGS_vmlinux += --build-id=sha1
18991197b4b58 (Roland McGrath           2007-07-19 01:48:40 -0700 1032) 
5d7d18f5bc507 (David Howells            2009-03-04 11:59:07 -0800 1033) ifeq ($(CONFIG_STRIP_ASM_SYMS),y)
d79a27195a33f (Andi Kleen               2009-09-16 22:36:55 +0200 1034) LDFLAGS_vmlinux	+= $(call ld-option, -X,)
5d7d18f5bc507 (David Howells            2009-03-04 11:59:07 -0800 1035) endif
5d7d18f5bc507 (David Howells            2009-03-04 11:59:07 -0800 1036) 
5cf896fb6be3e (Peter Collingbourne      2019-07-31 18:18:42 -0700 1037) ifeq ($(CONFIG_RELR),y)
27f2a4db76e8d (Nick Desaulniers         2021-05-21 18:26:24 -0700 1038) LDFLAGS_vmlinux	+= --pack-dyn-relocs=relr --use-android-relr-tags
5cf896fb6be3e (Peter Collingbourne      2019-07-31 18:18:42 -0700 1039) endif
5cf896fb6be3e (Peter Collingbourne      2019-07-31 18:18:42 -0700 1040) 
59612b24f78a0 (Nathan Chancellor        2020-11-19 13:46:56 -0700 1041) # We never want expected sections to be placed heuristically by the
59612b24f78a0 (Nathan Chancellor        2020-11-19 13:46:56 -0700 1042) # linker. All sections should be explicitly named in the linker script.
59612b24f78a0 (Nathan Chancellor        2020-11-19 13:46:56 -0700 1043) ifdef CONFIG_LD_ORPHAN_WARN
59612b24f78a0 (Nathan Chancellor        2020-11-19 13:46:56 -0700 1044) LDFLAGS_vmlinux += --orphan-handling=warn
59612b24f78a0 (Nathan Chancellor        2020-11-19 13:46:56 -0700 1045) endif
59612b24f78a0 (Nathan Chancellor        2020-11-19 13:46:56 -0700 1046) 
7f3a59db274c3 (Masahiro Yamada          2020-04-29 12:45:14 +0900 1047) # Align the bit size of userspace programs with the kernel
7f58b487e9ff3 (Masahiro Yamada          2020-07-01 00:06:25 +0900 1048) KBUILD_USERCFLAGS  += $(filter -m32 -m64 --target=%, $(KBUILD_CFLAGS))
7f58b487e9ff3 (Masahiro Yamada          2020-07-01 00:06:25 +0900 1049) KBUILD_USERLDFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CFLAGS))
7f3a59db274c3 (Masahiro Yamada          2020-04-29 12:45:14 +0900 1050) 
80591e61a0f7e (Luc Van Oostenryck       2019-11-09 13:12:16 +0100 1051) # make the checker run with the right architecture
80591e61a0f7e (Luc Van Oostenryck       2019-11-09 13:12:16 +0100 1052) CHECKFLAGS += --arch=$(ARCH)
80591e61a0f7e (Luc Van Oostenryck       2019-11-09 13:12:16 +0100 1053) 
145167650b969 (Luc Van Oostenryck       2018-05-28 20:27:35 +0200 1054) # insure the checker run with the right endianness
145167650b969 (Luc Van Oostenryck       2018-05-28 20:27:35 +0200 1055) CHECKFLAGS += $(if $(CONFIG_CPU_BIG_ENDIAN),-mbig-endian,-mlittle-endian)
145167650b969 (Luc Van Oostenryck       2018-05-28 20:27:35 +0200 1056) 
1f2f01b122d7c (Luc Van Oostenryck       2018-05-30 22:48:38 +0200 1057) # the checker needs the correct machine size
1f2f01b122d7c (Luc Van Oostenryck       2018-05-30 22:48:38 +0200 1058) CHECKFLAGS += $(if $(CONFIG_64BIT),-m64,-m32)
1f2f01b122d7c (Luc Van Oostenryck       2018-05-30 22:48:38 +0200 1059) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1060) # Default kernel image to build when no specific target is given.
070b98bfda3d2 (Sam Ravnborg             2006-06-25 00:07:55 +0200 1061) # KBUILD_IMAGE may be overruled on the command line or
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1062) # set in the environment
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1063) # Also any assignments in arch/$(ARCH)/Makefile take precedence over
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1064) # this default value
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1065) export KBUILD_IMAGE ?= vmlinux
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1066) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1067) #
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1068) # INSTALL_PATH specifies where to place the updated kernel and system map
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1069) # images. Default is /boot, but you can set it to other values
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1070) export	INSTALL_PATH ?= /boot
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1071) 
f4d4ffc03efc8 (Jason Cooper             2013-12-01 23:56:28 +0000 1072) #
f4d4ffc03efc8 (Jason Cooper             2013-12-01 23:56:28 +0000 1073) # INSTALL_DTBS_PATH specifies a prefix for relocations required by build roots.
f4d4ffc03efc8 (Jason Cooper             2013-12-01 23:56:28 +0000 1074) # Like INSTALL_MOD_PATH, it isn't defined in the Makefile, but can be passed as
f4d4ffc03efc8 (Jason Cooper             2013-12-01 23:56:28 +0000 1075) # an argument if needed. Otherwise it defaults to the kernel install path
f4d4ffc03efc8 (Jason Cooper             2013-12-01 23:56:28 +0000 1076) #
f4d4ffc03efc8 (Jason Cooper             2013-12-01 23:56:28 +0000 1077) export INSTALL_DTBS_PATH ?= $(INSTALL_PATH)/dtbs/$(KERNELRELEASE)
f4d4ffc03efc8 (Jason Cooper             2013-12-01 23:56:28 +0000 1078) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1079) #
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1080) # INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1081) # relocations required by build roots.  This is not defined in the
070b98bfda3d2 (Sam Ravnborg             2006-06-25 00:07:55 +0200 1082) # makefile but the argument can be passed to make if needed.
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1083) #
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1084) 
df9df036d3560 (Sam Ravnborg             2006-01-16 12:46:07 +0100 1085) MODLIB	= $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1086) export MODLIB
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1087) 
e00d888048149 (Masahiro Yamada          2019-01-15 16:19:00 +0900 1088) PHONY += prepare0
e2a666d52b482 (Rusty Russell            2012-10-19 11:53:15 +1030 1089) 
ccae4cfa7bfbe (Masahiro Yamada          2021-03-31 22:38:07 +0900 1090) export extmod_prefix = $(if $(KBUILD_EXTMOD),$(KBUILD_EXTMOD)/)
7f69180b8e905 (Masahiro Yamada          2021-03-31 22:38:06 +0900 1091) export MODORDER := $(extmod_prefix)modules.order
7f69180b8e905 (Masahiro Yamada          2021-03-31 22:38:06 +0900 1092) export MODULES_NSDEPS := $(extmod_prefix)modules.nsdeps
47801c97deb71 (Masahiro Yamada          2019-08-02 19:23:58 +0900 1093) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1094) ifeq ($(KBUILD_EXTMOD),)
4c928904ff771 (Masahiro Yamada          2021-09-27 23:00:00 +0900 1095) core-y			+= kernel/ certs/ mm/ fs/ ipc/ security/ crypto/
4c928904ff771 (Masahiro Yamada          2021-09-27 23:00:00 +0900 1096) core-$(CONFIG_BLOCK)	+= block/
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1097) 
23febe375d94d (Masahiro Yamada          2020-06-01 14:56:57 +0900 1098) vmlinux-dirs	:= $(patsubst %/,%,$(filter %/, \
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1099) 		     $(core-y) $(core-m) $(drivers-y) $(drivers-m) \
95fb6317b3ab8 (Masahiro Yamada          2020-06-01 14:56:58 +0900 1100) 		     $(libs-y) $(libs-m)))
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1101) 
1eaca4b982806 (Masahiro Yamada          2019-04-27 12:33:37 +0900 1102) vmlinux-alldirs	:= $(sort $(vmlinux-dirs) Documentation \
23febe375d94d (Masahiro Yamada          2020-06-01 14:56:57 +0900 1103) 		     $(patsubst %/,%,$(filter %/, $(core-) \
95fb6317b3ab8 (Masahiro Yamada          2020-06-01 14:56:58 +0900 1104) 			$(drivers-) $(libs-))))
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1105) 
b2c8855491226 (Masahiro Yamada          2020-06-01 14:57:00 +0900 1106) subdir-modorder := $(addsuffix modules.order,$(filter %/, \
b2c8855491226 (Masahiro Yamada          2020-06-01 14:57:00 +0900 1107) 			$(core-y) $(core-m) $(libs-y) $(libs-m) \
b2c8855491226 (Masahiro Yamada          2020-06-01 14:57:00 +0900 1108) 			$(drivers-y) $(drivers-m)))
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1109) 
c99f3918cf0a6 (Masahiro Yamada          2019-08-11 00:53:04 +0900 1110) build-dirs	:= $(vmlinux-dirs)
76cd306d79792 (Masahiro Yamada          2019-08-11 00:53:05 +0900 1111) clean-dirs	:= $(vmlinux-alldirs)
c99f3918cf0a6 (Masahiro Yamada          2019-08-11 00:53:04 +0900 1112) 
f0d50ca045e44 (Masahiro Yamada          2020-06-01 14:56:59 +0900 1113) # Externally visible symbols (used by link-vmlinux.sh)
f0d50ca045e44 (Masahiro Yamada          2020-06-01 14:56:59 +0900 1114) KBUILD_VMLINUX_OBJS := $(head-y) $(patsubst %/,%/built-in.a, $(core-y))
f0d50ca045e44 (Masahiro Yamada          2020-06-01 14:56:59 +0900 1115) KBUILD_VMLINUX_OBJS += $(addsuffix built-in.a, $(filter %/, $(libs-y)))
7273ad2b08f8a (Masahiro Yamada          2020-03-12 07:37:25 +0900 1116) ifdef CONFIG_MODULES
f0d50ca045e44 (Masahiro Yamada          2020-06-01 14:56:59 +0900 1117) KBUILD_VMLINUX_OBJS += $(patsubst %/, %/lib.a, $(filter %/, $(libs-y)))
f0d50ca045e44 (Masahiro Yamada          2020-06-01 14:56:59 +0900 1118) KBUILD_VMLINUX_LIBS := $(filter-out %/, $(libs-y))
7273ad2b08f8a (Masahiro Yamada          2020-03-12 07:37:25 +0900 1119) else
f0d50ca045e44 (Masahiro Yamada          2020-06-01 14:56:59 +0900 1120) KBUILD_VMLINUX_LIBS := $(patsubst %/,%/lib.a, $(libs-y))
7273ad2b08f8a (Masahiro Yamada          2020-03-12 07:37:25 +0900 1121) endif
f0d50ca045e44 (Masahiro Yamada          2020-06-01 14:56:59 +0900 1122) KBUILD_VMLINUX_OBJS += $(patsubst %/,%/built-in.a, $(drivers-y))
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1123) 
f0d50ca045e44 (Masahiro Yamada          2020-06-01 14:56:59 +0900 1124) export KBUILD_VMLINUX_OBJS KBUILD_VMLINUX_LIBS
95698570510b7 (Sam Ravnborg             2012-05-05 10:18:40 +0200 1125) export KBUILD_LDS          := arch/$(SRCARCH)/kernel/vmlinux.lds
85f0ae7e435af (Masahiro Yamada          2019-09-21 22:18:46 +0900 1126) # used by scripts/Makefile.package
233c741dcbb13 (Masahiro Yamada          2019-05-16 01:18:54 +0900 1127) export KBUILD_ALLDIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) LICENSES arch include scripts tools)
9bb482476c6c9 (Jan Beulich              2008-12-16 11:30:08 +0000 1128) 
d151e9719f184 (Masahiro Yamada          2019-01-17 09:10:04 +0900 1129) vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS)
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1130) 
3fdc7d3fe4c04 (Masahiro Yamada          2018-03-16 16:37:15 +0900 1131) # Recurse until adjust_autoksyms.sh is satisfied
3fdc7d3fe4c04 (Masahiro Yamada          2018-03-16 16:37:15 +0900 1132) PHONY += autoksyms_recursive
2441e78b19192 (Nicolas Pitre            2016-04-22 15:25:00 -0400 1133) ifdef CONFIG_TRIM_UNUSED_KSYMS
1f50b80a09383 (Masahiro Yamada          2018-03-16 16:37:13 +0900 1134) # For the kernel to actually contain only the needed exported symbols,
1f50b80a09383 (Masahiro Yamada          2018-03-16 16:37:13 +0900 1135) # we have to build modules as well to determine what those symbols are.
1f50b80a09383 (Masahiro Yamada          2018-03-16 16:37:13 +0900 1136) # (this can be evaluated only once include/config/auto.conf has been included)
fb2d99be8919d (Masahiro Yamada          2020-05-31 19:11:39 +0900 1137) KBUILD_MODULES := 1
fb2d99be8919d (Masahiro Yamada          2020-05-31 19:11:39 +0900 1138) 
fb2d99be8919d (Masahiro Yamada          2020-05-31 19:11:39 +0900 1139) autoksyms_recursive: descend modules.order
fb2d99be8919d (Masahiro Yamada          2020-05-31 19:11:39 +0900 1140) 	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh \
fb2d99be8919d (Masahiro Yamada          2020-05-31 19:11:39 +0900 1141) 	  "$(MAKE) -f $(srctree)/Makefile vmlinux"
1f50b80a09383 (Masahiro Yamada          2018-03-16 16:37:13 +0900 1142) endif
1f50b80a09383 (Masahiro Yamada          2018-03-16 16:37:13 +0900 1143) 
07a422bb213ad (Masahiro Yamada          2018-03-16 16:37:12 +0900 1144) autoksyms_h := $(if $(CONFIG_TRIM_UNUSED_KSYMS), include/generated/autoksyms.h)
07a422bb213ad (Masahiro Yamada          2018-03-16 16:37:12 +0900 1145) 
88694cff4952d (Quentin Perret           2020-02-28 17:20:15 +0000 1146) quiet_cmd_autoksyms_h = GEN     $@
88694cff4952d (Quentin Perret           2020-02-28 17:20:15 +0000 1147)       cmd_autoksyms_h = mkdir -p $(dir $@); \
88694cff4952d (Quentin Perret           2020-02-28 17:20:15 +0000 1148) 			$(CONFIG_SHELL) $(srctree)/scripts/gen_autoksyms.sh $@
88694cff4952d (Quentin Perret           2020-02-28 17:20:15 +0000 1149) 
07a422bb213ad (Masahiro Yamada          2018-03-16 16:37:12 +0900 1150) $(autoksyms_h):
88694cff4952d (Quentin Perret           2020-02-28 17:20:15 +0000 1151) 	$(call cmd,autoksyms_h)
23121ca2b56b5 (Nicolas Pitre            2016-01-26 21:50:18 -0500 1152) 
fbe6e37dab974 (Nicholas Piggin          2016-08-24 22:29:21 +1000 1153) ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink)
fbe6e37dab974 (Nicholas Piggin          2016-08-24 22:29:21 +1000 1154) 
fbe6e37dab974 (Nicholas Piggin          2016-08-24 22:29:21 +1000 1155) # Final link of vmlinux with optional arch pass after final link
312a3d0918bb7 (Cao jin                  2017-08-02 10:31:06 +0800 1156) cmd_link-vmlinux =                                                 \
3ec8a5b33deac (Masahiro Yamada          2020-07-02 04:29:36 +0900 1157) 	$(CONFIG_SHELL) $< "$(LD)" "$(KBUILD_LDFLAGS)" "$(LDFLAGS_vmlinux)";    \
fbe6e37dab974 (Nicholas Piggin          2016-08-24 22:29:21 +1000 1158) 	$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
2441e78b19192 (Nicolas Pitre            2016-04-22 15:25:00 -0400 1159) 
3fdc7d3fe4c04 (Masahiro Yamada          2018-03-16 16:37:15 +0900 1160) vmlinux: scripts/link-vmlinux.sh autoksyms_recursive $(vmlinux-deps) FORCE
0b956e204132c (Rasmus Villemoes         2021-03-05 11:02:12 +0100 1161) 	+$(call if_changed_dep,link-vmlinux)
741f98fe298a7 (Sam Ravnborg             2007-07-17 10:54:06 +0200 1162) 
392885ee82d35 (Masahiro Yamada          2018-11-30 10:05:22 +0900 1163) targets := vmlinux
392885ee82d35 (Masahiro Yamada          2018-11-30 10:05:22 +0900 1164) 
38385f8f01803 (Masahiro Yamada          2014-04-28 16:26:18 +0900 1165) # The actual objects are generated when descending,
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1166) # make sure no implicit rule kicks in
b2c8855491226 (Masahiro Yamada          2020-06-01 14:57:00 +0900 1167) $(sort $(vmlinux-deps) $(subdir-modorder)): descend ;
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1168) 
ba97df45581f0 (Masahiro Yamada          2019-01-03 10:16:54 +0900 1169) filechk_kernel.release = \
0d0e7718a9da7 (Michal Marek             2013-07-11 15:34:51 +0200 1170) 	echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))"
0d0e7718a9da7 (Michal Marek             2013-07-11 15:34:51 +0200 1171) 
83a35e360433b (Geert Uytterhoeven       2013-06-28 11:27:31 +0200 1172) # Store (new) KERNELRELEASE string in include/config/kernel.release
24512795df090 (Masahiro Yamada          2019-04-07 19:03:18 +0900 1173) include/config/kernel.release: FORCE
0d0e7718a9da7 (Michal Marek             2013-07-11 15:34:51 +0200 1174) 	$(call filechk,kernel.release)
cb58455c48dc4 (Sam Ravnborg             2006-01-09 21:20:34 +0100 1175) 
d8821622c889d (Masahiro Yamada          2018-03-16 16:37:11 +0900 1176) # Additional helpers built in scripts/
d8821622c889d (Masahiro Yamada          2018-03-16 16:37:11 +0900 1177) # Carefully list dependencies so we do not try to build scripts twice
d8821622c889d (Masahiro Yamada          2018-03-16 16:37:11 +0900 1178) # in parallel
d8821622c889d (Masahiro Yamada          2018-03-16 16:37:11 +0900 1179) PHONY += scripts
60df1aee2aecb (Masahiro Yamada          2018-11-29 12:13:24 +0900 1180) scripts: scripts_basic scripts_dtc
d8821622c889d (Masahiro Yamada          2018-03-16 16:37:11 +0900 1181) 	$(Q)$(MAKE) $(build)=$(@)
cb58455c48dc4 (Sam Ravnborg             2006-01-09 21:20:34 +0100 1182) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1183) # Things we need to do before we recursively start building the kernel
5bb78269000cf (Sam Ravnborg             2005-09-11 22:30:22 +0200 1184) # or the modules are listed in "prepare".
5bb78269000cf (Sam Ravnborg             2005-09-11 22:30:22 +0200 1185) # A multi level approach is used. prepareN is processed before prepareN-1.
5bb78269000cf (Sam Ravnborg             2005-09-11 22:30:22 +0200 1186) # archprepare is used in arch Makefiles and when processed asm symlink,
5bb78269000cf (Sam Ravnborg             2005-09-11 22:30:22 +0200 1187) # version.h and scripts_basic is processed / created.
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1188) 
a5139fb368d26 (Masahiro Yamada          2019-08-22 13:46:12 +0900 1189) PHONY += prepare archprepare
5bb78269000cf (Sam Ravnborg             2005-09-11 22:30:22 +0200 1190) 
36de077b20d05 (Masahiro Yamada          2019-08-22 13:46:13 +0900 1191) archprepare: outputmakefile archheaders archscripts scripts include/config/kernel.release \
3044dd05289d6 (Masahiro Yamada          2020-05-01 15:01:41 +0900 1192) 	asm-generic $(version_h) $(autoksyms_h) include/generated/utsrelease.h \
1476fee5c53e2 (Masahiro Yamada          2021-04-25 16:07:12 +0900 1193) 	include/generated/autoconf.h remove-stale-files
5bb78269000cf (Sam Ravnborg             2005-09-11 22:30:22 +0200 1194) 
65bba0423ecf8 (Masahiro Yamada          2018-11-29 11:58:50 +0900 1195) prepare0: archprepare
60df1aee2aecb (Masahiro Yamada          2018-11-29 12:13:24 +0900 1196) 	$(Q)$(MAKE) $(build)=scripts/mod
8d36a62364b6b (Sam Ravnborg             2005-09-10 21:05:36 +0200 1197) 	$(Q)$(MAKE) $(build)=.
86feeaa8120bb (Sam Ravnborg             2005-09-09 19:28:28 +0200 1198) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1199) # All the preparing..
0d989ac2c90b5 (Masahiro Yamada          2021-05-12 15:52:01 +0900 1200) prepare: prepare0
b9ab5ebb14ec3 (Josh Poimboeuf           2016-02-28 22:22:42 -0600 1201) 
1476fee5c53e2 (Masahiro Yamada          2021-04-25 16:07:12 +0900 1202) PHONY += remove-stale-files
1476fee5c53e2 (Masahiro Yamada          2021-04-25 16:07:12 +0900 1203) remove-stale-files:
1476fee5c53e2 (Masahiro Yamada          2021-04-25 16:07:12 +0900 1204) 	$(Q)$(srctree)/scripts/remove-stale-files
1476fee5c53e2 (Masahiro Yamada          2021-04-25 16:07:12 +0900 1205) 
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900 1206) # Support for using generic headers in asm-generic
7d0e5c2056c70 (Masahiro Yamada          2018-12-05 20:28:04 +0900 1207) asm-generic := -f $(srctree)/scripts/Makefile.asm-generic obj
7d0e5c2056c70 (Masahiro Yamada          2018-12-05 20:28:04 +0900 1208) 
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900 1209) PHONY += asm-generic uapi-asm-generic
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900 1210) asm-generic: uapi-asm-generic
037fc3368be46 (Masahiro Yamada          2019-03-17 11:01:09 +0900 1211) 	$(Q)$(MAKE) $(asm-generic)=arch/$(SRCARCH)/include/generated/asm \
037fc3368be46 (Masahiro Yamada          2019-03-17 11:01:09 +0900 1212) 	generic=include/asm-generic
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900 1213) uapi-asm-generic:
037fc3368be46 (Masahiro Yamada          2019-03-17 11:01:09 +0900 1214) 	$(Q)$(MAKE) $(asm-generic)=arch/$(SRCARCH)/include/generated/uapi/asm \
037fc3368be46 (Masahiro Yamada          2019-03-17 11:01:09 +0900 1215) 	generic=include/uapi/asm-generic
2c1f4f125159f (Masahiro Yamada          2017-10-04 12:56:06 +0900 1216) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1217) # Generate some files
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1218) # ---------------------------------------------------------------------------
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1219) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1220) # KERNELRELEASE can change from a few different places, meaning version.h
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1221) # needs to be updated, so this check is forced on all builds
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1222) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1223) uts_len := 64
63104eec234bd (Sam Ravnborg             2006-07-03 23:30:54 +0200 1224) define filechk_utsrelease.h
63104eec234bd (Sam Ravnborg             2006-07-03 23:30:54 +0200 1225) 	if [ `echo -n "$(KERNELRELEASE)" | wc -c ` -gt $(uts_len) ]; then \
63104eec234bd (Sam Ravnborg             2006-07-03 23:30:54 +0200 1226) 	  echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2;    \
63104eec234bd (Sam Ravnborg             2006-07-03 23:30:54 +0200 1227) 	  exit 1;                                                         \
63104eec234bd (Sam Ravnborg             2006-07-03 23:30:54 +0200 1228) 	fi;                                                               \
ad774086356da (Masahiro Yamada          2018-12-31 17:24:09 +0900 1229) 	echo \#define UTS_RELEASE \"$(KERNELRELEASE)\"
63104eec234bd (Sam Ravnborg             2006-07-03 23:30:54 +0200 1230) endef
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1231) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1232) define filechk_version.h
9b82f13e7ef31 (Sasha Levin              2021-02-05 22:50:32 -0500 1233) 	if [ $(SUBLEVEL) -gt 255 ]; then                                 \
9b82f13e7ef31 (Sasha Levin              2021-02-05 22:50:32 -0500 1234) 		echo \#define LINUX_VERSION_CODE $(shell                 \
207da4c82ade9 (Masahiro Yamada          2021-02-27 23:20:23 +0900 1235) 		expr $(VERSION) \* 65536 + $(PATCHLEVEL) \* 256 + 255); \
9b82f13e7ef31 (Sasha Levin              2021-02-05 22:50:32 -0500 1236) 	else                                                             \
9b82f13e7ef31 (Sasha Levin              2021-02-05 22:50:32 -0500 1237) 		echo \#define LINUX_VERSION_CODE $(shell                 \
207da4c82ade9 (Masahiro Yamada          2021-02-27 23:20:23 +0900 1238) 		expr $(VERSION) \* 65536 + $(PATCHLEVEL) \* 256 + $(SUBLEVEL)); \
9b82f13e7ef31 (Sasha Levin              2021-02-05 22:50:32 -0500 1239) 	fi;                                                              \
9b82f13e7ef31 (Sasha Levin              2021-02-05 22:50:32 -0500 1240) 	echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) +  \
88a686728b373 (Sasha Levin              2021-02-12 11:29:24 -0500 1241) 	((c) > 255 ? 255 : (c)))';                                       \
88a686728b373 (Sasha Levin              2021-02-12 11:29:24 -0500 1242) 	echo \#define LINUX_VERSION_MAJOR $(VERSION);                    \
88a686728b373 (Sasha Levin              2021-02-12 11:29:24 -0500 1243) 	echo \#define LINUX_VERSION_PATCHLEVEL $(PATCHLEVEL);            \
88a686728b373 (Sasha Levin              2021-02-12 11:29:24 -0500 1244) 	echo \#define LINUX_VERSION_SUBLEVEL $(SUBLEVEL)
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1245) endef
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1246) 
207da4c82ade9 (Masahiro Yamada          2021-02-27 23:20:23 +0900 1247) $(version_h): PATCHLEVEL := $(if $(PATCHLEVEL), $(PATCHLEVEL), 0)
207da4c82ade9 (Masahiro Yamada          2021-02-27 23:20:23 +0900 1248) $(version_h): SUBLEVEL := $(if $(SUBLEVEL), $(SUBLEVEL), 0)
43fee2b238959 (Masahiro Yamada          2018-07-25 14:16:11 +0900 1249) $(version_h): FORCE
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1250) 	$(call filechk,version.h)
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1251) 
273b281fa22c2 (Sam Ravnborg             2009-10-18 00:52:28 +0200 1252) include/generated/utsrelease.h: include/config/kernel.release FORCE
63104eec234bd (Sam Ravnborg             2006-07-03 23:30:54 +0200 1253) 	$(call filechk,utsrelease.h)
63104eec234bd (Sam Ravnborg             2006-07-03 23:30:54 +0200 1254) 
179efcb47d5a5 (Vegard Nossum            2008-12-16 12:33:43 +0100 1255) PHONY += headerdep
179efcb47d5a5 (Vegard Nossum            2008-12-16 12:33:43 +0100 1256) headerdep:
9663d9890d804 (Peter Foley              2011-04-26 17:17:11 -0400 1257) 	$(Q)find $(srctree)/include/ -name '*.h' | xargs --max-args 1 \
9663d9890d804 (Peter Foley              2011-04-26 17:17:11 -0400 1258) 	$(srctree)/scripts/headerdep.pl -I$(srctree)/include
179efcb47d5a5 (Vegard Nossum            2008-12-16 12:33:43 +0100 1259) 
8d730cfb50cc7 (David Woodhouse          2006-06-18 11:58:39 +0100 1260) # ---------------------------------------------------------------------------
8d730cfb50cc7 (David Woodhouse          2006-06-18 11:58:39 +0100 1261) # Kernel headers
8d730cfb50cc7 (David Woodhouse          2006-06-18 11:58:39 +0100 1262) 
e6883b187920e (Sam Ravnborg             2008-06-05 16:43:46 +0200 1263) #Default location for installed headers
e6883b187920e (Sam Ravnborg             2008-06-05 16:43:46 +0200 1264) export INSTALL_HDR_PATH = $(objtree)/usr
6d71627581e96 (David Woodhouse          2006-09-24 22:16:03 +0100 1265) 
59b2bd05f5f4d (Masahiro Yamada          2019-06-04 19:14:02 +0900 1266) quiet_cmd_headers_install = INSTALL $(INSTALL_HDR_PATH)/include
59b2bd05f5f4d (Masahiro Yamada          2019-06-04 19:14:02 +0900 1267)       cmd_headers_install = \
59b2bd05f5f4d (Masahiro Yamada          2019-06-04 19:14:02 +0900 1268) 	mkdir -p $(INSTALL_HDR_PATH); \
59b2bd05f5f4d (Masahiro Yamada          2019-06-04 19:14:02 +0900 1269) 	rsync -mrl --include='*/' --include='*\.h' --exclude='*' \
59b2bd05f5f4d (Masahiro Yamada          2019-06-04 19:14:02 +0900 1270) 	usr/include $(INSTALL_HDR_PATH)
e6883b187920e (Sam Ravnborg             2008-06-05 16:43:46 +0200 1271) 
8d730cfb50cc7 (David Woodhouse          2006-06-18 11:58:39 +0100 1272) PHONY += headers_install
59b2bd05f5f4d (Masahiro Yamada          2019-06-04 19:14:02 +0900 1273) headers_install: headers
59b2bd05f5f4d (Masahiro Yamada          2019-06-04 19:14:02 +0900 1274) 	$(call cmd,headers_install)
6520fe5564acf (H. Peter Anvin           2012-05-08 21:22:24 +0300 1275) 
59b2bd05f5f4d (Masahiro Yamada          2019-06-04 19:14:02 +0900 1276) PHONY += archheaders archscripts
e6883b187920e (Sam Ravnborg             2008-06-05 16:43:46 +0200 1277) 
a5bae54c106db (Masahiro Yamada          2019-06-04 19:14:04 +0900 1278) hdr-inst := -f $(srctree)/scripts/Makefile.headersinst obj
6d71627581e96 (David Woodhouse          2006-09-24 22:16:03 +0100 1279) 
59b2bd05f5f4d (Masahiro Yamada          2019-06-04 19:14:02 +0900 1280) PHONY += headers
59b2bd05f5f4d (Masahiro Yamada          2019-06-04 19:14:02 +0900 1281) headers: $(version_h) scripts_unifdef uapi-asm-generic archheaders archscripts
9d022c540606a (Masahiro Yamada          2017-10-04 12:56:04 +0900 1282) 	$(if $(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/Kbuild),, \
10b63956fce7f (David Howells            2012-10-02 18:01:57 +0100 1283) 	  $(error Headers not exportable for the $(SRCARCH) architecture))
d5470d14431e9 (Masahiro Yamada          2019-06-04 19:14:03 +0900 1284) 	$(Q)$(MAKE) $(hdr-inst)=include/uapi
d5470d14431e9 (Masahiro Yamada          2019-06-04 19:14:03 +0900 1285) 	$(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi
1f85712e6e1f2 (Mike Frysinger           2007-02-14 00:33:02 -0800 1286) 
7ecaf069da52e (Masahiro Yamada          2019-11-07 16:14:41 +0900 1287) # Deprecated. It is no-op now.
684753599afc7 (David Woodhouse          2006-06-18 12:02:10 +0100 1288) PHONY += headers_check
7ecaf069da52e (Masahiro Yamada          2019-11-07 16:14:41 +0900 1289) headers_check:
609bbb4de4f85 (Masahiro Yamada          2021-03-02 23:26:14 +0900 1290) 	@echo >&2 "=================== WARNING ==================="
609bbb4de4f85 (Masahiro Yamada          2021-03-02 23:26:14 +0900 1291) 	@echo >&2 "Since Linux 5.5, 'make headers_check' is no-op,"
609bbb4de4f85 (Masahiro Yamada          2021-03-02 23:26:14 +0900 1292) 	@echo >&2 "and will be removed after Linux 5.15 release."
609bbb4de4f85 (Masahiro Yamada          2021-03-02 23:26:14 +0900 1293) 	@echo >&2 "Please remove headers_check from your scripts."
609bbb4de4f85 (Masahiro Yamada          2021-03-02 23:26:14 +0900 1294) 	@echo >&2 "==============================================="
684753599afc7 (David Woodhouse          2006-06-18 12:02:10 +0100 1295) 
e949f4c2d6a3d (Masahiro Yamada          2019-06-04 19:13:59 +0900 1296) ifdef CONFIG_HEADERS_INSTALL
59b2bd05f5f4d (Masahiro Yamada          2019-06-04 19:14:02 +0900 1297) prepare: headers
e949f4c2d6a3d (Masahiro Yamada          2019-06-04 19:13:59 +0900 1298) endif
684753599afc7 (David Woodhouse          2006-06-18 12:02:10 +0100 1299) 
bdd7714b6f4cc (Masahiro Yamada          2019-06-04 19:14:01 +0900 1300) PHONY += scripts_unifdef
bdd7714b6f4cc (Masahiro Yamada          2019-06-04 19:14:01 +0900 1301) scripts_unifdef: scripts_basic
bdd7714b6f4cc (Masahiro Yamada          2019-06-04 19:14:01 +0900 1302) 	$(Q)$(MAKE) $(build)=scripts scripts/unifdef
bdd7714b6f4cc (Masahiro Yamada          2019-06-04 19:14:01 +0900 1303) 
14ccc638b02f9 (Masahiro Yamada          2021-07-29 09:12:54 +0900 1304) # ---------------------------------------------------------------------------
14ccc638b02f9 (Masahiro Yamada          2021-07-29 09:12:54 +0900 1305) # Install
14ccc638b02f9 (Masahiro Yamada          2021-07-29 09:12:54 +0900 1306) 
14ccc638b02f9 (Masahiro Yamada          2021-07-29 09:12:54 +0900 1307) # Many distributions have the custom install script, /sbin/installkernel.
14ccc638b02f9 (Masahiro Yamada          2021-07-29 09:12:54 +0900 1308) # If DKMS is installed, 'make install' will eventually recuses back
14ccc638b02f9 (Masahiro Yamada          2021-07-29 09:12:54 +0900 1309) # to the this Makefile to build and install external modules.
14ccc638b02f9 (Masahiro Yamada          2021-07-29 09:12:54 +0900 1310) # Cancel sub_make_done so that options such as M=, V=, etc. are parsed.
14ccc638b02f9 (Masahiro Yamada          2021-07-29 09:12:54 +0900 1311) 
14ccc638b02f9 (Masahiro Yamada          2021-07-29 09:12:54 +0900 1312) install: sub_make_done :=
14ccc638b02f9 (Masahiro Yamada          2021-07-29 09:12:54 +0900 1313) 
1bb0b18a06dce (Masahiro Yamada          2021-05-12 15:52:00 +0900 1314) # ---------------------------------------------------------------------------
1bb0b18a06dce (Masahiro Yamada          2021-05-12 15:52:00 +0900 1315) # Tools
1bb0b18a06dce (Masahiro Yamada          2021-05-12 15:52:00 +0900 1316) 
0d989ac2c90b5 (Masahiro Yamada          2021-05-12 15:52:01 +0900 1317) ifdef CONFIG_STACK_VALIDATION
0d989ac2c90b5 (Masahiro Yamada          2021-05-12 15:52:01 +0900 1318) prepare: tools/objtool
0d989ac2c90b5 (Masahiro Yamada          2021-05-12 15:52:01 +0900 1319) endif
0d989ac2c90b5 (Masahiro Yamada          2021-05-12 15:52:01 +0900 1320) 
0d989ac2c90b5 (Masahiro Yamada          2021-05-12 15:52:01 +0900 1321) ifdef CONFIG_BPF
0d989ac2c90b5 (Masahiro Yamada          2021-05-12 15:52:01 +0900 1322) ifdef CONFIG_DEBUG_INFO_BTF
0d989ac2c90b5 (Masahiro Yamada          2021-05-12 15:52:01 +0900 1323) prepare: tools/bpf/resolve_btfids
0d989ac2c90b5 (Masahiro Yamada          2021-05-12 15:52:01 +0900 1324) endif
0d989ac2c90b5 (Masahiro Yamada          2021-05-12 15:52:01 +0900 1325) endif
0d989ac2c90b5 (Masahiro Yamada          2021-05-12 15:52:01 +0900 1326) 
0d989ac2c90b5 (Masahiro Yamada          2021-05-12 15:52:01 +0900 1327) PHONY += resolve_btfids_clean
0d989ac2c90b5 (Masahiro Yamada          2021-05-12 15:52:01 +0900 1328) 
0d989ac2c90b5 (Masahiro Yamada          2021-05-12 15:52:01 +0900 1329) resolve_btfids_O = $(abspath $(objtree))/tools/bpf/resolve_btfids
0d989ac2c90b5 (Masahiro Yamada          2021-05-12 15:52:01 +0900 1330) 
0d989ac2c90b5 (Masahiro Yamada          2021-05-12 15:52:01 +0900 1331) # tools/bpf/resolve_btfids directory might not exist
0d989ac2c90b5 (Masahiro Yamada          2021-05-12 15:52:01 +0900 1332) # in output directory, skip its clean in that case
0d989ac2c90b5 (Masahiro Yamada          2021-05-12 15:52:01 +0900 1333) resolve_btfids_clean:
0d989ac2c90b5 (Masahiro Yamada          2021-05-12 15:52:01 +0900 1334) ifneq ($(wildcard $(resolve_btfids_O)),)
0d989ac2c90b5 (Masahiro Yamada          2021-05-12 15:52:01 +0900 1335) 	$(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(resolve_btfids_O) clean
0d989ac2c90b5 (Masahiro Yamada          2021-05-12 15:52:01 +0900 1336) endif
0d989ac2c90b5 (Masahiro Yamada          2021-05-12 15:52:01 +0900 1337) 
1bb0b18a06dce (Masahiro Yamada          2021-05-12 15:52:00 +0900 1338) # Clear a bunch of variables before executing the submake
1bb0b18a06dce (Masahiro Yamada          2021-05-12 15:52:00 +0900 1339) ifeq ($(quiet),silent_)
1bb0b18a06dce (Masahiro Yamada          2021-05-12 15:52:00 +0900 1340) tools_silent=s
1bb0b18a06dce (Masahiro Yamada          2021-05-12 15:52:00 +0900 1341) endif
1bb0b18a06dce (Masahiro Yamada          2021-05-12 15:52:00 +0900 1342) 
1bb0b18a06dce (Masahiro Yamada          2021-05-12 15:52:00 +0900 1343) tools/: FORCE
1bb0b18a06dce (Masahiro Yamada          2021-05-12 15:52:00 +0900 1344) 	$(Q)mkdir -p $(objtree)/tools
1bb0b18a06dce (Masahiro Yamada          2021-05-12 15:52:00 +0900 1345) 	$(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/
1bb0b18a06dce (Masahiro Yamada          2021-05-12 15:52:00 +0900 1346) 
1bb0b18a06dce (Masahiro Yamada          2021-05-12 15:52:00 +0900 1347) tools/%: FORCE
1bb0b18a06dce (Masahiro Yamada          2021-05-12 15:52:00 +0900 1348) 	$(Q)mkdir -p $(objtree)/tools
1bb0b18a06dce (Masahiro Yamada          2021-05-12 15:52:00 +0900 1349) 	$(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/ $*
1bb0b18a06dce (Masahiro Yamada          2021-05-12 15:52:00 +0900 1350) 
5a5da78b3a481 (Shuah Khan               2014-08-07 13:07:46 -0600 1351) # ---------------------------------------------------------------------------
5a5da78b3a481 (Shuah Khan               2014-08-07 13:07:46 -0600 1352) # Kernel selftest
5a5da78b3a481 (Shuah Khan               2014-08-07 13:07:46 -0600 1353) 
5a5da78b3a481 (Shuah Khan               2014-08-07 13:07:46 -0600 1354) PHONY += kselftest
5a5da78b3a481 (Shuah Khan               2014-08-07 13:07:46 -0600 1355) kselftest:
2bc84526d174a (Shuah Khan               2017-09-06 16:44:35 -0600 1356) 	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests
5a5da78b3a481 (Shuah Khan               2014-08-07 13:07:46 -0600 1357) 
17eac6c2db8b2 (Shuah Khan               2019-09-26 16:40:14 -0600 1358) kselftest-%: FORCE
17eac6c2db8b2 (Shuah Khan               2019-09-26 16:40:14 -0600 1359) 	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests $*
dcb825a9fd865 (Wang Long                2015-10-08 02:41:18 +0000 1360) 
3d6dee7af7fe1 (Bamvor Jian Zhang        2016-01-08 15:27:34 +0800 1361) PHONY += kselftest-merge
3d6dee7af7fe1 (Bamvor Jian Zhang        2016-01-08 15:27:34 +0800 1362) kselftest-merge:
3d6dee7af7fe1 (Bamvor Jian Zhang        2016-01-08 15:27:34 +0800 1363) 	$(if $(wildcard $(objtree)/.config),, $(error No .config exists, config your kernel first!))
6d3db46c8e331 (Dan Rue                  2019-05-20 10:16:14 -0500 1364) 	$(Q)find $(srctree)/tools/testing/selftests -name config | \
6d3db46c8e331 (Dan Rue                  2019-05-20 10:16:14 -0500 1365) 		xargs $(srctree)/scripts/kconfig/merge_config.sh -m $(objtree)/.config
3e4c6948e78b4 (Masahiro Yamada          2019-08-21 16:03:48 +0900 1366) 	$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
3d6dee7af7fe1 (Bamvor Jian Zhang        2016-01-08 15:27:34 +0800 1367) 
37c8a5fafa3bb (Rob Herring              2018-01-10 15:19:37 -0600 1368) # ---------------------------------------------------------------------------
37c8a5fafa3bb (Rob Herring              2018-01-10 15:19:37 -0600 1369) # Devicetree files
37c8a5fafa3bb (Rob Herring              2018-01-10 15:19:37 -0600 1370) 
37c8a5fafa3bb (Rob Herring              2018-01-10 15:19:37 -0600 1371) ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/boot/dts/),)
37c8a5fafa3bb (Rob Herring              2018-01-10 15:19:37 -0600 1372) dtstree := arch/$(SRCARCH)/boot/dts
37c8a5fafa3bb (Rob Herring              2018-01-10 15:19:37 -0600 1373) endif
37c8a5fafa3bb (Rob Herring              2018-01-10 15:19:37 -0600 1374) 
37c8a5fafa3bb (Rob Herring              2018-01-10 15:19:37 -0600 1375) ifneq ($(dtstree),)
37c8a5fafa3bb (Rob Herring              2018-01-10 15:19:37 -0600 1376) 
75e895343d5a2 (Rob Herring              2021-12-08 15:39:16 -0600 1377) %.dtb: include/config/kernel.release scripts_dtc
75e895343d5a2 (Rob Herring              2021-12-08 15:39:16 -0600 1378) 	$(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
37c8a5fafa3bb (Rob Herring              2018-01-10 15:19:37 -0600 1379) 
75e895343d5a2 (Rob Herring              2021-12-08 15:39:16 -0600 1380) %.dtbo: include/config/kernel.release scripts_dtc
75e895343d5a2 (Rob Herring              2021-12-08 15:39:16 -0600 1381) 	$(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
ce88c9c79455f (Viresh Kumar             2021-01-29 12:54:08 +0530 1382) 
c473a8d03ea8e (Masahiro Yamada          2020-02-23 04:04:34 +0900 1383) PHONY += dtbs dtbs_install dtbs_check
b5154bf63e557 (Masahiro Yamada          2020-03-04 12:20:36 +0900 1384) dtbs: include/config/kernel.release scripts_dtc
37c8a5fafa3bb (Rob Herring              2018-01-10 15:19:37 -0600 1385) 	$(Q)$(MAKE) $(build)=$(dtstree)
37c8a5fafa3bb (Rob Herring              2018-01-10 15:19:37 -0600 1386) 
75e895343d5a2 (Rob Herring              2021-12-08 15:39:16 -0600 1387) ifneq ($(filter dtbs_check, $(MAKECMDGOALS)),)
e10c4321dc1e0 (Masahiro Yamada          2020-03-04 12:20:37 +0900 1388) export CHECK_DTBS=y
b5154bf63e557 (Masahiro Yamada          2020-03-04 12:20:36 +0900 1389) dtbs: dt_binding_check
b5154bf63e557 (Masahiro Yamada          2020-03-04 12:20:36 +0900 1390) endif
b5154bf63e557 (Masahiro Yamada          2020-03-04 12:20:36 +0900 1391) 
b5154bf63e557 (Masahiro Yamada          2020-03-04 12:20:36 +0900 1392) dtbs_check: dtbs
4f0e3a57d6eb7 (Rob Herring              2018-09-06 13:26:07 -0500 1393) 
37c8a5fafa3bb (Rob Herring              2018-01-10 15:19:37 -0600 1394) dtbs_install:
2431f22a911a6 (Masahiro Yamada          2020-03-07 02:08:51 +0900 1395) 	$(Q)$(MAKE) $(dtbinst)=$(dtstree) dst=$(INSTALL_DTBS_PATH)
37c8a5fafa3bb (Rob Herring              2018-01-10 15:19:37 -0600 1396) 
37c8a5fafa3bb (Rob Herring              2018-01-10 15:19:37 -0600 1397) ifdef CONFIG_OF_EARLY_FLATTREE
37c8a5fafa3bb (Rob Herring              2018-01-10 15:19:37 -0600 1398) all: dtbs
37c8a5fafa3bb (Rob Herring              2018-01-10 15:19:37 -0600 1399) endif
37c8a5fafa3bb (Rob Herring              2018-01-10 15:19:37 -0600 1400) 
37c8a5fafa3bb (Rob Herring              2018-01-10 15:19:37 -0600 1401) endif
37c8a5fafa3bb (Rob Herring              2018-01-10 15:19:37 -0600 1402) 
37c8a5fafa3bb (Rob Herring              2018-01-10 15:19:37 -0600 1403) PHONY += scripts_dtc
37c8a5fafa3bb (Rob Herring              2018-01-10 15:19:37 -0600 1404) scripts_dtc: scripts_basic
37c8a5fafa3bb (Rob Herring              2018-01-10 15:19:37 -0600 1405) 	$(Q)$(MAKE) $(build)=scripts/dtc
37c8a5fafa3bb (Rob Herring              2018-01-10 15:19:37 -0600 1406) 
e10c4321dc1e0 (Masahiro Yamada          2020-03-04 12:20:37 +0900 1407) ifneq ($(filter dt_binding_check, $(MAKECMDGOALS)),)
e10c4321dc1e0 (Masahiro Yamada          2020-03-04 12:20:37 +0900 1408) export CHECK_DT_BINDING=y
e10c4321dc1e0 (Masahiro Yamada          2020-03-04 12:20:37 +0900 1409) endif
e10c4321dc1e0 (Masahiro Yamada          2020-03-04 12:20:37 +0900 1410) 
c473a8d03ea8e (Masahiro Yamada          2020-02-23 04:04:34 +0900 1411) PHONY += dt_binding_check
4f0e3a57d6eb7 (Rob Herring              2018-09-06 13:26:07 -0500 1412) dt_binding_check: scripts_dtc
4f0e3a57d6eb7 (Rob Herring              2018-09-06 13:26:07 -0500 1413) 	$(Q)$(MAKE) $(build)=Documentation/devicetree/bindings
4f0e3a57d6eb7 (Rob Herring              2018-09-06 13:26:07 -0500 1414) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1415) # ---------------------------------------------------------------------------
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1416) # Modules
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1417) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1418) ifdef CONFIG_MODULES
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1419) 
070b98bfda3d2 (Sam Ravnborg             2006-06-25 00:07:55 +0200 1420) # By default, build modules as well
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1421) 
73d1393eb8507 (Michal Marek             2010-03-10 12:28:58 +0100 1422) all: modules
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1423) 
4b50c8c4eaf06 (Masahiro Yamada          2020-05-31 17:47:06 +0900 1424) # When we're building modules with modversions, we need to consider
4b50c8c4eaf06 (Masahiro Yamada          2020-05-31 17:47:06 +0900 1425) # the built-in objects during the descend as well, in order to
4b50c8c4eaf06 (Masahiro Yamada          2020-05-31 17:47:06 +0900 1426) # make sure the checksums are up to date before we record them.
4b50c8c4eaf06 (Masahiro Yamada          2020-05-31 17:47:06 +0900 1427) ifdef CONFIG_MODVERSIONS
4b50c8c4eaf06 (Masahiro Yamada          2020-05-31 17:47:06 +0900 1428)   KBUILD_BUILTIN := 1
4b50c8c4eaf06 (Masahiro Yamada          2020-05-31 17:47:06 +0900 1429) endif
4b50c8c4eaf06 (Masahiro Yamada          2020-05-31 17:47:06 +0900 1430) 
3fbb43df983ac (Masahiro Yamada          2014-04-28 16:32:43 +0900 1431) # Build modules
551559e13af1c (Tejun Heo                2007-12-07 21:04:30 +0900 1432) #
3fbb43df983ac (Masahiro Yamada          2014-04-28 16:32:43 +0900 1433) # A module can be listed more than once in obj-m resulting in
3fbb43df983ac (Masahiro Yamada          2014-04-28 16:32:43 +0900 1434) # duplicate lines in modules.order files.  Those are removed
3fbb43df983ac (Masahiro Yamada          2014-04-28 16:32:43 +0900 1435) # using awk while concatenating to the final file.
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1436) 
4f1933620f571 (Paul Smith               2006-03-05 17:14:10 -0500 1437) PHONY += modules
596b0474d3d9b (Masahiro Yamada          2020-09-08 13:27:08 +0900 1438) modules: $(if $(KBUILD_BUILTIN),vmlinux) modules_check modules_prepare
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1439) 
b2c8855491226 (Masahiro Yamada          2020-06-01 14:57:00 +0900 1440) cmd_modules_order = $(AWK) '!x[$$0]++' $(real-prereqs) > $@
b2c8855491226 (Masahiro Yamada          2020-06-01 14:57:00 +0900 1441) 
b2c8855491226 (Masahiro Yamada          2020-06-01 14:57:00 +0900 1442) modules.order: $(subdir-modorder) FORCE
b2c8855491226 (Masahiro Yamada          2020-06-01 14:57:00 +0900 1443) 	$(call if_changed,modules_order)
b2c8855491226 (Masahiro Yamada          2020-06-01 14:57:00 +0900 1444) 
b2c8855491226 (Masahiro Yamada          2020-06-01 14:57:00 +0900 1445) targets += modules.order
68980b4704d5d (Masahiro Yamada          2019-06-24 01:13:28 +0900 1446) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1447) # Target to prepare building external modules
4f1933620f571 (Paul Smith               2006-03-05 17:14:10 -0500 1448) PHONY += modules_prepare
059bc9fc375e0 (Masahiro Yamada          2018-11-29 12:56:30 +0900 1449) modules_prepare: prepare
596b0474d3d9b (Masahiro Yamada          2020-09-08 13:27:08 +0900 1450) 	$(Q)$(MAKE) $(build)=scripts scripts/module.lds
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1451) 
961ab4a3cd66c (Masahiro Yamada          2021-03-31 22:38:09 +0900 1452) export modules_sign_only :=
961ab4a3cd66c (Masahiro Yamada          2021-03-31 22:38:09 +0900 1453) 
961ab4a3cd66c (Masahiro Yamada          2021-03-31 22:38:09 +0900 1454) ifeq ($(CONFIG_MODULE_SIG),y)
961ab4a3cd66c (Masahiro Yamada          2021-03-31 22:38:09 +0900 1455) PHONY += modules_sign
961ab4a3cd66c (Masahiro Yamada          2021-03-31 22:38:09 +0900 1456) modules_sign: modules_install
961ab4a3cd66c (Masahiro Yamada          2021-03-31 22:38:09 +0900 1457) 	@:
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1458) 
961ab4a3cd66c (Masahiro Yamada          2021-03-31 22:38:09 +0900 1459) # modules_sign is a subset of modules_install.
961ab4a3cd66c (Masahiro Yamada          2021-03-31 22:38:09 +0900 1460) # 'make modules_install modules_sign' is equivalent to 'make modules_install'.
961ab4a3cd66c (Masahiro Yamada          2021-03-31 22:38:09 +0900 1461) ifeq ($(filter modules_install,$(MAKECMDGOALS)),)
961ab4a3cd66c (Masahiro Yamada          2021-03-31 22:38:09 +0900 1462) modules_sign_only := y
961ab4a3cd66c (Masahiro Yamada          2021-03-31 22:38:09 +0900 1463) endif
961ab4a3cd66c (Masahiro Yamada          2021-03-31 22:38:09 +0900 1464) endif
961ab4a3cd66c (Masahiro Yamada          2021-03-31 22:38:09 +0900 1465) 
961ab4a3cd66c (Masahiro Yamada          2021-03-31 22:38:09 +0900 1466) modinst_pre :=
961ab4a3cd66c (Masahiro Yamada          2021-03-31 22:38:09 +0900 1467) ifneq ($(filter modules_install,$(MAKECMDGOALS)),)
961ab4a3cd66c (Masahiro Yamada          2021-03-31 22:38:09 +0900 1468) modinst_pre := __modinst_pre
961ab4a3cd66c (Masahiro Yamada          2021-03-31 22:38:09 +0900 1469) endif
961ab4a3cd66c (Masahiro Yamada          2021-03-31 22:38:09 +0900 1470) 
961ab4a3cd66c (Masahiro Yamada          2021-03-31 22:38:09 +0900 1471) modules_install: $(modinst_pre)
3e3005df73b53 (Masahiro Yamada          2021-03-31 22:38:03 +0900 1472) PHONY += __modinst_pre
3e3005df73b53 (Masahiro Yamada          2021-03-31 22:38:03 +0900 1473) __modinst_pre:
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1474) 	@rm -rf $(MODLIB)/kernel
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1475) 	@rm -f $(MODLIB)/source
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1476) 	@mkdir -p $(MODLIB)/kernel
8e9b466799230 (Masahiro Yamada          2017-08-20 15:04:11 +0900 1477) 	@ln -s $(abspath $(srctree)) $(MODLIB)/source
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1478) 	@if [ ! $(objtree) -ef  $(MODLIB)/build ]; then \
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1479) 		rm -f $(MODLIB)/build ; \
7e1c04779efd5 (Michal Marek             2014-04-25 17:29:45 +0200 1480) 		ln -s $(CURDIR) $(MODLIB)/build ; \
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1481) 	fi
1bd9a468018dd (Masahiro Yamada          2019-07-17 15:17:50 +0900 1482) 	@sed 's:^:kernel/:' modules.order > $(MODLIB)/modules.order
2c6d9636ad920 (Masahiro Yamada          2020-06-20 00:09:55 +0900 1483) 	@cp -f modules.builtin $(MODLIB)/
2c6d9636ad920 (Masahiro Yamada          2020-06-20 00:09:55 +0900 1484) 	@cp -f $(objtree)/modules.builtin.modinfo $(MODLIB)/
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1485) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1486) endif # CONFIG_MODULES
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1487) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1488) ###
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1489) # Cleaning is done on three levels.
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1490) # make clean     Delete most generated files
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1491) #                Leave enough to build external modules
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1492) # make mrproper  Delete the current configuration, and all generated files
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1493) # make distclean Remove editor backup files, patch leftover files and the like
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1494) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1495) # Directories & files removed with 'make clean'
69bc8d386aebb (Masahiro Yamada          2021-03-26 03:54:09 +0900 1496) CLEAN_FILES += include/ksym vmlinux.symvers modules-only.symvers \
3d32285fa9959 (Masahiro Yamada          2020-08-22 23:56:16 +0900 1497) 	       modules.builtin modules.builtin.modinfo modules.nsdeps \
4c7858b9001c8 (Masahiro Yamada          2021-02-26 04:39:12 +0900 1498) 	       compile_commands.json .thinlto-cache
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1499) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1500) # Directories & files removed with 'make mrproper'
0663c68c4d2d3 (Masahiro Yamada          2020-05-04 17:08:07 +0900 1501) MRPROPER_FILES += include/config include/generated          \
46a63d4b0d79c (Masahiro Yamada          2019-08-21 16:02:02 +0900 1502) 		  arch/$(SRCARCH)/include/generated .tmp_objdiff \
0663c68c4d2d3 (Masahiro Yamada          2020-05-04 17:08:07 +0900 1503) 		  debian snap tar-install \
0663c68c4d2d3 (Masahiro Yamada          2020-05-04 17:08:07 +0900 1504) 		  .config .config.old .version \
46457133ac9d5 (Masahiro Yamada          2019-07-15 23:01:49 +0900 1505) 		  Module.symvers \
b31f2a495debc (Nayna Jain               2021-04-09 10:35:05 -0400 1506) 		  certs/signing_key.pem certs/signing_key.x509 \
b31f2a495debc (Nayna Jain               2021-04-09 10:35:05 -0400 1507) 		  certs/x509.genkey \
b31f2a495debc (Nayna Jain               2021-04-09 10:35:05 -0400 1508) 		  vmlinux-gdb.py \
46a63d4b0d79c (Masahiro Yamada          2019-08-21 16:02:02 +0900 1509) 		  *.spec
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1510) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1511) # clean - Delete most, but leave enough to build external modules
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1512) #
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1513) clean: rm-files := $(CLEAN_FILES)
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1514) 
76cd306d79792 (Masahiro Yamada          2019-08-11 00:53:05 +0900 1515) PHONY += archclean vmlinuxclean
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1516) 
bd1ee804af8bd (Pawel Moll               2012-10-29 11:23:02 +0000 1517) vmlinuxclean:
bd1ee804af8bd (Pawel Moll               2012-10-29 11:23:02 +0000 1518) 	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean
fbe6e37dab974 (Nicholas Piggin          2016-08-24 22:29:21 +1000 1519) 	$(Q)$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) clean)
bd1ee804af8bd (Pawel Moll               2012-10-29 11:23:02 +0000 1520) 
50d3a3f816895 (Jiri Olsa                2021-02-05 13:40:20 +0100 1521) clean: archclean vmlinuxclean resolve_btfids_clean
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1522) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1523) # mrproper - Delete all generated files, including .config
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1524) #
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1525) mrproper: rm-files := $(wildcard $(MRPROPER_FILES))
cb43fb5775dff (Mauro Carvalho Chehab    2017-05-14 11:50:01 -0300 1526) mrproper-dirs      := $(addprefix _mrproper_,scripts)
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1527) 
b421b8a6cb87f (Masahiro Yamada          2019-01-14 17:29:29 +0900 1528) PHONY += $(mrproper-dirs) mrproper
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1529) $(mrproper-dirs):
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1530) 	$(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@)
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1531) 
b421b8a6cb87f (Masahiro Yamada          2019-01-14 17:29:29 +0900 1532) mrproper: clean $(mrproper-dirs)
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1533) 	$(call cmd,rmfiles)
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1534) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1535) # distclean
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1536) #
4f1933620f571 (Paul Smith               2006-03-05 17:14:10 -0500 1537) PHONY += distclean
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1538) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1539) distclean: mrproper
19c8d912837e4 (Masahiro Yamada          2021-05-04 19:10:56 +0900 1540) 	@find . $(RCS_FIND_IGNORE) \
070b98bfda3d2 (Sam Ravnborg             2006-06-25 00:07:55 +0200 1541) 		\( -name '*.orig' -o -name '*.rej' -o -name '*~' \
f78271dfb7735 (Masahiro Yamada          2017-01-22 23:02:32 +0900 1542) 		-o -name '*.bak' -o -name '#*#' -o -name '*%' \
7a02cec523a90 (Masahiro Yamada          2021-05-04 19:10:57 +0900 1543) 		-o -name 'core' -o -name tags -o -name TAGS -o -name 'cscope*' \
7a02cec523a90 (Masahiro Yamada          2021-05-04 19:10:57 +0900 1544) 		-o -name GPATH -o -name GRTAGS -o -name GSYMS -o -name GTAGS \) \
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1545) 		-type f -print | xargs rm -f
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1546) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1547) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1548) # Packaging of the kernel to various formats
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1549) # ---------------------------------------------------------------------------
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1550) 
bafb67470b294 (Arnaldo Carvalho de Melo 2010-06-07 07:44:25 -0300 1551) %src-pkg: FORCE
000ec95fbe757 (Masahiro Yamada          2019-08-21 16:02:04 +0900 1552) 	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.package $@
031ecc6de7d17 (Zach Brown               2006-06-08 22:12:37 -0700 1553) %pkg: include/config/kernel.release FORCE
000ec95fbe757 (Masahiro Yamada          2019-08-21 16:02:04 +0900 1554) 	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.package $@
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1555) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1556) # Brief documentation of the typical targets used
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1557) # ---------------------------------------------------------------------------
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1558) 
5dffbe811b786 (Segher Boessenkool       2008-04-06 22:16:07 +0200 1559) boards := $(wildcard $(srctree)/arch/$(SRCARCH)/configs/*_defconfig)
a1e7b7bb1ab5b (Konstantin Khlebnikov    2014-10-28 17:18:20 +0400 1560) boards := $(sort $(notdir $(boards)))
5dffbe811b786 (Segher Boessenkool       2008-04-06 22:16:07 +0200 1561) board-dirs := $(dir $(wildcard $(srctree)/arch/$(SRCARCH)/configs/*/*_defconfig))
5dffbe811b786 (Segher Boessenkool       2008-04-06 22:16:07 +0200 1562) board-dirs := $(sort $(notdir $(board-dirs:/=)))
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1563) 
fe69b420d39d3 (Masahiro Yamada          2016-03-13 09:39:55 +0900 1564) PHONY += help
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1565) help:
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1566) 	@echo  'Cleaning targets:'
5ea084ef9c7d0 (Samuel Tardieu           2006-12-12 19:09:40 +0100 1567) 	@echo  '  clean		  - Remove most generated files but keep the config and'
5cc8d246d0ebb (Jesper Juhl              2006-09-24 14:01:08 +0200 1568) 	@echo  '                    enough build support to build external modules'
5ea084ef9c7d0 (Samuel Tardieu           2006-12-12 19:09:40 +0100 1569) 	@echo  '  mrproper	  - Remove all generated files + config + various backup files'
5cc8d246d0ebb (Jesper Juhl              2006-09-24 14:01:08 +0200 1570) 	@echo  '  distclean	  - mrproper + remove editor backup and patch files'
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1571) 	@echo  ''
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1572) 	@echo  'Configuration targets:'
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1573) 	@$(MAKE) -f $(srctree)/scripts/kconfig/Makefile help
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1574) 	@echo  ''
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1575) 	@echo  'Other generic targets:'
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1576) 	@echo  '  all		  - Build all targets marked with [*]'
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1577) 	@echo  '* vmlinux	  - Build the bare kernel'
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1578) 	@echo  '* modules	  - Build all modules'
9cc5d74c847dd (Bodo Eggert              2005-11-23 20:11:34 +0100 1579) 	@echo  '  modules_install - Install all modules to INSTALL_MOD_PATH (default: /)'
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1580) 	@echo  '  dir/            - Build all files in dir and below'
40ab87a4003c7 (Wang YanQing             2015-12-11 00:35:19 +0800 1581) 	@echo  '  dir/file.[ois]  - Build specified target only'
433db3e260bc8 (Vinícius Tinti           2017-04-24 13:04:58 -0700 1582) 	@echo  '  dir/file.ll     - Build the LLVM assembly file'
433db3e260bc8 (Vinícius Tinti           2017-04-24 13:04:58 -0700 1583) 	@echo  '                    (requires compiler support for LLVM assembly generation)'
6271897978072 (Joe Perches              2010-01-13 09:31:44 -0800 1584) 	@echo  '  dir/file.lst    - Build specified mixed source/assembly target only'
6271897978072 (Joe Perches              2010-01-13 09:31:44 -0800 1585) 	@echo  '                    (requires a recent binutils and recent build (System.map))'
155ad605b3c9c (Sam Ravnborg             2005-07-07 17:56:08 -0700 1586) 	@echo  '  dir/file.ko     - Build module including final link'
c4d5ee67ce265 (Robert P. J. Day         2009-04-24 12:35:23 -0400 1587) 	@echo  '  modules_prepare - Set up for building external modules'
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1588) 	@echo  '  tags/TAGS	  - Generate tags file for editors'
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1589) 	@echo  '  cscope	  - Generate cscope index'
f4ed1009fcea8 (Jianbin Kang             2011-01-14 20:07:05 +0800 1590) 	@echo  '  gtags           - Generate GNU GLOBAL index'
3f1d9a6cec011 (Michal Marek             2014-07-11 15:57:24 +0200 1591) 	@echo  '  kernelrelease	  - Output the release version string (use with make -s)'
3f1d9a6cec011 (Michal Marek             2014-07-11 15:57:24 +0200 1592) 	@echo  '  kernelversion	  - Output the version stored in Makefile (use with make -s)'
3f1d9a6cec011 (Michal Marek             2014-07-11 15:57:24 +0200 1593) 	@echo  '  image_name	  - Output the image name (use with make -s)'
2fb9b1bd9dd7f (Sam Ravnborg             2008-06-21 00:24:17 +0200 1594) 	@echo  '  headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH'; \
59df3230fc57f (Geert Uytterhoeven       2007-01-29 13:47:01 +0100 1595) 	 echo  '                    (default: $(INSTALL_HDR_PATH))'; \
2fb9b1bd9dd7f (Sam Ravnborg             2008-06-21 00:24:17 +0200 1596) 	 echo  ''
31b8cc80776c1 (Randy Dunlap             2017-05-08 15:55:08 -0700 1597) 	@echo  'Static analysers:'
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1598) 	@echo  '  checkstack      - Generate a list of stack hogs'
aa025e7d5cfbc (Sam Ravnborg             2007-11-14 21:34:55 +0100 1599) 	@echo  '  versioncheck    - Sanity check on version.h usage'
ec2d987f98ba7 (Randy Dunlap             2007-11-04 12:01:55 -0800 1600) 	@echo  '  includecheck    - Check for duplicate included header files'
295ac051861e0 (Adrian Bunk              2007-08-24 23:04:56 +0200 1601) 	@echo  '  export_report   - List the usages of all exported symbols'
74425eee71eb4 (Nicolas Palix            2010-06-06 17:15:01 +0200 1602) 	@echo  '  headerdep       - Detect inclusion cycles in headers'
7f855fc805cd9 (Masahiro Yamada          2017-11-14 18:47:20 +0900 1603) 	@echo  '  coccicheck      - Check with Coccinelle'
6ad7cbc015272 (Nathan Huckleberry       2020-08-22 23:56:18 +0900 1604) 	@echo  '  clang-analyzer  - Check with clang static analyzer'
6ad7cbc015272 (Nathan Huckleberry       2020-08-22 23:56:18 +0900 1605) 	@echo  '  clang-tidy      - Check with clang-tidy'
74425eee71eb4 (Nicolas Palix            2010-06-06 17:15:01 +0200 1606) 	@echo  ''
eb8305aecb958 (Matthias Maennich        2019-09-06 11:32:32 +0100 1607) 	@echo  'Tools:'
eb8305aecb958 (Matthias Maennich        2019-09-06 11:32:32 +0100 1608) 	@echo  '  nsdeps          - Generate missing symbol namespace dependencies'
eb8305aecb958 (Matthias Maennich        2019-09-06 11:32:32 +0100 1609) 	@echo  ''
31b8cc80776c1 (Randy Dunlap             2017-05-08 15:55:08 -0700 1610) 	@echo  'Kernel selftest:'
e51d8dacf2724 (Shuah Khan               2020-03-30 12:07:11 -0600 1611) 	@echo  '  kselftest         - Build and run kernel selftest'
e51d8dacf2724 (Shuah Khan               2020-03-30 12:07:11 -0600 1612) 	@echo  '                      Build, install, and boot kernel before'
e51d8dacf2724 (Shuah Khan               2020-03-30 12:07:11 -0600 1613) 	@echo  '                      running kselftest on it'
e51d8dacf2724 (Shuah Khan               2020-03-30 12:07:11 -0600 1614) 	@echo  '                      Run as root for full coverage'
e51d8dacf2724 (Shuah Khan               2020-03-30 12:07:11 -0600 1615) 	@echo  '  kselftest-all     - Build kernel selftest'
e51d8dacf2724 (Shuah Khan               2020-03-30 12:07:11 -0600 1616) 	@echo  '  kselftest-install - Build and install kernel selftest'
e51d8dacf2724 (Shuah Khan               2020-03-30 12:07:11 -0600 1617) 	@echo  '  kselftest-clean   - Remove all generated kselftest files'
e51d8dacf2724 (Shuah Khan               2020-03-30 12:07:11 -0600 1618) 	@echo  '  kselftest-merge   - Merge all the config dependencies of'
e51d8dacf2724 (Shuah Khan               2020-03-30 12:07:11 -0600 1619) 	@echo  '		      kselftest to existing .config.'
5a5da78b3a481 (Shuah Khan               2014-08-07 13:07:46 -0600 1620) 	@echo  ''
37c8a5fafa3bb (Rob Herring              2018-01-10 15:19:37 -0600 1621) 	@$(if $(dtstree), \
37c8a5fafa3bb (Rob Herring              2018-01-10 15:19:37 -0600 1622) 		echo 'Devicetree:'; \
7aa8dd91da63a (Stephen Boyd             2019-08-13 11:38:25 -0700 1623) 		echo '* dtbs             - Build device tree blobs for enabled boards'; \
7aa8dd91da63a (Stephen Boyd             2019-08-13 11:38:25 -0700 1624) 		echo '  dtbs_install     - Install dtbs to $(INSTALL_DTBS_PATH)'; \
7aa8dd91da63a (Stephen Boyd             2019-08-13 11:38:25 -0700 1625) 		echo '  dt_binding_check - Validate device tree binding documents'; \
7aa8dd91da63a (Stephen Boyd             2019-08-13 11:38:25 -0700 1626) 		echo '  dtbs_check       - Validate device tree source files';\
37c8a5fafa3bb (Rob Herring              2018-01-10 15:19:37 -0600 1627) 		echo '')
37c8a5fafa3bb (Rob Herring              2018-01-10 15:19:37 -0600 1628) 
31b8cc80776c1 (Randy Dunlap             2017-05-08 15:55:08 -0700 1629) 	@echo 'Userspace tools targets:'
31b8cc80776c1 (Randy Dunlap             2017-05-08 15:55:08 -0700 1630) 	@echo '  use "make tools/help"'
31b8cc80776c1 (Randy Dunlap             2017-05-08 15:55:08 -0700 1631) 	@echo '  or  "cd tools; make help"'
31b8cc80776c1 (Randy Dunlap             2017-05-08 15:55:08 -0700 1632) 	@echo  ''
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1633) 	@echo  'Kernel packaging:'
000ec95fbe757 (Masahiro Yamada          2019-08-21 16:02:04 +0900 1634) 	@$(MAKE) -f $(srctree)/scripts/Makefile.package help
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1635) 	@echo  ''
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1636) 	@echo  'Documentation targets:'
cb43fb5775dff (Mauro Carvalho Chehab    2017-05-14 11:50:01 -0300 1637) 	@$(MAKE) -f $(srctree)/Documentation/Makefile dochelp
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1638) 	@echo  ''
01dee1881d7cb (Andres Salomon           2008-04-25 22:34:58 -0400 1639) 	@echo  'Architecture specific targets ($(SRCARCH)):'
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1640) 	@$(if $(archhelp),$(archhelp),\
01dee1881d7cb (Andres Salomon           2008-04-25 22:34:58 -0400 1641) 		echo '  No architecture specific help defined for $(SRCARCH)')
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1642) 	@echo  ''
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1643) 	@$(if $(boards), \
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1644) 		$(foreach b, $(boards), \
4234448b7073d (Geert Uytterhoeven       2019-10-25 13:53:05 +0200 1645) 		printf "  %-27s - Build for %s\\n" $(b) $(subst _defconfig,,$(b));) \
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1646) 		echo '')
5dffbe811b786 (Segher Boessenkool       2008-04-06 22:16:07 +0200 1647) 	@$(if $(board-dirs), \
5dffbe811b786 (Segher Boessenkool       2008-04-06 22:16:07 +0200 1648) 		$(foreach b, $(board-dirs), \
5dffbe811b786 (Segher Boessenkool       2008-04-06 22:16:07 +0200 1649) 		printf "  %-16s - Show %s-specific targets\\n" help-$(b) $(b);) \
5dffbe811b786 (Segher Boessenkool       2008-04-06 22:16:07 +0200 1650) 		printf "  %-16s - Show all of the above\\n" help-boards; \
5dffbe811b786 (Segher Boessenkool       2008-04-06 22:16:07 +0200 1651) 		echo '')
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1652) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1653) 	@echo  '  make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build'
45d506bd65e2e (Sam Ravnborg             2006-08-08 21:35:14 +0200 1654) 	@echo  '  make V=2   [targets] 2 => give reason for rebuild of target'
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1655) 	@echo  '  make O=dir [targets] Locate all output files in "dir", including .config'
a64c0440dda1f (Geert Uytterhoeven       2019-10-25 13:52:32 +0200 1656) 	@echo  '  make C=1   [targets] Check re-compiled c source with $$CHECK'
a64c0440dda1f (Geert Uytterhoeven       2019-10-25 13:52:32 +0200 1657) 	@echo  '                       (sparse by default)'
701842e3bdd7d (Dustin Kirkland          2006-05-23 15:57:23 -0500 1658) 	@echo  '  make C=2   [targets] Force check of all c source with $$CHECK'
af07ce3e77d3b (Ingo Molnar              2011-06-16 13:26:23 +0200 1659) 	@echo  '  make RECORDMCOUNT_WARN=1 [targets] Warn about ignored mcount sections'
e27128db62834 (Masahiro Yamada          2019-09-01 01:25:55 +0900 1660) 	@echo  '  make W=n   [targets] Enable extra build checks, n=1,2,3 where'
28bc20dccadc6 (Sam Ravnborg             2011-04-27 22:15:27 +0200 1661) 	@echo  '		1: warnings which may be relevant and do not occur too often'
28bc20dccadc6 (Sam Ravnborg             2011-04-27 22:15:27 +0200 1662) 	@echo  '		2: warnings which occur quite often but may still be relevant'
28bc20dccadc6 (Sam Ravnborg             2011-04-27 22:15:27 +0200 1663) 	@echo  '		3: more obscure warnings, can most likely be ignored'
a6de553da01c2 (Michal Marek             2011-04-29 14:45:31 +0200 1664) 	@echo  '		Multiple levels can be combined with W=12 or W=123'
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1665) 	@echo  ''
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1666) 	@echo  'Execute "make" or "make all" to build all targets marked with [*] '
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1667) 	@echo  'For further info see the ./README file'
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1668) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1669) 
5dffbe811b786 (Segher Boessenkool       2008-04-06 22:16:07 +0200 1670) help-board-dirs := $(addprefix help-,$(board-dirs))
5dffbe811b786 (Segher Boessenkool       2008-04-06 22:16:07 +0200 1671) 
5dffbe811b786 (Segher Boessenkool       2008-04-06 22:16:07 +0200 1672) help-boards: $(help-board-dirs)
5dffbe811b786 (Segher Boessenkool       2008-04-06 22:16:07 +0200 1673) 
fbae4d585e5a6 (Michal Marek             2014-11-28 13:31:43 +0100 1674) boards-per-dir = $(sort $(notdir $(wildcard $(srctree)/arch/$(SRCARCH)/configs/$*/*_defconfig)))
5dffbe811b786 (Segher Boessenkool       2008-04-06 22:16:07 +0200 1675) 
5dffbe811b786 (Segher Boessenkool       2008-04-06 22:16:07 +0200 1676) $(help-board-dirs): help-%:
5dffbe811b786 (Segher Boessenkool       2008-04-06 22:16:07 +0200 1677) 	@echo  'Architecture specific targets ($(SRCARCH) $*):'
5dffbe811b786 (Segher Boessenkool       2008-04-06 22:16:07 +0200 1678) 	@$(if $(boards-per-dir), \
5dffbe811b786 (Segher Boessenkool       2008-04-06 22:16:07 +0200 1679) 		$(foreach b, $(boards-per-dir), \
5dffbe811b786 (Segher Boessenkool       2008-04-06 22:16:07 +0200 1680) 		printf "  %-24s - Build for %s\\n" $*/$(b) $(subst _defconfig,,$(b));) \
5dffbe811b786 (Segher Boessenkool       2008-04-06 22:16:07 +0200 1681) 		echo '')
5dffbe811b786 (Segher Boessenkool       2008-04-06 22:16:07 +0200 1682) 
5dffbe811b786 (Segher Boessenkool       2008-04-06 22:16:07 +0200 1683) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1684) # Documentation targets
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1685) # ---------------------------------------------------------------------------
e8939222dced6 (Jani Nikula              2017-10-09 18:26:15 +0300 1686) DOC_TARGETS := xmldocs latexdocs pdfdocs htmldocs epubdocs cleandocs \
e8939222dced6 (Jani Nikula              2017-10-09 18:26:15 +0300 1687) 	       linkcheckdocs dochelp refcheckdocs
22cba31bae9dc (Jani Nikula              2016-05-19 15:14:05 +0300 1688) PHONY += $(DOC_TARGETS)
bc7b752a7a1c8 (Masahiro Yamada          2019-08-22 02:33:21 +0900 1689) $(DOC_TARGETS):
cb43fb5775dff (Mauro Carvalho Chehab    2017-05-14 11:50:01 -0300 1690) 	$(Q)$(MAKE) $(build)=Documentation $@
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1691) 
67274c0834383 (Masahiro Yamada          2019-02-19 18:33:02 +0900 1692) # Misc
67274c0834383 (Masahiro Yamada          2019-02-19 18:33:02 +0900 1693) # ---------------------------------------------------------------------------
67274c0834383 (Masahiro Yamada          2019-02-19 18:33:02 +0900 1694) 
67274c0834383 (Masahiro Yamada          2019-02-19 18:33:02 +0900 1695) PHONY += scripts_gdb
7a739ce51dca7 (Masahiro Yamada          2019-06-04 19:13:57 +0900 1696) scripts_gdb: prepare0
1e5ff84ffe0b0 (Masahiro Yamada          2019-02-19 18:33:04 +0900 1697) 	$(Q)$(MAKE) $(build)=scripts/gdb
8d2e52003adf4 (Masahiro Yamada          2019-02-19 18:33:05 +0900 1698) 	$(Q)ln -fsn $(abspath $(srctree)/scripts/gdb/vmlinux-gdb.py)
67274c0834383 (Masahiro Yamada          2019-02-19 18:33:02 +0900 1699) 
67274c0834383 (Masahiro Yamada          2019-02-19 18:33:02 +0900 1700) ifdef CONFIG_GDB_SCRIPTS
67274c0834383 (Masahiro Yamada          2019-02-19 18:33:02 +0900 1701) all: scripts_gdb
67274c0834383 (Masahiro Yamada          2019-02-19 18:33:02 +0900 1702) endif
67274c0834383 (Masahiro Yamada          2019-02-19 18:33:02 +0900 1703) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1704) else # KBUILD_EXTMOD
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1705) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1706) ###
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1707) # External module support.
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1708) # When building external modules the kernel used as basis is considered
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1709) # read-only, and no consistency checks are made and the make
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1710) # system is not used on the basis kernel. If updates are required
11122b860bc52 (Masahiro Yamada          2021-05-04 19:10:58 +0900 1711) # in the basis kernel ordinary make commands (without M=...) must be used.
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1712) 
6212804f2d78e (Masahiro Yamada          2020-09-09 05:55:57 +0900 1713) # We are always building only modules.
6212804f2d78e (Masahiro Yamada          2020-09-09 05:55:57 +0900 1714) KBUILD_BUILTIN :=
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1715) KBUILD_MODULES := 1
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1716) 
c99f3918cf0a6 (Masahiro Yamada          2019-08-11 00:53:04 +0900 1717) build-dirs := $(KBUILD_EXTMOD)
3d32285fa9959 (Masahiro Yamada          2020-08-22 23:56:16 +0900 1718) $(MODORDER): descend
3d32285fa9959 (Masahiro Yamada          2020-08-22 23:56:16 +0900 1719) 	@:
3d32285fa9959 (Masahiro Yamada          2020-08-22 23:56:16 +0900 1720) 
7f69180b8e905 (Masahiro Yamada          2021-03-31 22:38:06 +0900 1721) compile_commands.json: $(extmod_prefix)compile_commands.json
3d32285fa9959 (Masahiro Yamada          2020-08-22 23:56:16 +0900 1722) PHONY += compile_commands.json
3d32285fa9959 (Masahiro Yamada          2020-08-22 23:56:16 +0900 1723) 
76cd306d79792 (Masahiro Yamada          2019-08-11 00:53:05 +0900 1724) clean-dirs := $(KBUILD_EXTMOD)
3d32285fa9959 (Masahiro Yamada          2020-08-22 23:56:16 +0900 1725) clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers $(KBUILD_EXTMOD)/modules.nsdeps \
dc5723b02e523 (Sami Tolvanen            2020-12-11 10:46:19 -0800 1726) 	$(KBUILD_EXTMOD)/compile_commands.json $(KBUILD_EXTMOD)/.thinlto-cache
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1727) 
6072b2c49d23e (Masahiro Yamada          2021-08-01 11:53:46 +0900 1728) PHONY += prepare
6072b2c49d23e (Masahiro Yamada          2021-08-01 11:53:46 +0900 1729) # now expand this into a simple variable to reduce the cost of shell evaluations
6072b2c49d23e (Masahiro Yamada          2021-08-01 11:53:46 +0900 1730) prepare: CC_VERSION_TEXT := $(CC_VERSION_TEXT)
6072b2c49d23e (Masahiro Yamada          2021-08-01 11:53:46 +0900 1731) prepare:
6072b2c49d23e (Masahiro Yamada          2021-08-01 11:53:46 +0900 1732) 	@if [ "$(CC_VERSION_TEXT)" != $(CONFIG_CC_VERSION_TEXT) ]; then \
6072b2c49d23e (Masahiro Yamada          2021-08-01 11:53:46 +0900 1733) 		echo >&2 "warning: the compiler differs from the one used to build the kernel"; \
6072b2c49d23e (Masahiro Yamada          2021-08-01 11:53:46 +0900 1734) 		echo >&2 "  The kernel was built by: "$(CONFIG_CC_VERSION_TEXT); \
6072b2c49d23e (Masahiro Yamada          2021-08-01 11:53:46 +0900 1735) 		echo >&2 "  You are using:           $(CC_VERSION_TEXT)"; \
6072b2c49d23e (Masahiro Yamada          2021-08-01 11:53:46 +0900 1736) 	fi
6072b2c49d23e (Masahiro Yamada          2021-08-01 11:53:46 +0900 1737) 
fe69b420d39d3 (Masahiro Yamada          2016-03-13 09:39:55 +0900 1738) PHONY += help
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1739) help:
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1740) 	@echo  '  Building external modules.'
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1741) 	@echo  '  Syntax: make -C path/to/kernel/src M=$$PWD target'
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1742) 	@echo  ''
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1743) 	@echo  '  modules         - default target, build the module(s)'
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1744) 	@echo  '  modules_install - install the module'
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1745) 	@echo  '  clean           - remove generated files in module directory only'
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1746) 	@echo  ''
06300b21f4c79 (Sam Ravnborg             2006-01-25 07:13:18 +0100 1747) 
596b0474d3d9b (Masahiro Yamada          2020-09-08 13:27:08 +0900 1748) # no-op for external module builds
6072b2c49d23e (Masahiro Yamada          2021-08-01 11:53:46 +0900 1749) PHONY += modules_prepare
596b0474d3d9b (Masahiro Yamada          2020-09-08 13:27:08 +0900 1750) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1751) endif # KBUILD_EXTMOD
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1752) 
3e3005df73b53 (Masahiro Yamada          2021-03-31 22:38:03 +0900 1753) # ---------------------------------------------------------------------------
3e3005df73b53 (Masahiro Yamada          2021-03-31 22:38:03 +0900 1754) # Modules
3e3005df73b53 (Masahiro Yamada          2021-03-31 22:38:03 +0900 1755) 
3e3005df73b53 (Masahiro Yamada          2021-03-31 22:38:03 +0900 1756) PHONY += modules modules_install
3e3005df73b53 (Masahiro Yamada          2021-03-31 22:38:03 +0900 1757) 
3e3005df73b53 (Masahiro Yamada          2021-03-31 22:38:03 +0900 1758) ifdef CONFIG_MODULES
3e3005df73b53 (Masahiro Yamada          2021-03-31 22:38:03 +0900 1759) 
1a998be620a10 (Masahiro Yamada          2021-03-31 22:38:05 +0900 1760) modules: modules_check
3e3005df73b53 (Masahiro Yamada          2021-03-31 22:38:03 +0900 1761) 	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
3e3005df73b53 (Masahiro Yamada          2021-03-31 22:38:03 +0900 1762) 
1a998be620a10 (Masahiro Yamada          2021-03-31 22:38:05 +0900 1763) PHONY += modules_check
1a998be620a10 (Masahiro Yamada          2021-03-31 22:38:05 +0900 1764) modules_check: $(MODORDER)
1a998be620a10 (Masahiro Yamada          2021-03-31 22:38:05 +0900 1765) 	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh $<
1a998be620a10 (Masahiro Yamada          2021-03-31 22:38:05 +0900 1766) 
3ac42b2112532 (Masahiro Yamada          2021-03-31 22:38:04 +0900 1767) quiet_cmd_depmod = DEPMOD  $(MODLIB)
3e3005df73b53 (Masahiro Yamada          2021-03-31 22:38:03 +0900 1768)       cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \
3e3005df73b53 (Masahiro Yamada          2021-03-31 22:38:03 +0900 1769)                    $(KERNELRELEASE)
3e3005df73b53 (Masahiro Yamada          2021-03-31 22:38:03 +0900 1770) 
3e3005df73b53 (Masahiro Yamada          2021-03-31 22:38:03 +0900 1771) modules_install:
3e3005df73b53 (Masahiro Yamada          2021-03-31 22:38:03 +0900 1772) 	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
3e3005df73b53 (Masahiro Yamada          2021-03-31 22:38:03 +0900 1773) 	$(call cmd,depmod)
3e3005df73b53 (Masahiro Yamada          2021-03-31 22:38:03 +0900 1774) 
3e3005df73b53 (Masahiro Yamada          2021-03-31 22:38:03 +0900 1775) else # CONFIG_MODULES
3e3005df73b53 (Masahiro Yamada          2021-03-31 22:38:03 +0900 1776) 
3e3005df73b53 (Masahiro Yamada          2021-03-31 22:38:03 +0900 1777) # Modules not configured
3e3005df73b53 (Masahiro Yamada          2021-03-31 22:38:03 +0900 1778) # ---------------------------------------------------------------------------
3e3005df73b53 (Masahiro Yamada          2021-03-31 22:38:03 +0900 1779) 
3e3005df73b53 (Masahiro Yamada          2021-03-31 22:38:03 +0900 1780) modules modules_install:
3e3005df73b53 (Masahiro Yamada          2021-03-31 22:38:03 +0900 1781) 	@echo >&2 '***'
3e3005df73b53 (Masahiro Yamada          2021-03-31 22:38:03 +0900 1782) 	@echo >&2 '*** The present kernel configuration has modules disabled.'
3e3005df73b53 (Masahiro Yamada          2021-03-31 22:38:03 +0900 1783) 	@echo >&2 '*** To use the module feature, please run "make menuconfig" etc.'
3e3005df73b53 (Masahiro Yamada          2021-03-31 22:38:03 +0900 1784) 	@echo >&2 '*** to enable CONFIG_MODULES.'
3e3005df73b53 (Masahiro Yamada          2021-03-31 22:38:03 +0900 1785) 	@echo >&2 '***'
3e3005df73b53 (Masahiro Yamada          2021-03-31 22:38:03 +0900 1786) 	@exit 1
3e3005df73b53 (Masahiro Yamada          2021-03-31 22:38:03 +0900 1787) 
3e3005df73b53 (Masahiro Yamada          2021-03-31 22:38:03 +0900 1788) endif # CONFIG_MODULES
3e3005df73b53 (Masahiro Yamada          2021-03-31 22:38:03 +0900 1789) 
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1790) # Single targets
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1791) # ---------------------------------------------------------------------------
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1792) # To build individual files in subdirectories, you can do like this:
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1793) #
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1794) #   make foo/bar/baz.s
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1795) #
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1796) # The supported suffixes for single-target are listed in 'single-targets'
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1797) #
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1798) # To build only under specific subdirectories, you can do like this:
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1799) #
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1800) #   make foo/bar/baz/
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1801) 
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1802) ifdef single-build
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1803) 
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1804) # .ko is special because modpost is needed
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1805) single-ko := $(sort $(filter %.ko, $(MAKECMDGOALS)))
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1806) single-no-ko := $(sort $(patsubst %.ko,%.mod, $(MAKECMDGOALS)))
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1807) 
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1808) $(single-ko): single_modpost
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1809) 	@:
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1810) $(single-no-ko): descend
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1811) 	@:
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1812) 
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1813) ifeq ($(KBUILD_EXTMOD),)
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1814) # For the single build of in-tree modules, use a temporary file to avoid
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1815) # the situation of modules_install installing an invalid modules.order.
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1816) MODORDER := .modules.tmp
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1817) endif
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1818) 
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1819) PHONY += single_modpost
596b0474d3d9b (Masahiro Yamada          2020-09-08 13:27:08 +0900 1820) single_modpost: $(single-no-ko) modules_prepare
7f69180b8e905 (Masahiro Yamada          2021-03-31 22:38:06 +0900 1821) 	$(Q){ $(foreach m, $(single-ko), echo $(extmod_prefix)$m;) } > $(MODORDER)
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1822) 	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1823) 
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1824) KBUILD_MODULES := 1
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1825) 
7f69180b8e905 (Masahiro Yamada          2021-03-31 22:38:06 +0900 1826) export KBUILD_SINGLE_TARGETS := $(addprefix $(extmod_prefix), $(single-no-ko))
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1827) 
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1828) # trim unrelated directories
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1829) build-dirs := $(foreach d, $(build-dirs), \
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1830) 			$(if $(filter $(d)/%, $(KBUILD_SINGLE_TARGETS)), $(d)))
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1831) 
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1832) endif
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1833) 
b480fec988b05 (Masahiro Yamada          2020-05-22 10:59:59 +0900 1834) ifndef CONFIG_MODULES
b480fec988b05 (Masahiro Yamada          2020-05-22 10:59:59 +0900 1835) KBUILD_MODULES :=
b480fec988b05 (Masahiro Yamada          2020-05-22 10:59:59 +0900 1836) endif
b480fec988b05 (Masahiro Yamada          2020-05-22 10:59:59 +0900 1837) 
c99f3918cf0a6 (Masahiro Yamada          2019-08-11 00:53:04 +0900 1838) # Handle descending into subdirectories listed in $(build-dirs)
c99f3918cf0a6 (Masahiro Yamada          2019-08-11 00:53:04 +0900 1839) # Preset locale variables to speed up the build process. Limit locale
c99f3918cf0a6 (Masahiro Yamada          2019-08-11 00:53:04 +0900 1840) # tweaks to this spot to avoid wrong language settings when running
c99f3918cf0a6 (Masahiro Yamada          2019-08-11 00:53:04 +0900 1841) # make menuconfig etc.
c99f3918cf0a6 (Masahiro Yamada          2019-08-11 00:53:04 +0900 1842) # Error messages still appears in the original language
c99f3918cf0a6 (Masahiro Yamada          2019-08-11 00:53:04 +0900 1843) PHONY += descend $(build-dirs)
c99f3918cf0a6 (Masahiro Yamada          2019-08-11 00:53:04 +0900 1844) descend: $(build-dirs)
c99f3918cf0a6 (Masahiro Yamada          2019-08-11 00:53:04 +0900 1845) $(build-dirs): prepare
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1846) 	$(Q)$(MAKE) $(build)=$@ \
20b1be5952829 (Masahiro Yamada          2020-07-08 01:35:08 +0900 1847) 	single-build=$(if $(filter-out $@/, $(filter $@/%, $(KBUILD_SINGLE_TARGETS))),1) \
b1fbfcb4a2094 (Masahiro Yamada          2019-11-18 13:52:47 +0900 1848) 	need-builtin=1 need-modorder=1
c99f3918cf0a6 (Masahiro Yamada          2019-08-11 00:53:04 +0900 1849) 
76cd306d79792 (Masahiro Yamada          2019-08-11 00:53:05 +0900 1850) clean-dirs := $(addprefix _clean_, $(clean-dirs))
76cd306d79792 (Masahiro Yamada          2019-08-11 00:53:05 +0900 1851) PHONY += $(clean-dirs) clean
76cd306d79792 (Masahiro Yamada          2019-08-11 00:53:05 +0900 1852) $(clean-dirs):
76cd306d79792 (Masahiro Yamada          2019-08-11 00:53:05 +0900 1853) 	$(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
76cd306d79792 (Masahiro Yamada          2019-08-11 00:53:05 +0900 1854) 
88d7be031f9f9 (Michal Marek             2010-09-06 12:00:08 +0200 1855) clean: $(clean-dirs)
88d7be031f9f9 (Michal Marek             2010-09-06 12:00:08 +0200 1856) 	$(call cmd,rmfiles)
43f67c98161c6 (Kevin Cernekee           2011-05-10 15:47:16 -0700 1857) 	@find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \
ef46d9b3dc01d (Masahiro Yamada          2017-11-17 01:49:13 +0900 1858) 		\( -name '*.[aios]' -o -name '*.ko' -o -name '.*.cmd' \
4f0e3a57d6eb7 (Rob Herring              2018-09-06 13:26:07 -0500 1859) 		-o -name '*.ko.*' \
ce88c9c79455f (Viresh Kumar             2021-01-29 12:54:08 +0530 1860) 		-o -name '*.dtb' -o -name '*.dtbo' -o -name '*.dtb.S' -o -name '*.dt.yaml' \
ef46d9b3dc01d (Masahiro Yamada          2017-11-17 01:49:13 +0900 1861) 		-o -name '*.dwo' -o -name '*.lst' \
bbc55bded4aaf (Masahiro Yamada          2019-10-29 21:38:07 +0900 1862) 		-o -name '*.su' -o -name '*.mod' \
88d7be031f9f9 (Michal Marek             2010-09-06 12:00:08 +0200 1863) 		-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
9a8dfb394c046 (Masahiro Yamada          2018-03-23 22:04:31 +0900 1864) 		-o -name '*.lex.c' -o -name '*.tab.[ch]' \
4fa8bc949de11 (Masahiro Yamada          2018-03-23 22:04:37 +0900 1865) 		-o -name '*.asn1.[ch]' \
88d7be031f9f9 (Michal Marek             2010-09-06 12:00:08 +0200 1866) 		-o -name '*.symtypes' -o -name 'modules.order' \
8b41fc4454e36 (Masahiro Yamada          2019-12-19 17:33:29 +0900 1867) 		-o -name '.tmp_*.o.*' \
6b90bd4ba40b3 (Emese Revfy              2016-05-24 00:09:38 +0200 1868) 		-o -name '*.c.[012]*.*' \
433db3e260bc8 (Vinícius Tinti           2017-04-24 13:04:58 -0700 1869) 		-o -name '*.ll' \
38e8918490038 (Sami Tolvanen            2020-12-11 10:46:20 -0800 1870) 		-o -name '*.gcno' \
38e8918490038 (Sami Tolvanen            2020-12-11 10:46:20 -0800 1871) 		-o -name '*.*.symversions' \) -type f -print | xargs rm -f
88d7be031f9f9 (Michal Marek             2010-09-06 12:00:08 +0200 1872) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1873) # Generate tags for editors
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1874) # ---------------------------------------------------------------------------
a680eedc6c621 (Sam Ravnborg             2008-12-03 22:24:13 +0100 1875) quiet_cmd_tags = GEN     $@
858805b336be1 (Masahiro Yamada          2019-08-25 22:28:37 +0900 1876)       cmd_tags = $(BASH) $(srctree)/scripts/tags.sh $@
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1877) 
f4ed1009fcea8 (Jianbin Kang             2011-01-14 20:07:05 +0800 1878) tags TAGS cscope gtags: FORCE
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1879) 	$(call cmd,tags)
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1880) 
eb8305aecb958 (Matthias Maennich        2019-09-06 11:32:32 +0100 1881) # Script to generate missing namespace dependencies
eb8305aecb958 (Matthias Maennich        2019-09-06 11:32:32 +0100 1882) # ---------------------------------------------------------------------------
eb8305aecb958 (Matthias Maennich        2019-09-06 11:32:32 +0100 1883) 
eb8305aecb958 (Matthias Maennich        2019-09-06 11:32:32 +0100 1884) PHONY += nsdeps
bff9c62b5d20d (Masahiro Yamada          2019-10-29 21:38:06 +0900 1885) nsdeps: export KBUILD_NSDEPS=1
eb8305aecb958 (Matthias Maennich        2019-09-06 11:32:32 +0100 1886) nsdeps: modules
bff9c62b5d20d (Masahiro Yamada          2019-10-29 21:38:06 +0900 1887) 	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/nsdeps
eb8305aecb958 (Matthias Maennich        2019-09-06 11:32:32 +0100 1888) 
3d32285fa9959 (Masahiro Yamada          2020-08-22 23:56:16 +0900 1889) # Clang Tooling
3d32285fa9959 (Masahiro Yamada          2020-08-22 23:56:16 +0900 1890) # ---------------------------------------------------------------------------
3d32285fa9959 (Masahiro Yamada          2020-08-22 23:56:16 +0900 1891) 
3d32285fa9959 (Masahiro Yamada          2020-08-22 23:56:16 +0900 1892) quiet_cmd_gen_compile_commands = GEN     $@
3d32285fa9959 (Masahiro Yamada          2020-08-22 23:56:16 +0900 1893)       cmd_gen_compile_commands = $(PYTHON3) $< -a $(AR) -o $@ $(filter-out $<, $(real-prereqs))
3d32285fa9959 (Masahiro Yamada          2020-08-22 23:56:16 +0900 1894) 
7f69180b8e905 (Masahiro Yamada          2021-03-31 22:38:06 +0900 1895) $(extmod_prefix)compile_commands.json: scripts/clang-tools/gen_compile_commands.py \
3d32285fa9959 (Masahiro Yamada          2020-08-22 23:56:16 +0900 1896) 	$(if $(KBUILD_EXTMOD),,$(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS)) \
3d32285fa9959 (Masahiro Yamada          2020-08-22 23:56:16 +0900 1897) 	$(if $(CONFIG_MODULES), $(MODORDER)) FORCE
3d32285fa9959 (Masahiro Yamada          2020-08-22 23:56:16 +0900 1898) 	$(call if_changed,gen_compile_commands)
3d32285fa9959 (Masahiro Yamada          2020-08-22 23:56:16 +0900 1899) 
7f69180b8e905 (Masahiro Yamada          2021-03-31 22:38:06 +0900 1900) targets += $(extmod_prefix)compile_commands.json
3d32285fa9959 (Masahiro Yamada          2020-08-22 23:56:16 +0900 1901) 
6ad7cbc015272 (Nathan Huckleberry       2020-08-22 23:56:18 +0900 1902) PHONY += clang-tidy clang-analyzer
6ad7cbc015272 (Nathan Huckleberry       2020-08-22 23:56:18 +0900 1903) 
6ad7cbc015272 (Nathan Huckleberry       2020-08-22 23:56:18 +0900 1904) ifdef CONFIG_CC_IS_CLANG
6ad7cbc015272 (Nathan Huckleberry       2020-08-22 23:56:18 +0900 1905) quiet_cmd_clang_tools = CHECK   $<
6ad7cbc015272 (Nathan Huckleberry       2020-08-22 23:56:18 +0900 1906)       cmd_clang_tools = $(PYTHON3) $(srctree)/scripts/clang-tools/run-clang-tools.py $@ $<
6ad7cbc015272 (Nathan Huckleberry       2020-08-22 23:56:18 +0900 1907) 
7f69180b8e905 (Masahiro Yamada          2021-03-31 22:38:06 +0900 1908) clang-tidy clang-analyzer: $(extmod_prefix)compile_commands.json
6ad7cbc015272 (Nathan Huckleberry       2020-08-22 23:56:18 +0900 1909) 	$(call cmd,clang_tools)
6ad7cbc015272 (Nathan Huckleberry       2020-08-22 23:56:18 +0900 1910) else
6ad7cbc015272 (Nathan Huckleberry       2020-08-22 23:56:18 +0900 1911) clang-tidy clang-analyzer:
6ad7cbc015272 (Nathan Huckleberry       2020-08-22 23:56:18 +0900 1912) 	@echo "$@ requires CC=clang" >&2
6ad7cbc015272 (Nathan Huckleberry       2020-08-22 23:56:18 +0900 1913) 	@false
6ad7cbc015272 (Nathan Huckleberry       2020-08-22 23:56:18 +0900 1914) endif
6ad7cbc015272 (Nathan Huckleberry       2020-08-22 23:56:18 +0900 1915) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1916) # Scripts to check various things for consistency
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1917) # ---------------------------------------------------------------------------
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1918) 
7dfbea4c468cf (Jacob Keller             2020-10-09 17:18:44 -0700 1919) PHONY += includecheck versioncheck coccicheck export_report
279f3dd3569d0 (Peter Foley              2011-04-26 17:15:01 -0400 1920) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1921) includecheck:
436f876ccb4ea (Peter Foley              2011-04-26 17:18:29 -0400 1922) 	find $(srctree)/* $(RCS_FIND_IGNORE) \
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1923) 		-name '*.[hcS]' -type f -print | sort \
800074345544a (Geert Uytterhoeven       2007-11-05 11:51:44 +0100 1924) 		| xargs $(PERL) -w $(srctree)/scripts/checkincludes.pl
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1925) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1926) versioncheck:
2ee2d29289951 (Peter Foley              2011-04-26 17:19:28 -0400 1927) 	find $(srctree)/* $(RCS_FIND_IGNORE) \
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1928) 		-name '*.[hcS]' -type f -print | sort \
800074345544a (Geert Uytterhoeven       2007-11-05 11:51:44 +0100 1929) 		| xargs $(PERL) -w $(srctree)/scripts/checkversion.pl
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1930) 
74425eee71eb4 (Nicolas Palix            2010-06-06 17:15:01 +0200 1931) coccicheck:
858805b336be1 (Masahiro Yamada          2019-08-25 22:28:37 +0900 1932) 	$(Q)$(BASH) $(srctree)/scripts/$@
74425eee71eb4 (Nicolas Palix            2010-06-06 17:15:01 +0200 1933) 
295ac051861e0 (Adrian Bunk              2007-08-24 23:04:56 +0200 1934) export_report:
295ac051861e0 (Adrian Bunk              2007-08-24 23:04:56 +0200 1935) 	$(PERL) $(srctree)/scripts/export_report.pl
295ac051861e0 (Adrian Bunk              2007-08-24 23:04:56 +0200 1936) 
c398ff00f55d5 (Mike Marciniszyn         2013-06-24 08:48:37 -0400 1937) PHONY += checkstack kernelrelease kernelversion image_name
e3ccf6e3699c8 (Jeff Dike                2006-09-27 01:50:37 -0700 1938) 
011e3a9ad4891 (Jeff Dike                2006-12-13 00:34:12 -0800 1939) # UML needs a little special treatment here.  It wants to use the host
011e3a9ad4891 (Jeff Dike                2006-12-13 00:34:12 -0800 1940) # toolchain, so needs $(SUBARCH) passed to checkstack.pl.  Everyone
011e3a9ad4891 (Jeff Dike                2006-12-13 00:34:12 -0800 1941) # else wants $(ARCH), including people doing cross-builds, which means
011e3a9ad4891 (Jeff Dike                2006-12-13 00:34:12 -0800 1942) # that $(SUBARCH) doesn't work here.
011e3a9ad4891 (Jeff Dike                2006-12-13 00:34:12 -0800 1943) ifeq ($(ARCH), um)
011e3a9ad4891 (Jeff Dike                2006-12-13 00:34:12 -0800 1944) CHECKSTACK_ARCH := $(SUBARCH)
011e3a9ad4891 (Jeff Dike                2006-12-13 00:34:12 -0800 1945) else
011e3a9ad4891 (Jeff Dike                2006-12-13 00:34:12 -0800 1946) CHECKSTACK_ARCH := $(ARCH)
011e3a9ad4891 (Jeff Dike                2006-12-13 00:34:12 -0800 1947) endif
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1948) checkstack:
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1949) 	$(OBJDUMP) -d vmlinux $$(find . -name '*.ko') | \
75dd47472b92c (Masahiro Yamada          2019-07-06 12:07:11 +0900 1950) 	$(PERL) $(srctree)/scripts/checkstack.pl $(CHECKSTACK_ARCH)
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1951) 
7b8ea53d7f186 (Amerigo Wang             2010-08-20 05:36:06 -0400 1952) kernelrelease:
7b8ea53d7f186 (Amerigo Wang             2010-08-20 05:36:06 -0400 1953) 	@echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))"
01ab17887f4cd (Amerigo Wang             2010-06-28 10:45:21 +0800 1954) 
cb58455c48dc4 (Sam Ravnborg             2006-01-09 21:20:34 +0100 1955) kernelversion:
2244cbd8a9185 (Sam Ravnborg             2006-01-16 12:12:12 +0100 1956) 	@echo $(KERNELVERSION)
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1957) 
c398ff00f55d5 (Mike Marciniszyn         2013-06-24 08:48:37 -0400 1958) image_name:
c398ff00f55d5 (Mike Marciniszyn         2013-06-24 08:48:37 -0400 1959) 	@echo $(KBUILD_IMAGE)
c398ff00f55d5 (Mike Marciniszyn         2013-06-24 08:48:37 -0400 1960) 
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1961) quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN   $(wildcard $(rm-files)))
0663c68c4d2d3 (Masahiro Yamada          2020-05-04 17:08:07 +0900 1962)       cmd_rmfiles = rm -rf $(rm-files)
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1963) 
392885ee82d35 (Masahiro Yamada          2018-11-30 10:05:22 +0900 1964) # read saved command lines for existing targets
392885ee82d35 (Masahiro Yamada          2018-11-30 10:05:22 +0900 1965) existing-targets := $(wildcard $(sort $(targets)))
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1966) 
b999923c29d69 (Masahiro Yamada          2019-02-22 16:40:08 +0900 1967) -include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1968) 
46b7c49254f89 (SZ Lin (林上智)          2020-03-01 00:09:58 +0800 1969) endif # config-build
2042b5486bd31 (Masahiro Yamada          2019-08-11 00:53:03 +0900 1970) endif # mixed-build
2042b5486bd31 (Masahiro Yamada          2019-08-11 00:53:03 +0900 1971) endif # need-sub-make
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1972) 
4f1933620f571 (Paul Smith               2006-03-05 17:14:10 -0500 1973) PHONY += FORCE
^1da177e4c3f4 (Linus Torvalds           2005-04-16 15:20:36 -0700 1974) FORCE:
4f1933620f571 (Paul Smith               2006-03-05 17:14:10 -0500 1975) 
bd412d81b7ea4 (Ulf Magnusson            2018-07-05 12:33:07 +0900 1976) # Declare the contents of the PHONY variable as phony.  We keep that
fe8d0a41081d6 (Kirill Smelkov           2009-04-09 15:34:34 +0400 1977) # information in a variable so we can use it in if_changed and friends.
4f1933620f571 (Paul Smith               2006-03-05 17:14:10 -0500 1978) .PHONY: $(PHONY)