diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-13 00:23:38 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-13 00:23:38 -0400 |
commit | 1700ff823b27b6572cf4c3cec66d279baa1a5d30 (patch) | |
tree | 74542164e5df783004f90fa972837294729a324d /Makefile | |
parent | 8841c8b3c4c4d9a9f2a6d30b463ad8d2c6e2f0ea (diff) | |
parent | 699c659b49b5c7cf601fe454683841df16495c3e (diff) |
Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull kbuild updates from Michal Marek:
"Kbuild changes for v3.16-rc1:
- cross-compilation fix so that cc-option is testing the right
compiler
- Fix for make defconfig all
- Using relative paths to the object and source directory where
possible, plus fixes for the fallout of the change
- several cleanups in the Makefiles and scripts
The powerpc fix is from today, because it was only discovered
recently. The rest has been in linux-next for some time"
* 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
powerpc: Avoid circular dependency with zImage.%
kbuild: create include/config directory in scripts/kconfig/Makefile
kbuild: do not create include/linux directory
Makefile: Fix unrecognized cross-compiler command line options
kbuild: do not add "selinux" to subdir- twice
um: Fix for relative objtree when generating x86 headers
kbuild: Use relative path when building in a subdir of the source tree
kbuild: Use relative path when building in the source tree
kbuild: Use relative path for $(objtree)
firmware: Use $(quote) in the Makefile
firmware: Simplify directory creation
kbuild: trivial - fix comment block indent
kbuild: trivial - remove trailing spaces
kbuild: support simultaneous "make %config" and "make all"
kbuild: move extra gcc checks to scripts/Makefile.extrawarn
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 89 |
1 files changed, 52 insertions, 37 deletions
@@ -105,10 +105,6 @@ ifeq ("$(origin O)", "command line") | |||
105 | KBUILD_OUTPUT := $(O) | 105 | KBUILD_OUTPUT := $(O) |
106 | endif | 106 | endif |
107 | 107 | ||
108 | ifeq ("$(origin W)", "command line") | ||
109 | export KBUILD_ENABLE_EXTRA_GCC_CHECKS := $(W) | ||
110 | endif | ||
111 | |||
112 | # That's our default target when none is given on the command line | 108 | # That's our default target when none is given on the command line |
113 | PHONY := _all | 109 | PHONY := _all |
114 | _all: | 110 | _all: |
@@ -153,8 +149,18 @@ else | |||
153 | _all: modules | 149 | _all: modules |
154 | endif | 150 | endif |
155 | 151 | ||
156 | srctree := $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR)) | 152 | ifeq ($(KBUILD_SRC),) |
157 | objtree := $(CURDIR) | 153 | # building in the source tree |
154 | srctree := . | ||
155 | else | ||
156 | ifeq ($(KBUILD_SRC)/,$(dir $(CURDIR))) | ||
157 | # building in a subdirectory of the source tree | ||
158 | srctree := .. | ||
159 | else | ||
160 | srctree := $(KBUILD_SRC) | ||
161 | endif | ||
162 | endif | ||
163 | objtree := . | ||
158 | src := $(srctree) | 164 | src := $(srctree) |
159 | obj := $(objtree) | 165 | obj := $(objtree) |
160 | 166 | ||
@@ -166,7 +172,7 @@ export srctree objtree VPATH | |||
166 | # SUBARCH tells the usermode build what the underlying arch is. That is set | 172 | # SUBARCH tells the usermode build what the underlying arch is. That is set |
167 | # first, and if a usermode build is happening, the "ARCH=um" on the command | 173 | # first, and if a usermode build is happening, the "ARCH=um" on the command |
168 | # line overrides the setting of ARCH below. If a native build is happening, | 174 | # line overrides the setting of ARCH below. If a native build is happening, |
169 | # then ARCH is assigned, getting whatever value it gets normally, and | 175 | # then ARCH is assigned, getting whatever value it gets normally, and |
170 | # SUBARCH is subsequently ignored. | 176 | # SUBARCH is subsequently ignored. |
171 | 177 | ||
172 | SUBARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \ | 178 | SUBARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \ |
@@ -259,18 +265,18 @@ endif | |||
259 | KBUILD_MODULES := | 265 | KBUILD_MODULES := |
260 | KBUILD_BUILTIN := 1 | 266 | KBUILD_BUILTIN := 1 |
261 | 267 | ||
262 | # If we have only "make modules", don't compile built-in objects. | 268 | # If we have only "make modules", don't compile built-in objects. |
263 | # When we're building modules with modversions, we need to consider | 269 | # When we're building modules with modversions, we need to consider |
264 | # the built-in objects during the descend as well, in order to | 270 | # the built-in objects during the descend as well, in order to |
265 | # make sure the checksums are up to date before we record them. | 271 | # make sure the checksums are up to date before we record them. |
266 | 272 | ||
267 | ifeq ($(MAKECMDGOALS),modules) | 273 | ifeq ($(MAKECMDGOALS),modules) |
268 | KBUILD_BUILTIN := $(if $(CONFIG_MODVERSIONS),1) | 274 | KBUILD_BUILTIN := $(if $(CONFIG_MODVERSIONS),1) |
269 | endif | 275 | endif |
270 | 276 | ||
271 | # If we have "make <whatever> modules", compile modules | 277 | # If we have "make <whatever> modules", compile modules |
272 | # in addition to whatever we do anyway. | 278 | # in addition to whatever we do anyway. |
273 | # Just "make" or "make all" shall build modules as well | 279 | # Just "make" or "make all" shall build modules as well |
274 | 280 | ||
275 | ifneq ($(filter all _all modules,$(MAKECMDGOALS)),) | 281 | ifneq ($(filter all _all modules,$(MAKECMDGOALS)),) |
276 | KBUILD_MODULES := 1 | 282 | KBUILD_MODULES := 1 |
@@ -294,7 +300,7 @@ export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD | |||
294 | # cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< | 300 | # cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< |
295 | # | 301 | # |
296 | # If $(quiet) is empty, the whole command will be printed. | 302 | # If $(quiet) is empty, the whole command will be printed. |
297 | # If it is set to "quiet_", only the short version will be printed. | 303 | # If it is set to "quiet_", only the short version will be printed. |
298 | # If it is set to "silent_", nothing will be printed at all, since | 304 | # If it is set to "silent_", nothing will be printed at all, since |
299 | # the variable $(silent_cmd_cc_o_c) doesn't exist. | 305 | # the variable $(silent_cmd_cc_o_c) doesn't exist. |
300 | # | 306 | # |
@@ -346,7 +352,6 @@ $(srctree)/scripts/Kbuild.include: ; | |||
346 | include $(srctree)/scripts/Kbuild.include | 352 | include $(srctree)/scripts/Kbuild.include |
347 | 353 | ||
348 | # Make variables (CC, etc...) | 354 | # Make variables (CC, etc...) |
349 | |||
350 | AS = $(CROSS_COMPILE)as | 355 | AS = $(CROSS_COMPILE)as |
351 | LD = $(CROSS_COMPILE)ld | 356 | LD = $(CROSS_COMPILE)ld |
352 | CC = $(CROSS_COMPILE)gcc | 357 | CC = $(CROSS_COMPILE)gcc |
@@ -395,8 +400,8 @@ KBUILD_CPPFLAGS := -D__KERNEL__ | |||
395 | KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ | 400 | KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ |
396 | -fno-strict-aliasing -fno-common \ | 401 | -fno-strict-aliasing -fno-common \ |
397 | -Werror-implicit-function-declaration \ | 402 | -Werror-implicit-function-declaration \ |
398 | -Wno-format-security \ | 403 | -Wno-format-security |
399 | $(call cc-option,-fno-delete-null-pointer-checks,) | 404 | |
400 | KBUILD_AFLAGS_KERNEL := | 405 | KBUILD_AFLAGS_KERNEL := |
401 | KBUILD_CFLAGS_KERNEL := | 406 | KBUILD_CFLAGS_KERNEL := |
402 | KBUILD_AFLAGS := -D__ASSEMBLY__ | 407 | KBUILD_AFLAGS := -D__ASSEMBLY__ |
@@ -504,8 +509,16 @@ ifeq ($(mixed-targets),1) | |||
504 | # We're called with mixed targets (*config and build targets). | 509 | # We're called with mixed targets (*config and build targets). |
505 | # Handle them one by one. | 510 | # Handle them one by one. |
506 | 511 | ||
507 | %:: FORCE | 512 | PHONY += $(MAKECMDGOALS) __build_one_by_one |
508 | $(Q)$(MAKE) -C $(srctree) KBUILD_SRC= $@ | 513 | |
514 | $(filter-out __build_one_by_one, $(MAKECMDGOALS)): __build_one_by_one | ||
515 | @: | ||
516 | |||
517 | __build_one_by_one: | ||
518 | $(Q)set -e; \ | ||
519 | for i in $(MAKECMDGOALS); do \ | ||
520 | $(MAKE) -f $(srctree)/Makefile $$i; \ | ||
521 | done | ||
509 | 522 | ||
510 | else | 523 | else |
511 | ifeq ($(config-targets),1) | 524 | ifeq ($(config-targets),1) |
@@ -520,11 +533,9 @@ include $(srctree)/arch/$(SRCARCH)/Makefile | |||
520 | export KBUILD_DEFCONFIG KBUILD_KCONFIG | 533 | export KBUILD_DEFCONFIG KBUILD_KCONFIG |
521 | 534 | ||
522 | config: scripts_basic outputmakefile FORCE | 535 | config: scripts_basic outputmakefile FORCE |
523 | $(Q)mkdir -p include/linux include/config | ||
524 | $(Q)$(MAKE) $(build)=scripts/kconfig $@ | 536 | $(Q)$(MAKE) $(build)=scripts/kconfig $@ |
525 | 537 | ||
526 | %config: scripts_basic outputmakefile FORCE | 538 | %config: scripts_basic outputmakefile FORCE |
527 | $(Q)mkdir -p include/linux include/config | ||
528 | $(Q)$(MAKE) $(build)=scripts/kconfig $@ | 539 | $(Q)$(MAKE) $(build)=scripts/kconfig $@ |
529 | 540 | ||
530 | else | 541 | else |
@@ -594,14 +605,16 @@ endif # $(dot-config) | |||
594 | # Defaults to vmlinux, but the arch makefile usually adds further targets | 605 | # Defaults to vmlinux, but the arch makefile usually adds further targets |
595 | all: vmlinux | 606 | all: vmlinux |
596 | 607 | ||
608 | include $(srctree)/arch/$(SRCARCH)/Makefile | ||
609 | |||
610 | KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,) | ||
611 | |||
597 | ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE | 612 | ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE |
598 | KBUILD_CFLAGS += -Os $(call cc-disable-warning,maybe-uninitialized,) | 613 | KBUILD_CFLAGS += -Os $(call cc-disable-warning,maybe-uninitialized,) |
599 | else | 614 | else |
600 | KBUILD_CFLAGS += -O2 | 615 | KBUILD_CFLAGS += -O2 |
601 | endif | 616 | endif |
602 | 617 | ||
603 | include $(srctree)/arch/$(SRCARCH)/Makefile | ||
604 | |||
605 | ifdef CONFIG_READABLE_ASM | 618 | ifdef CONFIG_READABLE_ASM |
606 | # Disable optimizations that make assembler listings hard to read. | 619 | # Disable optimizations that make assembler listings hard to read. |
607 | # reorder blocks reorders the control in the function | 620 | # reorder blocks reorders the control in the function |
@@ -731,6 +744,8 @@ ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC)), y) | |||
731 | KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO | 744 | KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO |
732 | endif | 745 | endif |
733 | 746 | ||
747 | include $(srctree)/scripts/Makefile.extrawarn | ||
748 | |||
734 | # Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments | 749 | # Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments |
735 | KBUILD_CPPFLAGS += $(KCPPFLAGS) | 750 | KBUILD_CPPFLAGS += $(KCPPFLAGS) |
736 | KBUILD_AFLAGS += $(KAFLAGS) | 751 | KBUILD_AFLAGS += $(KAFLAGS) |
@@ -775,10 +790,10 @@ MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE) | |||
775 | export MODLIB | 790 | export MODLIB |
776 | 791 | ||
777 | # | 792 | # |
778 | # INSTALL_MOD_STRIP, if defined, will cause modules to be | 793 | # INSTALL_MOD_STRIP, if defined, will cause modules to be |
779 | # stripped after they are installed. If INSTALL_MOD_STRIP is '1', then | 794 | # stripped after they are installed. If INSTALL_MOD_STRIP is '1', then |
780 | # the default option --strip-debug will be used. Otherwise, | 795 | # the default option --strip-debug will be used. Otherwise, |
781 | # INSTALL_MOD_STRIP value will be used as the options to the strip command. | 796 | # INSTALL_MOD_STRIP value will be used as the options to the strip command. |
782 | 797 | ||
783 | ifdef INSTALL_MOD_STRIP | 798 | ifdef INSTALL_MOD_STRIP |
784 | ifeq ($(INSTALL_MOD_STRIP),1) | 799 | ifeq ($(INSTALL_MOD_STRIP),1) |
@@ -863,7 +878,7 @@ ifdef CONFIG_BUILD_DOCSRC | |||
863 | endif | 878 | endif |
864 | +$(call if_changed,link-vmlinux) | 879 | +$(call if_changed,link-vmlinux) |
865 | 880 | ||
866 | # The actual objects are generated when descending, | 881 | # The actual objects are generated when descending, |
867 | # make sure no implicit rule kicks in | 882 | # make sure no implicit rule kicks in |
868 | $(sort $(vmlinux-deps)): $(vmlinux-dirs) ; | 883 | $(sort $(vmlinux-deps)): $(vmlinux-dirs) ; |
869 | 884 | ||
@@ -1021,11 +1036,11 @@ ifdef CONFIG_MODULES | |||
1021 | 1036 | ||
1022 | all: modules | 1037 | all: modules |
1023 | 1038 | ||
1024 | # Build modules | 1039 | # Build modules |
1025 | # | 1040 | # |
1026 | # A module can be listed more than once in obj-m resulting in | 1041 | # A module can be listed more than once in obj-m resulting in |
1027 | # duplicate lines in modules.order files. Those are removed | 1042 | # duplicate lines in modules.order files. Those are removed |
1028 | # using awk while concatenating to the final file. | 1043 | # using awk while concatenating to the final file. |
1029 | 1044 | ||
1030 | PHONY += modules | 1045 | PHONY += modules |
1031 | modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin | 1046 | modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin |
@@ -1054,10 +1069,10 @@ _modinst_: | |||
1054 | @rm -rf $(MODLIB)/kernel | 1069 | @rm -rf $(MODLIB)/kernel |
1055 | @rm -f $(MODLIB)/source | 1070 | @rm -f $(MODLIB)/source |
1056 | @mkdir -p $(MODLIB)/kernel | 1071 | @mkdir -p $(MODLIB)/kernel |
1057 | @ln -s $(srctree) $(MODLIB)/source | 1072 | @ln -s `cd $(srctree) && /bin/pwd` $(MODLIB)/source |
1058 | @if [ ! $(objtree) -ef $(MODLIB)/build ]; then \ | 1073 | @if [ ! $(objtree) -ef $(MODLIB)/build ]; then \ |
1059 | rm -f $(MODLIB)/build ; \ | 1074 | rm -f $(MODLIB)/build ; \ |
1060 | ln -s $(objtree) $(MODLIB)/build ; \ | 1075 | ln -s $(CURDIR) $(MODLIB)/build ; \ |
1061 | fi | 1076 | fi |
1062 | @cp -f $(objtree)/modules.order $(MODLIB)/ | 1077 | @cp -f $(objtree)/modules.order $(MODLIB)/ |
1063 | @cp -f $(objtree)/modules.builtin $(MODLIB)/ | 1078 | @cp -f $(objtree)/modules.builtin $(MODLIB)/ |
@@ -1104,7 +1119,7 @@ CLEAN_DIRS += $(MODVERDIR) | |||
1104 | 1119 | ||
1105 | # Directories & files removed with 'make mrproper' | 1120 | # Directories & files removed with 'make mrproper' |
1106 | MRPROPER_DIRS += include/config usr/include include/generated \ | 1121 | MRPROPER_DIRS += include/config usr/include include/generated \ |
1107 | arch/*/include/generated .tmp_objdiff | 1122 | arch/*/include/generated .tmp_objdiff |
1108 | MRPROPER_FILES += .config .config.old .version .old_version $(version_h) \ | 1123 | MRPROPER_FILES += .config .config.old .version .old_version $(version_h) \ |
1109 | Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS \ | 1124 | Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS \ |
1110 | signing_key.priv signing_key.x509 x509.genkey \ | 1125 | signing_key.priv signing_key.x509 x509.genkey \ |
@@ -1478,7 +1493,7 @@ endif | |||
1478 | $(build)=$(build-dir) $(@:.ko=.o) | 1493 | $(build)=$(build-dir) $(@:.ko=.o) |
1479 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost | 1494 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost |
1480 | 1495 | ||
1481 | # FIXME Should go into a make.lib or something | 1496 | # FIXME Should go into a make.lib or something |
1482 | # =========================================================================== | 1497 | # =========================================================================== |
1483 | 1498 | ||
1484 | quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN $(wildcard $(rm-dirs))) | 1499 | quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN $(wildcard $(rm-dirs))) |