3.2 What Name to Give Your Makefile(makefile文件起名规范)

By default, when make looks for the makefile, it tries the following names, in order: GNUmakefile, makefile and Makefile. (默认情况下,make按照GNUmakefile, makefile, Makefile这个顺序查找makefile文件,一旦找到一个makefile文件,其余的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 make finds none of these names, it does not use any makefile. Then you must specify a goal with a command argument, and make will attempt to figure out how to remake it using only its built-in implicit rules.

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’(一旦使用-f选项指定了makefile文件,缺省的文件名GNUmakefile, makefile, Makefile则不会进行检查 ).

<<<返回主目录

发布了200 篇原创文章 · 获赞 37 · 访问量 23万+

猜你喜欢

转载自blog.csdn.net/wo198711203217/article/details/104345871