Sometimes some string variables need to be processed temporarily in the makefile file. It is quite useful to know some string processing functions of the makefile file.
This article only describes how to use the subst function.
If you want to know how to use other functions, you can refer to the http://blog.csdn.net/yrj/article/details/4046853
Prototype
$ (Subst ;,;,;)
Name: String replacement function-subst.
Function: Replace the; string in the string ;.
Return: The function returns the replaced string.
Example
The CONF value of the variable is [MacRelease, MacDebug]. Remove Mac now.
Code: $ {substr Mac, $ {CONF }}
Result: Release or Debug
Notes
1. except the first space, the parameters of substr cannot contain spaces. Otherwise, spaces are used as character characters. for example, echo "cp/usr/lib/1.txt/local/$ {subst Mac, $ {CONF}". The parameter here is a space. If it is:
Cp/usr/lib/1.txt/local/Debug/
2. Double quotation marks are not required for parameters. Otherwise, double quotation marks are considered as the content of parameters.