makefile 问题 (gnuplot)
我正在尝试使用 GNUplot 和 makefile 生成一些图表。我希望目录中的每个 *.plt 文件都通过 GNUplot 运行,但是我看不到让它工作。 到目前为止,这是我的 makefile:
all: %.tex
%.tex: %.plt
<tab> gnuplot < $<
如果我单独指定一个 .plt 文件,该配方工作正常,但我希望它在生成新图时拾取它们。
编辑: 我想我现在已经开始工作了:
# plots all files in the folder with .plt extensions
SOURCES = $(wildcard *.plt)
TARGETS = $(SOURCES:.plt=.tex)
all: $(TARGETS)
%.tex: %.plt
gnuplot < $<
有人可以确认我的推理(如下)是否正确吗? 以前我没有为 all
指定任何文件(我对 % 有点困惑)。现在通过使用通配符选取任何 .plt 文件来分配变量 SOURCES
(为什么在使用 .plt 而不是 *.plt 时它不起作用?)。分配了 SOURCE
后,设置了 TARGETS
变量,现在 all:
已指定要构建的文件。现在正在运行匹配规则。
I'm trying to produce some graphs using GNUplot with a makefile. I would like for every *.plt file in the directory to be run through GNUplot, however I can't see to get it to work.
Here's my makefile so far:
all: %.tex
%.tex: %.plt
<tab> gnuplot < lt;
The recipe is working fine if I specify a .plt file individually but I want it to pick up my new plots as I produce them.
EDIT:
I think I've got it working now:
# plots all files in the folder with .plt extensions
SOURCES = $(wildcard *.plt)
TARGETS = $(SOURCES:.plt=.tex)
all: $(TARGETS)
%.tex: %.plt
gnuplot < lt;
Can someone confirm whether my reasoning (as follows) is correct?
Previously I hadn't specified any files for all
(I'm a little confused by %). Now assigning the variable SOURCES
by picking up any .plt files using the wildcard (why doesn't it work when using .plt instead of *.plt?). Having assigned SOURCE
, the TARGETS
variable is then set, now all:
has files specified to build. and the matching rule is now run.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
all : %.tex
不起作用,因为目标名称中没有百分比,换句话说,它不是模式规则。使用
通配符
函数获取所有.plt
文件的列表,并添加对这些文件的all
依赖项,并将扩展名替换为.tex
:all : %.tex
won't work because there is no percent in the target name, in other words, it is not a patter rule.Use
wildcard
function to get the list of all.plt
files and add anall
dependence on these files with the extension replaced by.tex
: