aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.m@jp.panasonic.com>2014-09-09 07:02:24 -0400
committerMichal Marek <mmarek@suse.cz>2014-10-01 16:44:21 -0400
commitaa55c8e2f7a395dfc9e67fc6637321e19ce9bfe1 (patch)
tree23fc4ca0d100904325701042b95ec406802e7daa /Makefile
parent745a254322c898dadf019342cd7140f7867d2d0f (diff)
kbuild: handle C=... and M=... after entering into build directory
This commit avoids processing C=... and M=... twice when O=... is also given. Besides, we can also remove KBUILD_EXTMOD="$(KBUILD_EXTMOD)" in the sub-make target. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Acked-by: Peter Foley <pefoley2@pefoley.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile60
1 files changed, 29 insertions, 31 deletions
diff --git a/Makefile b/Makefile
index edc1269ee24c..367239053684 100644
--- a/Makefile
+++ b/Makefile
@@ -95,34 +95,6 @@ endif
95 95
96export quiet Q KBUILD_VERBOSE 96export quiet Q KBUILD_VERBOSE
97 97
98# Call a source code checker (by default, "sparse") as part of the
99# C compilation.
100#
101# Use 'make C=1' to enable checking of only re-compiled files.
102# Use 'make C=2' to enable checking of *all* source files, regardless
103# of whether they are re-compiled or not.
104#
105# See the file "Documentation/sparse.txt" for more details, including
106# where to get the "sparse" utility.
107
108ifeq ("$(origin C)", "command line")
109 KBUILD_CHECKSRC = $(C)
110endif
111ifndef KBUILD_CHECKSRC
112 KBUILD_CHECKSRC = 0
113endif
114
115# Use make M=dir to specify directory of external module to build
116# Old syntax make ... SUBDIRS=$PWD is still supported
117# Setting the environment variable KBUILD_EXTMOD take precedence
118ifdef SUBDIRS
119 KBUILD_EXTMOD ?= $(SUBDIRS)
120endif
121
122ifeq ("$(origin M)", "command line")
123 KBUILD_EXTMOD := $(M)
124endif
125
126# kbuild supports saving output files in a separate directory. 98# kbuild supports saving output files in a separate directory.
127# To locate output files in a separate directory two syntaxes are supported. 99# To locate output files in a separate directory two syntaxes are supported.
128# In both cases the working directory must be the root of the kernel src. 100# In both cases the working directory must be the root of the kernel src.
@@ -138,7 +110,6 @@ endif
138# The O= assignment takes precedence over the KBUILD_OUTPUT environment 110# The O= assignment takes precedence over the KBUILD_OUTPUT environment
139# variable. 111# variable.
140 112
141
142# KBUILD_SRC is set on invocation of make in OBJ directory 113# KBUILD_SRC is set on invocation of make in OBJ directory
143# KBUILD_SRC is not intended to be used by the regular user (for now) 114# KBUILD_SRC is not intended to be used by the regular user (for now)
144ifeq ($(KBUILD_SRC),) 115ifeq ($(KBUILD_SRC),)
@@ -172,8 +143,7 @@ $(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make
172 143
173sub-make: FORCE 144sub-make: FORCE
174 $(Q)$(MAKE) -C $(KBUILD_OUTPUT) KBUILD_SRC=$(CURDIR) \ 145 $(Q)$(MAKE) -C $(KBUILD_OUTPUT) KBUILD_SRC=$(CURDIR) \
175 KBUILD_EXTMOD="$(KBUILD_EXTMOD)" -f $(CURDIR)/Makefile \ 146 -f $(CURDIR)/Makefile $(filter-out _all sub-make,$(MAKECMDGOALS))
176 $(filter-out _all sub-make,$(MAKECMDGOALS))
177 147
178# Leave processing to above invocation of make 148# Leave processing to above invocation of make
179skip-makefile := 1 149skip-makefile := 1
@@ -188,6 +158,34 @@ ifeq ($(skip-makefile),)
188# so that IDEs/editors are able to understand relative filenames. 158# so that IDEs/editors are able to understand relative filenames.
189MAKEFLAGS += --no-print-directory 159MAKEFLAGS += --no-print-directory
190 160
161# Call a source code checker (by default, "sparse") as part of the
162# C compilation.
163#
164# Use 'make C=1' to enable checking of only re-compiled files.
165# Use 'make C=2' to enable checking of *all* source files, regardless
166# of whether they are re-compiled or not.
167#
168# See the file "Documentation/sparse.txt" for more details, including
169# where to get the "sparse" utility.
170
171ifeq ("$(origin C)", "command line")
172 KBUILD_CHECKSRC = $(C)
173endif
174ifndef KBUILD_CHECKSRC
175 KBUILD_CHECKSRC = 0
176endif
177
178# Use make M=dir to specify directory of external module to build
179# Old syntax make ... SUBDIRS=$PWD is still supported
180# Setting the environment variable KBUILD_EXTMOD take precedence
181ifdef SUBDIRS
182 KBUILD_EXTMOD ?= $(SUBDIRS)
183endif
184
185ifeq ("$(origin M)", "command line")
186 KBUILD_EXTMOD := $(M)
187endif
188
191# If building an external module we do not care about the all: rule 189# If building an external module we do not care about the all: rule
192# but instead _all depend on modules 190# but instead _all depend on modules
193PHONY += all 191PHONY += all