bash - 使用 makefile 并行化 bash 脚本

标签 bash makefile

我有一些 .src 文件,并且我想在给定 A .src 文件的情况下渲染 ONE .png 文件。 也就是说,每个 .src 文件都可以独立渲染。

我曾经使用循环编写 bash 脚本。但这个循环不能并行执行。

所以我想编写一个 makefile 并使用“make -jN”。

问题是,我的 makefile 中的目标是什么? (我尝试过这个; %.png : %.src 猫$< 但它不起作用)

最佳答案

您需要一个将所有生成的文件列为依赖项的规则。当使用 GNU make 时,可能是

all: $(subst .src,.png,$(wildcard *.src))

关于bash - 使用 makefile 并行化 bash 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8974020/

相关文章:

c - 链接时间 "undefined reference to "错误

arrays - 使用变量在 bash 中传递 grep 模式

linux - Child_process 与模拟?

string - 找到模式并将其移至行尾

linux - 如何grep数字范围

gcc - 为 gcc 生成依赖项

c++ - gfortran makefile 问题

bash - 如何改进读取变量值并将其写入文件的逻辑?

linux - 在 makefile 中处理管道及其退出状态的最佳方法

makefile - 如何强制GNU Make不并行构建配方?