How to use include in gfortran?

678 Views Asked by At

I am trying to rewrite a Makefile for gfortran instead of g77. If I include the line

FCFLAGS += -I./include

then it looks for a .mod file that I do not have, but if I omit that line it can't find a file it needs in the ./include directory. Not sure how to fix this...

CMD     = tomoDD2
CC      = gcc
FC      = /usr/local/bin/gfortran
FCFLAGS = -g -fbounds-check
FCFLAGS = -O2
FCFLAGS += -I./include

SRCS    = $(CMD).f \
          aprod.f cluster_tomoDD.f covar.f datum.f \
          delaz.f delaz2.f direct1.f dist.f exist.f \
          freeunit.f getinp_tomoDD.f ifindi.f \
          indexxi.f juliam.f syn_time_new.f\
          lsqr.f matmult1.f matmult2.f matmult3.f mdian1.f \
          normlz.f  ran.f redist.f refract.f \
          resstat_tomoDD.f scopy.f sdc2.f setorg.f \
          snrm2.f sort.f sorti.f sscal.f \
          svd.f tiddid.f trialsrc_tomoDD.f trimlen.f \
          ttime.f vmodel.f Ray3VD.f \
          getdata_tomoDD.f add_sta.f find_id.f \
          dtres_tomoDD.f weighting_tomoDD_lw.f lsfitH_tomoDD_lsqrn.f
CSRCS   = atoangle_.c atoangle.c ndatetime_.c nhypot_.c nrpad_.c \
          sscanf3_.c
OBJS    = $(SRCS:%.f=%.o) $(CSRCS:%.c=%.o)
INCLDIR = ./include

all: $(CMD)

$(CMD): $(OBJS)
        $(FC) $(OBJS) $(LIBS) -o $@

%.o: %.f
        $(FC) $(FCFLAGS) -c $(@F:.o=.f) -o $@
#       $(FC) $(FCFLAGS) -c $<

clean:
        -rm -f $(CMD) *.o core a.out *.fln junk
1

There are 1 best solutions below

2
Media On

Because the modules have to be compiled first individually before compiling the main file in fortran.