Skip to Content
C语言核心技术(原书第2版)
book

C语言核心技术(原书第2版)

by Peter Prinz, Tony Crawford
August 2017
Intermediate to advanced
798 pages
17h 44m
Chinese
China Machine Press
Content preview from C语言核心技术(原书第2版)
698
第20章
使用make构建C程序
如在第
18
章所看到的那样,编译和链接
C
程序所涉及的命令庞大而复杂。
make
工具简化
了这个过程,它可以自动管理具有任意大小与复杂程度的程序的编译过程,使得只要一
个
make
命令,就可以取代很多个编译器和链接器命令。而且,
make
会比较相关文件的更
新时间,以避免重复之前的工作。更重要的是,使用
make
命令可以管理定义如何构建各
种目标的规则,并且自动分析所涉及文件之间的依赖关系。
现今有许多不同版本的
make
,它们的特性与用法也存在着不同程度的差异。它们具有
不同的内置变量和目标,并给这些内置变量和目标赋予了特殊的含义。本章简要介绍
make
,并不期望尝试涵盖各种不同的
make
版本,而是聚焦于
GNU
版本的
make
,该版本
被广泛使用(某些系统把非
GNU
版本的
make
作为默认的
make
,但通常还可以通过
gmake
命令来显式启动
GNU
版本的
make
)。而且,即使本章讨论的核心是
GNU
make
,但是这
些内容也或多或少地阐述了
make
的基础原理。在本书中,我们只把
make
当作从
C
源代码
构建程序的工具。如果希望探寻
make
的全部功能,阅读有关
make
的文档是必需的。建
议阅读
Robert Mecklenburg
编写的《
Managing Projects with GNU make
》(
O
’
Reilly
出
版),该书系统地介绍了
make
的高级功能。
20.1 目标、依赖和命令
在讨论
make
之前,我们先简要回顾一下程序编译的流程。为了创建可执行文件,需要链
接编译好的对象文件。为了产生对象文件,我们需要编译 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

算法精讲视频课程:24篇系列讲座

算法精讲视频课程:24篇系列讲座

罗伯特·塞奇威克, 凯文·韦恩(Kevin Wayne)

Publisher Resources

ISBN: 9787111562207