C++ 任何生成makefile的好工具?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9589/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 12:13:33  来源:igfitidea点击:

any good tool for makefile generation?

c++ccross-platformmakefile

提问by Serge

I'm looking for a tool which can generate makefile for a C/C++ project for different compilers (gcc, microsoft vc++, borland etc) and different platforms (Win, Linux, Mac).

我正在寻找一种工具,它可以为不同编译器(gcc、microsoft vc++、borland 等)和不同平台(Win、Linux、Mac)的 C/C++ 项目生成 makefile。

采纳答案by Thomi

Other suggestions you may want to consider:

您可能需要考虑的其他建议:

  • Sconsis a cross-platform, cross-compiler build library, uses Python scruipting for the build systems. Used in a variety of large projects, and performs very well.

  • If you're using Qt, QMakeis a nice build system too.

  • CMakeis also pretty sweet.

  • Finally, If all else fails...

  • Scons是一个跨平台、交叉编译器的构建库,使用 Python scruipting 构建系统。在各种大型项目中使用,并且表现非常好。

  • 如果您使用 Qt,QMake也是一个不错的构建系统。

  • CMake也很可爱。

  • 最后,如果一切都失败了......

回答by prakash

Have you tried Automatic Makefile Generator?

您是否尝试过自动生成文件生成器

It supports for the following compilers:

它支持以下编译器:

Borland 3.1 
Borland 5.0 
Borland 5.0, 16 bit 
Borland 5.5 
Borland 5.6 
Borland 5.8 
CC 
Gnu g++ 
Gnu g++, dynamic library 
Intel 5, 6, 7 for Linux 
Intel 5, 6, 7 for Linux, dynamic library 
Intel 5, 6, 7 for windows 
Intel 8,9,10 for Linux 
Intel 8,9,10 for Linux, dynamic library 
Intel 8,9 for windows 
Intel 10 for windows 
Visual C++ 5 
Visual C++ 6, 7, 7.1 
Visual C++ 8 
Open Watcom 
Watcom 10A 
Watcom 10A, 16 bit 

回答by JesperE

CMake is the only tool which can actually generate real Visual Studio projects (i.e. not "Makefile"-projects which call out to an external tool), and which automatically recreates the projects when the build input file (CMakeLists.txt) changes.

CMake 是唯一可以实际生成真正的 Visual Studio 项目(即不是调用外部工具的“Makefile”项目)的工具,并且在构建输入文件 (CMakeLists.txt) 更改时自动重新创建项目。

SCons performance issues are well-known and a thorougly debated topic on the SCons mailing lists.

SCons 的性能问题是众所周知的,并且是 SCons 邮件列表上一个激烈争论的话题。

回答by Imbue

I've used Bakefilebefore with some success. It's fairly simple and seems to work well.

我以前使用过Bakefile并取得了一些成功。它相当简单,似乎运行良好。

回答by bltxd

I would vote for OMake. It fixes all complains I had with GNU make:

我会投票给OMake。它解决了我对 GNU make 的所有抱怨:

  • it's a full-blown language.
  • uses MD5 instead of timestamps.
  • provides a minimal shell which implements the most useful unix commands on all platforms: find, sed, awk, etc...
  • works with either unix or dos style pathnames.
  • extensively documented.
  • supports parallel builds.
  • fast.
  • 这是一种成熟的语言。
  • 使用 MD5 而不是时间戳。
  • 提供了一个最小的 shell,它在所有平台上实现了最有用的 unix 命令:find、sed、awk 等...
  • 适用于 unix 或 dos 样式的路径名。
  • 广泛记录。
  • 支持并行构建。
  • 快速地。

回答by Rob Wells

Automatic generation of (M|m)akefiles makes me worry about what you're trying to do here.

(M|m)akefiles 的自动生成让我担心你在这里尝试做什么。

Do you understand what goes on under the covers when you type make? Or gmake? I'm only asking because if you don't when things break, such as new code changes not being incorporated into the build, you'll have difficulties trying to work what has happened.

当您输入 make 时,您是否了解封面下发生的事情?还是gmake?我之所以这么问,是因为如果您在出现问题时不这样做,例如未将新代码更改合并到构建中,那么您将难以处理已发生的事情。

To start to understand make, can I suggest having a read of "Managing Projects with GNU Make" by Robert Mecklenberg. The early chapters cover how make is working. Getting your heard around the fact that make is backward chaining is one of the biggest things you can do.

要开始了解 make,我建议您阅读Robert Mecklenberg 的“使用 GNU Make 管理项目”一文。前几章介绍了 make 是如何工作的。让您了解 make 是反向链接的事实是您可以做的最重要的事情之一。

If you don't, and your system appears to work, then you'll be, to use The Pragmatic Programmers' term, "programming by coincidence". (-:

如果您不这样做,并且您的系统似乎可以工作,那么您将使用实用程序员的术语“巧合编程”。(-:

BTW Great articles available at their site! And I'm not involved with them. YMMV. Yada-yada...

顺便说一句,他们网站上有很棒的文章!我不参与他们。天啊。雅达雅达...

回答by grosauro

I'll also second CMake. I've been using it for quite a while on a multi-platform project and I'm very satisfied with it.

我还将第二个 CMake。我已经在一个多平台项目中使用它一段时间了,我对它非常满意。

回答by Adam Mitz

One issue to consider is do you want a "makefile" creator or a replacement build system? The problem with replacement build systems is that you typically don't get good IDE integration for platforms whose users expect this (Visual C++). If you do want a makefile creator instead of a replacement build system, take a look at MPC. It's free and open source.

要考虑的一个问题是您想要“makefile”创建者还是替代构建系统?替换构建系统的问题在于,对于用户期望的平台(Visual C++),您通常无法获得良好的 IDE 集成。如果您确实想要一个 makefile 创建者而不是替换构建系统,请查看MPC。它是免费和开源的。

回答by Gabi Davar

A recent addition to the list of make replacements is waf. From personal experience SCONS does the job pretty well.

最近添加到 make 替换列表中的是waf。从个人经验来看,SCONS 做得很好。

回答by Li Dong

I do not know if you have interest on this question any more. I am working on a similar Makefile auto-generator projection called CodeMate, developed by using Ruby. Maybe it is not that mature for large application right now, but I will keep working on it to make it better. Users should not need to edit any configuration file to build the software, or at least it is supposed to be. The learning curve should be minimized.

不知道你对这个问题有没有兴趣了。我正在研究一个名为CodeMate的类似 Makefile 自动生成器投影,它是使用 Ruby 开发的。也许现在对于大型应用程序来说还不是很成熟,但我会继续努力使其变得更好。用户应该不需要编辑任何配置文件来构建软件,或者至少应该是这样。应该最小化学习曲线。