如何将Makefile与gnuplot一起使用? (/)------------------------------+----------+ | | | | | | (任务1)----------+(数据)(图像) | | | | (gnuplot)Makefile input.dat output.png | . ^ 绘图。gpi。。。。。。。

如何将Makefile与gnuplot一起使用? (/)------------------------------+----------+ | | | | | | (任务1)----------+(数据)(图像) | | | | (gnuplot)Makefile input.dat output.png | . ^ 绘图。gpi。。。。。。。,makefile,gnuplot,Makefile,Gnuplot,根据我的图表,我的问题是如何编写Makefile来处理这个案例中的gnuplot 详情如下: 我有plotting.gpi(gnuplot脚本),它从input.dat读取输入并生成输出到output.png文件。要执行脚本,我们只需键入gnuplot path/To/plotting.gpi其中path/To/file取决于在gnuplot文件夹内执行gnuplot命令的位置。只要gnuplot绘图。gpi就足够了 我试过什么 我试图写一个非常简单的Makefile,但我的理解似乎不够好。我的

根据我的图表,我的问题是如何编写
Makefile
来处理这个案例中的gnuplot

详情如下:

我有
plotting.gpi
(gnuplot脚本),它从
input.dat
读取输入并生成输出到
output.png
文件。要执行脚本,我们只需键入
gnuplot path/To/plotting.gpi
其中
path/To/file
取决于在
gnuplot
文件夹内执行
gnuplot
命令的位置。只要
gnuplot绘图。gpi
就足够了

我试过什么


我试图写一个非常简单的
Makefile
,但我的理解似乎不够好。我的
Makefile
在文件路径方面有一些问题,有时
Makefile
中的代码没有执行一些代码行。

您必须创建一个类似

    (/)-----------------------+------------+   
     |                        |            |
     |                        |            |
  (task#1)--------+         (data)      (images)
     |            |           |            |
 (gnuplot)    Makefile     input.dat   output.png
     |                        .            ^
plotting.gpi<....input....<....            .
     .                                     .
     .........>.......output........>.......
您可以在根目录或task1目录中键入
make

这些文件包含以下文本

Makefile

.
├── data
│   └── input.dat
├── images
│   └── output.png
├── Makefile
└── task1
    ├── gnuplot
    │   └── ploting.gpi
    └── Makefile
all :
                make all -C task1

clean:
                make clean -C task1
task1/Makefile

.
├── data
│   └── input.dat
├── images
│   └── output.png
├── Makefile
└── task1
    ├── gnuplot
    │   └── ploting.gpi
    └── Makefile
all :
                make all -C task1

clean:
                make clean -C task1
绘图.gpi

IMAGES=../images/output.png

all : $(IMAGES)

clean:
                rm $(IMAGES)

../images/output.png : gnuplot/ploting.gpi ../data/input.dat
                gnuplot gnuplot/ploting.gpi
input.dat

set term pngcairo 
set output '../images/output.png'
plot '../data/input.dat' using 1:2 with lp
set term x11
output.png是
您必须创建一个文件结构,如

    (/)-----------------------+------------+   
     |                        |            |
     |                        |            |
  (task#1)--------+         (data)      (images)
     |            |           |            |
 (gnuplot)    Makefile     input.dat   output.png
     |                        .            ^
plotting.gpi<....input....<....            .
     .                                     .
     .........>.......output........>.......
您可以在根目录或task1目录中键入
make

这些文件包含以下文本

Makefile

.
├── data
│   └── input.dat
├── images
│   └── output.png
├── Makefile
└── task1
    ├── gnuplot
    │   └── ploting.gpi
    └── Makefile
all :
                make all -C task1

clean:
                make clean -C task1
task1/Makefile

.
├── data
│   └── input.dat
├── images
│   └── output.png
├── Makefile
└── task1
    ├── gnuplot
    │   └── ploting.gpi
    └── Makefile
all :
                make all -C task1

clean:
                make clean -C task1
绘图.gpi

IMAGES=../images/output.png

all : $(IMAGES)

clean:
                rm $(IMAGES)

../images/output.png : gnuplot/ploting.gpi ../data/input.dat
                gnuplot gnuplot/ploting.gpi
input.dat

set term pngcairo 
set output '../images/output.png'
plot '../data/input.dat' using 1:2 with lp
set term x11
output.png是
您必须创建一个文件结构,如

    (/)-----------------------+------------+   
     |                        |            |
     |                        |            |
  (task#1)--------+         (data)      (images)
     |            |           |            |
 (gnuplot)    Makefile     input.dat   output.png
     |                        .            ^
plotting.gpi<....input....<....            .
     .                                     .
     .........>.......output........>.......
您可以在根目录或task1目录中键入
make

这些文件包含以下文本

Makefile

.
├── data
│   └── input.dat
├── images
│   └── output.png
├── Makefile
└── task1
    ├── gnuplot
    │   └── ploting.gpi
    └── Makefile
all :
                make all -C task1

clean:
                make clean -C task1
task1/Makefile

.
├── data
│   └── input.dat
├── images
│   └── output.png
├── Makefile
└── task1
    ├── gnuplot
    │   └── ploting.gpi
    └── Makefile
all :
                make all -C task1

clean:
                make clean -C task1
绘图.gpi

IMAGES=../images/output.png

all : $(IMAGES)

clean:
                rm $(IMAGES)

../images/output.png : gnuplot/ploting.gpi ../data/input.dat
                gnuplot gnuplot/ploting.gpi
input.dat

set term pngcairo 
set output '../images/output.png'
plot '../data/input.dat' using 1:2 with lp
set term x11
output.png是
您必须创建一个文件结构,如

    (/)-----------------------+------------+   
     |                        |            |
     |                        |            |
  (task#1)--------+         (data)      (images)
     |            |           |            |
 (gnuplot)    Makefile     input.dat   output.png
     |                        .            ^
plotting.gpi<....input....<....            .
     .                                     .
     .........>.......output........>.......
您可以在根目录或task1目录中键入
make

这些文件包含以下文本

Makefile

.
├── data
│   └── input.dat
├── images
│   └── output.png
├── Makefile
└── task1
    ├── gnuplot
    │   └── ploting.gpi
    └── Makefile
all :
                make all -C task1

clean:
                make clean -C task1
task1/Makefile

.
├── data
│   └── input.dat
├── images
│   └── output.png
├── Makefile
└── task1
    ├── gnuplot
    │   └── ploting.gpi
    └── Makefile
all :
                make all -C task1

clean:
                make clean -C task1
绘图.gpi

IMAGES=../images/output.png

all : $(IMAGES)

clean:
                rm $(IMAGES)

../images/output.png : gnuplot/ploting.gpi ../data/input.dat
                gnuplot gnuplot/ploting.gpi
input.dat

set term pngcairo 
set output '../images/output.png'
plot '../data/input.dat' using 1:2 with lp
set term x11
output.png是

对不起@ctheo,我想我弄错了
Makefile
应该在
task#1
文件夹中。对不起@ctheo,我想我弄错了
Makefile
应该在
task#1
文件夹中。对不起@ctheo,我想我弄错了
Makefile
应该在
task#1
文件夹中。对不起@ctheo,我想我弄错了<代码>生成文件应位于
任务#1
文件夹中。