Make and makefile

Source: Internet
Author: User

The Linux makefile tutorial is very detailed and easy to understand.

Make and makefile GNU make Systems
If programmers in Linux do not use GNU make to build and manage their own projects, they cannot be regarded as qualified professional programmers, at least not UNIX programmers. In a Linux (UNIX) environment, it is easier to use the GNU make tool to build a project of your own, the compilation of the entire project requires only one command to complete the compilation, connection, and final execution. However, we need to spend some time writing one or more makefile files.
The MAKEFILE file describes the compilation and connection rules of the entire project. These include: Which source files in the project need to be compiled, how to compile, how to create those library files, how to create these library files, and how to finally generate the executable files we want. Although it may seem complicated, the advantage of compiling makefile for the project is that you can use a single line of command to complete "Automated compilation ", once a correct makefile is provided (usually multiple for a project. The only thing you have to do to compile the entire project is to input the make command at a shell prompt. The entire project is fully automatically compiled, greatly improving the efficiency.
Make is a command tool that explains the commands in makefile (rules should be said ). The MAKEFILE file describes the compilation sequence and rules of all files in the project. Makefile has its own writing format, keywords, and functions. Just as C has its own format, keywords, and functions. In makefile, you can use any command provided by the system shell to complete the desired work. Makefile (may be another file name on other systems) is used in most IDE development environments and has become a compilation method for projects.
Makefile is related to the compilation rules of the entire project. The source files in a project are not counted. They are stored in several directories by type, function, and module. makefile defines a series of rules to specify which files need to be compiled first, which files need post-compilation, which need to be re-compiled, or even perform more complex functional operations, because makefile is like a shell script and can also execute operating system commands.
The benefit of makefile is "automatic compilation". Once written, only one make command is required, and the entire project is fully automatically compiled, which greatly improves the efficiency of software development. Make is a command tool that explains commands in makefile. Generally, most ides use this command, such as make in Delphi and nmake in Visual C ++, GNU make in Linux. It can be seen that makefile is a compilation method in Engineering.

A good ide hides too many engineering management details, so to stay close to the nature of the problem, makefile must be used. Without makefile, you must execute GCC commands for one file and one file, and the generated. O files are connected to an executable file using gcc, and makefile may effectively manage a project.
The make statements of different vendors are different and have different syntaxes. However, they are all about file dependencies. Here, I only talk about GNU make,

Makefile is an engineering management tool for the vast majority of software in Linux. It has almost become a factual standard. Makefile is the project description file of the make project management tool.

Manual writing and Automatic Generation of makefile
If three files exist in one path at the same time, make will select one, And gnumakefile, makefile, and makefile will follow the sequence.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.