MAKE如何知道要检查哪个源文件 [英] How MAKE knows which source file to check

查看:104
本文介绍了MAKE如何知道要检查哪个源文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个简单的如何让脚本知道一些cpp文件被改变了?这意味着对于每个.o文件,它会寻找相应的.cpp一个?如果扩展会不同 - 例如 .c

How this simple make script knows that some of cpp files is changed? Does it means that for each .o file it will look for corresponding .cpp one? What if extension will be different - for example .c

hellomake: hellomake.o hellofunc.o 
    gcc -o hellomake hellomake.o hellofunc.o -I.

UPD:
根据我的理解,我提供的不应该看c和cpp文件。当我问第二次建立项目 MAKE 告诉我make:'hellomake'是最新的
但是我很惊讶,当我改变 hellomake.cpp MAKE已决定做重建项目。

UPD: According to my understanding scrip I provide should not look to c and cpp files. And when I asked to build project second time MAKE told me "make: 'hellomake' is up to date. But I was surprised when I have changed hellomake.cpp MAKE has decided do rebuild project. Why?

推荐答案

GNU make 有许多内建规则。运行 make -p 找到它们,并使用 Makefile 中的现有规则,请参见

GNU make has many builtin rules. Run make -p to find them. And use the existing rules in your Makefile, see this or that or this

这篇关于MAKE如何知道要检查哪个源文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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