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