Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The difference between .mk file and Makefile

I've just begun to study Porting Android. And I come across a new type of file which is .mk file. It's is an extension of Makefile but I don't know what it is different from a Makefile ? So, can somebody help you clarify them. Thanks very much !

like image 505
hugtech Avatar asked Jul 27 '19 03:07

hugtech


People also ask

What is .MK makefile?

Makefile used by software compilers and linkers for building program executable from source files; may be a full Makefile or may contain additional rules referenced by a Makefile. Open .MK files with File Viewer for Android.

What type of file is a makefile?

Script written as a Makefile, a developer file type that is used for compiling and linking programs from source code files; stores instructions using the GNU make standard. NOTE: Makefiles more commonly are created with the filename Makefile, which does not have a file extension.

What is make and makefile?

Make is Unix utility that is designed to start execution of a makefile. A makefile is a special file, containing shell commands, that you create and name makefile (or Makefile depending upon the system).

What is the difference between and := in makefile?

= defines a recursively-expanded variable. := defines a simply-expanded variable.


1 Answers

A make file can have any name. The -f option of make is used to specify which file to use:

make -f foobar

You can even use -f several times:

make -f foo -f bar

In which case make processes the files in order (or, equivalently, concatenates the files and processes the result).

makefile and Makefile are special names because if make is called without the -f option it automatically searches for them, in this order, and use the first it finds. Note that GNU make also considers GNUmakefile, and prefers it over makefile and Makefile. Other make implementations can have other default names.

The .mk extension is a more or less standard extension for make files that have other names than the defaults. It is a reasonable extension if you want humans to quickly understand what these files are: convert.mk is more informative than foobar. Some editors use this extension to identify the file type and apply syntax coloring. They usually apply the same syntax coloring to makefile and Makefile.

like image 80
Renaud Pacalet Avatar answered Oct 08 '22 02:10

Renaud Pacalet