的意思是什么. (点)在makefile中的目标之前 [英] what is the meaning for . (dot) before the target in makefile

查看:313
本文介绍了的意思是什么. (点)在makefile中的目标之前的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个生成文件中,我找到了如下代码段. 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以第一个目标开头(不是名称以‘.’开头的目标).这称为默认目标.

By default, make starts with the first target (not targets whose names start with ‘.’). This is called the default goal.

因此,领先的.意味着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.

这表示setuprun_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中的目标之前的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆