LINUX Study Notes 8 -- Makefile project management

Source: Internet
Author: User
1. role: to compile the entire software project, the link can be completed with only one command. Gcc can only compile one file. 2. Makefile: describes the compilation and linking rules of the entire project. To execute the make Command 3. File name: by default, the make command looks for makefile or... 1. function: to compile the entire software project, the link can be completed with only one command. Gcc can only compile one file.
 
2. Makefile: describes the compilation and linking rules of the entire project. To execute the make command
 
3. File name: the make command searches for the makefile or Makefile project file by default,
 
A) specify the file name: make-f file name
 
4. rules:
 
A) 1st goals will be established as the final goal
 
B) multi-objective: the final target depends on multiple. o files gcc-c, while other. o files target. c files.
 
C) target: dependent on main. o: main. c
 
D) command gcc-c main. c: The Command must start with the TAB key.
 
5. pseudo targets:
 
A) define the pseudo target of "clean":. PHONY: clean
 
B) purpose: execute some other commands, such as deleting the rm-f hello. o file.
 
6. use variables: replace dependencies with variables to facilitate modification.
 
A) default variables:
 
1. $ ^: indicates all the dependent files in the rule.
 
2. $ @: indicates the target of the rule.
 
3. $ <: indicates the first dependency file in the rule.
 
7. Notes: # Start
 
8. cancel echo: + @: @ gcc before the command
Related Article

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.