冒号和$ makefile中的$ [英] Colon and $ in makefile

查看:91
本文介绍了冒号和$ makefile中的$的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面的TEMP0_FILES计算出什么? SOURCE_FILES可以等于多个源文件.请告诉我以下语法:.cpp=.o

What does TEMP0_FILES below compute to? SOURCE_FILES can equal to multiple source files. Please tell me the purpose of the following syntax :.cpp=.o

SOURCE_FILES = main.cpp

TEMP0_FILES = $(SOURCE_FILES:.cpp=.o)

推荐答案

:语法导致变量上发生替换.在这种情况下,它将在SOURCE_FILES变量的所有项目中将".cpp"替换为".o".

The : syntax causes a substitution to occur on the variable. In this case it will replace ".cpp" with ".o" in all of the items in the SOURCE_FILES variable.

TEMP0_FILES将为"main.o"

TEMP0_FILES will be "main.o"

如果SOURCE_FILES为"main.cpp otherfile.cpp otherfile2.cpp",则TEMP0_FILES将变为:"main.o otherfile.o otherfile2.o"等.

If SOURCE_FILES is "main.cpp otherfile.cpp otherfile2.cpp" TEMP0_FILES will become: "main.o otherfile.o otherfile2.o" etc.

这篇关于冒号和$ makefile中的$的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆