0

我正在尝试为 gfortran 而不是 g77 重写 Makefile。如果我包括该行

FCFLAGS += -I./include

然后它会查找我没有的 .mod 文件,但如果我省略该行,它将无法在 ./include 目录中找到它需要的文件。不知道如何解决这个问题...

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
4

1 回答 1

0

因为在用 fortran 编译主文件之前,必须先单独编译模块。

于 2017-03-14T15:37:06.130 回答