any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^)
时间: 2023-12-02 08:04:05 浏览: 27
这是一个 Makefile 中的语句,用于将所有的依赖文件(除了 PHONY 目标)作为先决条件传递给一个目标。其中 $^ 表示所有的依赖文件,$? 表示所有更新的依赖文件,$(wildcard $^) 表示 $^ 中所有的通配符表达式展开后的文件列表。最后,filter-out 函数用于过滤掉 PHONY 目标和通配符表达式展开后的文件列表。
相关问题
any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^) please give me an example based on this command
Sure, here's an example:
Let's say you have a Makefile with two targets, `main` and `test`, and the following dependencies:
```
main: file1.o file2.o
test: file1.o file3.o
```
You can use the `any-prereq` command to pass all dependencies to the `clean` target as follows:
```
clean:
rm -f $(any-prereq)
```
Now, when you run `make clean`, it will remove all the object files (`file1.o`, `file2.o`, and `file3.o`) because they are dependencies of either `main` or `test`.
Note that if you have any PHONY targets (i.e., targets that don't produce files), they will be filtered out by the `$(filter-out $(PHONY),$?)` part of the command.
AC_PREREQ 是什么意思
`AC_PREREQ` 是 `Autoconf` 宏之一,用于指定所需的 `Autoconf` 版本。它用于确保配置脚本在运行之前检查所需的 `Autoconf` 版本是否满足要求。
`AC_PREREQ` 宏的语法如下:
```
AC_PREREQ([version])
```
其中,`version` 是所需的 `Autoconf` 版本号。该版本号可以是完整的版本号,也可以是范围表达式。
使用 `AC_PREREQ` 宏可以确保你的项目在构建之前依赖的 `Autoconf` 版本满足要求。如果当前的 `Autoconf` 版本不满足要求,将会显示错误消息并终止配置过程。
以下是一个示例:
```autoconf
AC_PREREQ([2.69])
```
上述示例指定了对 `Autoconf` 版本 2.69 或更高版本的依赖。如果当前的 `Autoconf` 版本低于 2.69,配置过程将显示错误消息并终止。
通过使用 `AC_PREREQ` 宏,你可以明确指定所需的 `Autoconf` 版本,以确保配置脚本在合适的环境中运行。