强制 Eclipse 生成标准的 Unix 生成文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1274253/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Forcing Eclipse to generate standard Unix makefiles
提问by Cory Walker
I have an Eclipse project I've been working on for some time now, and I'd like to open source it. But to do that I'd like to have a clean Makefile like the majority of other open source programs. I understand I could make my own, but it would be better if Eclipse could manage it for me. Getting Eclipse to generate a CMake file would be even better, but I can settle for a plain makefile if that is easiest. So, how can I get Eclipse to do this? There are a few posts on the internet that suggest selecting "Managed make" when creating a project, but they were from a few years ago and are outdated. When I try to create a C project, there is the option to create a "Makefile project", but it creates the makefile in a folder called "Linux GCC" and makes everything cluttered. Any suggestions?
我有一个 Eclipse 项目,我已经工作了一段时间,我想将其开源。但要做到这一点,我希望像大多数其他开源程序一样拥有一个干净的 Makefile。我知道我可以自己制作,但如果 Eclipse 可以为我管理它会更好。让 Eclipse 生成 CMake 文件会更好,但如果最简单,我可以满足于简单的 makefile。那么,我怎样才能让 Eclipse 做到这一点呢?互联网上有一些帖子建议在创建项目时选择“Managed make”,但它们是几年前的,已经过时了。当我尝试创建一个 C 项目时,可以选择创建一个“Makefile 项目”,但它在一个名为“Linux GCC”的文件夹中创建了 makefile,并使一切变得混乱。有什么建议?
采纳答案by Cory Walker
I ended up just creating a CMake project by hand. CMake files are really not that hard to make, and it's a lot easier than trying to get Eclipse to do it for you. Plus, they're cross-platform.
我最终只是手动创建了一个 CMake 项目。CMake 文件其实并不难制作,而且比尝试让 Eclipse 为您制作要容易得多。另外,它们是跨平台的。
回答by Doug Carter
I've been a *nix guy for 25+ years and am a big fan of make. However, making your Eclipse project dependent upon make is going to exclude the Mac and Windows community. Why don't you just export the Eclipse project and open source it as an Eclipse project? Then users can can have it ready to extend if they choose. You didn't specify the language your project is written in, if it's Java (pretty common for Eclipse) why not create an ant build file for the project?
我 25 年来一直是 *nix 人,并且是 make 的忠实粉丝。但是,使您的 Eclipse 项目依赖于 make 将排除 Mac 和 Windows 社区。为什么不直接导出 Eclipse 项目并将其作为 Eclipse 项目开源?然后,如果用户愿意,他们可以准备好扩展它。你没有指定你的项目是用什么语言编写的,如果它是 Java(对于 Eclipse 来说很常见),为什么不为项目创建一个 ant 构建文件?
Just a thought.
只是一个想法。
回答by VonC
Would a CMakeBuildereclipse plugin, associated with this tutorialbe a good fit for what you are trying to do?
与本教程相关的CMakeBuildereclipse 插件是否适合您的工作?
The end result would be something like:
最终结果将类似于:
(source: vtk.org)
(来源:vtk.org)
回答by Adam
If you've been building your project using the Debug configuration the makefile Eclipse generates is stored in the Debug folder of your project (or the Release folder if you've built it using the release configuration).
如果您一直使用 Debug 配置构建项目,Eclipse 生成的 makefile 存储在项目的 Debug 文件夹中(如果您使用发布配置构建它,则存储在 Release 文件夹中)。