问题描述
在一个生成文件中,我找到了如下代码段. create_file和run_debug有什么区别?我的意思是使用. (点)在create_file引入任何类似PHONY的功能之前?
In a make file i found the code snip like below. Is there any difference between create_file and run_debug ? i mean the use of . (dot) before create_file introduce any functionality like PHONY?
all:debug run_debug
setup: .create_file
.create_file:
cd /home/user1
touch file.txt
run_debug:
@echo Building debug
cd /home/user1/debug
推荐答案
据我所知,它仅具有一个目的(在此makefile中,makefile的构造避免了该目的).
As far as I know it has only one purpose (and in this makefile that purpose is obviated by the makefile construction).
来自 make
如何处理Makefile :
From How make
Processes a Makefile:
因此,领先的.
意味着make不会将该目标视为有效的默认目标.
So a leading .
means that make will not consider that target as a valid default goal.
但是,正如所写的那样,all
目标是此makefile中的第一个目标,因此它将是默认目标,因此此处的前导点实际上不会执行任何操作.
But, as written, the all
target is the first target in this makefile so that will be the default goal so the leading dot here doesn't actually do anything.
这表示setup
,run_debug
和.create_file
这三个目标均应标记为.PHONY
,并且可能具有更好的写入方式等.
That said all three of the setup
, run_debug
and .create_file
targets should be marked as .PHONY
and may have much better ways of being written/etc.
这篇关于的意思是什么. (点)在makefile中的目标之前的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!