简体   繁体   English

Makefile中不存在“clean”规则,但make clean会产生一些东西

[英]“clean” rule not existing in Makefile, but make clean produces something anyway

I have a small issue with my build procedure on linux. 我在linux上的构建过程有一个小问题。

For whatever reason in my code if I issue a "make clean" Linux produces a file called "clean". 无论出于何种原因,如果我发出“make clean”,Linux会生成一个名为“clean”的文件。 The thing is that I don't have a "clean" section on the makefile of my project. 问题是我的项目的makefile上没有“干净”部分。

It looks like my make is picking up the wrong Makefile from somewhere and this might clash with the Makefile of my project. 看起来我的make从某个地方拾取了错误的Makefile,这可能与我项目的Makefile冲突。

Is there anyway to know which makefile is looked up? 无论如何知道查找哪个makefile?

Two ideas: 两个想法:

  1. Use the --debug command line option to have the make program tell you more about what it's doing. 使用--debug命令行选项让make程序告诉您更多有关它正在做什么的信息。
  2. Try adding a .PHONY declaration of the clean target. 尝试添加clean目标的.PHONY声明。

I suggest to use remake to debug your makefiles. 我建议使用重制来调试你的makefile。 Install it then run remake -x or even remake -x -d . 安装它然后运行remake -x甚至remake -x -d (The remake utility is a nearly compatible variant of GNU make ). remake实用程序是GNU make的几乎兼容的变体)。

In your case, the lack of a phony clean target makes the make utility creating an empty file named clean . 在您的情况下,缺少虚假clean目标会使make实用程序创建一个名为clean的空文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM