I'm trying to write a simple makefile and having a few problems. When I
run it ...
1) It only builds the fileA.f90 file and ignores the others.
2) It doesn't put the fileA.o inside my obj dir.

Any help much appreciated.

--- Makefile
COMMAND = myProg

SRCDIR = ./src
OBJDIR = ./obj
BINDIR = ./bin
MODDIR = $(SRCDIR)/modules
VPATH = $(SRCDIR) $(MODDIR)

FC = gfortran
FFLAGS = -I${SRCDIR} -I${MODDIR}

.SUFFIXES:
.SUFFIXES: .f90 .F90 .f .F .o .mod

include filelist.mk

$(OBJDIR)/%.o : $(addprefix $(MODDIR)/, $(MODSRC))
    $(FC) $(FFLAGS) -c $<

# not exactly sure what I'm doing here, but I have files that
# will depend on other files and these file have several
# different extensions. So I'm guessing for each file that needs
# another file, I just write a rule for it like this ...
$(OBJDIR)/fileA.o:  $(MODDIR)/fileA.f90
$(OBJDIR)/fileB.o:  $(MODDIR)/fileB.f90 $(MODDIR)/fileD.F
$(OBJDIR)/fileC.o:  $(MODDIR)/fileC.F90 $(MODDIR)/fileE.f90
$(OBJDIR)/fileD.o:  $(MODDIR)/fileD.F
$(OBJDIR)/fileE.o:  $(MODDIR)/fileE.f90

--- filelist.mk

MODSRC = fileA.f90 fileB.f90 fileC.F90 fileD.F fileE.f90

_______________________________________________
help-gnu-utils mailing list
help-gnu-utils@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-utils

Reply via email to