2011 2

WBOY
Release: 2016-06-07 15:31:54
Original
1162 people have browsed it

0, The basic formula: Target: prerequisites command to use prerequisites to generate target. (cc -c xx.c -o xx.o, cc -o executable objects) 1, using '/' to add two line together. 2, 伪目标文件 .PHONY标识 3, using variable: objects = main.o

0, The basic formula: 

Target: prerequisites

command to use prerequisites to generate target.

(cc -c xx.c -o xx.o, cc -o executable objects)

 

1, using  '/' to add two line together.

 

2, 伪目标文件 .PHONY标识

 

 

3, using variable:

   objects = main.o kbd.o # whitespace could exist?

When we use the variable, take it like this:  $(objects)

edit : $(objects)

 

4, 自动推导

   Gnu make内涵某些自动推导指令,如看到一个.o文件,就会自动把同名的.c文件加在依赖关系里。并且命令 cc -c xx.c也会自动被推导出来。

 

5,Makefile里包含:

显示规则,隐式规则,变量定义,文件指示和注释

 

显示规则说明如何生成一个或多个目标文件

隐式规则由make自动推导

变量定义类似与C中的宏,执行makefile时进行字符串替换

文件指示,1 文件引用 2 条件运行 3 定义一个多行命令

注释 ‘#’开头

makefile中的命令,必须以Tab键开始

 

P14

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template