aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile49
1 files changed, 27 insertions, 22 deletions
diff --git a/Makefile b/Makefile
index 99c0530489ef..026fbc450906 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
2VERSION = 5 2VERSION = 5
3PATCHLEVEL = 1 3PATCHLEVEL = 1
4SUBLEVEL = 0 4SUBLEVEL = 0
5EXTRAVERSION = -rc1 5EXTRAVERSION = -rc3
6NAME = Shy Crocodile 6NAME = Shy Crocodile
7 7
8# *DOCUMENTATION* 8# *DOCUMENTATION*
@@ -31,26 +31,12 @@ _all:
31# descending is started. They are now explicitly listed as the 31# descending is started. They are now explicitly listed as the
32# prepare rule. 32# prepare rule.
33 33
34# Ugly workaround for Debian make-kpkg: 34ifneq ($(sub_make_done),1)
35# make-kpkg directly includes the top Makefile of Linux kernel. In such a case,
36# skip sub-make to support debian_* targets in ruleset/kernel_version.mk, but
37# displays warning to discourage such abusage.
38ifneq ($(word 2, $(MAKEFILE_LIST)),)
39$(warning Do not include top Makefile of Linux Kernel)
40sub-make-done := 1
41MAKEFLAGS += -rR
42endif
43
44ifneq ($(sub-make-done),1)
45 35
46# Do not use make's built-in rules and variables 36# Do not use make's built-in rules and variables
47# (this increases performance and avoids hard-to-debug behaviour) 37# (this increases performance and avoids hard-to-debug behaviour)
48MAKEFLAGS += -rR 38MAKEFLAGS += -rR
49 39
50# 'MAKEFLAGS += -rR' does not become immediately effective for old
51# GNU Make versions. Cancel implicit rules for this Makefile.
52$(lastword $(MAKEFILE_LIST)): ;
53
54# Avoid funny character set dependencies 40# Avoid funny character set dependencies
55unexport LC_ALL 41unexport LC_ALL
56LC_COLLATE=C 42LC_COLLATE=C
@@ -153,6 +139,7 @@ $(if $(KBUILD_OUTPUT),, \
153# 'sub-make' below. 139# 'sub-make' below.
154MAKEFLAGS += --include-dir=$(CURDIR) 140MAKEFLAGS += --include-dir=$(CURDIR)
155 141
142need-sub-make := 1
156else 143else
157 144
158# Do not print "Entering directory ..." at all for in-tree build. 145# Do not print "Entering directory ..." at all for in-tree build.
@@ -160,6 +147,18 @@ MAKEFLAGS += --no-print-directory
160 147
161endif # ifneq ($(KBUILD_OUTPUT),) 148endif # ifneq ($(KBUILD_OUTPUT),)
162 149
150ifneq ($(filter 3.%,$(MAKE_VERSION)),)
151# 'MAKEFLAGS += -rR' does not immediately become effective for GNU Make 3.x
152# We need to invoke sub-make to avoid implicit rules in the top Makefile.
153need-sub-make := 1
154# Cancel implicit rules for this Makefile.
155$(lastword $(MAKEFILE_LIST)): ;
156endif
157
158export sub_make_done := 1
159
160ifeq ($(need-sub-make),1)
161
163PHONY += $(MAKECMDGOALS) sub-make 162PHONY += $(MAKECMDGOALS) sub-make
164 163
165$(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make 164$(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make
@@ -167,12 +166,15 @@ $(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make
167 166
168# Invoke a second make in the output directory, passing relevant variables 167# Invoke a second make in the output directory, passing relevant variables
169sub-make: 168sub-make:
170 $(Q)$(MAKE) sub-make-done=1 \ 169 $(Q)$(MAKE) \
171 $(if $(KBUILD_OUTPUT),-C $(KBUILD_OUTPUT) KBUILD_SRC=$(CURDIR)) \ 170 $(if $(KBUILD_OUTPUT),-C $(KBUILD_OUTPUT) KBUILD_SRC=$(CURDIR)) \
172 -f $(CURDIR)/Makefile $(filter-out _all sub-make,$(MAKECMDGOALS)) 171 -f $(CURDIR)/Makefile $(filter-out _all sub-make,$(MAKECMDGOALS))
173 172
174else # sub-make-done 173endif # need-sub-make
174endif # sub_make_done
175
175# We process the rest of the Makefile if this is the final invocation of make 176# We process the rest of the Makefile if this is the final invocation of make
177ifeq ($(need-sub-make),)
176 178
177# Do not print "Entering directory ...", 179# Do not print "Entering directory ...",
178# but we want to display it when entering to the output directory 180# but we want to display it when entering to the output directory
@@ -497,7 +499,8 @@ outputmakefile:
497ifneq ($(KBUILD_SRC),) 499ifneq ($(KBUILD_SRC),)
498 $(Q)ln -fsn $(srctree) source 500 $(Q)ln -fsn $(srctree) source
499 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile $(srctree) 501 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile $(srctree)
500 $(Q){ echo "# this is build directory, ignore it"; echo "*"; } > .gitignore 502 $(Q)test -e .gitignore || \
503 { echo "# this is build directory, ignore it"; echo "*"; } > .gitignore
501endif 504endif
502 505
503ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep clang),) 506ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep clang),)
@@ -677,7 +680,7 @@ KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow)
677KBUILD_CFLAGS += $(call cc-disable-warning, int-in-bool-context) 680KBUILD_CFLAGS += $(call cc-disable-warning, int-in-bool-context)
678 681
679ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE 682ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
680KBUILD_CFLAGS += $(call cc-option,-Oz,-Os) 683KBUILD_CFLAGS += -Os
681else 684else
682KBUILD_CFLAGS += -O2 685KBUILD_CFLAGS += -O2
683endif 686endif
@@ -950,9 +953,11 @@ mod_sign_cmd = true
950endif 953endif
951export mod_sign_cmd 954export mod_sign_cmd
952 955
956HOST_LIBELF_LIBS = $(shell pkg-config libelf --libs 2>/dev/null || echo -lelf)
957
953ifdef CONFIG_STACK_VALIDATION 958ifdef CONFIG_STACK_VALIDATION
954 has_libelf := $(call try-run,\ 959 has_libelf := $(call try-run,\
955 echo "int main() {}" | $(HOSTCC) -xc -o /dev/null -lelf -,1,0) 960 echo "int main() {}" | $(HOSTCC) -xc -o /dev/null $(HOST_LIBELF_LIBS) -,1,0)
956 ifeq ($(has_libelf),1) 961 ifeq ($(has_libelf),1)
957 objtool_target := tools/objtool FORCE 962 objtool_target := tools/objtool FORCE
958 else 963 else
@@ -1757,7 +1762,7 @@ existing-targets := $(wildcard $(sort $(targets)))
1757 1762
1758endif # ifeq ($(config-targets),1) 1763endif # ifeq ($(config-targets),1)
1759endif # ifeq ($(mixed-targets),1) 1764endif # ifeq ($(mixed-targets),1)
1760endif # sub-make-done 1765endif # need-sub-make
1761 1766
1762PHONY += FORCE 1767PHONY += FORCE
1763FORCE: 1768FORCE: