aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile41
1 files changed, 28 insertions, 13 deletions
diff --git a/Makefile b/Makefile
index 85a14f5b74e9..7431c283f15b 100644
--- a/Makefile
+++ b/Makefile
@@ -332,10 +332,9 @@ CHECK = sparse
332 332
333CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \ 333CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
334 -Wbitwise -Wno-return-void $(CF) 334 -Wbitwise -Wno-return-void $(CF)
335MODFLAGS = -DMODULE 335CFLAGS_MODULE =
336CFLAGS_MODULE = $(MODFLAGS) 336AFLAGS_MODULE =
337AFLAGS_MODULE = $(MODFLAGS) 337LDFLAGS_MODULE =
338LDFLAGS_MODULE = -T $(srctree)/scripts/module-common.lds
339CFLAGS_KERNEL = 338CFLAGS_KERNEL =
340AFLAGS_KERNEL = 339AFLAGS_KERNEL =
341CFLAGS_GCOV = -fprofile-arcs -ftest-coverage 340CFLAGS_GCOV = -fprofile-arcs -ftest-coverage
@@ -354,7 +353,12 @@ KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
354 -Werror-implicit-function-declaration \ 353 -Werror-implicit-function-declaration \
355 -Wno-format-security \ 354 -Wno-format-security \
356 -fno-delete-null-pointer-checks 355 -fno-delete-null-pointer-checks
356KBUILD_AFLAGS_KERNEL :=
357KBUILD_CFLAGS_KERNEL :=
357KBUILD_AFLAGS := -D__ASSEMBLY__ 358KBUILD_AFLAGS := -D__ASSEMBLY__
359KBUILD_AFLAGS_MODULE := -DMODULE
360KBUILD_CFLAGS_MODULE := -DMODULE
361KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds
358 362
359# Read KERNELRELEASE from include/config/kernel.release (if it exists) 363# Read KERNELRELEASE from include/config/kernel.release (if it exists)
360KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null) 364KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
@@ -369,6 +373,8 @@ export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
369export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS 373export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
370export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE CFLAGS_GCOV 374export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE CFLAGS_GCOV
371export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE 375export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
376export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE
377export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL
372 378
373# When compiling out-of-tree modules, put MODVERDIR in the module 379# When compiling out-of-tree modules, put MODVERDIR in the module
374# tree rather than in the kernel tree. The kernel tree might 380# tree rather than in the kernel tree. The kernel tree might
@@ -412,9 +418,9 @@ endif
412# of make so .config is not included in this case either (for *config). 418# of make so .config is not included in this case either (for *config).
413 419
414no-dot-config-targets := clean mrproper distclean \ 420no-dot-config-targets := clean mrproper distclean \
415 cscope TAGS tags help %docs check% \ 421 cscope TAGS tags help %docs check% coccicheck \
416 include/linux/version.h headers_% \ 422 include/linux/version.h headers_% \
417 kernelrelease kernelversion %src-pkg 423 kernelversion %src-pkg
418 424
419config-targets := 0 425config-targets := 0
420mixed-targets := 0 426mixed-targets := 0
@@ -526,7 +532,7 @@ endif # $(dot-config)
526# The all: target is the default when no target is given on the 532# The all: target is the default when no target is given on the
527# command line. 533# command line.
528# This allow a user to issue only 'make' to build a kernel including modules 534# This allow a user to issue only 'make' to build a kernel including modules
529# Defaults vmlinux but it is usually overridden in the arch makefile 535# Defaults to vmlinux, but the arch makefile usually adds further targets
530all: vmlinux 536all: vmlinux
531 537
532ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE 538ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
@@ -557,6 +563,10 @@ KBUILD_CFLAGS += -g
557KBUILD_AFLAGS += -gdwarf-2 563KBUILD_AFLAGS += -gdwarf-2
558endif 564endif
559 565
566ifdef CONFIG_DEBUG_INFO_REDUCED
567KBUILD_CFLAGS += $(call cc-option, -femit-struct-debug-baseonly)
568endif
569
560ifdef CONFIG_FUNCTION_TRACER 570ifdef CONFIG_FUNCTION_TRACER
561KBUILD_CFLAGS += -pg 571KBUILD_CFLAGS += -pg
562endif 572endif
@@ -603,7 +613,7 @@ endif
603# Use --build-id when available. 613# Use --build-id when available.
604LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\ 614LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\
605 $(call cc-ldoption, -Wl$(comma)--build-id,)) 615 $(call cc-ldoption, -Wl$(comma)--build-id,))
606LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID) 616KBUILD_LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID)
607LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID) 617LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID)
608 618
609ifeq ($(CONFIG_STRIP_ASM_SYMS),y) 619ifeq ($(CONFIG_STRIP_ASM_SYMS),y)
@@ -1211,8 +1221,9 @@ help:
1211 @echo ' includecheck - Check for duplicate included header files' 1221 @echo ' includecheck - Check for duplicate included header files'
1212 @echo ' export_report - List the usages of all exported symbols' 1222 @echo ' export_report - List the usages of all exported symbols'
1213 @echo ' headers_check - Sanity check on exported headers' 1223 @echo ' headers_check - Sanity check on exported headers'
1214 @echo ' headerdep - Detect inclusion cycles in headers'; \ 1224 @echo ' headerdep - Detect inclusion cycles in headers'
1215 echo '' 1225 @$(MAKE) -f $(srctree)/scripts/Makefile.help checker-help
1226 @echo ''
1216 @echo 'Kernel packaging:' 1227 @echo 'Kernel packaging:'
1217 @$(MAKE) $(build)=$(package-dir) help 1228 @$(MAKE) $(build)=$(package-dir) help
1218 @echo '' 1229 @echo ''
@@ -1371,6 +1382,9 @@ versioncheck:
1371 -name '*.[hcS]' -type f -print | sort \ 1382 -name '*.[hcS]' -type f -print | sort \
1372 | xargs $(PERL) -w $(srctree)/scripts/checkversion.pl 1383 | xargs $(PERL) -w $(srctree)/scripts/checkversion.pl
1373 1384
1385coccicheck:
1386 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/$@
1387
1374namespacecheck: 1388namespacecheck:
1375 $(PERL) $(srctree)/scripts/namespace.pl 1389 $(PERL) $(srctree)/scripts/namespace.pl
1376 1390
@@ -1395,9 +1409,9 @@ checkstack:
1395 $(OBJDUMP) -d vmlinux $$(find . -name '*.ko') | \ 1409 $(OBJDUMP) -d vmlinux $$(find . -name '*.ko') | \
1396 $(PERL) $(src)/scripts/checkstack.pl $(CHECKSTACK_ARCH) 1410 $(PERL) $(src)/scripts/checkstack.pl $(CHECKSTACK_ARCH)
1397 1411
1398kernelrelease: 1412kernelrelease: include/config/kernel.release
1399 $(if $(wildcard include/config/kernel.release), $(Q)echo $(KERNELRELEASE), \ 1413 @echo $(KERNELRELEASE)
1400 $(error kernelrelease not valid - run 'make prepare' to update it)) 1414
1401kernelversion: 1415kernelversion:
1402 @echo $(KERNELVERSION) 1416 @echo $(KERNELVERSION)
1403 1417
@@ -1474,6 +1488,7 @@ cmd_crmodverdir = $(Q)mkdir -p $(MODVERDIR) \
1474 $(if $(KBUILD_MODULES),; rm -f $(MODVERDIR)/*) 1488 $(if $(KBUILD_MODULES),; rm -f $(MODVERDIR)/*)
1475 1489
1476a_flags = -Wp,-MD,$(depfile) $(KBUILD_AFLAGS) $(AFLAGS_KERNEL) \ 1490a_flags = -Wp,-MD,$(depfile) $(KBUILD_AFLAGS) $(AFLAGS_KERNEL) \
1491 $(KBUILD_AFLAGS_KERNEL) \
1477 $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(KBUILD_CPPFLAGS) \ 1492 $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(KBUILD_CPPFLAGS) \
1478 $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(basetarget).o) 1493 $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(basetarget).o)
1479 1494