首页 新闻 会员 周边

makefile 的部分命令寻求解释

0
悬赏园豆:20 [已解决问题] 解决于 2020-03-31 21:10

# cc compile template, generate rule for dep, obj: (file, cc[, flags, dir])
define cc_template

# todep 的作用是生成对应的.d 文件 :后面的 $(1) | $$$$(dir $$$$@)如何解释,特别是这个 | ??

$$(call todep,$(1),$(4)): $(1) | $$$$(dir $$$$@)
@$(2) -I$$(dir $(1)) $(3) -MM $$< -MT "$$(patsubst %.d,%.o,$$@) $$@"> $$@
$$(call toobj,$(1),$(4)): $(1) | $$$$(dir $$$$@)
@echo + cc $$<
$(V)$(2) -I$$(dir $(1)) $(3) -c $$< -o $$@
ALLOBJS += $$(call toobj,$(1),$(4))
endef

todep 的作用是生成对应的.d 文件 :后面的 $(1) | $$$$(dir $$$$@)如何解释??

山貓先森的主页 山貓先森 | 初学一级 | 园豆:186
提问于:2020-02-17 15:28
< >
分享
最佳答案
0

建议看手册,搜索一下

Because dollar signs are used to start make variable references, if you really want a dollar sign in a target or prerequisite you must write two of them, ‘$$’ (see How to Use Variables). If you have enabled secondary expansion (see Secondary Expansion) and you want a literal dollar sign in the prerequisites list, you must actually write four dollar signs (‘$$$$’).
收获园豆:20
jakio6 | 小虾三级 |园豆:1318 | 2020-02-17 21:21

|后面的是叫做order-only的依赖,就是只要求其存在,而不要求target要比它新(一般是目录什么的)

jakio6 | 园豆:1318 (小虾三级) | 2020-02-17 21:53
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册