gpt4 book ai didi

c - 生成文件扩展名

转载 作者:太空狗 更新时间:2023-10-29 16:42:44 24 4
gpt4 key购买 nike

我正在 cygwin 中使用 gcc 编写 C 程序。我的问题是,如何创建 makefile?我的意思是,它有什么文件扩展名?我知道如何编写简单的规则,但我无法在文本编辑器中保存具有正确扩展名的文件?无法找到有关此的任何信息...这很可能是一个 super 新手问题。因此,让燃烧开始吧。 :-P

最佳答案

由于您使用的是 Cygwin,这反过来意味着您使用的是 GNU make,我引用了 relevant portion of the GNU make manual :

3.2 What Name to Give Your Makefile

By default, when make looks for the makefile, it tries the following names, in order: GNUmakefile, makefile and Makefile. Normally you should call your makefile either makefile or Makefile. (We recommend Makefile because it appears prominently near the beginning of a directory listing, right near other important files such as README.) The first name checked, GNUmakefile, is not recommended for most makefiles. You should use this name if you have a makefile that is specific to GNU make, and will not be understood by other versions of make. Other make programs look for makefile and Makefile, but not GNUmakefile.

[...]

If you want to use a nonstandard name for your makefile, you can specify the makefile name with the ‘-f’ or ‘--file’ option. The arguments ‘-f name’ or ‘--file=name’ tell make to read the file name as the makefile. If you use more than one ‘-f’ or ‘--file’ option, you can specify several makefiles. All the makefiles are effectively concatenated in the order specified. The default makefile names GNUmakefile, makefile and Makefile are not checked automatically if you specify ‘-f’ or ‘--file’.

关于c - 生成文件扩展名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3962552/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com