I have a fortran main program called solidsolver.f90, and a module called read_mesh.f90
. The module contains two subroutines and is used in the main program. I can compile them manually but not with a makefile. My makefile is named makefile.makefile
, and it gives me an error:
make: *** No targets specified and no makefile found. Stop.
I do need a makefile written in a concise way because in the future my code will grow exponentially. Here is the makefile:
OBJECTS = read_file.o solidsolver.o
MODULES = read_file.mod
.PHONY: clean
main.exe: $(MODULES) $(OBJECTS)
gfortran $(OBJECTS) -o main.exe
%.o: %.f90
gfortran -c $<
%.mod: %.f90
gfortran -c $<
clean:
rm -f $(OBJECTS) $(MODULES) main.exe
Alex is right. But actually the content of the makefile is wrong. I changed it as following and it works: