forked from Minki/linux
Kbuild updates for v4.15
One of the most remarkable improvements in this cycle is, Kbuild is now able to cache the result of shell commands. Some variables are expensive to compute, for example, $(call cc-option,...) invokes the compiler. It is not efficient to redo this computation every time, even when we are not actually building anything. Kbuild creates a hidden file ".cache.mk" that contains invoked shell commands and their results. The speed-up should be noticeable. Summary: - Fix arch build issues (hexagon, sh) - Clean up various Makefiles and scripts - Fix wrong usage of {CFLAGS,LDFLAGS}_MODULE in arch Makefiles - Cache variables that are expensive to compute - Improve cc-ldopton and ld-option for Clang - Optimize output directory creation -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJaDxaLAAoJED2LAQed4NsGIHQP/isMxxaIxIAWU56+ZcII74k7 639VgrKi9n5y25d1dBRTQg+vReHE6E2JbkCqpVOu11t7m0LT7yUK8v3WwyLf1qTN GxnqZ/WMQU5/AYVqIWo8jN4FGHpivHJ6qbeiNJM9qN4RAkzG0sZUq746VaFZYmIR Lu0Gf4m4qjifkkhXsQdWT5i7yNTidPqaL6GNb+FcFkEHlVre8jma0kJlgfHxru84 WmETpjQXvHAZ/R61vY6ekAWpqFhw3ecJY96A9npnx+SQVQdSNAdpaU0SK29jB0ON /SAfpHg9oa/gD0LFOKV6zkjnAkd4TEjrJEiHHhz5gjT/SbS3T1llBIGZ1oV4X7Y0 Vlh9KWlm1FJJI4SIzc9qUaQMp6JtLfEfHKJCc45xVaN3fNrDnR8jl80x5+95ELga dCkZgnq5u82MtTysCbHBESwDYQaVPyIrh7In+mduglaCqhqj9KoDjoLoiGfCg7SA 3tPflYVd629w5l5GrazJ40jWn1+ggMtgMOVooJNJ+dINCP+GxsUpH84Ww2Pdic+/ qLdud6TeqxrZDGzWXqKNLu8alM8NGgSr101l9gIf1oqSyy63duBpMrxGDoIJS3FU rFDoFFUhlfkAXNbQHtVGNzKtcpCjURh992j9Fa1+NfMwSce5IHkMwTvPmNSRowi8 0llLjXhD/bxK6FpdvlV8 =zIdO -----END PGP SIGNATURE----- Merge tag 'kbuild-v4.15' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild Pull Kbuild updates from Masahiro Yamada: "One of the most remarkable improvements in this cycle is, Kbuild is now able to cache the result of shell commands. Some variables are expensive to compute, for example, $(call cc-option,...) invokes the compiler. It is not efficient to redo this computation every time, even when we are not actually building anything. Kbuild creates a hidden file ".cache.mk" that contains invoked shell commands and their results. The speed-up should be noticeable. Summary: - Fix arch build issues (hexagon, sh) - Clean up various Makefiles and scripts - Fix wrong usage of {CFLAGS,LDFLAGS}_MODULE in arch Makefiles - Cache variables that are expensive to compute - Improve cc-ldopton and ld-option for Clang - Optimize output directory creation" * tag 'kbuild-v4.15' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (30 commits) kbuild: move coccicheck help from scripts/Makefile.help to top Makefile sh: decompressor: add shipped files to .gitignore frv: .gitignore: ignore vmlinux.lds selinux: remove unnecessary assignment to subdir- kbuild: specify FORCE in Makefile.headersinst as .PHONY target kbuild: remove redundant mkdir from ./Kbuild kbuild: optimize object directory creation for incremental build kbuild: create object directories simpler and faster kbuild: filter-out PHONY targets from "targets" kbuild: remove redundant $(wildcard ...) for cmd_files calculation kbuild: create directory for make cache only when necessary sh: select KBUILD_DEFCONFIG depending on ARCH kbuild: fix linker feature test macros when cross compiling with Clang kbuild: shrink .cache.mk when it exceeds 1000 lines kbuild: do not call cc-option before KBUILD_CFLAGS initialization kbuild: Cache a few more calls to the compiler kbuild: Add a cache for generated variables kbuild: add forward declaration of default target to Makefile.asm-generic kbuild: remove KBUILD_SUBDIR_ASFLAGS and KBUILD_SUBDIR_CCFLAGS hexagon/kbuild: replace CFLAGS_MODULE with KBUILD_CFLAGS_MODULE ...
This commit is contained in:
commit
09bd7c75e5
2
Kbuild
2
Kbuild
@ -18,7 +18,6 @@ targets := kernel/bounds.s
|
|||||||
|
|
||||||
# We use internal kbuild rules to avoid the "is up to date" message from make
|
# We use internal kbuild rules to avoid the "is up to date" message from make
|
||||||
kernel/bounds.s: kernel/bounds.c FORCE
|
kernel/bounds.s: kernel/bounds.c FORCE
|
||||||
$(Q)mkdir -p $(dir $@)
|
|
||||||
$(call if_changed_dep,cc_s_c)
|
$(call if_changed_dep,cc_s_c)
|
||||||
|
|
||||||
$(obj)/$(bounds-file): kernel/bounds.s FORCE
|
$(obj)/$(bounds-file): kernel/bounds.s FORCE
|
||||||
@ -54,7 +53,6 @@ targets += arch/$(SRCARCH)/kernel/asm-offsets.s
|
|||||||
# We use internal kbuild rules to avoid the "is up to date" message from make
|
# We use internal kbuild rules to avoid the "is up to date" message from make
|
||||||
arch/$(SRCARCH)/kernel/asm-offsets.s: arch/$(SRCARCH)/kernel/asm-offsets.c \
|
arch/$(SRCARCH)/kernel/asm-offsets.s: arch/$(SRCARCH)/kernel/asm-offsets.c \
|
||||||
$(obj)/$(timeconst-file) $(obj)/$(bounds-file) FORCE
|
$(obj)/$(timeconst-file) $(obj)/$(bounds-file) FORCE
|
||||||
$(Q)mkdir -p $(dir $@)
|
|
||||||
$(call if_changed_dep,cc_s_c)
|
$(call if_changed_dep,cc_s_c)
|
||||||
|
|
||||||
$(obj)/$(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s FORCE
|
$(obj)/$(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s FORCE
|
||||||
|
297
Makefile
297
Makefile
@ -11,6 +11,10 @@ NAME = Fearless Coyote
|
|||||||
# Comments in this file are targeted only to the developer, do not
|
# Comments in this file are targeted only to the developer, do not
|
||||||
# expect to learn how to build the kernel reading this file.
|
# expect to learn how to build the kernel reading this file.
|
||||||
|
|
||||||
|
# That's our default target when none is given on the command line
|
||||||
|
PHONY := _all
|
||||||
|
_all:
|
||||||
|
|
||||||
# o Do not use make's built-in rules and variables
|
# o Do not use make's built-in rules and variables
|
||||||
# (this increases performance and avoids hard-to-debug behaviour);
|
# (this increases performance and avoids hard-to-debug behaviour);
|
||||||
# o Look for make include files relative to root of kernel src
|
# o Look for make include files relative to root of kernel src
|
||||||
@ -117,10 +121,6 @@ ifeq ("$(origin O)", "command line")
|
|||||||
KBUILD_OUTPUT := $(O)
|
KBUILD_OUTPUT := $(O)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# That's our default target when none is given on the command line
|
|
||||||
PHONY := _all
|
|
||||||
_all:
|
|
||||||
|
|
||||||
# Cancel implicit rules on top Makefile
|
# Cancel implicit rules on top Makefile
|
||||||
$(CURDIR)/Makefile Makefile: ;
|
$(CURDIR)/Makefile Makefile: ;
|
||||||
|
|
||||||
@ -187,15 +187,6 @@ ifeq ("$(origin M)", "command line")
|
|||||||
KBUILD_EXTMOD := $(M)
|
KBUILD_EXTMOD := $(M)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# If building an external module we do not care about the all: rule
|
|
||||||
# but instead _all depend on modules
|
|
||||||
PHONY += all
|
|
||||||
ifeq ($(KBUILD_EXTMOD),)
|
|
||||||
_all: all
|
|
||||||
else
|
|
||||||
_all: modules
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(KBUILD_SRC),)
|
ifeq ($(KBUILD_SRC),)
|
||||||
# building in the source tree
|
# building in the source tree
|
||||||
srctree := .
|
srctree := .
|
||||||
@ -207,6 +198,9 @@ else
|
|||||||
srctree := $(KBUILD_SRC)
|
srctree := $(KBUILD_SRC)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
export KBUILD_CHECKSRC KBUILD_EXTMOD KBUILD_SRC
|
||||||
|
|
||||||
objtree := .
|
objtree := .
|
||||||
src := $(srctree)
|
src := $(srctree)
|
||||||
obj := $(objtree)
|
obj := $(objtree)
|
||||||
@ -215,6 +209,74 @@ VPATH := $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD))
|
|||||||
|
|
||||||
export srctree objtree VPATH
|
export srctree objtree VPATH
|
||||||
|
|
||||||
|
# To make sure we do not include .config for any of the *config targets
|
||||||
|
# catch them early, and hand them over to scripts/kconfig/Makefile
|
||||||
|
# It is allowed to specify more targets when calling make, including
|
||||||
|
# mixing *config targets and build targets.
|
||||||
|
# For example 'make oldconfig all'.
|
||||||
|
# Detect when mixed targets is specified, and make a second invocation
|
||||||
|
# of make so .config is not included in this case either (for *config).
|
||||||
|
|
||||||
|
version_h := include/generated/uapi/linux/version.h
|
||||||
|
old_version_h := include/linux/version.h
|
||||||
|
|
||||||
|
no-dot-config-targets := clean mrproper distclean \
|
||||||
|
cscope gtags TAGS tags help% %docs check% coccicheck \
|
||||||
|
$(version_h) headers_% archheaders archscripts \
|
||||||
|
kernelversion %src-pkg
|
||||||
|
|
||||||
|
config-targets := 0
|
||||||
|
mixed-targets := 0
|
||||||
|
dot-config := 1
|
||||||
|
|
||||||
|
ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
|
||||||
|
ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
|
||||||
|
dot-config := 0
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(KBUILD_EXTMOD),)
|
||||||
|
ifneq ($(filter config %config,$(MAKECMDGOALS)),)
|
||||||
|
config-targets := 1
|
||||||
|
ifneq ($(words $(MAKECMDGOALS)),1)
|
||||||
|
mixed-targets := 1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
# install and modules_install need also be processed one by one
|
||||||
|
ifneq ($(filter install,$(MAKECMDGOALS)),)
|
||||||
|
ifneq ($(filter modules_install,$(MAKECMDGOALS)),)
|
||||||
|
mixed-targets := 1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(mixed-targets),1)
|
||||||
|
# ===========================================================================
|
||||||
|
# We're called with mixed targets (*config and build targets).
|
||||||
|
# Handle them one by one.
|
||||||
|
|
||||||
|
PHONY += $(MAKECMDGOALS) __build_one_by_one
|
||||||
|
|
||||||
|
$(filter-out __build_one_by_one, $(MAKECMDGOALS)): __build_one_by_one
|
||||||
|
@:
|
||||||
|
|
||||||
|
__build_one_by_one:
|
||||||
|
$(Q)set -e; \
|
||||||
|
for i in $(MAKECMDGOALS); do \
|
||||||
|
$(MAKE) -f $(srctree)/Makefile $$i; \
|
||||||
|
done
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
# We need some generic definitions (do not try to remake the file).
|
||||||
|
scripts/Kbuild.include: ;
|
||||||
|
include scripts/Kbuild.include
|
||||||
|
|
||||||
|
# Read KERNELRELEASE from include/config/kernel.release (if it exists)
|
||||||
|
KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
|
||||||
|
KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
|
||||||
|
export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION
|
||||||
|
|
||||||
# SUBARCH tells the usermode build what the underlying arch is. That is set
|
# SUBARCH tells the usermode build what the underlying arch is. That is set
|
||||||
# first, and if a usermode build is happening, the "ARCH=um" on the command
|
# first, and if a usermode build is happening, the "ARCH=um" on the command
|
||||||
# line overrides the setting of ARCH below. If a native build is happening,
|
# line overrides the setting of ARCH below. If a native build is happening,
|
||||||
@ -285,9 +347,6 @@ ifeq ($(ARCH),tilegx)
|
|||||||
SRCARCH := tile
|
SRCARCH := tile
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Where to locate arch specific headers
|
|
||||||
hdr-arch := $(SRCARCH)
|
|
||||||
|
|
||||||
KCONFIG_CONFIG ?= .config
|
KCONFIG_CONFIG ?= .config
|
||||||
export KCONFIG_CONFIG
|
export KCONFIG_CONFIG
|
||||||
|
|
||||||
@ -308,45 +367,6 @@ HOSTCXXFLAGS := -O2 $(HOST_LFS_CFLAGS)
|
|||||||
HOSTLDFLAGS := $(HOST_LFS_LDFLAGS)
|
HOSTLDFLAGS := $(HOST_LFS_LDFLAGS)
|
||||||
HOST_LOADLIBES := $(HOST_LFS_LIBS)
|
HOST_LOADLIBES := $(HOST_LFS_LIBS)
|
||||||
|
|
||||||
ifeq ($(shell $(HOSTCC) -v 2>&1 | grep -c "clang version"), 1)
|
|
||||||
HOSTCFLAGS += -Wno-unused-value -Wno-unused-parameter \
|
|
||||||
-Wno-missing-field-initializers -fno-delete-null-pointer-checks
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Decide whether to build built-in, modular, or both.
|
|
||||||
# Normally, just do built-in.
|
|
||||||
|
|
||||||
KBUILD_MODULES :=
|
|
||||||
KBUILD_BUILTIN := 1
|
|
||||||
|
|
||||||
# If we have only "make modules", don't compile built-in objects.
|
|
||||||
# When we're building modules with modversions, we need to consider
|
|
||||||
# the built-in objects during the descend as well, in order to
|
|
||||||
# make sure the checksums are up to date before we record them.
|
|
||||||
|
|
||||||
ifeq ($(MAKECMDGOALS),modules)
|
|
||||||
KBUILD_BUILTIN := $(if $(CONFIG_MODVERSIONS),1)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# If we have "make <whatever> modules", compile modules
|
|
||||||
# in addition to whatever we do anyway.
|
|
||||||
# Just "make" or "make all" shall build modules as well
|
|
||||||
|
|
||||||
ifneq ($(filter all _all modules,$(MAKECMDGOALS)),)
|
|
||||||
KBUILD_MODULES := 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(MAKECMDGOALS),)
|
|
||||||
KBUILD_MODULES := 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
export KBUILD_MODULES KBUILD_BUILTIN
|
|
||||||
export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD
|
|
||||||
|
|
||||||
# We need some generic definitions (do not try to remake the file).
|
|
||||||
scripts/Kbuild.include: ;
|
|
||||||
include scripts/Kbuild.include
|
|
||||||
|
|
||||||
# Make variables (CC, etc...)
|
# Make variables (CC, etc...)
|
||||||
AS = $(CROSS_COMPILE)as
|
AS = $(CROSS_COMPILE)as
|
||||||
LD = $(CROSS_COMPILE)ld
|
LD = $(CROSS_COMPILE)ld
|
||||||
@ -374,12 +394,11 @@ LDFLAGS_MODULE =
|
|||||||
CFLAGS_KERNEL =
|
CFLAGS_KERNEL =
|
||||||
AFLAGS_KERNEL =
|
AFLAGS_KERNEL =
|
||||||
LDFLAGS_vmlinux =
|
LDFLAGS_vmlinux =
|
||||||
CFLAGS_GCOV := -fprofile-arcs -ftest-coverage -fno-tree-loop-im $(call cc-disable-warning,maybe-uninitialized,)
|
|
||||||
|
|
||||||
# Use USERINCLUDE when you must reference the UAPI directories only.
|
# Use USERINCLUDE when you must reference the UAPI directories only.
|
||||||
USERINCLUDE := \
|
USERINCLUDE := \
|
||||||
-I$(srctree)/arch/$(hdr-arch)/include/uapi \
|
-I$(srctree)/arch/$(SRCARCH)/include/uapi \
|
||||||
-I$(objtree)/arch/$(hdr-arch)/include/generated/uapi \
|
-I$(objtree)/arch/$(SRCARCH)/include/generated/uapi \
|
||||||
-I$(srctree)/include/uapi \
|
-I$(srctree)/include/uapi \
|
||||||
-I$(objtree)/include/generated/uapi \
|
-I$(objtree)/include/generated/uapi \
|
||||||
-include $(srctree)/include/linux/kconfig.h
|
-include $(srctree)/include/linux/kconfig.h
|
||||||
@ -387,40 +406,33 @@ USERINCLUDE := \
|
|||||||
# Use LINUXINCLUDE when you must reference the include/ directory.
|
# Use LINUXINCLUDE when you must reference the include/ directory.
|
||||||
# Needed to be compatible with the O= option
|
# Needed to be compatible with the O= option
|
||||||
LINUXINCLUDE := \
|
LINUXINCLUDE := \
|
||||||
-I$(srctree)/arch/$(hdr-arch)/include \
|
-I$(srctree)/arch/$(SRCARCH)/include \
|
||||||
-I$(objtree)/arch/$(hdr-arch)/include/generated \
|
-I$(objtree)/arch/$(SRCARCH)/include/generated \
|
||||||
$(if $(KBUILD_SRC), -I$(srctree)/include) \
|
$(if $(KBUILD_SRC), -I$(srctree)/include) \
|
||||||
-I$(objtree)/include \
|
-I$(objtree)/include \
|
||||||
$(USERINCLUDE)
|
$(USERINCLUDE)
|
||||||
|
|
||||||
KBUILD_CPPFLAGS := -D__KERNEL__
|
KBUILD_AFLAGS := -D__ASSEMBLY__
|
||||||
|
|
||||||
KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
|
KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
|
||||||
-fno-strict-aliasing -fno-common -fshort-wchar \
|
-fno-strict-aliasing -fno-common -fshort-wchar \
|
||||||
-Werror-implicit-function-declaration \
|
-Werror-implicit-function-declaration \
|
||||||
-Wno-format-security \
|
-Wno-format-security \
|
||||||
-std=gnu89 $(call cc-option,-fno-PIE)
|
-std=gnu89
|
||||||
|
KBUILD_CPPFLAGS := -D__KERNEL__
|
||||||
|
|
||||||
KBUILD_AFLAGS_KERNEL :=
|
KBUILD_AFLAGS_KERNEL :=
|
||||||
KBUILD_CFLAGS_KERNEL :=
|
KBUILD_CFLAGS_KERNEL :=
|
||||||
KBUILD_AFLAGS := -D__ASSEMBLY__ $(call cc-option,-fno-PIE)
|
|
||||||
KBUILD_AFLAGS_MODULE := -DMODULE
|
KBUILD_AFLAGS_MODULE := -DMODULE
|
||||||
KBUILD_CFLAGS_MODULE := -DMODULE
|
KBUILD_CFLAGS_MODULE := -DMODULE
|
||||||
KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds
|
KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds
|
||||||
|
GCC_PLUGINS_CFLAGS :=
|
||||||
|
|
||||||
# Read KERNELRELEASE from include/config/kernel.release (if it exists)
|
|
||||||
KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
|
|
||||||
KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
|
|
||||||
|
|
||||||
export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION
|
|
||||||
export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC
|
export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC
|
||||||
export CPP AR NM STRIP OBJCOPY OBJDUMP HOSTLDFLAGS HOST_LOADLIBES
|
export CPP AR NM STRIP OBJCOPY OBJDUMP HOSTLDFLAGS HOST_LOADLIBES
|
||||||
export MAKE AWK GENKSYMS INSTALLKERNEL PERL PYTHON UTS_MACHINE
|
export MAKE AWK GENKSYMS INSTALLKERNEL PERL PYTHON UTS_MACHINE
|
||||||
export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
|
export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
|
||||||
|
|
||||||
export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
|
export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
|
||||||
export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE CFLAGS_GCOV CFLAGS_KCOV CFLAGS_KASAN CFLAGS_UBSAN
|
export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE CFLAGS_KASAN CFLAGS_UBSAN
|
||||||
export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
|
export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
|
||||||
export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE
|
export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE
|
||||||
export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL
|
export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL
|
||||||
@ -462,73 +474,6 @@ ifneq ($(KBUILD_SRC),)
|
|||||||
$(srctree) $(objtree) $(VERSION) $(PATCHLEVEL)
|
$(srctree) $(objtree) $(VERSION) $(PATCHLEVEL)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Support for using generic headers in asm-generic
|
|
||||||
PHONY += asm-generic uapi-asm-generic
|
|
||||||
asm-generic: uapi-asm-generic
|
|
||||||
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \
|
|
||||||
src=asm obj=arch/$(SRCARCH)/include/generated/asm
|
|
||||||
uapi-asm-generic:
|
|
||||||
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \
|
|
||||||
src=uapi/asm obj=arch/$(SRCARCH)/include/generated/uapi/asm
|
|
||||||
|
|
||||||
# To make sure we do not include .config for any of the *config targets
|
|
||||||
# catch them early, and hand them over to scripts/kconfig/Makefile
|
|
||||||
# It is allowed to specify more targets when calling make, including
|
|
||||||
# mixing *config targets and build targets.
|
|
||||||
# For example 'make oldconfig all'.
|
|
||||||
# Detect when mixed targets is specified, and make a second invocation
|
|
||||||
# of make so .config is not included in this case either (for *config).
|
|
||||||
|
|
||||||
version_h := include/generated/uapi/linux/version.h
|
|
||||||
old_version_h := include/linux/version.h
|
|
||||||
|
|
||||||
no-dot-config-targets := clean mrproper distclean \
|
|
||||||
cscope gtags TAGS tags help% %docs check% coccicheck \
|
|
||||||
$(version_h) headers_% archheaders archscripts \
|
|
||||||
kernelversion %src-pkg
|
|
||||||
|
|
||||||
config-targets := 0
|
|
||||||
mixed-targets := 0
|
|
||||||
dot-config := 1
|
|
||||||
|
|
||||||
ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
|
|
||||||
ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
|
|
||||||
dot-config := 0
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(KBUILD_EXTMOD),)
|
|
||||||
ifneq ($(filter config %config,$(MAKECMDGOALS)),)
|
|
||||||
config-targets := 1
|
|
||||||
ifneq ($(words $(MAKECMDGOALS)),1)
|
|
||||||
mixed-targets := 1
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
# install and modules_install need also be processed one by one
|
|
||||||
ifneq ($(filter install,$(MAKECMDGOALS)),)
|
|
||||||
ifneq ($(filter modules_install,$(MAKECMDGOALS)),)
|
|
||||||
mixed-targets := 1
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(mixed-targets),1)
|
|
||||||
# ===========================================================================
|
|
||||||
# We're called with mixed targets (*config and build targets).
|
|
||||||
# Handle them one by one.
|
|
||||||
|
|
||||||
PHONY += $(MAKECMDGOALS) __build_one_by_one
|
|
||||||
|
|
||||||
$(filter-out __build_one_by_one, $(MAKECMDGOALS)): __build_one_by_one
|
|
||||||
@:
|
|
||||||
|
|
||||||
__build_one_by_one:
|
|
||||||
$(Q)set -e; \
|
|
||||||
for i in $(MAKECMDGOALS); do \
|
|
||||||
$(MAKE) -f $(srctree)/Makefile $$i; \
|
|
||||||
done
|
|
||||||
|
|
||||||
else
|
|
||||||
ifeq ($(config-targets),1)
|
ifeq ($(config-targets),1)
|
||||||
# ===========================================================================
|
# ===========================================================================
|
||||||
# *config targets only - make sure prerequisites are updated, and descend
|
# *config targets only - make sure prerequisites are updated, and descend
|
||||||
@ -551,6 +496,44 @@ else
|
|||||||
# Build targets only - this includes vmlinux, arch specific targets, clean
|
# Build targets only - this includes vmlinux, arch specific targets, clean
|
||||||
# targets and others. In general all targets except *config targets.
|
# targets and others. In general all targets except *config targets.
|
||||||
|
|
||||||
|
# If building an external module we do not care about the all: rule
|
||||||
|
# but instead _all depend on modules
|
||||||
|
PHONY += all
|
||||||
|
ifeq ($(KBUILD_EXTMOD),)
|
||||||
|
_all: all
|
||||||
|
else
|
||||||
|
_all: modules
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Decide whether to build built-in, modular, or both.
|
||||||
|
# Normally, just do built-in.
|
||||||
|
|
||||||
|
KBUILD_MODULES :=
|
||||||
|
KBUILD_BUILTIN := 1
|
||||||
|
|
||||||
|
# If we have only "make modules", don't compile built-in objects.
|
||||||
|
# When we're building modules with modversions, we need to consider
|
||||||
|
# the built-in objects during the descend as well, in order to
|
||||||
|
# make sure the checksums are up to date before we record them.
|
||||||
|
|
||||||
|
ifeq ($(MAKECMDGOALS),modules)
|
||||||
|
KBUILD_BUILTIN := $(if $(CONFIG_MODVERSIONS),1)
|
||||||
|
endif
|
||||||
|
|
||||||
|
# If we have "make <whatever> modules", compile modules
|
||||||
|
# in addition to whatever we do anyway.
|
||||||
|
# Just "make" or "make all" shall build modules as well
|
||||||
|
|
||||||
|
ifneq ($(filter all _all modules,$(MAKECMDGOALS)),)
|
||||||
|
KBUILD_MODULES := 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(MAKECMDGOALS),)
|
||||||
|
KBUILD_MODULES := 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
export KBUILD_MODULES KBUILD_BUILTIN
|
||||||
|
|
||||||
ifeq ($(KBUILD_EXTMOD),)
|
ifeq ($(KBUILD_EXTMOD),)
|
||||||
# Additional helpers built in scripts/
|
# Additional helpers built in scripts/
|
||||||
# Carefully list dependencies so we do not try to build scripts twice
|
# Carefully list dependencies so we do not try to build scripts twice
|
||||||
@ -621,6 +604,11 @@ endif
|
|||||||
# Defaults to vmlinux, but the arch makefile usually adds further targets
|
# Defaults to vmlinux, but the arch makefile usually adds further targets
|
||||||
all: vmlinux
|
all: vmlinux
|
||||||
|
|
||||||
|
KBUILD_CFLAGS += $(call cc-option,-fno-PIE)
|
||||||
|
KBUILD_AFLAGS += $(call cc-option,-fno-PIE)
|
||||||
|
CFLAGS_GCOV := -fprofile-arcs -ftest-coverage -fno-tree-loop-im $(call cc-disable-warning,maybe-uninitialized,)
|
||||||
|
export CFLAGS_GCOV CFLAGS_KCOV
|
||||||
|
|
||||||
# The arch Makefile can set ARCH_{CPP,A,C}FLAGS to override the default
|
# The arch Makefile can set ARCH_{CPP,A,C}FLAGS to override the default
|
||||||
# values of the respective KBUILD_* variables
|
# values of the respective KBUILD_* variables
|
||||||
ARCH_CPPFLAGS :=
|
ARCH_CPPFLAGS :=
|
||||||
@ -652,7 +640,7 @@ KBUILD_CFLAGS += $(call cc-ifversion, -lt, 0409, \
|
|||||||
KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0)
|
KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0)
|
||||||
|
|
||||||
# check for 'asm goto'
|
# check for 'asm goto'
|
||||||
ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y)
|
ifeq ($(call shell-cached,$(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y)
|
||||||
KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO
|
KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO
|
||||||
KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO
|
KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO
|
||||||
endif
|
endif
|
||||||
@ -789,7 +777,7 @@ KBUILD_CFLAGS += $(call cc-option,-fdata-sections,)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
# arch Makefile may override CC so keep this after arch Makefile is included
|
# arch Makefile may override CC so keep this after arch Makefile is included
|
||||||
NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
|
NOSTDINC_FLAGS += -nostdinc -isystem $(call shell-cached,$(CC) -print-file-name=include)
|
||||||
CHECKFLAGS += $(NOSTDINC_FLAGS)
|
CHECKFLAGS += $(NOSTDINC_FLAGS)
|
||||||
|
|
||||||
# warn about C99 declaration after statement
|
# warn about C99 declaration after statement
|
||||||
@ -1071,6 +1059,15 @@ prepare0: archprepare gcc-plugins
|
|||||||
# All the preparing..
|
# All the preparing..
|
||||||
prepare: prepare0 prepare-objtool
|
prepare: prepare0 prepare-objtool
|
||||||
|
|
||||||
|
# Support for using generic headers in asm-generic
|
||||||
|
PHONY += asm-generic uapi-asm-generic
|
||||||
|
asm-generic: uapi-asm-generic
|
||||||
|
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \
|
||||||
|
src=asm obj=arch/$(SRCARCH)/include/generated/asm
|
||||||
|
uapi-asm-generic:
|
||||||
|
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \
|
||||||
|
src=uapi/asm obj=arch/$(SRCARCH)/include/generated/uapi/asm
|
||||||
|
|
||||||
PHONY += prepare-objtool
|
PHONY += prepare-objtool
|
||||||
prepare-objtool: $(objtool_target)
|
prepare-objtool: $(objtool_target)
|
||||||
|
|
||||||
@ -1139,8 +1136,8 @@ headerdep:
|
|||||||
#Default location for installed headers
|
#Default location for installed headers
|
||||||
export INSTALL_HDR_PATH = $(objtree)/usr
|
export INSTALL_HDR_PATH = $(objtree)/usr
|
||||||
|
|
||||||
# If we do an all arch process set dst to include/arch-$(hdr-arch)
|
# If we do an all arch process set dst to include/arch-$(SRCARCH)
|
||||||
hdr-dst = $(if $(KBUILD_HEADERS), dst=include/arch-$(hdr-arch), dst=include)
|
hdr-dst = $(if $(KBUILD_HEADERS), dst=include/arch-$(SRCARCH), dst=include)
|
||||||
|
|
||||||
PHONY += archheaders
|
PHONY += archheaders
|
||||||
archheaders:
|
archheaders:
|
||||||
@ -1158,10 +1155,10 @@ headers_install_all:
|
|||||||
|
|
||||||
PHONY += headers_install
|
PHONY += headers_install
|
||||||
headers_install: __headers
|
headers_install: __headers
|
||||||
$(if $(wildcard $(srctree)/arch/$(hdr-arch)/include/uapi/asm/Kbuild),, \
|
$(if $(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/Kbuild),, \
|
||||||
$(error Headers not exportable for the $(SRCARCH) architecture))
|
$(error Headers not exportable for the $(SRCARCH) architecture))
|
||||||
$(Q)$(MAKE) $(hdr-inst)=include/uapi dst=include
|
$(Q)$(MAKE) $(hdr-inst)=include/uapi dst=include
|
||||||
$(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi $(hdr-dst)
|
$(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi $(hdr-dst)
|
||||||
|
|
||||||
PHONY += headers_check_all
|
PHONY += headers_check_all
|
||||||
headers_check_all: headers_install_all
|
headers_check_all: headers_install_all
|
||||||
@ -1170,7 +1167,7 @@ headers_check_all: headers_install_all
|
|||||||
PHONY += headers_check
|
PHONY += headers_check
|
||||||
headers_check: headers_install
|
headers_check: headers_install
|
||||||
$(Q)$(MAKE) $(hdr-inst)=include/uapi dst=include HDRCHECK=1
|
$(Q)$(MAKE) $(hdr-inst)=include/uapi dst=include HDRCHECK=1
|
||||||
$(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi $(hdr-dst) HDRCHECK=1
|
$(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi $(hdr-dst) HDRCHECK=1
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# Kernel selftest
|
# Kernel selftest
|
||||||
@ -1283,7 +1280,7 @@ CLEAN_DIRS += $(MODVERDIR)
|
|||||||
# Directories & files removed with 'make mrproper'
|
# Directories & files removed with 'make mrproper'
|
||||||
MRPROPER_DIRS += include/config usr/include include/generated \
|
MRPROPER_DIRS += include/config usr/include include/generated \
|
||||||
arch/*/include/generated .tmp_objdiff
|
arch/*/include/generated .tmp_objdiff
|
||||||
MRPROPER_FILES += .config .config.old .version .old_version \
|
MRPROPER_FILES += .config .config.old .version \
|
||||||
Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS \
|
Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS \
|
||||||
signing_key.pem signing_key.priv signing_key.x509 \
|
signing_key.pem signing_key.priv signing_key.x509 \
|
||||||
x509.genkey extra_certificates signing_key.x509.keyid \
|
x509.genkey extra_certificates signing_key.x509.keyid \
|
||||||
@ -1393,7 +1390,7 @@ help:
|
|||||||
@echo ' export_report - List the usages of all exported symbols'
|
@echo ' export_report - List the usages of all exported symbols'
|
||||||
@echo ' headers_check - Sanity check on exported headers'
|
@echo ' headers_check - Sanity check on exported headers'
|
||||||
@echo ' headerdep - Detect inclusion cycles in headers'
|
@echo ' headerdep - Detect inclusion cycles in headers'
|
||||||
@$(MAKE) -f $(srctree)/scripts/Makefile.help checker-help
|
@echo ' coccicheck - Check with Coccinelle'
|
||||||
@echo ''
|
@echo ''
|
||||||
@echo 'Kernel selftest:'
|
@echo 'Kernel selftest:'
|
||||||
@echo ' kselftest - Build and run kernel selftest (run as root)'
|
@echo ' kselftest - Build and run kernel selftest (run as root)'
|
||||||
@ -1556,6 +1553,7 @@ clean: $(clean-dirs)
|
|||||||
-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
|
-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
|
||||||
-o -name '*.symtypes' -o -name 'modules.order' \
|
-o -name '*.symtypes' -o -name 'modules.order' \
|
||||||
-o -name modules.builtin -o -name '.tmp_*.o.*' \
|
-o -name modules.builtin -o -name '.tmp_*.o.*' \
|
||||||
|
-o -name .cache.mk \
|
||||||
-o -name '*.c.[012]*.*' \
|
-o -name '*.c.[012]*.*' \
|
||||||
-o -name '*.ll' \
|
-o -name '*.ll' \
|
||||||
-o -name '*.gcno' \) -type f -print | xargs rm -f
|
-o -name '*.gcno' \) -type f -print | xargs rm -f
|
||||||
@ -1702,8 +1700,7 @@ cmd_crmodverdir = $(Q)mkdir -p $(MODVERDIR) \
|
|||||||
|
|
||||||
# read all saved command lines
|
# read all saved command lines
|
||||||
|
|
||||||
targets := $(wildcard $(sort $(targets)))
|
cmd_files := $(wildcard .*.cmd $(foreach f,$(sort $(targets)),$(dir $(f)).$(notdir $(f)).cmd))
|
||||||
cmd_files := $(wildcard .*.cmd $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd))
|
|
||||||
|
|
||||||
ifneq ($(cmd_files),)
|
ifneq ($(cmd_files),)
|
||||||
$(cmd_files): ; # Do not try to update included dependency files
|
$(cmd_files): ; # Do not try to update included dependency files
|
||||||
|
@ -16,11 +16,11 @@ LDFLAGS :=
|
|||||||
LDFLAGS_vmlinux :=-p --no-undefined -X --pic-veneer
|
LDFLAGS_vmlinux :=-p --no-undefined -X --pic-veneer
|
||||||
ifeq ($(CONFIG_CPU_ENDIAN_BE8),y)
|
ifeq ($(CONFIG_CPU_ENDIAN_BE8),y)
|
||||||
LDFLAGS_vmlinux += --be8
|
LDFLAGS_vmlinux += --be8
|
||||||
LDFLAGS_MODULE += --be8
|
KBUILD_LDFLAGS_MODULE += --be8
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_ARM_MODULE_PLTS),y)
|
ifeq ($(CONFIG_ARM_MODULE_PLTS),y)
|
||||||
LDFLAGS_MODULE += -T $(srctree)/arch/arm/kernel/module.lds
|
KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/arm/kernel/module.lds
|
||||||
endif
|
endif
|
||||||
|
|
||||||
GZFLAGS :=-9
|
GZFLAGS :=-9
|
||||||
@ -122,7 +122,7 @@ CFLAGS_ISA :=-mthumb $(AFLAGS_AUTOIT) $(AFLAGS_NOWARN)
|
|||||||
AFLAGS_ISA :=$(CFLAGS_ISA) -Wa$(comma)-mthumb
|
AFLAGS_ISA :=$(CFLAGS_ISA) -Wa$(comma)-mthumb
|
||||||
# Work around buggy relocation from gas if requested:
|
# Work around buggy relocation from gas if requested:
|
||||||
ifeq ($(CONFIG_THUMB2_AVOID_R_ARM_THM_JUMP11),y)
|
ifeq ($(CONFIG_THUMB2_AVOID_R_ARM_THM_JUMP11),y)
|
||||||
CFLAGS_MODULE +=-fno-optimize-sibling-calls
|
KBUILD_CFLAGS_MODULE +=-fno-optimize-sibling-calls
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
CFLAGS_ISA :=$(call cc-option,-marm,)
|
CFLAGS_ISA :=$(call cc-option,-marm,)
|
||||||
|
@ -12,7 +12,7 @@ cflags-y += -mno-dsbt -msdata=none -D__linux__
|
|||||||
|
|
||||||
cflags-$(CONFIG_C6X_BIG_KERNEL) += -mlong-calls
|
cflags-$(CONFIG_C6X_BIG_KERNEL) += -mlong-calls
|
||||||
|
|
||||||
CFLAGS_MODULE += -mlong-calls -mno-dsbt -msdata=none
|
KBUILD_CFLAGS_MODULE += -mlong-calls -mno-dsbt -msdata=none
|
||||||
|
|
||||||
CHECKFLAGS +=
|
CHECKFLAGS +=
|
||||||
|
|
||||||
|
1
arch/frv/kernel/.gitignore
vendored
Normal file
1
arch/frv/kernel/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
vmlinux.lds
|
@ -12,9 +12,9 @@ KBUILD_CFLAGS += -fno-short-enums
|
|||||||
|
|
||||||
# Modules must use either long-calls, or use pic/plt.
|
# Modules must use either long-calls, or use pic/plt.
|
||||||
# Use long-calls for now, it's easier. And faster.
|
# Use long-calls for now, it's easier. And faster.
|
||||||
# CFLAGS_MODULE += -fPIC
|
# KBUILD_CFLAGS_MODULE += -fPIC
|
||||||
# LDFLAGS_MODULE += -shared
|
# KBUILD_LDFLAGS_MODULE += -shared
|
||||||
CFLAGS_MODULE += -mlong-calls
|
KBUILD_CFLAGS_MODULE += -mlong-calls
|
||||||
|
|
||||||
cflags-y += $(call cc-option,-mv${CONFIG_HEXAGON_ARCH_VERSION})
|
cflags-y += $(call cc-option,-mv${CONFIG_HEXAGON_ARCH_VERSION})
|
||||||
aflags-y += $(call cc-option,-mv${CONFIG_HEXAGON_ARCH_VERSION})
|
aflags-y += $(call cc-option,-mv${CONFIG_HEXAGON_ARCH_VERSION})
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
* 02110-1301, USA.
|
* 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <generated/compile.h>
|
|
||||||
|
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/sched.h>
|
#include <linux/sched.h>
|
||||||
#include <linux/sched/task_stack.h>
|
#include <linux/sched/task_stack.h>
|
||||||
@ -180,7 +178,7 @@ static const struct user_regset hexagon_regsets[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const struct user_regset_view hexagon_user_view = {
|
static const struct user_regset_view hexagon_user_view = {
|
||||||
.name = UTS_MACHINE,
|
.name = "hexagon",
|
||||||
.e_machine = ELF_ARCH,
|
.e_machine = ELF_ARCH,
|
||||||
.ei_osabi = ELF_OSABI,
|
.ei_osabi = ELF_OSABI,
|
||||||
.regsets = hexagon_regsets,
|
.regsets = hexagon_regsets,
|
||||||
|
@ -15,6 +15,12 @@ ifneq ($(SUBARCH),$(ARCH))
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(ARCH),sh)
|
||||||
|
KBUILD_DEFCONFIG := shx3_defconfig
|
||||||
|
else
|
||||||
|
KBUILD_DEFCONFIG := cayman_defconfig
|
||||||
|
endif
|
||||||
|
|
||||||
isa-y := any
|
isa-y := any
|
||||||
isa-$(CONFIG_SH_DSP) := sh
|
isa-$(CONFIG_SH_DSP) := sh
|
||||||
isa-$(CONFIG_CPU_SH2) := sh2
|
isa-$(CONFIG_CPU_SH2) := sh2
|
||||||
@ -105,14 +111,12 @@ ifdef CONFIG_SUPERH32
|
|||||||
UTS_MACHINE := sh
|
UTS_MACHINE := sh
|
||||||
BITS := 32
|
BITS := 32
|
||||||
LDFLAGS_vmlinux += -e _stext
|
LDFLAGS_vmlinux += -e _stext
|
||||||
KBUILD_DEFCONFIG := shx3_defconfig
|
|
||||||
else
|
else
|
||||||
UTS_MACHINE := sh64
|
UTS_MACHINE := sh64
|
||||||
BITS := 64
|
BITS := 64
|
||||||
LDFLAGS_vmlinux += --defsym phys_stext=_stext-$(CONFIG_PAGE_OFFSET) \
|
LDFLAGS_vmlinux += --defsym phys_stext=_stext-$(CONFIG_PAGE_OFFSET) \
|
||||||
--defsym phys_stext_shmedia=phys_stext+1 \
|
--defsym phys_stext_shmedia=phys_stext+1 \
|
||||||
-e phys_stext_shmedia
|
-e phys_stext_shmedia
|
||||||
KBUILD_DEFCONFIG := cayman_defconfig
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef CONFIG_CPU_LITTLE_ENDIAN
|
ifdef CONFIG_CPU_LITTLE_ENDIAN
|
||||||
|
5
arch/sh/boot/compressed/.gitignore
vendored
5
arch/sh/boot/compressed/.gitignore
vendored
@ -1 +1,6 @@
|
|||||||
|
ashiftrt.S
|
||||||
|
ashldi3.c
|
||||||
|
ashlsi3.S
|
||||||
|
ashrsi3.S
|
||||||
|
lshrsi3.S
|
||||||
vmlinux.bin.*
|
vmlinux.bin.*
|
||||||
|
@ -130,10 +130,6 @@ $(obj)/vdsox32.so.dbg: $(src)/vdsox32.lds $(vobjx32s) FORCE
|
|||||||
CPPFLAGS_vdso32.lds = $(CPPFLAGS_vdso.lds)
|
CPPFLAGS_vdso32.lds = $(CPPFLAGS_vdso.lds)
|
||||||
VDSO_LDFLAGS_vdso32.lds = -m32 -Wl,-m,elf_i386 -Wl,-soname=linux-gate.so.1
|
VDSO_LDFLAGS_vdso32.lds = -m32 -Wl,-m,elf_i386 -Wl,-soname=linux-gate.so.1
|
||||||
|
|
||||||
# This makes sure the $(obj) subdirectory exists even though vdso32/
|
|
||||||
# is not a kbuild sub-make subdirectory.
|
|
||||||
override obj-dirs = $(dir $(obj)) $(obj)/vdso32/
|
|
||||||
|
|
||||||
targets += vdso32/vdso32.lds
|
targets += vdso32/vdso32.lds
|
||||||
targets += vdso32/note.o vdso32/system_call.o vdso32/sigreturn.o
|
targets += vdso32/note.o vdso32/system_call.o vdso32/sigreturn.o
|
||||||
targets += vdso32/vclock_gettime.o
|
targets += vdso32/vclock_gettime.o
|
||||||
|
@ -8,6 +8,8 @@ squote := '
|
|||||||
empty :=
|
empty :=
|
||||||
space := $(empty) $(empty)
|
space := $(empty) $(empty)
|
||||||
space_escape := _-_SPACE_-_
|
space_escape := _-_SPACE_-_
|
||||||
|
right_paren := )
|
||||||
|
left_paren := (
|
||||||
|
|
||||||
###
|
###
|
||||||
# Name of target with a '.' as filename prefix. foo/bar.o => foo/.bar.o
|
# Name of target with a '.' as filename prefix. foo/bar.o => foo/.bar.o
|
||||||
@ -80,6 +82,71 @@ cc-cross-prefix = \
|
|||||||
echo $(c); \
|
echo $(c); \
|
||||||
fi)))
|
fi)))
|
||||||
|
|
||||||
|
# Tools for caching Makefile variables that are "expensive" to compute.
|
||||||
|
#
|
||||||
|
# Here we want to help deal with variables that take a long time to compute
|
||||||
|
# by making it easy to store these variables in a cache.
|
||||||
|
#
|
||||||
|
# The canonical example here is testing for compiler flags. On a simple system
|
||||||
|
# each call to the compiler takes 10 ms, but on a system with a compiler that's
|
||||||
|
# called through various wrappers it can take upwards of 100 ms. If we have
|
||||||
|
# 100 calls to the compiler this can take 1 second (on a simple system) or 10
|
||||||
|
# seconds (on a complicated system).
|
||||||
|
#
|
||||||
|
# The "cache" will be in Makefile syntax and can be directly included.
|
||||||
|
# Any time we try to reference a variable that's not in the cache we'll
|
||||||
|
# calculate it and store it in the cache for next time.
|
||||||
|
|
||||||
|
# Include values from last time
|
||||||
|
make-cache := $(if $(KBUILD_EXTMOD),$(KBUILD_EXTMOD)/,$(if $(obj),$(obj)/)).cache.mk
|
||||||
|
$(make-cache): ;
|
||||||
|
-include $(make-cache)
|
||||||
|
|
||||||
|
cached-data := $(filter __cached_%, $(.VARIABLES))
|
||||||
|
|
||||||
|
# If cache exceeds 1000 lines, shrink it down to 500.
|
||||||
|
ifneq ($(word 1000,$(cached-data)),)
|
||||||
|
$(shell tail -n 500 $(make-cache) > $(make-cache).tmp; \
|
||||||
|
mv $(make-cache).tmp $(make-cache))
|
||||||
|
endif
|
||||||
|
|
||||||
|
create-cache-dir := $(if $(KBUILD_SRC),$(if $(cache-data),,1))
|
||||||
|
|
||||||
|
# Usage: $(call __sanitize-opt,Hello=Hola$(comma)Goodbye Adios)
|
||||||
|
#
|
||||||
|
# Convert all '$', ')', '(', '\', '=', ' ', ',', ':' to '_'
|
||||||
|
__sanitize-opt = $(subst $$,_,$(subst $(right_paren),_,$(subst $(left_paren),_,$(subst \,_,$(subst =,_,$(subst $(space),_,$(subst $(comma),_,$(subst :,_,$(1)))))))))
|
||||||
|
|
||||||
|
# Usage: $(call shell-cached,shell_command)
|
||||||
|
# Example: $(call shell-cached,md5sum /usr/bin/gcc)
|
||||||
|
#
|
||||||
|
# If we've already seen a call to this exact shell command (even in a
|
||||||
|
# previous invocation of make!) we'll return the value. If not, we'll
|
||||||
|
# compute it and store the result for future runs.
|
||||||
|
#
|
||||||
|
# This is a bit of voodoo, but basic explanation is that if the variable
|
||||||
|
# was undefined then we'll evaluate the shell command and store the result
|
||||||
|
# into the variable. We'll then store that value in the cache and finally
|
||||||
|
# output the value.
|
||||||
|
#
|
||||||
|
# NOTE: The $$(2) here isn't actually a parameter to __run-and-store. We
|
||||||
|
# happen to know that the caller will have their shell command in $(2) so the
|
||||||
|
# result of "call"ing this will produce a reference to that $(2). The reason
|
||||||
|
# for this strangeness is to avoid an extra level of eval (and escaping) of
|
||||||
|
# $(2).
|
||||||
|
define __run-and-store
|
||||||
|
ifeq ($(origin $(1)),undefined)
|
||||||
|
$$(eval $(1) := $$(shell $$(2)))
|
||||||
|
ifeq ($(create-cache-dir),1)
|
||||||
|
$$(shell mkdir -p $(dir $(make-cache)))
|
||||||
|
$$(eval create-cache-dir :=)
|
||||||
|
endif
|
||||||
|
$$(shell echo '$(1) := $$($(1))' >> $(make-cache))
|
||||||
|
endif
|
||||||
|
endef
|
||||||
|
__shell-cached = $(eval $(call __run-and-store,$(1)))$($(1))
|
||||||
|
shell-cached = $(call __shell-cached,__cached_$(call __sanitize-opt,$(1)),$(1))
|
||||||
|
|
||||||
# output directory for tests below
|
# output directory for tests below
|
||||||
TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/)
|
TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/)
|
||||||
|
|
||||||
@ -87,30 +154,36 @@ TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/)
|
|||||||
# Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise)
|
# Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise)
|
||||||
# Exit code chooses option. "$$TMP" serves as a temporary file and is
|
# Exit code chooses option. "$$TMP" serves as a temporary file and is
|
||||||
# automatically cleaned up.
|
# automatically cleaned up.
|
||||||
try-run = $(shell set -e; \
|
__try-run = set -e; \
|
||||||
TMP="$(TMPOUT).$$$$.tmp"; \
|
TMP="$(TMPOUT).$$$$.tmp"; \
|
||||||
TMPO="$(TMPOUT).$$$$.o"; \
|
TMPO="$(TMPOUT).$$$$.o"; \
|
||||||
if ($(1)) >/dev/null 2>&1; \
|
if ($(1)) >/dev/null 2>&1; \
|
||||||
then echo "$(2)"; \
|
then echo "$(2)"; \
|
||||||
else echo "$(3)"; \
|
else echo "$(3)"; \
|
||||||
fi; \
|
fi; \
|
||||||
rm -f "$$TMP" "$$TMPO")
|
rm -f "$$TMP" "$$TMPO"
|
||||||
|
|
||||||
|
try-run = $(shell $(__try-run))
|
||||||
|
|
||||||
|
# try-run-cached
|
||||||
|
# This works like try-run, but the result is cached.
|
||||||
|
try-run-cached = $(call shell-cached,$(__try-run))
|
||||||
|
|
||||||
# as-option
|
# as-option
|
||||||
# Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,)
|
# Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,)
|
||||||
|
|
||||||
as-option = $(call try-run,\
|
as-option = $(call try-run-cached,\
|
||||||
$(CC) $(KBUILD_CFLAGS) $(1) -c -x assembler /dev/null -o "$$TMP",$(1),$(2))
|
$(CC) $(KBUILD_CFLAGS) $(1) -c -x assembler /dev/null -o "$$TMP",$(1),$(2))
|
||||||
|
|
||||||
# as-instr
|
# as-instr
|
||||||
# Usage: cflags-y += $(call as-instr,instr,option1,option2)
|
# Usage: cflags-y += $(call as-instr,instr,option1,option2)
|
||||||
|
|
||||||
as-instr = $(call try-run,\
|
as-instr = $(call try-run-cached,\
|
||||||
printf "%b\n" "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3))
|
printf "%b\n" "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3))
|
||||||
|
|
||||||
# __cc-option
|
# __cc-option
|
||||||
# Usage: MY_CFLAGS += $(call __cc-option,$(CC),$(MY_CFLAGS),-march=winchip-c6,-march=i586)
|
# Usage: MY_CFLAGS += $(call __cc-option,$(CC),$(MY_CFLAGS),-march=winchip-c6,-march=i586)
|
||||||
__cc-option = $(call try-run,\
|
__cc-option = $(call try-run-cached,\
|
||||||
$(1) -Werror $(2) $(3) -c -x c /dev/null -o "$$TMP",$(3),$(4))
|
$(1) -Werror $(2) $(3) -c -x c /dev/null -o "$$TMP",$(3),$(4))
|
||||||
|
|
||||||
# Do not attempt to build with gcc plugins during cc-option tests.
|
# Do not attempt to build with gcc plugins during cc-option tests.
|
||||||
@ -130,23 +203,23 @@ hostcc-option = $(call __cc-option, $(HOSTCC),\
|
|||||||
|
|
||||||
# cc-option-yn
|
# cc-option-yn
|
||||||
# Usage: flag := $(call cc-option-yn,-march=winchip-c6)
|
# Usage: flag := $(call cc-option-yn,-march=winchip-c6)
|
||||||
cc-option-yn = $(call try-run,\
|
cc-option-yn = $(call try-run-cached,\
|
||||||
$(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n)
|
$(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n)
|
||||||
|
|
||||||
# cc-disable-warning
|
# cc-disable-warning
|
||||||
# Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable)
|
# Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable)
|
||||||
cc-disable-warning = $(call try-run,\
|
cc-disable-warning = $(call try-run-cached,\
|
||||||
$(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
|
$(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
|
||||||
|
|
||||||
# cc-name
|
# cc-name
|
||||||
# Expands to either gcc or clang
|
# Expands to either gcc or clang
|
||||||
cc-name = $(shell $(CC) -v 2>&1 | grep -q "clang version" && echo clang || echo gcc)
|
cc-name = $(call shell-cached,$(CC) -v 2>&1 | grep -q "clang version" && echo clang || echo gcc)
|
||||||
|
|
||||||
# cc-version
|
# cc-version
|
||||||
cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC))
|
cc-version = $(call shell-cached,$(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC))
|
||||||
|
|
||||||
# cc-fullversion
|
# cc-fullversion
|
||||||
cc-fullversion = $(shell $(CONFIG_SHELL) \
|
cc-fullversion = $(call shell-cached,$(CONFIG_SHELL) \
|
||||||
$(srctree)/scripts/gcc-version.sh -p $(CC))
|
$(srctree)/scripts/gcc-version.sh -p $(CC))
|
||||||
|
|
||||||
# cc-ifversion
|
# cc-ifversion
|
||||||
@ -159,22 +232,23 @@ cc-if-fullversion = $(shell [ $(cc-fullversion) $(1) $(2) ] && echo $(3) || echo
|
|||||||
|
|
||||||
# cc-ldoption
|
# cc-ldoption
|
||||||
# Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both)
|
# Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both)
|
||||||
cc-ldoption = $(call try-run,\
|
cc-ldoption = $(call try-run-cached,\
|
||||||
$(CC) $(1) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2))
|
$(CC) $(1) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2))
|
||||||
|
|
||||||
# ld-option
|
# ld-option
|
||||||
# Usage: LDFLAGS += $(call ld-option, -X)
|
# Usage: LDFLAGS += $(call ld-option, -X)
|
||||||
ld-option = $(call try-run,\
|
ld-option = $(call try-run-cached,\
|
||||||
$(CC) -x c /dev/null -c -o "$$TMPO" ; $(LD) $(1) "$$TMPO" -o "$$TMP",$(1),$(2))
|
$(CC) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -x c /dev/null -c -o "$$TMPO"; \
|
||||||
|
$(LD) $(LDFLAGS) $(1) "$$TMPO" -o "$$TMP",$(1),$(2))
|
||||||
|
|
||||||
# ar-option
|
# ar-option
|
||||||
# Usage: KBUILD_ARFLAGS := $(call ar-option,D)
|
# Usage: KBUILD_ARFLAGS := $(call ar-option,D)
|
||||||
# Important: no spaces around options
|
# Important: no spaces around options
|
||||||
ar-option = $(call try-run, $(AR) rc$(1) "$$TMP",$(1),$(2))
|
ar-option = $(call try-run-cached, $(AR) rc$(1) "$$TMP",$(1),$(2))
|
||||||
|
|
||||||
# ld-version
|
# ld-version
|
||||||
# Note this is mainly for HJ Lu's 3 number binutil versions
|
# Note this is mainly for HJ Lu's 3 number binutil versions
|
||||||
ld-version = $(shell $(LD) --version | $(srctree)/scripts/ld-version.sh)
|
ld-version = $(call shell-cached,$(LD) --version | $(srctree)/scripts/ld-version.sh)
|
||||||
|
|
||||||
# ld-ifversion
|
# ld-ifversion
|
||||||
# Usage: $(call ld-ifversion, -ge, 22252, y)
|
# Usage: $(call ld-ifversion, -ge, 22252, y)
|
||||||
|
@ -6,6 +6,9 @@
|
|||||||
# and for each file listed in this file with generic-y creates
|
# and for each file listed in this file with generic-y creates
|
||||||
# a small wrapper file in $(obj) (arch/$(SRCARCH)/include/generated/$(src))
|
# a small wrapper file in $(obj) (arch/$(SRCARCH)/include/generated/$(src))
|
||||||
|
|
||||||
|
PHONY := all
|
||||||
|
all:
|
||||||
|
|
||||||
kbuild-file := $(srctree)/arch/$(SRCARCH)/include/$(src)/Kbuild
|
kbuild-file := $(srctree)/arch/$(SRCARCH)/include/$(src)/Kbuild
|
||||||
-include $(kbuild-file)
|
-include $(kbuild-file)
|
||||||
|
|
||||||
|
@ -65,15 +65,6 @@ ifneq ($(hostprogs-y)$(hostprogs-m)$(hostlibs-y)$(hostlibs-m)$(hostcxxlibs-y)$(h
|
|||||||
include scripts/Makefile.host
|
include scripts/Makefile.host
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(KBUILD_SRC),)
|
|
||||||
# Create output directory if not already present
|
|
||||||
_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj))
|
|
||||||
|
|
||||||
# Create directories for object files if directory does not exist
|
|
||||||
# Needed when obj-y := dir/file.o syntax is used
|
|
||||||
_dummy := $(foreach d,$(obj-dirs), $(shell [ -d $(d) ] || mkdir -p $(d)))
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef obj
|
ifndef obj
|
||||||
$(warning kbuild: Makefile.build is included improperly)
|
$(warning kbuild: Makefile.build is included improperly)
|
||||||
endif
|
endif
|
||||||
@ -563,7 +554,7 @@ $(multi-used-m): FORCE
|
|||||||
$(call multi_depend, $(multi-used-m), .o, -objs -y -m)
|
$(call multi_depend, $(multi-used-m), .o, -objs -y -m)
|
||||||
|
|
||||||
targets += $(multi-used-y) $(multi-used-m)
|
targets += $(multi-used-y) $(multi-used-m)
|
||||||
|
targets := $(filter-out $(PHONY), $(targets))
|
||||||
|
|
||||||
# Descending
|
# Descending
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
@ -584,13 +575,23 @@ FORCE:
|
|||||||
# optimization, we don't need to read them if the target does not
|
# optimization, we don't need to read them if the target does not
|
||||||
# exist, we will rebuild anyway in that case.
|
# exist, we will rebuild anyway in that case.
|
||||||
|
|
||||||
targets := $(wildcard $(sort $(targets)))
|
cmd_files := $(wildcard $(foreach f,$(sort $(targets)),$(dir $(f)).$(notdir $(f)).cmd))
|
||||||
cmd_files := $(wildcard $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd))
|
|
||||||
|
|
||||||
ifneq ($(cmd_files),)
|
ifneq ($(cmd_files),)
|
||||||
include $(cmd_files)
|
include $(cmd_files)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifneq ($(KBUILD_SRC),)
|
||||||
|
# Create directories for object files if they do not exist
|
||||||
|
obj-dirs := $(sort $(obj) $(patsubst %/,%, $(dir $(targets))))
|
||||||
|
# If cmd_files exist, their directories apparently exist. Skip mkdir.
|
||||||
|
exist-dirs := $(sort $(patsubst %/,%, $(dir $(cmd_files))))
|
||||||
|
obj-dirs := $(strip $(filter-out $(exist-dirs), $(obj-dirs)))
|
||||||
|
ifneq ($(obj-dirs),)
|
||||||
|
$(shell mkdir -p $(obj-dirs))
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
# Declare the contents of the .PHONY variable as phony. We keep that
|
# Declare the contents of the .PHONY variable as phony. We keep that
|
||||||
# information in a variable se we can use it in if_changed and friends.
|
# information in a variable se we can use it in if_changed and friends.
|
||||||
|
|
||||||
|
@ -27,11 +27,11 @@ subdirs := $(patsubst $(srcdir)/%/,%,\
|
|||||||
# Recursion
|
# Recursion
|
||||||
__headers: $(subdirs)
|
__headers: $(subdirs)
|
||||||
|
|
||||||
.PHONY: $(subdirs)
|
PHONY += $(subdirs)
|
||||||
$(subdirs):
|
$(subdirs):
|
||||||
$(Q)$(MAKE) $(hdr-inst)=$(obj)/$@ dst=$(dst)/$@
|
$(Q)$(MAKE) $(hdr-inst)=$(obj)/$@ dst=$(dst)/$@
|
||||||
|
|
||||||
# Skip header install/check for include/uapi and arch/$(hdr-arch)/include/uapi.
|
# Skip header install/check for include/uapi and arch/$(SRCARCH)/include/uapi.
|
||||||
# We have only sub-directories there.
|
# We have only sub-directories there.
|
||||||
skip-inst := $(if $(filter %/uapi,$(obj)),1)
|
skip-inst := $(if $(filter %/uapi,$(obj)),1)
|
||||||
|
|
||||||
@ -115,9 +115,8 @@ $(check-file): scripts/headers_check.pl $(output-files) FORCE
|
|||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
targets := $(wildcard $(sort $(targets)))
|
|
||||||
cmd_files := $(wildcard \
|
cmd_files := $(wildcard \
|
||||||
$(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd))
|
$(foreach f,$(sort $(targets)),$(dir $(f)).$(notdir $(f)).cmd))
|
||||||
|
|
||||||
ifneq ($(cmd_files),)
|
ifneq ($(cmd_files),)
|
||||||
include $(cmd_files)
|
include $(cmd_files)
|
||||||
@ -125,6 +124,7 @@ endif
|
|||||||
|
|
||||||
endif # skip-inst
|
endif # skip-inst
|
||||||
|
|
||||||
.PHONY: $(PHONY)
|
|
||||||
PHONY += FORCE
|
PHONY += FORCE
|
||||||
FORCE: ;
|
FORCE: ;
|
||||||
|
|
||||||
|
.PHONY: $(PHONY)
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
|
|
||||||
checker-help:
|
|
||||||
@echo ' coccicheck - Check with Coccinelle.'
|
|
@ -49,15 +49,6 @@ host-cxxobjs := $(sort $(foreach m,$(host-cxxmulti),$($(m)-cxxobjs)))
|
|||||||
host-cshobjs := $(sort $(foreach m,$(host-cshlib),$($(m:.so=-objs))))
|
host-cshobjs := $(sort $(foreach m,$(host-cshlib),$($(m:.so=-objs))))
|
||||||
host-cxxshobjs := $(sort $(foreach m,$(host-cxxshlib),$($(m:.so=-objs))))
|
host-cxxshobjs := $(sort $(foreach m,$(host-cxxshlib),$($(m:.so=-objs))))
|
||||||
|
|
||||||
# output directory for programs/.o files
|
|
||||||
# hostprogs-y := tools/build may have been specified.
|
|
||||||
# Retrieve also directory of .o files from prog-objs or prog-cxxobjs notation
|
|
||||||
host-objdirs := $(dir $(__hostprogs) $(host-cobjs) $(host-cxxobjs))
|
|
||||||
|
|
||||||
host-objdirs := $(strip $(sort $(filter-out ./,$(host-objdirs))))
|
|
||||||
|
|
||||||
|
|
||||||
__hostprogs := $(addprefix $(obj)/,$(__hostprogs))
|
|
||||||
host-csingle := $(addprefix $(obj)/,$(host-csingle))
|
host-csingle := $(addprefix $(obj)/,$(host-csingle))
|
||||||
host-cmulti := $(addprefix $(obj)/,$(host-cmulti))
|
host-cmulti := $(addprefix $(obj)/,$(host-cmulti))
|
||||||
host-cobjs := $(addprefix $(obj)/,$(host-cobjs))
|
host-cobjs := $(addprefix $(obj)/,$(host-cobjs))
|
||||||
@ -67,9 +58,6 @@ host-cshlib := $(addprefix $(obj)/,$(host-cshlib))
|
|||||||
host-cxxshlib := $(addprefix $(obj)/,$(host-cxxshlib))
|
host-cxxshlib := $(addprefix $(obj)/,$(host-cxxshlib))
|
||||||
host-cshobjs := $(addprefix $(obj)/,$(host-cshobjs))
|
host-cshobjs := $(addprefix $(obj)/,$(host-cshobjs))
|
||||||
host-cxxshobjs := $(addprefix $(obj)/,$(host-cxxshobjs))
|
host-cxxshobjs := $(addprefix $(obj)/,$(host-cxxshobjs))
|
||||||
host-objdirs := $(addprefix $(obj)/,$(host-objdirs))
|
|
||||||
|
|
||||||
obj-dirs += $(host-objdirs)
|
|
||||||
|
|
||||||
#####
|
#####
|
||||||
# Handle options to gcc. Support building with separate output directory
|
# Handle options to gcc. Support building with separate output directory
|
||||||
|
@ -5,24 +5,25 @@ ccflags-y += $(EXTRA_CFLAGS)
|
|||||||
cppflags-y += $(EXTRA_CPPFLAGS)
|
cppflags-y += $(EXTRA_CPPFLAGS)
|
||||||
ldflags-y += $(EXTRA_LDFLAGS)
|
ldflags-y += $(EXTRA_LDFLAGS)
|
||||||
|
|
||||||
#
|
# flags that take effect in current and sub directories
|
||||||
# flags that take effect in sub directories
|
KBUILD_AFLAGS += $(subdir-asflags-y)
|
||||||
export KBUILD_SUBDIR_ASFLAGS := $(KBUILD_SUBDIR_ASFLAGS) $(subdir-asflags-y)
|
KBUILD_CFLAGS += $(subdir-ccflags-y)
|
||||||
export KBUILD_SUBDIR_CCFLAGS := $(KBUILD_SUBDIR_CCFLAGS) $(subdir-ccflags-y)
|
|
||||||
|
|
||||||
# Figure out what we need to build from the various variables
|
# Figure out what we need to build from the various variables
|
||||||
# ===========================================================================
|
# ===========================================================================
|
||||||
|
|
||||||
# When an object is listed to be built compiled-in and modular,
|
# When an object is listed to be built compiled-in and modular,
|
||||||
# only build the compiled-in version
|
# only build the compiled-in version
|
||||||
|
|
||||||
obj-m := $(filter-out $(obj-y),$(obj-m))
|
obj-m := $(filter-out $(obj-y),$(obj-m))
|
||||||
|
|
||||||
# Libraries are always collected in one lib file.
|
# Libraries are always collected in one lib file.
|
||||||
# Filter out objects already built-in
|
# Filter out objects already built-in
|
||||||
|
|
||||||
lib-y := $(filter-out $(obj-y), $(sort $(lib-y) $(lib-m)))
|
lib-y := $(filter-out $(obj-y), $(sort $(lib-y) $(lib-m)))
|
||||||
|
|
||||||
|
# Determine modorder.
|
||||||
|
# Unfortunately, we don't have information about ordering between -y
|
||||||
|
# and -m subdirs. Just put -y's first.
|
||||||
|
modorder := $(patsubst %/,%/modules.order, $(filter %/, $(obj-y)) $(obj-m:.o=.ko))
|
||||||
|
|
||||||
# Handle objects in subdirs
|
# Handle objects in subdirs
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
@ -30,12 +31,6 @@ lib-y := $(filter-out $(obj-y), $(sort $(lib-y) $(lib-m)))
|
|||||||
# and add the directory to the list of dirs to descend into: $(subdir-y)
|
# and add the directory to the list of dirs to descend into: $(subdir-y)
|
||||||
# o if we encounter foo/ in $(obj-m), remove it from $(obj-m)
|
# o if we encounter foo/ in $(obj-m), remove it from $(obj-m)
|
||||||
# and add the directory to the list of dirs to descend into: $(subdir-m)
|
# and add the directory to the list of dirs to descend into: $(subdir-m)
|
||||||
|
|
||||||
# Determine modorder.
|
|
||||||
# Unfortunately, we don't have information about ordering between -y
|
|
||||||
# and -m subdirs. Just put -y's first.
|
|
||||||
modorder := $(patsubst %/,%/modules.order, $(filter %/, $(obj-y)) $(obj-m:.o=.ko))
|
|
||||||
|
|
||||||
__subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y)))
|
__subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y)))
|
||||||
subdir-y += $(__subdir-y)
|
subdir-y += $(__subdir-y)
|
||||||
__subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m)))
|
__subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m)))
|
||||||
@ -44,10 +39,9 @@ obj-y := $(patsubst %/, %/built-in.o, $(obj-y))
|
|||||||
obj-m := $(filter-out %/, $(obj-m))
|
obj-m := $(filter-out %/, $(obj-m))
|
||||||
|
|
||||||
# Subdirectories we need to descend into
|
# Subdirectories we need to descend into
|
||||||
|
|
||||||
subdir-ym := $(sort $(subdir-y) $(subdir-m))
|
subdir-ym := $(sort $(subdir-y) $(subdir-m))
|
||||||
|
|
||||||
# if $(foo-objs) exists, foo.o is a composite object
|
# if $(foo-objs), $(foo-y), or $(foo-m) exists, foo.o is a composite object
|
||||||
multi-used-y := $(sort $(foreach m,$(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m))))
|
multi-used-y := $(sort $(foreach m,$(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m))))
|
||||||
multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))), $(m))))
|
multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))), $(m))))
|
||||||
multi-used := $(multi-used-y) $(multi-used-m)
|
multi-used := $(multi-used-y) $(multi-used-m)
|
||||||
@ -57,15 +51,11 @@ single-used-m := $(sort $(filter-out $(multi-used-m),$(obj-m)))
|
|||||||
# objects depend on those (obviously)
|
# objects depend on those (obviously)
|
||||||
multi-objs-y := $(foreach m, $(multi-used-y), $($(m:.o=-objs)) $($(m:.o=-y)))
|
multi-objs-y := $(foreach m, $(multi-used-y), $($(m:.o=-objs)) $($(m:.o=-y)))
|
||||||
multi-objs-m := $(foreach m, $(multi-used-m), $($(m:.o=-objs)) $($(m:.o=-y)))
|
multi-objs-m := $(foreach m, $(multi-used-m), $($(m:.o=-objs)) $($(m:.o=-y)))
|
||||||
multi-objs := $(multi-objs-y) $(multi-objs-m)
|
|
||||||
|
|
||||||
# $(subdir-obj-y) is the list of objects in $(obj-y) which uses dir/ to
|
# $(subdir-obj-y) is the list of objects in $(obj-y) which uses dir/ to
|
||||||
# tell kbuild to descend
|
# tell kbuild to descend
|
||||||
subdir-obj-y := $(filter %/built-in.o, $(obj-y))
|
subdir-obj-y := $(filter %/built-in.o, $(obj-y))
|
||||||
|
|
||||||
# $(obj-dirs) is a list of directories that contain object files
|
|
||||||
obj-dirs := $(dir $(multi-objs) $(obj-y))
|
|
||||||
|
|
||||||
# Replace multi-part objects by their individual parts, look at local dir only
|
# Replace multi-part objects by their individual parts, look at local dir only
|
||||||
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)
|
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)
|
||||||
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)))
|
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))
|
|||||||
multi-objs-y := $(addprefix $(obj)/,$(multi-objs-y))
|
multi-objs-y := $(addprefix $(obj)/,$(multi-objs-y))
|
||||||
multi-objs-m := $(addprefix $(obj)/,$(multi-objs-m))
|
multi-objs-m := $(addprefix $(obj)/,$(multi-objs-m))
|
||||||
subdir-ym := $(addprefix $(obj)/,$(subdir-ym))
|
subdir-ym := $(addprefix $(obj)/,$(subdir-ym))
|
||||||
obj-dirs := $(addprefix $(obj)/,$(obj-dirs))
|
|
||||||
|
|
||||||
# These flags are needed for modversions and compiling, so we define them here
|
# These flags are needed for modversions and compiling, so we define them here
|
||||||
# already
|
# $(modname_flags) defines KBUILD_MODNAME as the name of the module it will
|
||||||
# $(modname_flags) #defines KBUILD_MODNAME as the name of the module it will
|
|
||||||
# end up in (or would, if it gets compiled in)
|
# end up in (or would, if it gets compiled in)
|
||||||
# Note: Files that end up in two or more modules are compiled without the
|
# Note: Files that end up in two or more modules are compiled without the
|
||||||
# KBUILD_MODNAME definition. The reason is that any made-up name would
|
# KBUILD_MODNAME definition. The reason is that any made-up name would
|
||||||
@ -107,10 +95,10 @@ basename_flags = -DKBUILD_BASENAME=$(call name-fix,$(basetarget))
|
|||||||
modname_flags = $(if $(filter 1,$(words $(modname))),\
|
modname_flags = $(if $(filter 1,$(words $(modname))),\
|
||||||
-DKBUILD_MODNAME=$(call name-fix,$(modname)))
|
-DKBUILD_MODNAME=$(call name-fix,$(modname)))
|
||||||
|
|
||||||
orig_c_flags = $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(KBUILD_SUBDIR_CCFLAGS) \
|
orig_c_flags = $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \
|
||||||
$(ccflags-y) $(CFLAGS_$(basetarget).o)
|
$(ccflags-y) $(CFLAGS_$(basetarget).o)
|
||||||
_c_flags = $(filter-out $(CFLAGS_REMOVE_$(basetarget).o), $(orig_c_flags))
|
_c_flags = $(filter-out $(CFLAGS_REMOVE_$(basetarget).o), $(orig_c_flags))
|
||||||
orig_a_flags = $(KBUILD_CPPFLAGS) $(KBUILD_AFLAGS) $(KBUILD_SUBDIR_ASFLAGS) \
|
orig_a_flags = $(KBUILD_CPPFLAGS) $(KBUILD_AFLAGS) \
|
||||||
$(asflags-y) $(AFLAGS_$(basetarget).o)
|
$(asflags-y) $(AFLAGS_$(basetarget).o)
|
||||||
_a_flags = $(filter-out $(AFLAGS_REMOVE_$(basetarget).o), $(orig_a_flags))
|
_a_flags = $(filter-out $(AFLAGS_REMOVE_$(basetarget).o), $(orig_a_flags))
|
||||||
_cpp_flags = $(KBUILD_CPPFLAGS) $(cppflags-y) $(CPPFLAGS_$(@F))
|
_cpp_flags = $(KBUILD_CPPFLAGS) $(cppflags-y) $(CPPFLAGS_$(@F))
|
||||||
|
@ -143,8 +143,7 @@ FORCE:
|
|||||||
# optimization, we don't need to read them if the target does not
|
# optimization, we don't need to read them if the target does not
|
||||||
# exist, we will rebuild anyway in that case.
|
# exist, we will rebuild anyway in that case.
|
||||||
|
|
||||||
targets := $(wildcard $(sort $(targets)))
|
cmd_files := $(wildcard $(foreach f,$(sort $(targets)),$(dir $(f)).$(notdir $(f)).cmd))
|
||||||
cmd_files := $(wildcard $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd))
|
|
||||||
|
|
||||||
ifneq ($(cmd_files),)
|
ifneq ($(cmd_files),)
|
||||||
include $(cmd_files)
|
include $(cmd_files)
|
||||||
|
@ -188,10 +188,8 @@ sortextable()
|
|||||||
# Delete output files in case of error
|
# Delete output files in case of error
|
||||||
cleanup()
|
cleanup()
|
||||||
{
|
{
|
||||||
rm -f .old_version
|
|
||||||
rm -f .tmp_System.map
|
rm -f .tmp_System.map
|
||||||
rm -f .tmp_kallsyms*
|
rm -f .tmp_kallsyms*
|
||||||
rm -f .tmp_version
|
|
||||||
rm -f .tmp_vmlinux*
|
rm -f .tmp_vmlinux*
|
||||||
rm -f built-in.o
|
rm -f built-in.o
|
||||||
rm -f System.map
|
rm -f System.map
|
||||||
@ -239,12 +237,12 @@ esac
|
|||||||
|
|
||||||
# Update version
|
# Update version
|
||||||
info GEN .version
|
info GEN .version
|
||||||
if [ ! -r .version ]; then
|
if [ -r .version ]; then
|
||||||
rm -f .version;
|
VERSION=$(expr 0$(cat .version) + 1)
|
||||||
echo 1 >.version;
|
echo $VERSION > .version
|
||||||
else
|
else
|
||||||
mv .version .old_version;
|
rm -f .version
|
||||||
expr 0$(cat .old_version) + 1 >.version;
|
echo 1 > .version
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
# final build of init/
|
# final build of init/
|
||||||
@ -332,6 +330,3 @@ if [ -n "${CONFIG_KALLSYMS}" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# We made a new kernel - delete old version file
|
|
||||||
rm -f .old_version
|
|
||||||
|
@ -28,12 +28,7 @@ LC_ALL=C
|
|||||||
export LC_ALL
|
export LC_ALL
|
||||||
|
|
||||||
if [ -z "$KBUILD_BUILD_VERSION" ]; then
|
if [ -z "$KBUILD_BUILD_VERSION" ]; then
|
||||||
if [ -r .version ]; then
|
VERSION=$(cat .version 2>/dev/null || echo 1)
|
||||||
VERSION=`cat .version`
|
|
||||||
else
|
|
||||||
VERSION=0
|
|
||||||
echo 0 > .version
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
VERSION=$KBUILD_BUILD_VERSION
|
VERSION=$KBUILD_BUILD_VERSION
|
||||||
fi
|
fi
|
||||||
|
@ -1,2 +1 @@
|
|||||||
subdir-y := mdp genheaders
|
subdir-y := mdp genheaders
|
||||||
subdir- += mdp genheaders
|
|
||||||
|
Loading…
Reference in New Issue
Block a user