我想将makefile的编译器从pgi更改为gfortran,我想知道如何更改FC和FFLAGS才能使其工作



我有5个makefile,它们是为pgi编译器设计的。然而,我的系统正在使用gfortran,我不知道如何使它们与我的系统一起工作,也不知道我应该如何更改FC和FFLAGS。我是Linux操作系统的新手,我使用的是Ubuntu 20.04。以下是文件包含的内容:

SHELL=/bin/sh
FC= pgf90
FFLAGS= -O -Mvect=sse -Mextend -Msecond_underscore -Mlfs -Bstatic
PROGRAM= mgn2mech
LIBS =   -L/models/CMAQ/lib/ioapi_3.mulcahy/Linux2_x86pg -lioapi 
-L/models/CMAQ/lib/ioapi_3.mulcahy/Linux2_x86pg -lnetcdf
INCLUDE = -I/models/CMAQ/lib/ioapi_3.mulcahy/ioapi/fixed_src 
-I/models/CMAQ/lib/netcdf-3.6.0-p1.mulcahy/include 
-I$(CURDIR)/INCLDIR
OBJS = 
checkmem.o 
growseason.o 
$(PROGRAM).o
MODULES= *mod.f
#-----------------------------------------------------------------------
# line to allow file.mod files to be recognised by GNU make
%.o : %.mod
#-----------------------------------------------------------------------
.SUFFIXES : .f .f .o 
.f.o:
$(FC) -c $(FFLAGS) $(INCLUDE) $<
.F.o:
$(FC) -c $(FFLAGS) $(INCLUDE) $<
#-----------------------------------------------------------------------
$(PROGRAM): $(OBJS)
$(FC) $(FFLAGS) $(INCLUDE) -o $(@) $(OBJS) $(LIBS)
#-----------------------------------------------------------------------
clean:
rm -f $(PROGRAM) *.o *.mod *.core
#-----------------------------------------------------------------------

下一篇:

FC = /usr/local/pgi/linux86/bin/pgf90
FCFLGS = -O -Mextend -Mbounds -Mlfs -Msecond_underscore
FCFLGS2 = -O -Mbyteswapio -Mextend -Mbounds -Mlfs -Msecond_underscore
LNKFLGS = -Bstatic
OBJCTS = 
met2mgn.o 
readpar.o 
readmcip.o 
micromet.o 
caldate.o 
lcpgeo.o 
interp_lcp.o 
procmm5.o 
readmm5.o 
xtod.o 
vertmap.o 
juldate.o 
utmgeo.o
LIBS = -L/models/CMAQ/lib/ioapi_3.mulcahy/Linux2_x86pg -lioapi 
-L/models/CMAQ/lib/netcdf-3.6.0-p1.mulcahy/lib -lnetcdf -lpthread
INC = -I/models/CMAQ/lib/ioapi_3.mulcahy/ioapi/fixed_src 
-I/models/CMAQ/lib/netcdf-3.6.0-p1.mulcahy/include
met2mgn: $(OBJCTS)
$(FC) -o met2mgn $(LNKFLGS) $(OBJCTS) $(LIBS)
met2mgn.o:
$(FC) -c $(FCFLGS2) $(INC) met2mgn.f
readpar.o:
$(FC) -c $(FCFLGS) $(INC) readpar.f
readmcip.o:
$(FC) -c $(FCFLGS2) $(INC) readmcip.f
micromet.o:
$(FC) -c $(FCFLGS2) $(INC) micromet.f
caldate.o:
$(FC) -c $(FCFLGS2) $(INC) caldate.f
lcpgeo.o:
$(FC) -c $(FCFLGS2) ${INC} lcpgeo.f
interp_lcp.o:
$(FC) -c $(FCFLGS2) ${INC} interp_lcp.f
procmm5.o:
$(FC) -c $(FCFLGS2) ${INC} procmm5.f
readmm5.o:
$(FC) -c $(FCFLGS2) ${INC} readmm5.f
xtod.o:
$(FC) -c $(FCFLGS2) ${INC} xtod.f
vertmap.o:
$(FC) -c $(FCFLGS2) ${INC} vertmap.f
juldate.o:
$(FC) -c $(FCFLGS2) ${INC} juldate.f
utmgeo.o:
$(FC) -c $(FCFLGS2) ${INC} utmgeo.f
clean:
rm -rf *.o met2mgn

下一篇:

SHELL = /bin/sh
FC = pgf90
FFLAGS = -O2 -Mdalign -Mnoframe -byteswapio -Mlfs -Bstatic
PROGRAM = ioapi2uam
LIBS = -L/models/MEGAN/MEGANv2.03a/lib/ioapi_3/Linux2_x86pg -lioapi 
-L/models/MEGAN/MEGANv2.03a/lib/netCDF/lib -lnetcdf
INCLUDE = -I/models/MEGAN/MEGANv2.03a/lib/ioapi_3/fixed_src
RAW = $(PROGRAM).o
.f.o:
$(FC) $(FFLAGS) $(INCLUDE) -c -o $@ $<
.F.o:
$(FC) $(FFLAGS) $(INCLUDE) -c -o $@ $<
$(PROGRAM):     $(RAW)
$(FC) $(FFLAGS) $(INCLUDE) -o $(@) $(RAW) $(LIBS)
clean:
rm -f $(PROGRAM)

下一篇:

SHELL=/bin/sh
FC= pgf90
FFLAGS= -O -Mvect=sse -Mextend -Msecond_underscore -Mlfs -Bstatic
PROGRAM= emproc
LIBS =   -L/models/CMAQ/lib/ioapi_3.mulcahy/Linux2_x86pg -lioapi 
-L/models/CMAQ/lib/ioapi_3.mulcahy/Linux2_x86pg -lnetcdf
INCLUDE = -I/models/CMAQ/lib/ioapi_3.mulcahy/ioapi/fixed_src 
-I/models/CMAQ/lib/netcdf-3.6.0-p1.mulcahy/include 
-I$(CURDIR)/INCLDIR
OBJS = 
gamma_etc.o 
checkmem.o 
canopy.o 
solarangle.o 
findlai.o 
soilnox_fx.o 
soilnox.o 
$(PROGRAM).o
MODULES= *mod.f
#-----------------------------------------------------------------------
# line to allow file.mod files to be recognised by GNU make
%.o : %.mod
#-----------------------------------------------------------------------
.SUFFIXES : .f .f .o 
.f.o:
$(FC) -c $(FFLAGS) $(INCLUDE) $<
.F.o:
$(FC) -c $(FFLAGS) $(INCLUDE) $<
#-----------------------------------------------------------------------
$(PROGRAM): $(OBJS)
$(FC) $(FFLAGS) $(INCLUDE) -o $(@) $(OBJS) $(LIBS)
#-----------------------------------------------------------------------
clean:
rm -f $(PROGRAM) *.o *.mod *.core
#-----------------------------------------------------------------------

上一篇:

SHELL=/bin/sh
FC= pgf90
FFLAGS= -O -Mvect=sse -Mextend -Msecond_underscore -Mlfs -Bstatic
PROGRAM= emproc
LIBS =   -L/models/CMAQ/lib/ioapi_3.mulcahy/Linux2_x86pg -lioapi 
-L/models/CMAQ/lib/ioapi_3.mulcahy/Linux2_x86pg -lnetcdf
INCLUDE = -I/models/CMAQ/lib/ioapi_3.mulcahy/ioapi/fixed_src 
-I/models/CMAQ/lib/netcdf-3.6.0-p1.mulcahy/include 
-I$(CURDIR)/INCLDIR
OBJS = 
gamma_etc.o 
checkmem.o 
canopy.o 
solarangle.o 
findlai.o 
soilnox_fx.o 
soilnox.o 
$(PROGRAM).o
MODULES= *mod.f
#-----------------------------------------------------------------------
# line to allow file.mod files to be recognised by GNU make
%.o : %.mod
#-----------------------------------------------------------------------
.SUFFIXES : .f .f .o 
.f.o:
$(FC) -c $(FFLAGS) $(INCLUDE) $<
.F.o:
$(FC) -c $(FFLAGS) $(INCLUDE) $<
#-----------------------------------------------------------------------
$(PROGRAM): $(OBJS)
$(FC) $(FFLAGS) $(INCLUDE) -o $(@) $(OBJS) $(LIBS)
#-----------------------------------------------------------------------
clean:
rm -f $(PROGRAM) *.o *.mod *.core
#-----------------------------------------------------------------------

查看I/O API M3ToolsMakefile模板。

请注意ioapi/Makeinclude${BIN}各种类型的文件——在这种情况下,$BIN=Linux2_x86_64gfort(适用于gfortran版本10之前的版本(或$BIN=Linux2_x86_64gfort10(适用于gfort ran10或更高版本(将为您提供所需的标志。

还要注意,这个m3tools/Makefile.template与底层Models-3 I/O API的集成比代码作者提供的更好。。。。

相关内容

  • 没有找到相关文章

最新更新