makefile extension

后端 未结 8 1104
遥遥无期
遥遥无期 2021-02-08 09:29

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

相关标签:
8条回答
  • 2021-02-08 10:01

    The default filename for a makefile is Makefile; this is the name that GNU Make looks for when you run it without any options. The -f argument lets you specify an alternate filename if desired.

    0 讨论(0)
  • 2021-02-08 10:01

    Makefiles don't usually have an extension. They're typically called 'makefile' or 'Makefile'. Sometimes, when someone writes a complex set of makefiles that include each other, the included files get a .mak extension to indicate that they're makefiles even though they aren't called 'makefile'.

    0 讨论(0)
  • 2021-02-08 10:08

    You can name them whatever you like, but ".mak" looks right.

    ... google ... http://msdn.microsoft.com/en-us/library/aa380049%28VS.85%29.aspx ... yeah

    0 讨论(0)
  • 2021-02-08 10:09

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

    0 讨论(0)
  • 2021-02-08 10:10

    In the few places where I've seen extensions used on makefile names they have generally been either .make or .gmk, and even then those extensions are usually reserved for makefile fragments that are included by master files given one of the default names.

    0 讨论(0)
  • 2021-02-08 10:18

    A makefile is usually just called Makefile.

    0 讨论(0)
提交回复
热议问题