是'全部:'makefile中的默认设置是什么? [英] Is 'all:' is default in Eclipse makefile?

查看:66
本文介绍了是'全部:'makefile中的默认设置是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Eclipse中有c ++ makefile项目.Makefile包含以下行:

I have c++ makefile project in Eclipse. Makefile contains lines:

executable:
    $(COMPILER) $(CFLAGS) aaa.cpp -o aaa.o
    $(COMPILER) aaa.o -o aaa.exe -ldl

Eclipse对可执行文件不满意并显示错误;

Eclipse is not happy with executable and shows error;

make all 
make: *** No rule to make target 'all'.  Stop.

如何告诉Eclipse使用可执行文件代替 all ?

How to tell Eclipse to use executable instead all?

推荐答案

虽然我不使用Eclipse并且无法告诉您如何更改默认构建目标,但是拥有目标 all可能是值得的,因为这是很常见的事情.

While I don't use Eclipse and couldn't tell you how to change the default build target, it may be worthwhile to have a target all since it's a pretty common thing to have.

只需将 all 指定为第一个目标:

Just specify all as the first target:

all: executable

作为第一个目标,当在命令行上未指定任何目标时,它也是默认目标.由于该规则没有命令,因此它所做的全部取决于构建的 executable ,从而有效地成为别名.为了更加安全,请添加

As the first target it's also be the default target when no target is specified on the command line. Since the rule has no commands, all it does is depend on executable being built, effectively becoming an alias. To be extra safe, add

.PHONY: all

某处(或现有的 .PHONY 行,如果您已经拥有它们),以便文件 all 的存在不会阻止构建.

somewhere (or to existing .PHONY lines if you already have them) so that the existence of a file all won't prevent building.

这篇关于是'全部:'makefile中的默认设置是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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