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版)
714
|
第
20
章
SHELL
当
make
执行命令脚本时,它所调用的
shell
的名称,通常是
/bin/sh
。与大多数变量
不同,
make
不会从环境中读取
SHELL
的值(但
Windows
除外),因为用户对于
shell
的
个性设置可能会让
make
的结果有差异。如果希望
make
使用一个指定的
shell
来执行命
令,则必须在
makefile
中设置这个变量。
SUFFIXES
make
已知扩展名的默认列表(请参见
20.3.3
节)。该变量包含了默认列表,它并非
是当前必须起作用的列表。当使用内置目标
.SUFFIXES
清除该列表,或者添加自定义
的已知扩展名时,该变量的值不会改变。
VPATH
一个目录路径。当
make
在当前工作目录下找不到文件时,就会去搜索这个目录路
径。
20.5.6 环境变量
如果需要,可以在启动
make
之前,先在
shell
设定环境变量,然后在
makefile
中引用
它们,使用的语法与其他的
make
变量一样。而且,可以在调用
shell
命令之前,先在
makefile
中使用
export
命令,把任一或全部
make
变量复制到
shell
环境,如下例所示:
INCLUDE=/usr/include:/usr/local/include:~/include
export INCLUDE
export LIB := $(LIBS):/usr/lib:/usr/local/lib
%.o: %.c
$(CC) $(CFLAGS) -o $@ -c $<
在上述示例中,当
C
编译器被模式规则所调用时,它能够通过读取环境变量 ...
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