Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use make in Linux

Shulou Source: shulou.com Published: 2022-06-01 18:31:01 10月05日 Update

This article will explain in detail how to use make in Linux. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

Linux common command make command is the engineering compilation tool of GNU, which is used to compile many interrelated source code files in order to achieve engineering management and improve development efficiency.

Engineering compilation tool of makeGNU

Syntax make (option) (parameter) option-f: specify "makefile" file;-I: ignore the error message returned by command execution;-s: silent mode, do not output corresponding command line information before execution;-r: prohibit the use of build-in rules;-n: non-execution mode, output all execution commands but not execute;-t: update target file The-q:make operation will return "0" or non-"0" status information based on whether the target file has been updated;-p: output all macro definitions and object file descriptions;-d:Debug mode, output detailed information about the file and detection time. The common options under Linux are slightly different from those in Unix systems. Here are the different parts:

-c dir: change to the specified directory dir;-I dir before reading makefile: use this option to specify a search directory when other makefile files are included;-h:help document to display all make options;-w: display the working directory before and after processing makefile. Parameter target: specify the compilation target.

Knowledge extension make is a very important compilation command in both linux and Unix environments. Whether we develop our own projects or install applications, we often use make or make install. Using make tools, we can decompose large development projects into more manageable modules. For an application that includes hundreds of source files, we can use make and makefile tools to straighten out the complicated relationships between source files succinctly and clearly.

And with so many source files, it would be a disaster for programmers to type the gcc command to compile every time. The make tool compiles automatically and compiles only the parts that have been modified by the programmer since the last compilation.

Therefore, the effective use of make and makefile tools can greatly improve the efficiency of project development. After mastering both make and makefile, you will no longer be at a loss in the face of applications under Linux.

This is the end of the article on "how to use make in Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Tags: Compile command file tool target information development output project pattern source file directory program article project application different parameter commonly used application software Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Linux Shulou Information Redmi OPPO Reno