【发布时间】:2021-05-07 21:04:26
【问题描述】:
假设我在.bashrc 中定义了以下函数:
foo (){
touch $1
}
我想像这样在 makefile 中调用这个函数:
%.png : %.tex
bash -i -c foo $<
但这抱怨缺少操作数。 (错误是“touch: missing file operand”,所以它正在调用touch...)。我已经看到了一些类似问题的解决方案,但它们并不适用,因为我需要将自动变量 $<(或者更确切地说,它的值)作为参数传递给 shell 脚本。
我知道我可以解决这个问题(例如,将函数批量复制到 makefile 中),但我很想知道如何在 makefile 中解决我的问题。
【问题讨论】:
标签: makefile