is the usage of wildcard and firstword in makefile?
时间: 2024-02-17 16:02:15 浏览: 100
makefile的使用
In a Makefile, a wildcard is a special character that matches any number of characters in a filename. The `wildcard` function can be used to find all files that match a particular pattern. For example, the following line will find all files in the current directory that end with ".c":
```
SOURCES := $(wildcard *.c)
```
The `firstword` function, on the other hand, is used to extract the first word from a string. This is often used in Makefiles to extract the first word from a list of space-separated values. For example, the following line extracts the first word from the `SOURCES` variable defined above:
```
FIRST_SOURCE := $(firstword $(SOURCES))
```
This would set the `FIRST_SOURCE` variable to the name of the first C file in the current directory.
阅读全文