c - obj-y += something/in linux kernel Makefile 是什么意思?

标签 c linux makefile linux-kernel

我明白了

的意思
obj-$(CONFIG_USB)       += usb.o

如果 CONFIG_USB 是 y 那么 usb.o 将被编译。那么现在如何理解这个

obj-y               += something/

最佳答案

内核 Makefile 是 kbuild 系统的一部分,记录在网络上的各个地方,例如 http://lwn.net/Articles/21835/ .相关摘录在这里:

--- 3.1 Goal definitions

Goal definitions are the main part (heart) of the kbuild Makefile. These lines define the files to be built, any special compilation options, and any subdirectories to be entered recursively.

The most simple kbuild makefile contains one line:

Example: obj-y += foo.o

This tell kbuild that there is one object in that directory named foo.o. foo.o will be build from foo.c or foo.S.

If foo.o shall be built as a module, the variable obj-m is used. Therefore the following pattern is often used:

Example: obj-$(CONFIG_FOO) += foo.o

$(CONFIG_FOO) evaluates to either y (for built-in) or m (for module). If CONFIG_FOO is neither y nor m, then the file will not be compiled nor linked.

所以 m 表示模块,y 表示内置(在内核配置过程中代表是),$(CONFIG_FOO) 从正常中提取正确答案配置过程。

关于c - obj-y += something/in linux kernel Makefile 是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10949986/

相关文章:

linux - Makefile 和符号链接(symbolic link)

c - 查找数组中元素的最大总和的算法,使得不超过 k 个元素相邻

c - 将 char 变量类型转换为 unsigned int

linux - Bash,按值引用数组?

linux - 如何从 ps aux 列出每个进程,如果它们重复,请保持运行计数和格式

linux - 如何将构建的目标从构建目录复制到父目录?

makefile - 怎么办 "make <subdir> <target>"?

c++ - 将文件添加到 GNU 依赖列表?

c - Go:导入和 C 库之间的类型冲突

c - 将 tcl.h 包含到 C 项目中