Makefile干净不删除* .o文件吗? [英] Makefile clean not removing *.o files?

查看:543
本文介绍了Makefile干净不删除* .o文件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道为什么在运行make时不会删除/清除* .o文件吗?

I wonder why this won't delete/clean *.o files generated when running make?

# UNIX Makefile

CXX = g++
LD  = g++
CXXFLAGS = -g

testlfunction: lfunction.o lfunctionlist.o lprocessor.o testlfunction.o
    $(LD) -o $@ $^

clean:
    rm *.o testlfunction

以前曾经是

$(RM) *.o testlfunction

但是它也不起作用;(

这是为什么?

推荐答案

要检查实际发生的情况,请运行"make clean"并检查该命令的输出.

To check what really happens, run "make clean" and examine the output of that command.

  1. 没事吗?然后,当前目录中可能会有一个名为"clean"的文件.删除它,然后再试一次.
  2. 它以"rm ..."开头吗?那似乎很正常.
  3. 在所有其他情况下,请告诉我们您获得的确切输出.

要检查命令是否真正运行,请在"rm"命令之前和之后插入一些"echo"命令.他们被处决了吗?

To check whether the commands are really run, insert some "echo" commands before and after the "rm" command. Are they executed?

最后,您是否区分了制表符和空格?在Makefiles中,区别很重要.命令必须使用制表符缩进.

And finally, did you distinguish between tab characters and spaces? In Makefiles the difference is important. Commands must be indented using tabs.

这篇关于Makefile干净不删除* .o文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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