$(firstword $(wildcard $(LDS_SRC_STEM).S $(LDS_SRC_STEM).sx) $(LDS_SRC_STEM).S) what is the usage of $(wildcard) and $(firstword)?
时间: 2024-05-23 15:12:56 浏览: 88
`$(wildcard)` is a function in makefile that searches for files in the specified path. It returns a space-separated list of all the files that match the pattern.
`$(firstword)` is another function in makefile that returns the first word of a given string.
In the given code snippet, `$(wildcard $(LDS_SRC_STEM).S $(LDS_SRC_STEM).sx)` searches for all the files with extension `.S` and `.sx` in the path specified by the variable `LDS_SRC_STEM`. If multiple files are found, they are returned as a space-separated list.
`$(firstword)` is then used to extract the first file name from the list returned by `$(wildcard)`. If the list is empty, then `$(LDS_SRC_STEM).S` is used as a fallback value.
Finally, the entire expression is enclosed in parentheses as it is a part of a command line statement that expects a single file name.
阅读全文