zoukankan      html  css  js  c++  java
  • 神奇的make自动生成include file的功能

    嗯,今天研究公司makefile的代码,始终搞不明白有一段下载编译依赖的rule recipe(对这个名词不了解请参考make的官方文档)是怎么执行的。明明在执行的时候并指定的target并没有依赖那段recipe对应的target啊。原来,make有一个不指定target也能运行相应target recipe的功能,见如下Makefile:

    include file.mk
    
    file.mk :
        echo "#this is auto-gen file" >file.mk

    运行这个makefile之前,file.mk是不存在的。看看运行结果:

    C:Users***>make
    Makefile:1: file.mk: No such file or directory
    echo "#this is auto-gen file" >file.mk
    make: `file.mk' is up to date.

    再看看运行的文件夹,file.mk被创建了。原来,make在include文件的时候,如果文件不存在,make并不立即报fatal并停止,而是会去找是否有对应的rule能创建(或更新)这个target。如果有,创建完之后再include。

    学习了。。。

  • 相关阅读:
    vue chrome调试工具开启
    mac显示隐藏文件
    mac网络变慢?
    57-文件处理小结
    56-文件修改的两种方式
    54-with管理文件操作上下文
    53-文件的三种打开方式
    51-基本文件操作
    50-Python2和3字符编码的区别
    49-字符编码
  • 原文地址:https://www.cnblogs.com/waytofall/p/4747985.html
Copyright © 2011-2022 走看看