关于Makefile的一些问题
Some questions on Makefile
我正在尝试理解uboot的二级makefile(这个makefile在子目录中)
a) What is the difference between $(COBJS:.o=.c) and COBJS := test_main.o
b) What is the meaning of $(call cmd_link_o_target, $(OBJS)). What is the cmd_link_o_target and what is the call statement doing
c) Does this line creating 2 targets ?
ALL := $(obj).depend $(LIB)
====
==========================================================include $(TOPDIR)/config.mk
LIB = $(obj)libtest.o
SOBJS := test.o
COBJS := test_main.o
COBJS += diagnostic.o
SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS))
ALL := $(obj).depend $(LIB)
all: $(ALL)
$(LIB): $(OBJS)
$(call cmd_link_o_target, $(OBJS))
#########################################################################
# defines $(obj).depend target
include $(SRCTREE)/rules.mk
sinclude $(obj).depend
#########################################################################
a) $(COBJS:.o=.c)
对COBJ
的每个元素执行后缀替换,在这种情况下等效于使用SRCS := test.S test_main.c
b) $(call cmd_link_o_target, $(OBJS))
是一种在 make 中创建参数函数的方法。它将采用表达式作为cmd_link_o_target
(包含在包含的文件中),并将每次出现的$(1)
替换为进一步扩展$(OBJS)
。
c) 是的,它确实如此(obj
也包含在 Makefile 包含的文件中)。
如果您想知道,=
赋值和:=
赋值之间的区别在于=
允许递归替换,而:=
是静态的,即只扩展一次,而不创建对其他变量的引用。
相关文章:
- 在 Makefile 中的链接过程中添加库时出现问题
- 构建Makefile的问题
- C++ & Gtkmm 的 Makefile 问题
- "Recursive Makefile Considered Harmful"样式生成文件问题
- 使用makefile编译C++项目时出现问题
- Makefile问题将Zeromq Libs链接在Linux上
- 对的未定义引用带有继承,makefile问题
- 关于Makefile的一些问题
- 类模板的Makefile问题:clang警告链接器输入未使用
- 一个文件Makefile问题:C++
- 关于我的简单Makefile的问题
- 在Linux中执行C++makefile时出现问题(在mac上运行良好)
- C++与Fortran混合程序的Makefile编译问题
- 需要解决在Storm数据程序中读取Makefile的问题
- 我的简单g++ Makefile有什么问题?
- Ardrone SDK中的外部Makefile问题
- makefile编译问题
- 我的makefile有什么问题?无法实现
- 在Code::Blocks (custom makefile)中启用符号的问题
- 用Xcode编写c++项目的Makefile有问题