下面了解一下 Linux内核的 顶层 Makefile前期所做的工作。
16 MAKEFLAGS += -rR --include-dir=$(CURDIR)
- 69 ifeq ("$(origin V)", "command line")
- 70 KBUILD_VERBOSE = $(V)
- 71 endif
- 72 ifndef KBUILD_VERBOSE
- 73 KBUILD_VERBOSE = 0
- 74 endif
- 75
- 76 ifeq ($(KBUILD_VERBOSE),1)
- 77 quiet =
- 78 Q =
- 79 else
- 80 quiet=quiet_
- 81 Q = @
- 82 endif
Linux 编译的时候使用“make -s”就可实现静默编译,编译的时候就不会打印任何的信息, 同 uboot 一样,相关代码如下:
- 87 ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4
- 88 ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),)
- 89 quiet=silent_
- 90 endif
- 91 else # make-3.8x
- 92 ifneq ($(filter s% -s%,$(MAKEFLAGS)),)
- 93 quiet=silent_
- 94 endif
- 95 endif
- 96
- 97 export quiet Q KBUILD_VERBOSE
- 116 ifeq ($(KBUILD_SRC),)
- 117
- 118 # OK, Make called in directory where kernel src resides
- 119 # Do we want to locate output files in a separate directory?
- 120 ifeq ("$(origin O)", "command line")
- 121 KBUILD_OUTPUT := $(O)
- 122 endif
- 172 ifeq ("$(origin C)", "command line")
- 173 KBUILD_CHECKSRC = $(C)
- 174 endif
- 175 ifndef KBUILD_CHECKSRC
- 176 KBUILD_CHECKSRC = 0
- 177 endif