make參數(shù)傳遞
參數(shù)-C
# We process the rest of the Makefile if this is the final invocation of make
ifeq ($(skip-makefile),)
# Do not print "Entering directory ...",
# but we want to display it when entering to the output directory
# so that IDEs/editors are able to understand relative filenames.
MAKEFLAGS += --no-print-directory
# Call a source code checker (by default, "sparse") as part of the
# C compilation.
#
# Use 'make C=1' to enable checking of only re-compiled files.
# Use 'make C=2' to enable checking of *all* source files, regardless
# of whether they are re-compiled or not.
#
# See the file "Documentation/sparse.txt" for more details, including
# where to get the "sparse" utility.
ifeq ("$(origin C)", "command line")
KBUILD_CHECKSRC = $(C)
endif
ifndef KBUILD_CHECKSRC
KBUILD_CHECKSRC = 0
endif
首先檢查了skip-makefile 蹦肴,這個變量在配置選項O的時候設(shè)置為1
然后ifeq語句會檢查傳遞給make的選項C
參數(shù) -M
用來編譯外部模塊
# Use make M=dir to specify directory of external module to build
# Old syntax make ... SUBDIRS=$PWD is still supported
# Setting the environment variable KBUILD_EXTMOD take precedence
ifdef SUBDIRS
KBUILD_EXTMOD ?= $(SUBDIRS)
endif
ifeq ("$(origin M)", "command line")
KBUILD_EXTMOD := $(M)
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
設(shè)置objtree
OBJTREE:編譯出的.o文件存放的目錄的根目錄;
在默認(rèn)編譯下猴娩,OBJTREE等于當(dāng)前目錄阴幌;
在O=xx編譯下,OBJTREE就等于我們設(shè)置的那個輸出目錄卷中。
SRCTREE: 源碼目錄矛双,其實就是源代碼的根目錄,也就是當(dāng)前目錄蟆豫。
ifeq ($(KBUILD_SRC),)
# building in the source tree
srctree := .
else
ifeq ($(KBUILD_SRC)/,$(dir $(CURDIR)))
# building in a subdirectory of the source tree
srctree := ..
else
srctree := $(KBUILD_SRC)
endif
endif
objtree := .
src := $(srctree)
obj := $(objtree)
VPATH := $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD))
export srctree objtree VPATH
系統(tǒng)檢查了變量KBUILD_SRC 议忽,如果KBUILD_SRC 未設(shè)置,系統(tǒng)會設(shè)置變量srctree為當(dāng)前目錄十减。
設(shè)置objtree和其他變量為這個目錄栈幸,并且將這些變量導(dǎo)出