[英]How to use Makefile with gnuplot?
(/)-----------------------+------------+
| | |
| | |
(task#1)--------+ (data) (images)
| | | |
(gnuplot) Makefile input.dat output.png
| . ^
plotting.gpi<....input....<.... .
. .
.........>.......output........>.......
根据我的图,我的问题是在这种情况下如何编写Makefile
与gnuplot一起使用?
详细信息是:
我有plotting.gpi
从读取输入(gnuplot的脚本) input.dat
并生成输出到output.png
文件。 要执行脚本,我们只需要输入gnuplot path/to/plotting.gpi
,其中path/to/file
取决于gnuplot
文件夹中您在哪里执行gnuplot
命令。 只需gnuplot plotting.gpi
就足够了。
我尝试了什么?
我试图编写一个非常简单的Makefile
但似乎我的理解还不够好。 我的Makefile
关于文件路径存在一些问题,有时Makefile
中的代码未执行某些代码行。
您必须创建一个类似的文件结构
.
├── data
│ └── input.dat
├── images
│ └── output.png
├── Makefile
└── task1
├── gnuplot
│ └── ploting.gpi
└── Makefile
您可以在根目录或task1目录中键入make
。
这些文件具有以下文本
生成文件
all :
make all -C task1
clean:
make clean -C task1
task1 / Makefile
IMAGES=../images/output.png
all : $(IMAGES)
clean:
rm $(IMAGES)
../images/output.png : gnuplot/ploting.gpi ../data/input.dat
gnuplot gnuplot/ploting.gpi
plot.gpi
set term pngcairo
set output '../images/output.png'
plot '../data/input.dat' using 1:2 with lp
set term x11
input.dat
1 1
2 2
3 0
4 2
5 3
output.png是
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.