在GNU Make中,如何将变量转换为小写? [英] In GNU Make, how do I convert a variable to lower case?
本文介绍了在GNU Make中,如何将变量转换为小写?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是一个愚蠢的问题,但是....使用GNU Make:
This is a silly question, but.... with GNU Make:
VAR = MixedCaseText
LOWER_VAR = $(VAR,lc)
default:
@echo $(VAR)
@echo $(LOWER_VAR)
在上面的示例中,将VAR的内容转换为小写的正确语法是什么?显示的语法(以及我遇到的所有其他问题)导致LOWER_VAR为空字符串.
In the above example, what's the correct syntax for converting VAR's contents to lower case? The syntax shown (and everything else I've run across) result in LOWER_VAR being an empty string.
推荐答案
您始终可以生成tr
LOWER_VAR = `echo $(VAR) | tr A-Z a-z`
或
LOWER_VAR = $(shell echo $(VAR) | tr A-Z a-z)
您尝试调用的"lc"函数来自 GNU Make标准库
The 'lc' functions you trying to call is from GNU Make Standard Library
假设已安装,则正确的语法为
Assuming that is installed , the proper syntax would be
LOWER_VAR = $(call lc,$(VAR))
这篇关于在GNU Make中,如何将变量转换为小写?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文