$(firstword $(wildcard $(LDS_SRC_STEM).S $(LDS_SRC_STEM).sx) $(LDS_SRC_STEM).S)
时间: 2023-09-19 19:13:08 浏览: 49
这是一个Makefile中的语句,用于获取以`.S`或`.sx`结尾的文件名并将其作为参数传递给指令。其中,`$(wildcard)`函数用于查找当前目录下符合模式的文件,`$(firstword)`函数用于获取第一个符合条件的文件名。`$(LDS_SRC_STEM)`是一个变量,它应该在Makefile中定义。
相关问题
$(firstword $(wildcard $(LDS_SRC_STEM).S $(LDS_SRC_STEM).sx) $(LDS_SRC_STEM).S) what is the usage of $(wildcard) and $(firstword)?
`$(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.
CUR_SOURCE=${wildcard *.c}
这是一个 Makefile 中的语句,用于获取当前目录下的所有 .c 文件。具体来说,这个语句中使用了 Makefile 中的一个函数 wildcard,该函数可以匹配指定模式的文件,并返回一个以空格分隔的文件列表。在这个语句中,使用了通配符 *.c 来匹配当前目录下的所有 .c 文件,并将其保存在 CUR_SOURCE 变量中。通过这个变量,可以方便地获取当前目录下的所有 .c 文件,并将其用于编译和链接。这个语句的作用是获取当前目录下的所有 .c 文件,以便进行编译和链接操作。