makefile扩展名 [英] makefile extension

查看:107
本文介绍了makefile扩展名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm writing a C program using gcc in cygwin. My question is, how do you create a makefile? I mean, what file-extension does it have? I know how to write simple rules, but I can't save a file in the text-editor with the right extension? Impossible to find any info about this... This is prolly a super-newbie question. So let the flaming begin. :-P

推荐答案

当您使用Cygwin时,这反过来又意味着您正在使用GNU make,我引用了

As you are using Cygwin which in turn means that you are using GNU make, I cite the relevant portion of the GNU make manual:

3.2给您的Makefile取什么名字

3.2 What Name to Give Your Makefile

默认情况下,当make查找 makefile,它将尝试以下操作 名称,依次为:GNUmakefile,makefile 和Makefile.通常你应该打电话 您的makefile要么是makefile,要么是 生成文件. (我们推荐Makefile 因为它显眼地靠近 目录列表的开头, 就在其他重要文件附近 作为自述文件.)名字被选中了, 不建议使用GNUmakefile 大多数makefile.你应该用这个 名称,如果您有一个makefile是 特定于GNU make,并且不会 其他版本的make可以理解. 其他make程序寻找makefile 和Makefile,但不包括GNUmakefile.

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.

[...]

如果要为makefile使用非标准名称,则可以使用以下命令指定makefile名称: "-f"或"--file"选项.参数"-f name"或"--file = name"告诉make读取文件名 作为makefile.如果您使用多个"-f"或"--file"选项,则可以指定多个 生成文件.所有makefile均以指定的顺序有效地串联在一起.默认值 如果您指定"-f",则不会自动检查makefile名称GNUmakefile,makefile和Makefile. 或-文件".

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’.

这篇关于makefile扩展名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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