diff options
| -rw-r--r-- | Kbuild | 2 | ||||
| -rw-r--r-- | Makefile | 297 | ||||
| -rw-r--r-- | arch/arm/Makefile | 6 | ||||
| -rw-r--r-- | arch/c6x/Makefile | 2 | ||||
| -rw-r--r-- | arch/frv/kernel/.gitignore | 1 | ||||
| -rw-r--r-- | arch/hexagon/Makefile | 6 | ||||
| -rw-r--r-- | arch/hexagon/kernel/ptrace.c | 4 | ||||
| -rw-r--r-- | arch/sh/Makefile | 8 | ||||
| -rw-r--r-- | arch/sh/boot/compressed/.gitignore | 5 | ||||
| -rw-r--r-- | arch/x86/entry/vdso/Makefile | 4 | ||||
| -rw-r--r-- | scripts/Kbuild.include | 106 | ||||
| -rw-r--r-- | scripts/Makefile.asm-generic | 3 | ||||
| -rw-r--r-- | scripts/Makefile.build | 25 | ||||
| -rw-r--r-- | scripts/Makefile.headersinst | 10 | ||||
| -rw-r--r-- | scripts/Makefile.help | 3 | ||||
| -rw-r--r-- | scripts/Makefile.host | 12 | ||||
| -rw-r--r-- | scripts/Makefile.lib | 34 | ||||
| -rw-r--r-- | scripts/Makefile.modpost | 3 | ||||
| -rwxr-xr-x | scripts/link-vmlinux.sh | 15 | ||||
| -rwxr-xr-x | scripts/mkcompile_h | 7 | ||||
| -rw-r--r-- | scripts/selinux/Makefile | 1 |
21 files changed, 296 insertions, 258 deletions
| @@ -18,7 +18,6 @@ targets := kernel/bounds.s | |||
| 18 | 18 | ||
| 19 | # We use internal kbuild rules to avoid the "is up to date" message from make | 19 | # We use internal kbuild rules to avoid the "is up to date" message from make |
| 20 | kernel/bounds.s: kernel/bounds.c FORCE | 20 | kernel/bounds.s: kernel/bounds.c FORCE |
| 21 | $(Q)mkdir -p $(dir $@) | ||
| 22 | $(call if_changed_dep,cc_s_c) | 21 | $(call if_changed_dep,cc_s_c) |
| 23 | 22 | ||
| 24 | $(obj)/$(bounds-file): kernel/bounds.s FORCE | 23 | $(obj)/$(bounds-file): kernel/bounds.s FORCE |
| @@ -54,7 +53,6 @@ targets += arch/$(SRCARCH)/kernel/asm-offsets.s | |||
| 54 | # We use internal kbuild rules to avoid the "is up to date" message from make | 53 | # We use internal kbuild rules to avoid the "is up to date" message from make |
| 55 | arch/$(SRCARCH)/kernel/asm-offsets.s: arch/$(SRCARCH)/kernel/asm-offsets.c \ | 54 | arch/$(SRCARCH)/kernel/asm-offsets.s: arch/$(SRCARCH)/kernel/asm-offsets.c \ |
| 56 | $(obj)/$(timeconst-file) $(obj)/$(bounds-file) FORCE | 55 | $(obj)/$(timeconst-file) $(obj)/$(bounds-file) FORCE |
| 57 | $(Q)mkdir -p $(dir $@) | ||
| 58 | $(call if_changed_dep,cc_s_c) | 56 | $(call if_changed_dep,cc_s_c) |
| 59 | 57 | ||
| 60 | $(obj)/$(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s FORCE | 58 | $(obj)/$(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s FORCE |
| @@ -11,6 +11,10 @@ NAME = Fearless Coyote | |||
| 11 | # Comments in this file are targeted only to the developer, do not | 11 | # Comments in this file are targeted only to the developer, do not |
| 12 | # expect to learn how to build the kernel reading this file. | 12 | # expect to learn how to build the kernel reading this file. |
| 13 | 13 | ||
| 14 | # That's our default target when none is given on the command line | ||
| 15 | PHONY := _all | ||
| 16 | _all: | ||
| 17 | |||
| 14 | # o Do not use make's built-in rules and variables | 18 | # o Do not use make's built-in rules and variables |
| 15 | # (this increases performance and avoids hard-to-debug behaviour); | 19 | # (this increases performance and avoids hard-to-debug behaviour); |
| 16 | # o Look for make include files relative to root of kernel src | 20 | # o Look for make include files relative to root of kernel src |
| @@ -117,10 +121,6 @@ ifeq ("$(origin O)", "command line") | |||
| 117 | KBUILD_OUTPUT := $(O) | 121 | KBUILD_OUTPUT := $(O) |
| 118 | endif | 122 | endif |
| 119 | 123 | ||
| 120 | # That's our default target when none is given on the command line | ||
| 121 | PHONY := _all | ||
| 122 | _all: | ||
| 123 | |||
| 124 | # Cancel implicit rules on top Makefile | 124 | # Cancel implicit rules on top Makefile |
| 125 | $(CURDIR)/Makefile Makefile: ; | 125 | $(CURDIR)/Makefile Makefile: ; |
| 126 | 126 | ||
| @@ -187,15 +187,6 @@ ifeq ("$(origin M)", "command line") | |||
| 187 | KBUILD_EXTMOD := $(M) | 187 | KBUILD_EXTMOD := $(M) |
| 188 | endif | 188 | endif |
| 189 | 189 | ||
| 190 | # If building an external module we do not care about the all: rule | ||
| 191 | # but instead _all depend on modules | ||
| 192 | PHONY += all | ||
| 193 | ifeq ($(KBUILD_EXTMOD),) | ||
| 194 | _all: all | ||
| 195 | else | ||
| 196 | _all: modules | ||
| 197 | endif | ||
| 198 | |||
| 199 | ifeq ($(KBUILD_SRC),) | 190 | ifeq ($(KBUILD_SRC),) |
| 200 | # building in the source tree | 191 | # building in the source tree |
| 201 | srctree := . | 192 | srctree := . |
| @@ -207,6 +198,9 @@ else | |||
| 207 | srctree := $(KBUILD_SRC) | 198 | srctree := $(KBUILD_SRC) |
| 208 | endif | 199 | endif |
| 209 | endif | 200 | endif |
| 201 | |||
| 202 | export KBUILD_CHECKSRC KBUILD_EXTMOD KBUILD_SRC | ||
| 203 | |||
| 210 | objtree := . | 204 | objtree := . |
| 211 | src := $(srctree) | 205 | src := $(srctree) |
| 212 | obj := $(objtree) | 206 | obj := $(objtree) |
| @@ -215,6 +209,74 @@ VPATH := $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD)) | |||
| 215 | 209 | ||
| 216 | export srctree objtree VPATH | 210 | export srctree objtree VPATH |
| 217 | 211 | ||
| 212 | # To make sure we do not include .config for any of the *config targets | ||
| 213 | # catch them early, and hand them over to scripts/kconfig/Makefile | ||
| 214 | # It is allowed to specify more targets when calling make, including | ||
| 215 | # mixing *config targets and build targets. | ||
| 216 | # For example 'make oldconfig all'. | ||
| 217 | # Detect when mixed targets is specified, and make a second invocation | ||
| 218 | # of make so .config is not included in this case either (for *config). | ||
| 219 | |||
| 220 | version_h := include/generated/uapi/linux/version.h | ||
| 221 | old_version_h := include/linux/version.h | ||
| 222 | |||
| 223 | no-dot-config-targets := clean mrproper distclean \ | ||
| 224 | cscope gtags TAGS tags help% %docs check% coccicheck \ | ||
| 225 | $(version_h) headers_% archheaders archscripts \ | ||
| 226 | kernelversion %src-pkg | ||
| 227 | |||
| 228 | config-targets := 0 | ||
| 229 | mixed-targets := 0 | ||
| 230 | dot-config := 1 | ||
| 231 | |||
| 232 | ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),) | ||
| 233 | ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),) | ||
| 234 | dot-config := 0 | ||
| 235 | endif | ||
| 236 | endif | ||
| 237 | |||
| 238 | ifeq ($(KBUILD_EXTMOD),) | ||
| 239 | ifneq ($(filter config %config,$(MAKECMDGOALS)),) | ||
| 240 | config-targets := 1 | ||
| 241 | ifneq ($(words $(MAKECMDGOALS)),1) | ||
| 242 | mixed-targets := 1 | ||
| 243 | endif | ||
| 244 | endif | ||
| 245 | endif | ||
| 246 | # install and modules_install need also be processed one by one | ||
| 247 | ifneq ($(filter install,$(MAKECMDGOALS)),) | ||
| 248 | ifneq ($(filter modules_install,$(MAKECMDGOALS)),) | ||
| 249 | mixed-targets := 1 | ||
| 250 | endif | ||
| 251 | endif | ||
| 252 | |||
| 253 | ifeq ($(mixed-targets),1) | ||
| 254 | # =========================================================================== | ||
| 255 | # We're called with mixed targets (*config and build targets). | ||
| 256 | # Handle them one by one. | ||
| 257 | |||
| 258 | PHONY += $(MAKECMDGOALS) __build_one_by_one | ||
| 259 | |||
| 260 | $(filter-out __build_one_by_one, $(MAKECMDGOALS)): __build_one_by_one | ||
| 261 | @: | ||
| 262 | |||
| 263 | __build_one_by_one: | ||
| 264 | $(Q)set -e; \ | ||
| 265 | for i in $(MAKECMDGOALS); do \ | ||
| 266 | $(MAKE) -f $(srctree)/Makefile $$i; \ | ||
| 267 | done | ||
| 268 | |||
| 269 | else | ||
| 270 | |||
| 271 | # We need some generic definitions (do not try to remake the file). | ||
| 272 | scripts/Kbuild.include: ; | ||
| 273 | include scripts/Kbuild.include | ||
| 274 | |||
| 275 | # Read KERNELRELEASE from include/config/kernel.release (if it exists) | ||
| 276 | KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null) | ||
| 277 | KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION) | ||
| 278 | export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION | ||
| 279 | |||
| 218 | # SUBARCH tells the usermode build what the underlying arch is. That is set | 280 | # SUBARCH tells the usermode build what the underlying arch is. That is set |
| 219 | # first, and if a usermode build is happening, the "ARCH=um" on the command | 281 | # first, and if a usermode build is happening, the "ARCH=um" on the command |
| 220 | # line overrides the setting of ARCH below. If a native build is happening, | 282 | # line overrides the setting of ARCH below. If a native build is happening, |
| @@ -285,9 +347,6 @@ ifeq ($(ARCH),tilegx) | |||
| 285 | SRCARCH := tile | 347 | SRCARCH := tile |
| 286 | endif | 348 | endif |
| 287 | 349 | ||
| 288 | # Where to locate arch specific headers | ||
| 289 | hdr-arch := $(SRCARCH) | ||
| 290 | |||
| 291 | KCONFIG_CONFIG ?= .config | 350 | KCONFIG_CONFIG ?= .config |
| 292 | export KCONFIG_CONFIG | 351 | export KCONFIG_CONFIG |
| 293 | 352 | ||
| @@ -308,45 +367,6 @@ HOSTCXXFLAGS := -O2 $(HOST_LFS_CFLAGS) | |||
| 308 | HOSTLDFLAGS := $(HOST_LFS_LDFLAGS) | 367 | HOSTLDFLAGS := $(HOST_LFS_LDFLAGS) |
| 309 | HOST_LOADLIBES := $(HOST_LFS_LIBS) | 368 | HOST_LOADLIBES := $(HOST_LFS_LIBS) |
| 310 | 369 | ||
| 311 | ifeq ($(shell $(HOSTCC) -v 2>&1 | grep -c "clang version"), 1) | ||
| 312 | HOSTCFLAGS += -Wno-unused-value -Wno-unused-parameter \ | ||
| 313 | -Wno-missing-field-initializers -fno-delete-null-pointer-checks | ||
| 314 | endif | ||
| 315 | |||
| 316 | # Decide whether to build built-in, modular, or both. | ||
| 317 | # Normally, just do built-in. | ||
| 318 | |||
| 319 | KBUILD_MODULES := | ||
| 320 | KBUILD_BUILTIN := 1 | ||
| 321 | |||
| 322 | # If we have only "make modules", don't compile built-in objects. | ||
| 323 | # When we're building modules with modversions, we need to consider | ||
| 324 | # the built-in objects during the descend as well, in order to | ||
| 325 | # make sure the checksums are up to date before we record them. | ||
| 326 | |||
| 327 | ifeq ($(MAKECMDGOALS),modules) | ||
| 328 | KBUILD_BUILTIN := $(if $(CONFIG_MODVERSIONS),1) | ||
| 329 | endif | ||
| 330 | |||
| 331 | # If we have "make <whatever> modules", compile modules | ||
| 332 | # in addition to whatever we do anyway. | ||
| 333 | # Just "make" or "make all" shall build modules as well | ||
| 334 | |||
| 335 | ifneq ($(filter all _all modules,$(MAKECMDGOALS)),) | ||
| 336 | KBUILD_MODULES := 1 | ||
| 337 | endif | ||
| 338 | |||
| 339 | ifeq ($(MAKECMDGOALS),) | ||
| 340 | KBUILD_MODULES := 1 | ||
| 341 | endif | ||
| 342 | |||
| 343 | export KBUILD_MODULES KBUILD_BUILTIN | ||
| 344 | export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD | ||
| 345 | |||
| 346 | # We need some generic definitions (do not try to remake the file). | ||
| 347 | scripts/Kbuild.include: ; | ||
| 348 | include scripts/Kbuild.include | ||
| 349 | |||
| 350 | # Make variables (CC, etc...) | 370 | # Make variables (CC, etc...) |
| 351 | AS = $(CROSS_COMPILE)as | 371 | AS = $(CROSS_COMPILE)as |
| 352 | LD = $(CROSS_COMPILE)ld | 372 | LD = $(CROSS_COMPILE)ld |
| @@ -374,12 +394,11 @@ LDFLAGS_MODULE = | |||
| 374 | CFLAGS_KERNEL = | 394 | CFLAGS_KERNEL = |
| 375 | AFLAGS_KERNEL = | 395 | AFLAGS_KERNEL = |
| 376 | LDFLAGS_vmlinux = | 396 | LDFLAGS_vmlinux = |
| 377 | CFLAGS_GCOV := -fprofile-arcs -ftest-coverage -fno-tree-loop-im $(call cc-disable-warning,maybe-uninitialized,) | ||
| 378 | 397 | ||
| 379 | # Use USERINCLUDE when you must reference the UAPI directories only. | 398 | # Use USERINCLUDE when you must reference the UAPI directories only. |
| 380 | USERINCLUDE := \ | 399 | USERINCLUDE := \ |
| 381 | -I$(srctree)/arch/$(hdr-arch)/include/uapi \ | 400 | -I$(srctree)/arch/$(SRCARCH)/include/uapi \ |
| 382 | -I$(objtree)/arch/$(hdr-arch)/include/generated/uapi \ | 401 | -I$(objtree)/arch/$(SRCARCH)/include/generated/uapi \ |
| 383 | -I$(srctree)/include/uapi \ | 402 | -I$(srctree)/include/uapi \ |
| 384 | -I$(objtree)/include/generated/uapi \ | 403 | -I$(objtree)/include/generated/uapi \ |
| 385 | -include $(srctree)/include/linux/kconfig.h | 404 | -include $(srctree)/include/linux/kconfig.h |
| @@ -387,40 +406,33 @@ USERINCLUDE := \ | |||
| 387 | # Use LINUXINCLUDE when you must reference the include/ directory. | 406 | # Use LINUXINCLUDE when you must reference the include/ directory. |
| 388 | # Needed to be compatible with the O= option | 407 | # Needed to be compatible with the O= option |
| 389 | LINUXINCLUDE := \ | 408 | LINUXINCLUDE := \ |
| 390 | -I$(srctree)/arch/$(hdr-arch)/include \ | 409 | -I$(srctree)/arch/$(SRCARCH)/include \ |
| 391 | -I$(objtree)/arch/$(hdr-arch)/include/generated \ | 410 | -I$(objtree)/arch/$(SRCARCH)/include/generated \ |
| 392 | $(if $(KBUILD_SRC), -I$(srctree)/include) \ | 411 | $(if $(KBUILD_SRC), -I$(srctree)/include) \ |
| 393 | -I$(objtree)/include \ | 412 | -I$(objtree)/include \ |
| 394 | $(USERINCLUDE) | 413 | $(USERINCLUDE) |
| 395 | 414 | ||
| 396 | KBUILD_CPPFLAGS := -D__KERNEL__ | 415 | KBUILD_AFLAGS := -D__ASSEMBLY__ |
| 397 | |||
| 398 | KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ | 416 | KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ |
| 399 | -fno-strict-aliasing -fno-common -fshort-wchar \ | 417 | -fno-strict-aliasing -fno-common -fshort-wchar \ |
| 400 | -Werror-implicit-function-declaration \ | 418 | -Werror-implicit-function-declaration \ |
| 401 | -Wno-format-security \ | 419 | -Wno-format-security \ |
| 402 | -std=gnu89 $(call cc-option,-fno-PIE) | 420 | -std=gnu89 |
| 403 | 421 | KBUILD_CPPFLAGS := -D__KERNEL__ | |
| 404 | |||
| 405 | KBUILD_AFLAGS_KERNEL := | 422 | KBUILD_AFLAGS_KERNEL := |
| 406 | KBUILD_CFLAGS_KERNEL := | 423 | KBUILD_CFLAGS_KERNEL := |
| 407 | KBUILD_AFLAGS := -D__ASSEMBLY__ $(call cc-option,-fno-PIE) | ||
| 408 | KBUILD_AFLAGS_MODULE := -DMODULE | 424 | KBUILD_AFLAGS_MODULE := -DMODULE |
| 409 | KBUILD_CFLAGS_MODULE := -DMODULE | 425 | KBUILD_CFLAGS_MODULE := -DMODULE |
| 410 | KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds | 426 | KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds |
| 427 | GCC_PLUGINS_CFLAGS := | ||
| 411 | 428 | ||
| 412 | # Read KERNELRELEASE from include/config/kernel.release (if it exists) | ||
| 413 | KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null) | ||
| 414 | KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION) | ||
| 415 | |||
| 416 | export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION | ||
| 417 | export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC | 429 | export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC |
| 418 | export CPP AR NM STRIP OBJCOPY OBJDUMP HOSTLDFLAGS HOST_LOADLIBES | 430 | export CPP AR NM STRIP OBJCOPY OBJDUMP HOSTLDFLAGS HOST_LOADLIBES |
| 419 | export MAKE AWK GENKSYMS INSTALLKERNEL PERL PYTHON UTS_MACHINE | 431 | export MAKE AWK GENKSYMS INSTALLKERNEL PERL PYTHON UTS_MACHINE |
| 420 | export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS | 432 | export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS |
| 421 | 433 | ||
| 422 | export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS | 434 | export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS |
| 423 | export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE CFLAGS_GCOV CFLAGS_KCOV CFLAGS_KASAN CFLAGS_UBSAN | 435 | export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE CFLAGS_KASAN CFLAGS_UBSAN |
| 424 | export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE | 436 | export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE |
| 425 | export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE | 437 | export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE |
| 426 | export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL | 438 | export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL |
| @@ -462,73 +474,6 @@ ifneq ($(KBUILD_SRC),) | |||
| 462 | $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) | 474 | $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) |
| 463 | endif | 475 | endif |
| 464 | 476 | ||
| 465 | # Support for using generic headers in asm-generic | ||
| 466 | PHONY += asm-generic uapi-asm-generic | ||
| 467 | asm-generic: uapi-asm-generic | ||
| 468 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \ | ||
| 469 | src=asm obj=arch/$(SRCARCH)/include/generated/asm | ||
| 470 | uapi-asm-generic: | ||
| 471 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \ | ||
| 472 | src=uapi/asm obj=arch/$(SRCARCH)/include/generated/uapi/asm | ||
| 473 | |||
| 474 | # To make sure we do not include .config for any of the *config targets | ||
| 475 | # catch them early, and hand them over to scripts/kconfig/Makefile | ||
| 476 | # It is allowed to specify more targets when calling make, including | ||
| 477 | # mixing *config targets and build targets. | ||
| 478 | # For example 'make oldconfig all'. | ||
| 479 | # Detect when mixed targets is specified, and make a second invocation | ||
| 480 | # of make so .config is not included in this case either (for *config). | ||
| 481 | |||
| 482 | version_h := include/generated/uapi/linux/version.h | ||
| 483 | old_version_h := include/linux/version.h | ||
| 484 | |||
| 485 | no-dot-config-targets := clean mrproper distclean \ | ||
| 486 | cscope gtags TAGS tags help% %docs check% coccicheck \ | ||
| 487 | $(version_h) headers_% archheaders archscripts \ | ||
| 488 | kernelversion %src-pkg | ||
| 489 | |||
| 490 | config-targets := 0 | ||
| 491 | mixed-targets := 0 | ||
| 492 | dot-config := 1 | ||
| 493 | |||
| 494 | ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),) | ||
| 495 | ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),) | ||
| 496 | dot-config := 0 | ||
| 497 | endif | ||
| 498 | endif | ||
| 499 | |||
| 500 | ifeq ($(KBUILD_EXTMOD),) | ||
| 501 | ifneq ($(filter config %config,$(MAKECMDGOALS)),) | ||
| 502 | config-targets := 1 | ||
| 503 | ifneq ($(words $(MAKECMDGOALS)),1) | ||
| 504 | mixed-targets := 1 | ||
| 505 | endif | ||
| 506 | endif | ||
| 507 | endif | ||
| 508 | # install and modules_install need also be processed one by one | ||
| 509 | ifneq ($(filter install,$(MAKECMDGOALS)),) | ||
| 510 | ifneq ($(filter modules_install,$(MAKECMDGOALS)),) | ||
| 511 | mixed-targets := 1 | ||
| 512 | endif | ||
| 513 | endif | ||
| 514 | |||
| 515 | ifeq ($(mixed-targets),1) | ||
| 516 | # =========================================================================== | ||
| 517 | # We're called with mixed targets (*config and build targets). | ||
| 518 | # Handle them one by one. | ||
| 519 | |||
| 520 | PHONY += $(MAKECMDGOALS) __build_one_by_one | ||
| 521 | |||
| 522 | $(filter-out __build_one_by_one, $(MAKECMDGOALS)): __build_one_by_one | ||
| 523 | @: | ||
| 524 | |||
| 525 | __build_one_by_one: | ||
| 526 | $(Q)set -e; \ | ||
| 527 | for i in $(MAKECMDGOALS); do \ | ||
| 528 | $(MAKE) -f $(srctree)/Makefile $$i; \ | ||
| 529 | done | ||
| 530 | |||
| 531 | else | ||
| 532 | ifeq ($(config-targets),1) | 477 | ifeq ($(config-targets),1) |
| 533 | # =========================================================================== | 478 | # =========================================================================== |
| 534 | # *config targets only - make sure prerequisites are updated, and descend | 479 | # *config targets only - make sure prerequisites are updated, and descend |
| @@ -551,6 +496,44 @@ else | |||
| 551 | # Build targets only - this includes vmlinux, arch specific targets, clean | 496 | # Build targets only - this includes vmlinux, arch specific targets, clean |
| 552 | # targets and others. In general all targets except *config targets. | 497 | # targets and others. In general all targets except *config targets. |
| 553 | 498 | ||
| 499 | # If building an external module we do not care about the all: rule | ||
| 500 | # but instead _all depend on modules | ||
| 501 | PHONY += all | ||
| 502 | ifeq ($(KBUILD_EXTMOD),) | ||
| 503 | _all: all | ||
| 504 | else | ||
| 505 | _all: modules | ||
| 506 | endif | ||
| 507 | |||
| 508 | # Decide whether to build built-in, modular, or both. | ||
| 509 | # Normally, just do built-in. | ||
| 510 | |||
| 511 | KBUILD_MODULES := | ||
| 512 | KBUILD_BUILTIN := 1 | ||
| 513 | |||
| 514 | # If we have only "make modules", don't compile built-in objects. | ||
| 515 | # When we're building modules with modversions, we need to consider | ||
| 516 | # the built-in objects during the descend as well, in order to | ||
| 517 | # make sure the checksums are up to date before we record them. | ||
| 518 | |||
| 519 | ifeq ($(MAKECMDGOALS),modules) | ||
| 520 | KBUILD_BUILTIN := $(if $(CONFIG_MODVERSIONS),1) | ||
| 521 | endif | ||
| 522 | |||
| 523 | # If we have "make <whatever> modules", compile modules | ||
| 524 | # in addition to whatever we do anyway. | ||
| 525 | # Just "make" or "make all" shall build modules as well | ||
| 526 | |||
| 527 | ifneq ($(filter all _all modules,$(MAKECMDGOALS)),) | ||
| 528 | KBUILD_MODULES := 1 | ||
| 529 | endif | ||
| 530 | |||
| 531 | ifeq ($(MAKECMDGOALS),) | ||
| 532 | KBUILD_MODULES := 1 | ||
| 533 | endif | ||
| 534 | |||
| 535 | export KBUILD_MODULES KBUILD_BUILTIN | ||
| 536 | |||
| 554 | ifeq ($(KBUILD_EXTMOD),) | 537 | ifeq ($(KBUILD_EXTMOD),) |
| 555 | # Additional helpers built in scripts/ | 538 | # Additional helpers built in scripts/ |
| 556 | # Carefully list dependencies so we do not try to build scripts twice | 539 | # Carefully list dependencies so we do not try to build scripts twice |
| @@ -621,6 +604,11 @@ endif | |||
| 621 | # Defaults to vmlinux, but the arch makefile usually adds further targets | 604 | # Defaults to vmlinux, but the arch makefile usually adds further targets |
| 622 | all: vmlinux | 605 | all: vmlinux |
| 623 | 606 | ||
| 607 | KBUILD_CFLAGS += $(call cc-option,-fno-PIE) | ||
| 608 | KBUILD_AFLAGS += $(call cc-option,-fno-PIE) | ||
| 609 | CFLAGS_GCOV := -fprofile-arcs -ftest-coverage -fno-tree-loop-im $(call cc-disable-warning,maybe-uninitialized,) | ||
| 610 | export CFLAGS_GCOV CFLAGS_KCOV | ||
| 611 | |||
| 624 | # The arch Makefile can set ARCH_{CPP,A,C}FLAGS to override the default | 612 | # The arch Makefile can set ARCH_{CPP,A,C}FLAGS to override the default |
| 625 | # values of the respective KBUILD_* variables | 613 | # values of the respective KBUILD_* variables |
| 626 | ARCH_CPPFLAGS := | 614 | ARCH_CPPFLAGS := |
| @@ -652,7 +640,7 @@ KBUILD_CFLAGS += $(call cc-ifversion, -lt, 0409, \ | |||
| 652 | KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0) | 640 | KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0) |
| 653 | 641 | ||
| 654 | # check for 'asm goto' | 642 | # check for 'asm goto' |
| 655 | ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y) | 643 | ifeq ($(call shell-cached,$(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y) |
| 656 | KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO | 644 | KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO |
| 657 | KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO | 645 | KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO |
| 658 | endif | 646 | endif |
| @@ -789,7 +777,7 @@ KBUILD_CFLAGS += $(call cc-option,-fdata-sections,) | |||
| 789 | endif | 777 | endif |
| 790 | 778 | ||
| 791 | # arch Makefile may override CC so keep this after arch Makefile is included | 779 | # arch Makefile may override CC so keep this after arch Makefile is included |
| 792 | NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) | 780 | NOSTDINC_FLAGS += -nostdinc -isystem $(call shell-cached,$(CC) -print-file-name=include) |
| 793 | CHECKFLAGS += $(NOSTDINC_FLAGS) | 781 | CHECKFLAGS += $(NOSTDINC_FLAGS) |
| 794 | 782 | ||
| 795 | # warn about C99 declaration after statement | 783 | # warn about C99 declaration after statement |
| @@ -1071,6 +1059,15 @@ prepare0: archprepare gcc-plugins | |||
| 1071 | # All the preparing.. | 1059 | # All the preparing.. |
| 1072 | prepare: prepare0 prepare-objtool | 1060 | prepare: prepare0 prepare-objtool |
| 1073 | 1061 | ||
| 1062 | # Support for using generic headers in asm-generic | ||
| 1063 | PHONY += asm-generic uapi-asm-generic | ||
| 1064 | asm-generic: uapi-asm-generic | ||
| 1065 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \ | ||
| 1066 | src=asm obj=arch/$(SRCARCH)/include/generated/asm | ||
| 1067 | uapi-asm-generic: | ||
| 1068 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \ | ||
| 1069 | src=uapi/asm obj=arch/$(SRCARCH)/include/generated/uapi/asm | ||
| 1070 | |||
| 1074 | PHONY += prepare-objtool | 1071 | PHONY += prepare-objtool |
| 1075 | prepare-objtool: $(objtool_target) | 1072 | prepare-objtool: $(objtool_target) |
| 1076 | 1073 | ||
| @@ -1139,8 +1136,8 @@ headerdep: | |||
| 1139 | #Default location for installed headers | 1136 | #Default location for installed headers |
| 1140 | export INSTALL_HDR_PATH = $(objtree)/usr | 1137 | export INSTALL_HDR_PATH = $(objtree)/usr |
| 1141 | 1138 | ||
| 1142 | # If we do an all arch process set dst to include/arch-$(hdr-arch) | 1139 | # If we do an all arch process set dst to include/arch-$(SRCARCH) |
| 1143 | hdr-dst = $(if $(KBUILD_HEADERS), dst=include/arch-$(hdr-arch), dst=include) | 1140 | hdr-dst = $(if $(KBUILD_HEADERS), dst=include/arch-$(SRCARCH), dst=include) |
| 1144 | 1141 | ||
| 1145 | PHONY += archheaders | 1142 | PHONY += archheaders |
| 1146 | archheaders: | 1143 | archheaders: |
| @@ -1158,10 +1155,10 @@ headers_install_all: | |||
| 1158 | 1155 | ||
| 1159 | PHONY += headers_install | 1156 | PHONY += headers_install |
| 1160 | headers_install: __headers | 1157 | headers_install: __headers |
| 1161 | $(if $(wildcard $(srctree)/arch/$(hdr-arch)/include/uapi/asm/Kbuild),, \ | 1158 | $(if $(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/Kbuild),, \ |
| 1162 | $(error Headers not exportable for the $(SRCARCH) architecture)) | 1159 | $(error Headers not exportable for the $(SRCARCH) architecture)) |
| 1163 | $(Q)$(MAKE) $(hdr-inst)=include/uapi dst=include | 1160 | $(Q)$(MAKE) $(hdr-inst)=include/uapi dst=include |
| 1164 | $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi $(hdr-dst) | 1161 | $(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi $(hdr-dst) |
| 1165 | 1162 | ||
| 1166 | PHONY += headers_check_all | 1163 | PHONY += headers_check_all |
| 1167 | headers_check_all: headers_install_all | 1164 | headers_check_all: headers_install_all |
| @@ -1170,7 +1167,7 @@ headers_check_all: headers_install_all | |||
| 1170 | PHONY += headers_check | 1167 | PHONY += headers_check |
| 1171 | headers_check: headers_install | 1168 | headers_check: headers_install |
| 1172 | $(Q)$(MAKE) $(hdr-inst)=include/uapi dst=include HDRCHECK=1 | 1169 | $(Q)$(MAKE) $(hdr-inst)=include/uapi dst=include HDRCHECK=1 |
| 1173 | $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi $(hdr-dst) HDRCHECK=1 | 1170 | $(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi $(hdr-dst) HDRCHECK=1 |
| 1174 | 1171 | ||
| 1175 | # --------------------------------------------------------------------------- | 1172 | # --------------------------------------------------------------------------- |
| 1176 | # Kernel selftest | 1173 | # Kernel selftest |
| @@ -1283,7 +1280,7 @@ CLEAN_DIRS += $(MODVERDIR) | |||
| 1283 | # Directories & files removed with 'make mrproper' | 1280 | # Directories & files removed with 'make mrproper' |
| 1284 | MRPROPER_DIRS += include/config usr/include include/generated \ | 1281 | MRPROPER_DIRS += include/config usr/include include/generated \ |
| 1285 | arch/*/include/generated .tmp_objdiff | 1282 | arch/*/include/generated .tmp_objdiff |
| 1286 | MRPROPER_FILES += .config .config.old .version .old_version \ | 1283 | MRPROPER_FILES += .config .config.old .version \ |
| 1287 | Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS \ | 1284 | Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS \ |
| 1288 | signing_key.pem signing_key.priv signing_key.x509 \ | 1285 | signing_key.pem signing_key.priv signing_key.x509 \ |
| 1289 | x509.genkey extra_certificates signing_key.x509.keyid \ | 1286 | x509.genkey extra_certificates signing_key.x509.keyid \ |
| @@ -1393,7 +1390,7 @@ help: | |||
| 1393 | @echo ' export_report - List the usages of all exported symbols' | 1390 | @echo ' export_report - List the usages of all exported symbols' |
| 1394 | @echo ' headers_check - Sanity check on exported headers' | 1391 | @echo ' headers_check - Sanity check on exported headers' |
| 1395 | @echo ' headerdep - Detect inclusion cycles in headers' | 1392 | @echo ' headerdep - Detect inclusion cycles in headers' |
| 1396 | @$(MAKE) -f $(srctree)/scripts/Makefile.help checker-help | 1393 | @echo ' coccicheck - Check with Coccinelle' |
| 1397 | @echo '' | 1394 | @echo '' |
| 1398 | @echo 'Kernel selftest:' | 1395 | @echo 'Kernel selftest:' |
| 1399 | @echo ' kselftest - Build and run kernel selftest (run as root)' | 1396 | @echo ' kselftest - Build and run kernel selftest (run as root)' |
| @@ -1556,6 +1553,7 @@ clean: $(clean-dirs) | |||
| 1556 | -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ | 1553 | -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ |
| 1557 | -o -name '*.symtypes' -o -name 'modules.order' \ | 1554 | -o -name '*.symtypes' -o -name 'modules.order' \ |
| 1558 | -o -name modules.builtin -o -name '.tmp_*.o.*' \ | 1555 | -o -name modules.builtin -o -name '.tmp_*.o.*' \ |
| 1556 | -o -name .cache.mk \ | ||
| 1559 | -o -name '*.c.[012]*.*' \ | 1557 | -o -name '*.c.[012]*.*' \ |
| 1560 | -o -name '*.ll' \ | 1558 | -o -name '*.ll' \ |
| 1561 | -o -name '*.gcno' \) -type f -print | xargs rm -f | 1559 | -o -name '*.gcno' \) -type f -print | xargs rm -f |
| @@ -1702,8 +1700,7 @@ cmd_crmodverdir = $(Q)mkdir -p $(MODVERDIR) \ | |||
| 1702 | 1700 | ||
| 1703 | # read all saved command lines | 1701 | # read all saved command lines |
| 1704 | 1702 | ||
| 1705 | targets := $(wildcard $(sort $(targets))) | 1703 | cmd_files := $(wildcard .*.cmd $(foreach f,$(sort $(targets)),$(dir $(f)).$(notdir $(f)).cmd)) |
| 1706 | cmd_files := $(wildcard .*.cmd $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd)) | ||
| 1707 | 1704 | ||
| 1708 | ifneq ($(cmd_files),) | 1705 | ifneq ($(cmd_files),) |
| 1709 | $(cmd_files): ; # Do not try to update included dependency files | 1706 | $(cmd_files): ; # Do not try to update included dependency files |
diff --git a/arch/arm/Makefile b/arch/arm/Makefile index def8824fc71c..80351e505fd5 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile | |||
| @@ -16,11 +16,11 @@ LDFLAGS := | |||
| 16 | LDFLAGS_vmlinux :=-p --no-undefined -X --pic-veneer | 16 | LDFLAGS_vmlinux :=-p --no-undefined -X --pic-veneer |
| 17 | ifeq ($(CONFIG_CPU_ENDIAN_BE8),y) | 17 | ifeq ($(CONFIG_CPU_ENDIAN_BE8),y) |
| 18 | LDFLAGS_vmlinux += --be8 | 18 | LDFLAGS_vmlinux += --be8 |
| 19 | LDFLAGS_MODULE += --be8 | 19 | KBUILD_LDFLAGS_MODULE += --be8 |
| 20 | endif | 20 | endif |
| 21 | 21 | ||
| 22 | ifeq ($(CONFIG_ARM_MODULE_PLTS),y) | 22 | ifeq ($(CONFIG_ARM_MODULE_PLTS),y) |
| 23 | LDFLAGS_MODULE += -T $(srctree)/arch/arm/kernel/module.lds | 23 | KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/arm/kernel/module.lds |
| 24 | endif | 24 | endif |
| 25 | 25 | ||
| 26 | GZFLAGS :=-9 | 26 | GZFLAGS :=-9 |
| @@ -122,7 +122,7 @@ CFLAGS_ISA :=-mthumb $(AFLAGS_AUTOIT) $(AFLAGS_NOWARN) | |||
| 122 | AFLAGS_ISA :=$(CFLAGS_ISA) -Wa$(comma)-mthumb | 122 | AFLAGS_ISA :=$(CFLAGS_ISA) -Wa$(comma)-mthumb |
| 123 | # Work around buggy relocation from gas if requested: | 123 | # Work around buggy relocation from gas if requested: |
| 124 | ifeq ($(CONFIG_THUMB2_AVOID_R_ARM_THM_JUMP11),y) | 124 | ifeq ($(CONFIG_THUMB2_AVOID_R_ARM_THM_JUMP11),y) |
| 125 | CFLAGS_MODULE +=-fno-optimize-sibling-calls | 125 | KBUILD_CFLAGS_MODULE +=-fno-optimize-sibling-calls |
| 126 | endif | 126 | endif |
| 127 | else | 127 | else |
| 128 | CFLAGS_ISA :=$(call cc-option,-marm,) | 128 | CFLAGS_ISA :=$(call cc-option,-marm,) |
diff --git a/arch/c6x/Makefile b/arch/c6x/Makefile index 6b0be670ddfa..6f6096ff05a4 100644 --- a/arch/c6x/Makefile +++ b/arch/c6x/Makefile | |||
| @@ -12,7 +12,7 @@ cflags-y += -mno-dsbt -msdata=none -D__linux__ | |||
| 12 | 12 | ||
| 13 | cflags-$(CONFIG_C6X_BIG_KERNEL) += -mlong-calls | 13 | cflags-$(CONFIG_C6X_BIG_KERNEL) += -mlong-calls |
| 14 | 14 | ||
| 15 | CFLAGS_MODULE += -mlong-calls -mno-dsbt -msdata=none | 15 | KBUILD_CFLAGS_MODULE += -mlong-calls -mno-dsbt -msdata=none |
| 16 | 16 | ||
| 17 | CHECKFLAGS += | 17 | CHECKFLAGS += |
| 18 | 18 | ||
diff --git a/arch/frv/kernel/.gitignore b/arch/frv/kernel/.gitignore new file mode 100644 index 000000000000..c5f676c3c224 --- /dev/null +++ b/arch/frv/kernel/.gitignore | |||
| @@ -0,0 +1 @@ | |||
| vmlinux.lds | |||
diff --git a/arch/hexagon/Makefile b/arch/hexagon/Makefile index 48fe08230a80..2efaa18e995a 100644 --- a/arch/hexagon/Makefile +++ b/arch/hexagon/Makefile | |||
| @@ -12,9 +12,9 @@ KBUILD_CFLAGS += -fno-short-enums | |||
| 12 | 12 | ||
| 13 | # Modules must use either long-calls, or use pic/plt. | 13 | # Modules must use either long-calls, or use pic/plt. |
| 14 | # Use long-calls for now, it's easier. And faster. | 14 | # Use long-calls for now, it's easier. And faster. |
| 15 | # CFLAGS_MODULE += -fPIC | 15 | # KBUILD_CFLAGS_MODULE += -fPIC |
| 16 | # LDFLAGS_MODULE += -shared | 16 | # KBUILD_LDFLAGS_MODULE += -shared |
| 17 | CFLAGS_MODULE += -mlong-calls | 17 | KBUILD_CFLAGS_MODULE += -mlong-calls |
| 18 | 18 | ||
| 19 | cflags-y += $(call cc-option,-mv${CONFIG_HEXAGON_ARCH_VERSION}) | 19 | cflags-y += $(call cc-option,-mv${CONFIG_HEXAGON_ARCH_VERSION}) |
| 20 | aflags-y += $(call cc-option,-mv${CONFIG_HEXAGON_ARCH_VERSION}) | 20 | aflags-y += $(call cc-option,-mv${CONFIG_HEXAGON_ARCH_VERSION}) |
diff --git a/arch/hexagon/kernel/ptrace.c b/arch/hexagon/kernel/ptrace.c index ecd75e2e8eb3..fa76493c1745 100644 --- a/arch/hexagon/kernel/ptrace.c +++ b/arch/hexagon/kernel/ptrace.c | |||
| @@ -18,8 +18,6 @@ | |||
| 18 | * 02110-1301, USA. | 18 | * 02110-1301, USA. |
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | #include <generated/compile.h> | ||
| 22 | |||
| 23 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
| 24 | #include <linux/sched.h> | 22 | #include <linux/sched.h> |
| 25 | #include <linux/sched/task_stack.h> | 23 | #include <linux/sched/task_stack.h> |
| @@ -180,7 +178,7 @@ static const struct user_regset hexagon_regsets[] = { | |||
| 180 | }; | 178 | }; |
| 181 | 179 | ||
| 182 | static const struct user_regset_view hexagon_user_view = { | 180 | static const struct user_regset_view hexagon_user_view = { |
| 183 | .name = UTS_MACHINE, | 181 | .name = "hexagon", |
| 184 | .e_machine = ELF_ARCH, | 182 | .e_machine = ELF_ARCH, |
| 185 | .ei_osabi = ELF_OSABI, | 183 | .ei_osabi = ELF_OSABI, |
| 186 | .regsets = hexagon_regsets, | 184 | .regsets = hexagon_regsets, |
diff --git a/arch/sh/Makefile b/arch/sh/Makefile index 280bbff12102..65300193b99f 100644 --- a/arch/sh/Makefile +++ b/arch/sh/Makefile | |||
| @@ -15,6 +15,12 @@ ifneq ($(SUBARCH),$(ARCH)) | |||
| 15 | endif | 15 | endif |
| 16 | endif | 16 | endif |
| 17 | 17 | ||
| 18 | ifeq ($(ARCH),sh) | ||
| 19 | KBUILD_DEFCONFIG := shx3_defconfig | ||
| 20 | else | ||
| 21 | KBUILD_DEFCONFIG := cayman_defconfig | ||
| 22 | endif | ||
| 23 | |||
| 18 | isa-y := any | 24 | isa-y := any |
| 19 | isa-$(CONFIG_SH_DSP) := sh | 25 | isa-$(CONFIG_SH_DSP) := sh |
| 20 | isa-$(CONFIG_CPU_SH2) := sh2 | 26 | isa-$(CONFIG_CPU_SH2) := sh2 |
| @@ -105,14 +111,12 @@ ifdef CONFIG_SUPERH32 | |||
| 105 | UTS_MACHINE := sh | 111 | UTS_MACHINE := sh |
| 106 | BITS := 32 | 112 | BITS := 32 |
| 107 | LDFLAGS_vmlinux += -e _stext | 113 | LDFLAGS_vmlinux += -e _stext |
| 108 | KBUILD_DEFCONFIG := shx3_defconfig | ||
| 109 | else | 114 | else |
| 110 | UTS_MACHINE := sh64 | 115 | UTS_MACHINE := sh64 |
| 111 | BITS := 64 | 116 | BITS := 64 |
| 112 | LDFLAGS_vmlinux += --defsym phys_stext=_stext-$(CONFIG_PAGE_OFFSET) \ | 117 | LDFLAGS_vmlinux += --defsym phys_stext=_stext-$(CONFIG_PAGE_OFFSET) \ |
| 113 | --defsym phys_stext_shmedia=phys_stext+1 \ | 118 | --defsym phys_stext_shmedia=phys_stext+1 \ |
| 114 | -e phys_stext_shmedia | 119 | -e phys_stext_shmedia |
| 115 | KBUILD_DEFCONFIG := cayman_defconfig | ||
| 116 | endif | 120 | endif |
| 117 | 121 | ||
| 118 | ifdef CONFIG_CPU_LITTLE_ENDIAN | 122 | ifdef CONFIG_CPU_LITTLE_ENDIAN |
diff --git a/arch/sh/boot/compressed/.gitignore b/arch/sh/boot/compressed/.gitignore index 2374a83d87b2..edff113f1b85 100644 --- a/arch/sh/boot/compressed/.gitignore +++ b/arch/sh/boot/compressed/.gitignore | |||
| @@ -1 +1,6 @@ | |||
| 1 | ashiftrt.S | ||
| 2 | ashldi3.c | ||
| 3 | ashlsi3.S | ||
| 4 | ashrsi3.S | ||
| 5 | lshrsi3.S | ||
| 1 | vmlinux.bin.* | 6 | vmlinux.bin.* |
diff --git a/arch/x86/entry/vdso/Makefile b/arch/x86/entry/vdso/Makefile index c366c0adeb40..1943aebadede 100644 --- a/arch/x86/entry/vdso/Makefile +++ b/arch/x86/entry/vdso/Makefile | |||
| @@ -130,10 +130,6 @@ $(obj)/vdsox32.so.dbg: $(src)/vdsox32.lds $(vobjx32s) FORCE | |||
| 130 | CPPFLAGS_vdso32.lds = $(CPPFLAGS_vdso.lds) | 130 | CPPFLAGS_vdso32.lds = $(CPPFLAGS_vdso.lds) |
| 131 | VDSO_LDFLAGS_vdso32.lds = -m32 -Wl,-m,elf_i386 -Wl,-soname=linux-gate.so.1 | 131 | VDSO_LDFLAGS_vdso32.lds = -m32 -Wl,-m,elf_i386 -Wl,-soname=linux-gate.so.1 |
| 132 | 132 | ||
| 133 | # This makes sure the $(obj) subdirectory exists even though vdso32/ | ||
| 134 | # is not a kbuild sub-make subdirectory. | ||
| 135 | override obj-dirs = $(dir $(obj)) $(obj)/vdso32/ | ||
| 136 | |||
| 137 | targets += vdso32/vdso32.lds | 133 | targets += vdso32/vdso32.lds |
| 138 | targets += vdso32/note.o vdso32/system_call.o vdso32/sigreturn.o | 134 | targets += vdso32/note.o vdso32/system_call.o vdso32/sigreturn.o |
| 139 | targets += vdso32/vclock_gettime.o | 135 | targets += vdso32/vclock_gettime.o |
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 9ffd3dda3889..065324a8046f 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include | |||
| @@ -8,6 +8,8 @@ squote := ' | |||
| 8 | empty := | 8 | empty := |
| 9 | space := $(empty) $(empty) | 9 | space := $(empty) $(empty) |
| 10 | space_escape := _-_SPACE_-_ | 10 | space_escape := _-_SPACE_-_ |
| 11 | right_paren := ) | ||
| 12 | left_paren := ( | ||
| 11 | 13 | ||
| 12 | ### | 14 | ### |
| 13 | # Name of target with a '.' as filename prefix. foo/bar.o => foo/.bar.o | 15 | # Name of target with a '.' as filename prefix. foo/bar.o => foo/.bar.o |
| @@ -80,6 +82,71 @@ cc-cross-prefix = \ | |||
| 80 | echo $(c); \ | 82 | echo $(c); \ |
| 81 | fi))) | 83 | fi))) |
| 82 | 84 | ||
| 85 | # Tools for caching Makefile variables that are "expensive" to compute. | ||
| 86 | # | ||
| 87 | # Here we want to help deal with variables that take a long time to compute | ||
| 88 | # by making it easy to store these variables in a cache. | ||
| 89 | # | ||
| 90 | # The canonical example here is testing for compiler flags. On a simple system | ||
| 91 | # each call to the compiler takes 10 ms, but on a system with a compiler that's | ||
| 92 | # called through various wrappers it can take upwards of 100 ms. If we have | ||
| 93 | # 100 calls to the compiler this can take 1 second (on a simple system) or 10 | ||
| 94 | # seconds (on a complicated system). | ||
| 95 | # | ||
| 96 | # The "cache" will be in Makefile syntax and can be directly included. | ||
| 97 | # Any time we try to reference a variable that's not in the cache we'll | ||
| 98 | # calculate it and store it in the cache for next time. | ||
| 99 | |||
| 100 | # Include values from last time | ||
| 101 | make-cache := $(if $(KBUILD_EXTMOD),$(KBUILD_EXTMOD)/,$(if $(obj),$(obj)/)).cache.mk | ||
| 102 | $(make-cache): ; | ||
| 103 | -include $(make-cache) | ||
| 104 | |||
| 105 | cached-data := $(filter __cached_%, $(.VARIABLES)) | ||
| 106 | |||
| 107 | # If cache exceeds 1000 lines, shrink it down to 500. | ||
| 108 | ifneq ($(word 1000,$(cached-data)),) | ||
| 109 | $(shell tail -n 500 $(make-cache) > $(make-cache).tmp; \ | ||
| 110 | mv $(make-cache).tmp $(make-cache)) | ||
| 111 | endif | ||
| 112 | |||
| 113 | create-cache-dir := $(if $(KBUILD_SRC),$(if $(cache-data),,1)) | ||
| 114 | |||
| 115 | # Usage: $(call __sanitize-opt,Hello=Hola$(comma)Goodbye Adios) | ||
| 116 | # | ||
| 117 | # Convert all '$', ')', '(', '\', '=', ' ', ',', ':' to '_' | ||
| 118 | __sanitize-opt = $(subst $$,_,$(subst $(right_paren),_,$(subst $(left_paren),_,$(subst \,_,$(subst =,_,$(subst $(space),_,$(subst $(comma),_,$(subst :,_,$(1))))))))) | ||
| 119 | |||
| 120 | # Usage: $(call shell-cached,shell_command) | ||
| 121 | # Example: $(call shell-cached,md5sum /usr/bin/gcc) | ||
| 122 | # | ||
| 123 | # If we've already seen a call to this exact shell command (even in a | ||
| 124 | # previous invocation of make!) we'll return the value. If not, we'll | ||
| 125 | # compute it and store the result for future runs. | ||
| 126 | # | ||
| 127 | # This is a bit of voodoo, but basic explanation is that if the variable | ||
| 128 | # was undefined then we'll evaluate the shell command and store the result | ||
| 129 | # into the variable. We'll then store that value in the cache and finally | ||
| 130 | # output the value. | ||
| 131 | # | ||
| 132 | # NOTE: The $$(2) here isn't actually a parameter to __run-and-store. We | ||
| 133 | # happen to know that the caller will have their shell command in $(2) so the | ||
| 134 | # result of "call"ing this will produce a reference to that $(2). The reason | ||
| 135 | # for this strangeness is to avoid an extra level of eval (and escaping) of | ||
| 136 | # $(2). | ||
| 137 | define __run-and-store | ||
| 138 | ifeq ($(origin $(1)),undefined) | ||
| 139 | $$(eval $(1) := $$(shell $$(2))) | ||
| 140 | ifeq ($(create-cache-dir),1) | ||
| 141 | $$(shell mkdir -p $(dir $(make-cache))) | ||
| 142 | $$(eval create-cache-dir :=) | ||
| 143 | endif | ||
| 144 | $$(shell echo '$(1) := $$($(1))' >> $(make-cache)) | ||
| 145 | endif | ||
| 146 | endef | ||
| 147 | __shell-cached = $(eval $(call __run-and-store,$(1)))$($(1)) | ||
| 148 | shell-cached = $(call __shell-cached,__cached_$(call __sanitize-opt,$(1)),$(1)) | ||
| 149 | |||
| 83 | # output directory for tests below | 150 | # output directory for tests below |
| 84 | TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/) | 151 | TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/) |
| 85 | 152 | ||
| @@ -87,30 +154,36 @@ TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/) | |||
| 87 | # Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise) | 154 | # Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise) |
| 88 | # Exit code chooses option. "$$TMP" serves as a temporary file and is | 155 | # Exit code chooses option. "$$TMP" serves as a temporary file and is |
| 89 | # automatically cleaned up. | 156 | # automatically cleaned up. |
| 90 | try-run = $(shell set -e; \ | 157 | __try-run = set -e; \ |
| 91 | TMP="$(TMPOUT).$$$$.tmp"; \ | 158 | TMP="$(TMPOUT).$$$$.tmp"; \ |
| 92 | TMPO="$(TMPOUT).$$$$.o"; \ | 159 | TMPO="$(TMPOUT).$$$$.o"; \ |
| 93 | if ($(1)) >/dev/null 2>&1; \ | 160 | if ($(1)) >/dev/null 2>&1; \ |
| 94 | then echo "$(2)"; \ | 161 | then echo "$(2)"; \ |
| 95 | else echo "$(3)"; \ | 162 | else echo "$(3)"; \ |
| 96 | fi; \ | 163 | fi; \ |
| 97 | rm -f "$$TMP" "$$TMPO") | 164 | rm -f "$$TMP" "$$TMPO" |
| 165 | |||
| 166 | try-run = $(shell $(__try-run)) | ||
| 167 | |||
| 168 | # try-run-cached | ||
| 169 | # This works like try-run, but the result is cached. | ||
| 170 | try-run-cached = $(call shell-cached,$(__try-run)) | ||
| 98 | 171 | ||
| 99 | # as-option | 172 | # as-option |
| 100 | # Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,) | 173 | # Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,) |
| 101 | 174 | ||
| 102 | as-option = $(call try-run,\ | 175 | as-option = $(call try-run-cached,\ |
| 103 | $(CC) $(KBUILD_CFLAGS) $(1) -c -x assembler /dev/null -o "$$TMP",$(1),$(2)) | 176 | $(CC) $(KBUILD_CFLAGS) $(1) -c -x assembler /dev/null -o "$$TMP",$(1),$(2)) |
| 104 | 177 | ||
| 105 | # as-instr | 178 | # as-instr |
| 106 | # Usage: cflags-y += $(call as-instr,instr,option1,option2) | 179 | # Usage: cflags-y += $(call as-instr,instr,option1,option2) |
| 107 | 180 | ||
| 108 | as-instr = $(call try-run,\ | 181 | as-instr = $(call try-run-cached,\ |
| 109 | printf "%b\n" "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3)) | 182 | printf "%b\n" "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3)) |
| 110 | 183 | ||
| 111 | # __cc-option | 184 | # __cc-option |
| 112 | # Usage: MY_CFLAGS += $(call __cc-option,$(CC),$(MY_CFLAGS),-march=winchip-c6,-march=i586) | 185 | # Usage: MY_CFLAGS += $(call __cc-option,$(CC),$(MY_CFLAGS),-march=winchip-c6,-march=i586) |
| 113 | __cc-option = $(call try-run,\ | 186 | __cc-option = $(call try-run-cached,\ |
| 114 | $(1) -Werror $(2) $(3) -c -x c /dev/null -o "$$TMP",$(3),$(4)) | 187 | $(1) -Werror $(2) $(3) -c -x c /dev/null -o "$$TMP",$(3),$(4)) |
| 115 | 188 | ||
| 116 | # Do not attempt to build with gcc plugins during cc-option tests. | 189 | # Do not attempt to build with gcc plugins during cc-option tests. |
| @@ -130,23 +203,23 @@ hostcc-option = $(call __cc-option, $(HOSTCC),\ | |||
| 130 | 203 | ||
| 131 | # cc-option-yn | 204 | # cc-option-yn |
| 132 | # Usage: flag := $(call cc-option-yn,-march=winchip-c6) | 205 | # Usage: flag := $(call cc-option-yn,-march=winchip-c6) |
| 133 | cc-option-yn = $(call try-run,\ | 206 | cc-option-yn = $(call try-run-cached,\ |
| 134 | $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n) | 207 | $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n) |
| 135 | 208 | ||
| 136 | # cc-disable-warning | 209 | # cc-disable-warning |
| 137 | # Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable) | 210 | # Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable) |
| 138 | cc-disable-warning = $(call try-run,\ | 211 | cc-disable-warning = $(call try-run-cached,\ |
| 139 | $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1))) | 212 | $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1))) |
| 140 | 213 | ||
| 141 | # cc-name | 214 | # cc-name |
| 142 | # Expands to either gcc or clang | 215 | # Expands to either gcc or clang |
| 143 | cc-name = $(shell $(CC) -v 2>&1 | grep -q "clang version" && echo clang || echo gcc) | 216 | cc-name = $(call shell-cached,$(CC) -v 2>&1 | grep -q "clang version" && echo clang || echo gcc) |
| 144 | 217 | ||
| 145 | # cc-version | 218 | # cc-version |
| 146 | cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC)) | 219 | cc-version = $(call shell-cached,$(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC)) |
| 147 | 220 | ||
| 148 | # cc-fullversion | 221 | # cc-fullversion |
| 149 | cc-fullversion = $(shell $(CONFIG_SHELL) \ | 222 | cc-fullversion = $(call shell-cached,$(CONFIG_SHELL) \ |
| 150 | $(srctree)/scripts/gcc-version.sh -p $(CC)) | 223 | $(srctree)/scripts/gcc-version.sh -p $(CC)) |
| 151 | 224 | ||
| 152 | # cc-ifversion | 225 | # cc-ifversion |
| @@ -159,22 +232,23 @@ cc-if-fullversion = $(shell [ $(cc-fullversion) $(1) $(2) ] && echo $(3) || echo | |||
| 159 | 232 | ||
| 160 | # cc-ldoption | 233 | # cc-ldoption |
| 161 | # Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both) | 234 | # Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both) |
| 162 | cc-ldoption = $(call try-run,\ | 235 | cc-ldoption = $(call try-run-cached,\ |
| 163 | $(CC) $(1) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2)) | 236 | $(CC) $(1) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2)) |
| 164 | 237 | ||
| 165 | # ld-option | 238 | # ld-option |
| 166 | # Usage: LDFLAGS += $(call ld-option, -X) | 239 | # Usage: LDFLAGS += $(call ld-option, -X) |
| 167 | ld-option = $(call try-run,\ | 240 | ld-option = $(call try-run-cached,\ |
| 168 | $(CC) -x c /dev/null -c -o "$$TMPO" ; $(LD) $(1) "$$TMPO" -o "$$TMP",$(1),$(2)) | 241 | $(CC) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -x c /dev/null -c -o "$$TMPO"; \ |
| 242 | $(LD) $(LDFLAGS) $(1) "$$TMPO" -o "$$TMP",$(1),$(2)) | ||
| 169 | 243 | ||
| 170 | # ar-option | 244 | # ar-option |
| 171 | # Usage: KBUILD_ARFLAGS := $(call ar-option,D) | 245 | # Usage: KBUILD_ARFLAGS := $(call ar-option,D) |
| 172 | # Important: no spaces around options | 246 | # Important: no spaces around options |
| 173 | ar-option = $(call try-run, $(AR) rc$(1) "$$TMP",$(1),$(2)) | 247 | ar-option = $(call try-run-cached, $(AR) rc$(1) "$$TMP",$(1),$(2)) |
| 174 | 248 | ||
| 175 | # ld-version | 249 | # ld-version |
| 176 | # Note this is mainly for HJ Lu's 3 number binutil versions | 250 | # Note this is mainly for HJ Lu's 3 number binutil versions |
| 177 | ld-version = $(shell $(LD) --version | $(srctree)/scripts/ld-version.sh) | 251 | ld-version = $(call shell-cached,$(LD) --version | $(srctree)/scripts/ld-version.sh) |
| 178 | 252 | ||
| 179 | # ld-ifversion | 253 | # ld-ifversion |
| 180 | # Usage: $(call ld-ifversion, -ge, 22252, y) | 254 | # Usage: $(call ld-ifversion, -ge, 22252, y) |
diff --git a/scripts/Makefile.asm-generic b/scripts/Makefile.asm-generic index 524eeedc8d25..32ad8e93fbe1 100644 --- a/scripts/Makefile.asm-generic +++ b/scripts/Makefile.asm-generic | |||
| @@ -6,6 +6,9 @@ | |||
| 6 | # and for each file listed in this file with generic-y creates | 6 | # and for each file listed in this file with generic-y creates |
| 7 | # a small wrapper file in $(obj) (arch/$(SRCARCH)/include/generated/$(src)) | 7 | # a small wrapper file in $(obj) (arch/$(SRCARCH)/include/generated/$(src)) |
| 8 | 8 | ||
| 9 | PHONY := all | ||
| 10 | all: | ||
| 11 | |||
| 9 | kbuild-file := $(srctree)/arch/$(SRCARCH)/include/$(src)/Kbuild | 12 | kbuild-file := $(srctree)/arch/$(SRCARCH)/include/$(src)/Kbuild |
| 10 | -include $(kbuild-file) | 13 | -include $(kbuild-file) |
| 11 | 14 | ||
diff --git a/scripts/Makefile.build b/scripts/Makefile.build index e63af4e19382..f171225383cc 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build | |||
| @@ -65,15 +65,6 @@ ifneq ($(hostprogs-y)$(hostprogs-m)$(hostlibs-y)$(hostlibs-m)$(hostcxxlibs-y)$(h | |||
| 65 | include scripts/Makefile.host | 65 | include scripts/Makefile.host |
| 66 | endif | 66 | endif |
| 67 | 67 | ||
| 68 | ifneq ($(KBUILD_SRC),) | ||
| 69 | # Create output directory if not already present | ||
| 70 | _dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj)) | ||
| 71 | |||
| 72 | # Create directories for object files if directory does not exist | ||
| 73 | # Needed when obj-y := dir/file.o syntax is used | ||
| 74 | _dummy := $(foreach d,$(obj-dirs), $(shell [ -d $(d) ] || mkdir -p $(d))) | ||
| 75 | endif | ||
| 76 | |||
| 77 | ifndef obj | 68 | ifndef obj |
| 78 | $(warning kbuild: Makefile.build is included improperly) | 69 | $(warning kbuild: Makefile.build is included improperly) |
| 79 | endif | 70 | endif |
| @@ -563,7 +554,7 @@ $(multi-used-m): FORCE | |||
| 563 | $(call multi_depend, $(multi-used-m), .o, -objs -y -m) | 554 | $(call multi_depend, $(multi-used-m), .o, -objs -y -m) |
| 564 | 555 | ||
| 565 | targets += $(multi-used-y) $(multi-used-m) | 556 | targets += $(multi-used-y) $(multi-used-m) |
| 566 | 557 | targets := $(filter-out $(PHONY), $(targets)) | |
| 567 | 558 | ||
| 568 | # Descending | 559 | # Descending |
| 569 | # --------------------------------------------------------------------------- | 560 | # --------------------------------------------------------------------------- |
| @@ -584,13 +575,23 @@ FORCE: | |||
| 584 | # optimization, we don't need to read them if the target does not | 575 | # optimization, we don't need to read them if the target does not |
| 585 | # exist, we will rebuild anyway in that case. | 576 | # exist, we will rebuild anyway in that case. |
| 586 | 577 | ||
| 587 | targets := $(wildcard $(sort $(targets))) | 578 | cmd_files := $(wildcard $(foreach f,$(sort $(targets)),$(dir $(f)).$(notdir $(f)).cmd)) |
| 588 | cmd_files := $(wildcard $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd)) | ||
| 589 | 579 | ||
| 590 | ifneq ($(cmd_files),) | 580 | ifneq ($(cmd_files),) |
| 591 | include $(cmd_files) | 581 | include $(cmd_files) |
| 592 | endif | 582 | endif |
| 593 | 583 | ||
| 584 | ifneq ($(KBUILD_SRC),) | ||
| 585 | # Create directories for object files if they do not exist | ||
| 586 | obj-dirs := $(sort $(obj) $(patsubst %/,%, $(dir $(targets)))) | ||
| 587 | # If cmd_files exist, their directories apparently exist. Skip mkdir. | ||
| 588 | exist-dirs := $(sort $(patsubst %/,%, $(dir $(cmd_files)))) | ||
| 589 | obj-dirs := $(strip $(filter-out $(exist-dirs), $(obj-dirs))) | ||
| 590 | ifneq ($(obj-dirs),) | ||
| 591 | $(shell mkdir -p $(obj-dirs)) | ||
| 592 | endif | ||
| 593 | endif | ||
| 594 | |||
| 594 | # Declare the contents of the .PHONY variable as phony. We keep that | 595 | # Declare the contents of the .PHONY variable as phony. We keep that |
| 595 | # information in a variable se we can use it in if_changed and friends. | 596 | # information in a variable se we can use it in if_changed and friends. |
| 596 | 597 | ||
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst index 99967948d764..d5e131471131 100644 --- a/scripts/Makefile.headersinst +++ b/scripts/Makefile.headersinst | |||
| @@ -27,11 +27,11 @@ subdirs := $(patsubst $(srcdir)/%/,%,\ | |||
| 27 | # Recursion | 27 | # Recursion |
| 28 | __headers: $(subdirs) | 28 | __headers: $(subdirs) |
| 29 | 29 | ||
| 30 | .PHONY: $(subdirs) | 30 | PHONY += $(subdirs) |
| 31 | $(subdirs): | 31 | $(subdirs): |
| 32 | $(Q)$(MAKE) $(hdr-inst)=$(obj)/$@ dst=$(dst)/$@ | 32 | $(Q)$(MAKE) $(hdr-inst)=$(obj)/$@ dst=$(dst)/$@ |
| 33 | 33 | ||
| 34 | # Skip header install/check for include/uapi and arch/$(hdr-arch)/include/uapi. | 34 | # Skip header install/check for include/uapi and arch/$(SRCARCH)/include/uapi. |
| 35 | # We have only sub-directories there. | 35 | # We have only sub-directories there. |
| 36 | skip-inst := $(if $(filter %/uapi,$(obj)),1) | 36 | skip-inst := $(if $(filter %/uapi,$(obj)),1) |
| 37 | 37 | ||
| @@ -115,9 +115,8 @@ $(check-file): scripts/headers_check.pl $(output-files) FORCE | |||
| 115 | 115 | ||
| 116 | endif | 116 | endif |
| 117 | 117 | ||
| 118 | targets := $(wildcard $(sort $(targets))) | ||
| 119 | cmd_files := $(wildcard \ | 118 | cmd_files := $(wildcard \ |
| 120 | $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd)) | 119 | $(foreach f,$(sort $(targets)),$(dir $(f)).$(notdir $(f)).cmd)) |
| 121 | 120 | ||
| 122 | ifneq ($(cmd_files),) | 121 | ifneq ($(cmd_files),) |
| 123 | include $(cmd_files) | 122 | include $(cmd_files) |
| @@ -125,6 +124,7 @@ endif | |||
| 125 | 124 | ||
| 126 | endif # skip-inst | 125 | endif # skip-inst |
| 127 | 126 | ||
| 128 | .PHONY: $(PHONY) | ||
| 129 | PHONY += FORCE | 127 | PHONY += FORCE |
| 130 | FORCE: ; | 128 | FORCE: ; |
| 129 | |||
| 130 | .PHONY: $(PHONY) | ||
diff --git a/scripts/Makefile.help b/scripts/Makefile.help deleted file mode 100644 index d03608f5db04..000000000000 --- a/scripts/Makefile.help +++ /dev/null | |||
| @@ -1,3 +0,0 @@ | |||
| 1 | |||
| 2 | checker-help: | ||
| 3 | @echo ' coccicheck - Check with Coccinelle.' | ||
diff --git a/scripts/Makefile.host b/scripts/Makefile.host index 10e5c3cb89dc..e6dc6ae2d7c4 100644 --- a/scripts/Makefile.host +++ b/scripts/Makefile.host | |||
| @@ -49,15 +49,6 @@ host-cxxobjs := $(sort $(foreach m,$(host-cxxmulti),$($(m)-cxxobjs))) | |||
| 49 | host-cshobjs := $(sort $(foreach m,$(host-cshlib),$($(m:.so=-objs)))) | 49 | host-cshobjs := $(sort $(foreach m,$(host-cshlib),$($(m:.so=-objs)))) |
| 50 | host-cxxshobjs := $(sort $(foreach m,$(host-cxxshlib),$($(m:.so=-objs)))) | 50 | host-cxxshobjs := $(sort $(foreach m,$(host-cxxshlib),$($(m:.so=-objs)))) |
| 51 | 51 | ||
| 52 | # output directory for programs/.o files | ||
| 53 | # hostprogs-y := tools/build may have been specified. | ||
| 54 | # Retrieve also directory of .o files from prog-objs or prog-cxxobjs notation | ||
| 55 | host-objdirs := $(dir $(__hostprogs) $(host-cobjs) $(host-cxxobjs)) | ||
| 56 | |||
| 57 | host-objdirs := $(strip $(sort $(filter-out ./,$(host-objdirs)))) | ||
| 58 | |||
| 59 | |||
| 60 | __hostprogs := $(addprefix $(obj)/,$(__hostprogs)) | ||
| 61 | host-csingle := $(addprefix $(obj)/,$(host-csingle)) | 52 | host-csingle := $(addprefix $(obj)/,$(host-csingle)) |
| 62 | host-cmulti := $(addprefix $(obj)/,$(host-cmulti)) | 53 | host-cmulti := $(addprefix $(obj)/,$(host-cmulti)) |
| 63 | host-cobjs := $(addprefix $(obj)/,$(host-cobjs)) | 54 | host-cobjs := $(addprefix $(obj)/,$(host-cobjs)) |
| @@ -67,9 +58,6 @@ host-cshlib := $(addprefix $(obj)/,$(host-cshlib)) | |||
| 67 | host-cxxshlib := $(addprefix $(obj)/,$(host-cxxshlib)) | 58 | host-cxxshlib := $(addprefix $(obj)/,$(host-cxxshlib)) |
| 68 | host-cshobjs := $(addprefix $(obj)/,$(host-cshobjs)) | 59 | host-cshobjs := $(addprefix $(obj)/,$(host-cshobjs)) |
| 69 | host-cxxshobjs := $(addprefix $(obj)/,$(host-cxxshobjs)) | 60 | host-cxxshobjs := $(addprefix $(obj)/,$(host-cxxshobjs)) |
| 70 | host-objdirs := $(addprefix $(obj)/,$(host-objdirs)) | ||
| 71 | |||
| 72 | obj-dirs += $(host-objdirs) | ||
| 73 | 61 | ||
| 74 | ##### | 62 | ##### |
| 75 | # Handle options to gcc. Support building with separate output directory | 63 | # Handle options to gcc. Support building with separate output directory |
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 2278405cbc80..08eb40a7729f 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib | |||
| @@ -5,24 +5,25 @@ ccflags-y += $(EXTRA_CFLAGS) | |||
| 5 | cppflags-y += $(EXTRA_CPPFLAGS) | 5 | cppflags-y += $(EXTRA_CPPFLAGS) |
| 6 | ldflags-y += $(EXTRA_LDFLAGS) | 6 | ldflags-y += $(EXTRA_LDFLAGS) |
| 7 | 7 | ||
| 8 | # | 8 | # flags that take effect in current and sub directories |
| 9 | # flags that take effect in sub directories | 9 | KBUILD_AFLAGS += $(subdir-asflags-y) |
| 10 | export KBUILD_SUBDIR_ASFLAGS := $(KBUILD_SUBDIR_ASFLAGS) $(subdir-asflags-y) | 10 | KBUILD_CFLAGS += $(subdir-ccflags-y) |
| 11 | export KBUILD_SUBDIR_CCFLAGS := $(KBUILD_SUBDIR_CCFLAGS) $(subdir-ccflags-y) | ||
| 12 | 11 | ||
| 13 | # Figure out what we need to build from the various variables | 12 | # Figure out what we need to build from the various variables |
| 14 | # =========================================================================== | 13 | # =========================================================================== |
| 15 | 14 | ||
| 16 | # When an object is listed to be built compiled-in and modular, | 15 | # When an object is listed to be built compiled-in and modular, |
| 17 | # only build the compiled-in version | 16 | # only build the compiled-in version |
| 18 | |||
| 19 | obj-m := $(filter-out $(obj-y),$(obj-m)) | 17 | obj-m := $(filter-out $(obj-y),$(obj-m)) |
| 20 | 18 | ||
| 21 | # Libraries are always collected in one lib file. | 19 | # Libraries are always collected in one lib file. |
| 22 | # Filter out objects already built-in | 20 | # Filter out objects already built-in |
| 23 | |||
| 24 | lib-y := $(filter-out $(obj-y), $(sort $(lib-y) $(lib-m))) | 21 | lib-y := $(filter-out $(obj-y), $(sort $(lib-y) $(lib-m))) |
| 25 | 22 | ||
| 23 | # Determine modorder. | ||
| 24 | # Unfortunately, we don't have information about ordering between -y | ||
| 25 | # and -m subdirs. Just put -y's first. | ||
| 26 | modorder := $(patsubst %/,%/modules.order, $(filter %/, $(obj-y)) $(obj-m:.o=.ko)) | ||
| 26 | 27 | ||
| 27 | # Handle objects in subdirs | 28 | # Handle objects in subdirs |
| 28 | # --------------------------------------------------------------------------- | 29 | # --------------------------------------------------------------------------- |
| @@ -30,12 +31,6 @@ lib-y := $(filter-out $(obj-y), $(sort $(lib-y) $(lib-m))) | |||
| 30 | # and add the directory to the list of dirs to descend into: $(subdir-y) | 31 | # and add the directory to the list of dirs to descend into: $(subdir-y) |
| 31 | # o if we encounter foo/ in $(obj-m), remove it from $(obj-m) | 32 | # o if we encounter foo/ in $(obj-m), remove it from $(obj-m) |
| 32 | # and add the directory to the list of dirs to descend into: $(subdir-m) | 33 | # and add the directory to the list of dirs to descend into: $(subdir-m) |
| 33 | |||
| 34 | # Determine modorder. | ||
| 35 | # Unfortunately, we don't have information about ordering between -y | ||
| 36 | # and -m subdirs. Just put -y's first. | ||
| 37 | modorder := $(patsubst %/,%/modules.order, $(filter %/, $(obj-y)) $(obj-m:.o=.ko)) | ||
| 38 | |||
| 39 | __subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y))) | 34 | __subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y))) |
| 40 | subdir-y += $(__subdir-y) | 35 | subdir-y += $(__subdir-y) |
| 41 | __subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m))) | 36 | __subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m))) |
| @@ -44,10 +39,9 @@ obj-y := $(patsubst %/, %/built-in.o, $(obj-y)) | |||
| 44 | obj-m := $(filter-out %/, $(obj-m)) | 39 | obj-m := $(filter-out %/, $(obj-m)) |
| 45 | 40 | ||
| 46 | # Subdirectories we need to descend into | 41 | # Subdirectories we need to descend into |
| 47 | |||
| 48 | subdir-ym := $(sort $(subdir-y) $(subdir-m)) | 42 | subdir-ym := $(sort $(subdir-y) $(subdir-m)) |
| 49 | 43 | ||
| 50 | # if $(foo-objs) exists, foo.o is a composite object | 44 | # if $(foo-objs), $(foo-y), or $(foo-m) exists, foo.o is a composite object |
| 51 | multi-used-y := $(sort $(foreach m,$(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m)))) | 45 | multi-used-y := $(sort $(foreach m,$(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m)))) |
| 52 | multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))), $(m)))) | 46 | multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))), $(m)))) |
| 53 | multi-used := $(multi-used-y) $(multi-used-m) | 47 | multi-used := $(multi-used-y) $(multi-used-m) |
| @@ -57,15 +51,11 @@ single-used-m := $(sort $(filter-out $(multi-used-m),$(obj-m))) | |||
| 57 | # objects depend on those (obviously) | 51 | # objects depend on those (obviously) |
| 58 | multi-objs-y := $(foreach m, $(multi-used-y), $($(m:.o=-objs)) $($(m:.o=-y))) | 52 | multi-objs-y := $(foreach m, $(multi-used-y), $($(m:.o=-objs)) $($(m:.o=-y))) |
| 59 | multi-objs-m := $(foreach m, $(multi-used-m), $($(m:.o=-objs)) $($(m:.o=-y))) | 53 | multi-objs-m := $(foreach m, $(multi-used-m), $($(m:.o=-objs)) $($(m:.o=-y))) |
| 60 | multi-objs := $(multi-objs-y) $(multi-objs-m) | ||
| 61 | 54 | ||
| 62 | # $(subdir-obj-y) is the list of objects in $(obj-y) which uses dir/ to | 55 | # $(subdir-obj-y) is the list of objects in $(obj-y) which uses dir/ to |
| 63 | # tell kbuild to descend | 56 | # tell kbuild to descend |
| 64 | subdir-obj-y := $(filter %/built-in.o, $(obj-y)) | 57 | subdir-obj-y := $(filter %/built-in.o, $(obj-y)) |
| 65 | 58 | ||
| 66 | # $(obj-dirs) is a list of directories that contain object files | ||
| 67 | obj-dirs := $(dir $(multi-objs) $(obj-y)) | ||
| 68 | |||
| 69 | # Replace multi-part objects by their individual parts, look at local dir only | 59 | # Replace multi-part objects by their individual parts, look at local dir only |
| 70 | real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) $(extra-y) | 60 | real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) $(extra-y) |
| 71 | real-objs-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))),$($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)),$(m))) | 61 | real-objs-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))),$($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)),$(m))) |
| @@ -93,11 +83,9 @@ multi-used-m := $(addprefix $(obj)/,$(multi-used-m)) | |||
| 93 | multi-objs-y := $(addprefix $(obj)/,$(multi-objs-y)) | 83 | multi-objs-y := $(addprefix $(obj)/,$(multi-objs-y)) |
| 94 | multi-objs-m := $(addprefix $(obj)/,$(multi-objs-m)) | 84 | multi-objs-m := $(addprefix $(obj)/,$(multi-objs-m)) |
| 95 | subdir-ym := $(addprefix $(obj)/,$(subdir-ym)) | 85 | subdir-ym := $(addprefix $(obj)/,$(subdir-ym)) |
| 96 | obj-dirs := $(addprefix $(obj)/,$(obj-dirs)) | ||
| 97 | 86 | ||
| 98 | # These flags are needed for modversions and compiling, so we define them here | 87 | # These flags are needed for modversions and compiling, so we define them here |
| 99 | # already | 88 | # $(modname_flags) defines KBUILD_MODNAME as the name of the module it will |
| 100 | # $(modname_flags) #defines KBUILD_MODNAME as the name of the module it will | ||
| 101 | # end up in (or would, if it gets compiled in) | 89 | # end up in (or would, if it gets compiled in) |
| 102 | # Note: Files that end up in two or more modules are compiled without the | 90 | # Note: Files that end up in two or more modules are compiled without the |
| 103 | # KBUILD_MODNAME definition. The reason is that any made-up name would | 91 | # KBUILD_MODNAME definition. The reason is that any made-up name would |
| @@ -107,10 +95,10 @@ basename_flags = -DKBUILD_BASENAME=$(call name-fix,$(basetarget)) | |||
| 107 | modname_flags = $(if $(filter 1,$(words $(modname))),\ | 95 | modname_flags = $(if $(filter 1,$(words $(modname))),\ |
| 108 | -DKBUILD_MODNAME=$(call name-fix,$(modname))) | 96 | -DKBUILD_MODNAME=$(call name-fix,$(modname))) |
| 109 | 97 | ||
| 110 | orig_c_flags = $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(KBUILD_SUBDIR_CCFLAGS) \ | 98 | orig_c_flags = $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \ |
| 111 | $(ccflags-y) $(CFLAGS_$(basetarget).o) | 99 | $(ccflags-y) $(CFLAGS_$(basetarget).o) |
| 112 | _c_flags = $(filter-out $(CFLAGS_REMOVE_$(basetarget).o), $(orig_c_flags)) | 100 | _c_flags = $(filter-out $(CFLAGS_REMOVE_$(basetarget).o), $(orig_c_flags)) |
| 113 | orig_a_flags = $(KBUILD_CPPFLAGS) $(KBUILD_AFLAGS) $(KBUILD_SUBDIR_ASFLAGS) \ | 101 | orig_a_flags = $(KBUILD_CPPFLAGS) $(KBUILD_AFLAGS) \ |
| 114 | $(asflags-y) $(AFLAGS_$(basetarget).o) | 102 | $(asflags-y) $(AFLAGS_$(basetarget).o) |
| 115 | _a_flags = $(filter-out $(AFLAGS_REMOVE_$(basetarget).o), $(orig_a_flags)) | 103 | _a_flags = $(filter-out $(AFLAGS_REMOVE_$(basetarget).o), $(orig_a_flags)) |
| 116 | _cpp_flags = $(KBUILD_CPPFLAGS) $(cppflags-y) $(CPPFLAGS_$(@F)) | 104 | _cpp_flags = $(KBUILD_CPPFLAGS) $(cppflags-y) $(CPPFLAGS_$(@F)) |
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index 991db7d6e4df..df4174405feb 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost | |||
| @@ -143,8 +143,7 @@ FORCE: | |||
| 143 | # optimization, we don't need to read them if the target does not | 143 | # optimization, we don't need to read them if the target does not |
| 144 | # exist, we will rebuild anyway in that case. | 144 | # exist, we will rebuild anyway in that case. |
| 145 | 145 | ||
| 146 | targets := $(wildcard $(sort $(targets))) | 146 | cmd_files := $(wildcard $(foreach f,$(sort $(targets)),$(dir $(f)).$(notdir $(f)).cmd)) |
| 147 | cmd_files := $(wildcard $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd)) | ||
| 148 | 147 | ||
| 149 | ifneq ($(cmd_files),) | 148 | ifneq ($(cmd_files),) |
| 150 | include $(cmd_files) | 149 | include $(cmd_files) |
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index e6818b8e7141..c0d129d7f430 100755 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh | |||
| @@ -188,10 +188,8 @@ sortextable() | |||
| 188 | # Delete output files in case of error | 188 | # Delete output files in case of error |
| 189 | cleanup() | 189 | cleanup() |
| 190 | { | 190 | { |
| 191 | rm -f .old_version | ||
| 192 | rm -f .tmp_System.map | 191 | rm -f .tmp_System.map |
| 193 | rm -f .tmp_kallsyms* | 192 | rm -f .tmp_kallsyms* |
| 194 | rm -f .tmp_version | ||
| 195 | rm -f .tmp_vmlinux* | 193 | rm -f .tmp_vmlinux* |
| 196 | rm -f built-in.o | 194 | rm -f built-in.o |
| 197 | rm -f System.map | 195 | rm -f System.map |
| @@ -239,12 +237,12 @@ esac | |||
| 239 | 237 | ||
| 240 | # Update version | 238 | # Update version |
| 241 | info GEN .version | 239 | info GEN .version |
| 242 | if [ ! -r .version ]; then | 240 | if [ -r .version ]; then |
| 243 | rm -f .version; | 241 | VERSION=$(expr 0$(cat .version) + 1) |
| 244 | echo 1 >.version; | 242 | echo $VERSION > .version |
| 245 | else | 243 | else |
| 246 | mv .version .old_version; | 244 | rm -f .version |
| 247 | expr 0$(cat .old_version) + 1 >.version; | 245 | echo 1 > .version |
| 248 | fi; | 246 | fi; |
| 249 | 247 | ||
| 250 | # final build of init/ | 248 | # final build of init/ |
| @@ -332,6 +330,3 @@ if [ -n "${CONFIG_KALLSYMS}" ]; then | |||
| 332 | exit 1 | 330 | exit 1 |
| 333 | fi | 331 | fi |
| 334 | fi | 332 | fi |
| 335 | |||
| 336 | # We made a new kernel - delete old version file | ||
| 337 | rm -f .old_version | ||
diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h index 959199c3147e..87f1fc9801d7 100755 --- a/scripts/mkcompile_h +++ b/scripts/mkcompile_h | |||
| @@ -28,12 +28,7 @@ LC_ALL=C | |||
| 28 | export LC_ALL | 28 | export LC_ALL |
| 29 | 29 | ||
| 30 | if [ -z "$KBUILD_BUILD_VERSION" ]; then | 30 | if [ -z "$KBUILD_BUILD_VERSION" ]; then |
| 31 | if [ -r .version ]; then | 31 | VERSION=$(cat .version 2>/dev/null || echo 1) |
| 32 | VERSION=`cat .version` | ||
| 33 | else | ||
| 34 | VERSION=0 | ||
| 35 | echo 0 > .version | ||
| 36 | fi | ||
| 37 | else | 32 | else |
| 38 | VERSION=$KBUILD_BUILD_VERSION | 33 | VERSION=$KBUILD_BUILD_VERSION |
| 39 | fi | 34 | fi |
diff --git a/scripts/selinux/Makefile b/scripts/selinux/Makefile index e8049da1831f..b3048b894a39 100644 --- a/scripts/selinux/Makefile +++ b/scripts/selinux/Makefile | |||
| @@ -1,2 +1 @@ | |||
| 1 | subdir-y := mdp genheaders | subdir-y := mdp genheaders | |
| 2 | subdir- += mdp genheaders | ||
