基于MPI的C程序的简单makefile

基于MPI的C程序的简单makefile,makefile,mpi,Makefile,Mpi,我正在编写我的第一个基于MPI的C程序。我有四个文件,即MPI_Program.c和Helper.c,以及它们相应的.h文件。c包括MPI.h和Helper.h 我编写了以下简单的makefile来编译MPI_程序,但出现了错误“没有规则生成目标MPI.h” 以下是生成文件: # Rules to produce the target all: MPI_Program MPI_Program: MPI_Program.o Helper.o mpixlc MPI_Program.o

我正在编写我的第一个基于MPI的C程序。我有四个文件,即MPI_Program.c和Helper.c,以及它们相应的.h文件。c包括MPI.h和Helper.h

我编写了以下简单的makefile来编译MPI_程序,但出现了错误“没有规则生成目标MPI.h”

以下是生成文件:

# Rules to produce the target

all: MPI_Program

MPI_Program: MPI_Program.o Helper.o 
     mpixlc MPI_Program.o Helper.o -f machineFile -std=c99 -g -o MPI_Program


# Rules to produce the object files

Helper.o: Helper.c Helper.h
     gcc -c Helper.c -std=c99 -g

MPI_Program.o: MPI_Program.c MPI_Program.h Helper.h mpi.h
     mpixlc -c MPI_Program.c -std=c99 -g -f machineFile

我确实遗漏了一些东西…请有人提供建议。

您确定运行Make的目录中存在
mpi.h
吗?我假设mpi.h是实际的mpi库头文件。在这种情况下,如果您想将其包括在这样的先决条件列表中,则需要使用完整路径列出它。。。也就是说,你可能实际上并不想这样做(不过你可能想看看MadScientist网站上自动生成依赖项的东西)。