summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile43
1 files changed, 38 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 453fe00b1132..ed6907448fb0 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 4 1VERSION = 4
2PATCHLEVEL = 5 2PATCHLEVEL = 5
3SUBLEVEL = 0 3SUBLEVEL = 0
4EXTRAVERSION = -rc1 4EXTRAVERSION =
5NAME = Blurry Fish Butt 5NAME = Blurry Fish Butt
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
@@ -365,6 +365,7 @@ LDFLAGS_MODULE =
365CFLAGS_KERNEL = 365CFLAGS_KERNEL =
366AFLAGS_KERNEL = 366AFLAGS_KERNEL =
367CFLAGS_GCOV = -fprofile-arcs -ftest-coverage 367CFLAGS_GCOV = -fprofile-arcs -ftest-coverage
368CFLAGS_KCOV = -fsanitize-coverage=trace-pc
368 369
369 370
370# Use USERINCLUDE when you must reference the UAPI directories only. 371# Use USERINCLUDE when you must reference the UAPI directories only.
@@ -411,7 +412,7 @@ export MAKE AWK GENKSYMS INSTALLKERNEL PERL PYTHON UTS_MACHINE
411export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS 412export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
412 413
413export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS 414export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
414export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE CFLAGS_GCOV CFLAGS_KASAN CFLAGS_UBSAN 415export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE CFLAGS_GCOV CFLAGS_KCOV CFLAGS_KASAN CFLAGS_UBSAN
415export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE 416export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
416export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE 417export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE
417export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL 418export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL
@@ -673,6 +674,14 @@ endif
673endif 674endif
674KBUILD_CFLAGS += $(stackp-flag) 675KBUILD_CFLAGS += $(stackp-flag)
675 676
677ifdef CONFIG_KCOV
678 ifeq ($(call cc-option, $(CFLAGS_KCOV)),)
679 $(warning Cannot use CONFIG_KCOV: \
680 -fsanitize-coverage=trace-pc is not supported by compiler)
681 CFLAGS_KCOV =
682 endif
683endif
684
676ifeq ($(cc-name),clang) 685ifeq ($(cc-name),clang)
677KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,) 686KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,)
678KBUILD_CPPFLAGS += $(call cc-option,-Wno-unknown-warning-option,) 687KBUILD_CPPFLAGS += $(call cc-option,-Wno-unknown-warning-option,)
@@ -996,7 +1005,21 @@ prepare0: archprepare FORCE
996 $(Q)$(MAKE) $(build)=. 1005 $(Q)$(MAKE) $(build)=.
997 1006
998# All the preparing.. 1007# All the preparing..
999prepare: prepare0 1008prepare: prepare0 prepare-objtool
1009
1010ifdef CONFIG_STACK_VALIDATION
1011 has_libelf := $(shell echo "int main() {}" | $(HOSTCC) -xc -o /dev/null -lelf - &> /dev/null && echo 1 || echo 0)
1012 ifeq ($(has_libelf),1)
1013 objtool_target := tools/objtool FORCE
1014 else
1015 $(warning "Cannot use CONFIG_STACK_VALIDATION, please install libelf-dev or elfutils-libelf-devel")
1016 SKIP_STACK_VALIDATION := 1
1017 export SKIP_STACK_VALIDATION
1018 endif
1019endif
1020
1021PHONY += prepare-objtool
1022prepare-objtool: $(objtool_target)
1000 1023
1001# Generate some files 1024# Generate some files
1002# --------------------------------------------------------------------------- 1025# ---------------------------------------------------------------------------
@@ -1090,6 +1113,14 @@ kselftest:
1090kselftest-clean: 1113kselftest-clean:
1091 $(Q)$(MAKE) -C tools/testing/selftests clean 1114 $(Q)$(MAKE) -C tools/testing/selftests clean
1092 1115
1116PHONY += kselftest-merge
1117kselftest-merge:
1118 $(if $(wildcard $(objtree)/.config),, $(error No .config exists, config your kernel first!))
1119 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh \
1120 -m $(objtree)/.config \
1121 $(srctree)/tools/testing/selftests/*/config
1122 +$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
1123
1093# --------------------------------------------------------------------------- 1124# ---------------------------------------------------------------------------
1094# Modules 1125# Modules
1095 1126
@@ -1298,6 +1329,8 @@ help:
1298 @echo ' Build, install, and boot kernel before' 1329 @echo ' Build, install, and boot kernel before'
1299 @echo ' running kselftest on it' 1330 @echo ' running kselftest on it'
1300 @echo ' kselftest-clean - Remove all generated kselftest files' 1331 @echo ' kselftest-clean - Remove all generated kselftest files'
1332 @echo ' kselftest-merge - Merge all the config dependencies of kselftest to existed'
1333 @echo ' .config.'
1301 @echo '' 1334 @echo ''
1302 @echo 'Kernel packaging:' 1335 @echo 'Kernel packaging:'
1303 @$(MAKE) $(build)=$(package-dir) help 1336 @$(MAKE) $(build)=$(package-dir) help
@@ -1509,11 +1542,11 @@ image_name:
1509# Clear a bunch of variables before executing the submake 1542# Clear a bunch of variables before executing the submake
1510tools/: FORCE 1543tools/: FORCE
1511 $(Q)mkdir -p $(objtree)/tools 1544 $(Q)mkdir -p $(objtree)/tools
1512 $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(filter --j% -j,$(MAKEFLAGS))" O=$(O) subdir=tools -C $(src)/tools/ 1545 $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(filter --j% -j,$(MAKEFLAGS))" O=$(shell cd $(objtree) && /bin/pwd) subdir=tools -C $(src)/tools/
1513 1546
1514tools/%: FORCE 1547tools/%: FORCE
1515 $(Q)mkdir -p $(objtree)/tools 1548 $(Q)mkdir -p $(objtree)/tools
1516 $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(filter --j% -j,$(MAKEFLAGS))" O=$(O) subdir=tools -C $(src)/tools/ $* 1549 $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(filter --j% -j,$(MAKEFLAGS))" O=$(shell cd $(objtree) && /bin/pwd) subdir=tools -C $(src)/tools/ $*
1517 1550
1518# Single targets 1551# Single targets
1519# --------------------------------------------------------------------------- 1552# ---------------------------------------------------------------------------