makefile extension
I wanted to create a makefile. So I wrote instructions in a notepad file.
But what extension should开发者_运维问答 I give while saving this file?If you run:
make
this program will look for a file named makefile in your directory, and then execute it. If you have several makefiles, then you can execute them with the command:
make -f MyMakefile
By default, The GNU Make tries some particular names, no using any extension. You can specify file with any name to it. But if you want syntax highlighting in some editors, you can use an extension.
There is a wildcard rule for recognizing make files in Geany editor:
Make=*.mak;*.mk;GNUmakefile;makefile;Makefile;makefile.*;Makefile.*;
From the GNU Make documentation
By default, when make looks for the makefile, it tries the following names, in order:
GNUmakefile
,makefile
andMakefile
. Normally you should call your makefile eithermakefile
orMakefile
These will be searched for if you don't specify the makefile with the -f
flag (Only GNU make will look for GNUMakefile
, so give it that name only if you know you're using GNU tools)
It sounds like you're running Windows, in which case makefiles often have a .NMK
suffix (because they are intended for use with NMAKE
). In the civilised world though makefiles do not generally have a suffix: makefile
or Makefile
are the canonical file names.
If you need to distinguish one from another, and you are configuration managing the makefile, you should use project.make as the name. On the basis that most LSE's , in particular gedit, are recognising this over .mak. Upon packaging, or sign out to a dedicated folder it can be renamed to makefile, the fully qualified path being descriptive of the project. In this way you can have different versions. If your work is complex enough to be using a makefile you should not mixing multiple builds in the same folder anyway.
精彩评论