Linux software compilation and installation: make and configure

Source: Internet
Author: User

Linux software compilation and installation: make and configure
1. What are make and configure?
The make command is mainly used to simplify the compilation process. When the make statement is executed, the Makefile (or makefile) file is searched in the current directory, and The Makefile records the detailed information about how to compile the source code. Make automatically checks whether the source code has changed and updates the execution file.
Software developers usually write a program that detects the user's operating environment, that is, configure or config. After the test is completed, they will create the Makefile file.
2. Advantages of the make command
Simplify the command to be executed during compilation. After compilation, if a source code file is modified, make will only compile the modified file, and other target files will not be changed. Recompilation only updates the update operation,
3. Makefile syntax
Syntax: target file 1 target file 2 Target file 1 of the executable file to be created by gcc-o

[gang@www]$ vim Makefilehello: hello.o thank_you.o     gcc -o hello hello.o thank_you.o clean:    rm -f hello hello.o thank_you.o
Clean Delete target file
 [gang@www]$ make cleanrm -f hello hello.o thank_you.o [gang@www]$ makecc    -c -o hello.o hello.ccc    -c -o thank_you.o thank_you.cgcc -o hello hello.o thank_you.o  [gang@www]$ ./hello Hello World. Thank you.

Makefile can use variables
[gang@www]$ vim MakefileOBJS = hello.o thank_you.oCFLAGS = -Wallhello: ${OBJS}    gcc -o hello ${OBJS}clean:    rm -f hello ${OBJS}
Variable assignment = There are spaces on both sides, $ @: representing the current target gcc-o $ {OBJS}
4. Installation Steps
1./configure create Makefile file 2. make clean Delete the target file, 3. make compile according to Makefile. Generate an executable file, which is placed in the current directory and has not been installed in the pre-installed directory. 4. make install installs the compiled data in the previous step to the default directory based on the install option in Makefile.

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.