gpt4 book ai didi

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

转载 作者:IT王子 更新时间:2023-10-29 00:17:14 24 4
gpt4 key购买 nike

我明白了

的意思
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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com