diff options
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 49 |
1 files changed, 27 insertions, 22 deletions
| @@ -2,7 +2,7 @@ | |||
| 2 | VERSION = 5 | 2 | VERSION = 5 |
| 3 | PATCHLEVEL = 1 | 3 | PATCHLEVEL = 1 |
| 4 | SUBLEVEL = 0 | 4 | SUBLEVEL = 0 |
| 5 | EXTRAVERSION = -rc1 | 5 | EXTRAVERSION = -rc3 |
| 6 | NAME = Shy Crocodile | 6 | NAME = 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: | 34 | ifneq ($(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. | ||
| 38 | ifneq ($(word 2, $(MAKEFILE_LIST)),) | ||
| 39 | $(warning Do not include top Makefile of Linux Kernel) | ||
| 40 | sub-make-done := 1 | ||
| 41 | MAKEFLAGS += -rR | ||
| 42 | endif | ||
| 43 | |||
| 44 | ifneq ($(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) |
| 48 | MAKEFLAGS += -rR | 38 | MAKEFLAGS += -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 |
| 55 | unexport LC_ALL | 41 | unexport LC_ALL |
| 56 | LC_COLLATE=C | 42 | LC_COLLATE=C |
| @@ -153,6 +139,7 @@ $(if $(KBUILD_OUTPUT),, \ | |||
| 153 | # 'sub-make' below. | 139 | # 'sub-make' below. |
| 154 | MAKEFLAGS += --include-dir=$(CURDIR) | 140 | MAKEFLAGS += --include-dir=$(CURDIR) |
| 155 | 141 | ||
| 142 | need-sub-make := 1 | ||
| 156 | else | 143 | else |
| 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 | ||
| 161 | endif # ifneq ($(KBUILD_OUTPUT),) | 148 | endif # ifneq ($(KBUILD_OUTPUT),) |
| 162 | 149 | ||
| 150 | ifneq ($(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. | ||
| 153 | need-sub-make := 1 | ||
| 154 | # Cancel implicit rules for this Makefile. | ||
| 155 | $(lastword $(MAKEFILE_LIST)): ; | ||
| 156 | endif | ||
| 157 | |||
| 158 | export sub_make_done := 1 | ||
| 159 | |||
| 160 | ifeq ($(need-sub-make),1) | ||
| 161 | |||
| 163 | PHONY += $(MAKECMDGOALS) sub-make | 162 | PHONY += $(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 |
| 169 | sub-make: | 168 | sub-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 | ||
| 174 | else # sub-make-done | 173 | endif # need-sub-make |
| 174 | endif # 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 |
| 177 | ifeq ($(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: | |||
| 497 | ifneq ($(KBUILD_SRC),) | 499 | ifneq ($(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 | ||
| 501 | endif | 504 | endif |
| 502 | 505 | ||
| 503 | ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep clang),) | 506 | ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep clang),) |
| @@ -677,7 +680,7 @@ KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow) | |||
| 677 | KBUILD_CFLAGS += $(call cc-disable-warning, int-in-bool-context) | 680 | KBUILD_CFLAGS += $(call cc-disable-warning, int-in-bool-context) |
| 678 | 681 | ||
| 679 | ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE | 682 | ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE |
| 680 | KBUILD_CFLAGS += $(call cc-option,-Oz,-Os) | 683 | KBUILD_CFLAGS += -Os |
| 681 | else | 684 | else |
| 682 | KBUILD_CFLAGS += -O2 | 685 | KBUILD_CFLAGS += -O2 |
| 683 | endif | 686 | endif |
| @@ -950,9 +953,11 @@ mod_sign_cmd = true | |||
| 950 | endif | 953 | endif |
| 951 | export mod_sign_cmd | 954 | export mod_sign_cmd |
| 952 | 955 | ||
| 956 | HOST_LIBELF_LIBS = $(shell pkg-config libelf --libs 2>/dev/null || echo -lelf) | ||
| 957 | |||
| 953 | ifdef CONFIG_STACK_VALIDATION | 958 | ifdef 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 | ||
| 1758 | endif # ifeq ($(config-targets),1) | 1763 | endif # ifeq ($(config-targets),1) |
| 1759 | endif # ifeq ($(mixed-targets),1) | 1764 | endif # ifeq ($(mixed-targets),1) |
| 1760 | endif # sub-make-done | 1765 | endif # need-sub-make |
| 1761 | 1766 | ||
| 1762 | PHONY += FORCE | 1767 | PHONY += FORCE |
| 1763 | FORCE: | 1768 | FORCE: |
