Issue
I have 3 C files, all of them form one C program. One of them is a MPI file, it is called mpi.c, the others are read.c and write.c. I don't know how to include mpi.c in my Makefile, here's got I got so far (and it's wrong):
all: program
program: mpi.o read.o write.o
mpicc mpi.o read.o write.o -o program // I think this line is wrong
mpi.o: mpi.c
mpicc -o mpi.o mpi.c
read.o: read.c
gcc -c read.c -o read.o
write.o: write.c
gcc -c write.c -o write.o
clean:
rm -f write.o read.o mpi.o program core *~
Solution
I think it's this line:
mpicc -o mpi.o mpi.c
and that it should be
mpicc -c mpi.c -o mpi.o
or simply
mpicc -c mpi.c
The way it stands, it's attempting to compile mpi.c alone into a program called mpi.o, when mpi.o should simply be an object file.
Answered By - Wintermute