Simple use of make

Source: Internet
Author: User
Tags knowledge base

Note: If you want to use this article to write a simple make statement, but you do not have the knowledge base, please go back quickly. Click here and go to the PDF to explain it in detail, half an hour is enough for you to write one.

maketree:maketree.o stackstdio.o treestdio.ogcc -g maketree.o stackstdio.o treestdio.o -o maketreemaketree.o:maketree.c tree.h stackarray.hgcc -c maketree.cstackstdio.o:stackstdio.c stackarray.hgcc -c stackstdio.ctreestdio.o:treestdio.c tree.h stackarray.hgcc -c treestdio.c#This is a makefile ,my first makefile

  

Basic Unit is rule
Rule: Create one or more target files
Follow the compilation to generate the files or modules on which the target file depends
Command Used to generate or update the target file

Format:
Target file list delimiter dependent file list [; command]
[Command]
[Command]

Note: The command is a line marked with a tab key starting with. If not, it is the command of the previous rule.
# Annotation
\ Input for Branch

Simple run mode of make
First, find the makefile or makefile (you can specify make-F othername)
Open according to rules
1. the target file does not exist and the dependent file does not exist. Execute the next rule.
2. the target file does not exist. The dependent file exists. The target file is generated.
3. the target file exists, the dependent file exists, and the generation time is compared.
If (time of the target file <dependent file) is regenerated
Else skip
4. trace back to the First Command (why, similar to recursive nature, but what determines the end at the beginning
Explanation: the final target rule puts the final target file to be generated in the first target file of the first rule.
)

Hide rules
Example: module. O: headl. h
Make will automatically expand:
Module. O: modele. c headl. h
Gcc-C modele. C-o modele. o



Simple use of make

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.