| 1 | # svn $Id: MINGW-gfortran.mk 47 2007-05-08 19:35:07Z arango $
|
|---|
| 2 | #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
|---|
| 3 | # Copyright (c) 2002-2007 The ROMS/TOMS Group :::
|
|---|
| 4 | # Licensed under a MIT/X style license :::
|
|---|
| 5 | # See License_ROMS.txt :::
|
|---|
| 6 | #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
|---|
| 7 | #
|
|---|
| 8 | # Include file for GNU g95 on MSYS/MinGW
|
|---|
| 9 | # -------------------------------------------------------------------------
|
|---|
| 10 | #
|
|---|
| 11 | # ARPACK_LIBDIR ARPACK libary directory
|
|---|
| 12 | # FC Name of the fortran compiler to use
|
|---|
| 13 | # FFLAGS Flags to the fortran compiler
|
|---|
| 14 | # CPP Name of the C-preprocessor
|
|---|
| 15 | # CPPFLAGS Flags to the C-preprocessor
|
|---|
| 16 | # CLEAN Name of cleaning executable after C-preprocessing
|
|---|
| 17 | # NETCDF_INCDIR NetCDF include directory
|
|---|
| 18 | # NETCDF_LIBDIR NetCDF libary directory
|
|---|
| 19 | # LD Program to load the objects into an executable
|
|---|
| 20 | # LDFLAGS Flags to the loader
|
|---|
| 21 | # RANLIB Name of ranlib command
|
|---|
| 22 | # MDEPFLAGS Flags for sfmakedepend (-s if you keep .f files)
|
|---|
| 23 | #
|
|---|
| 24 | # First the defaults
|
|---|
| 25 | #
|
|---|
| 26 |
|
|---|
| 27 | BIN := $(BIN).exe
|
|---|
| 28 |
|
|---|
| 29 | FC := gfortran
|
|---|
| 30 | FFLAGS := -frepack-arrays
|
|---|
| 31 | CPP := cpp
|
|---|
| 32 | CPPFLAGS := -P -traditional
|
|---|
| 33 | LD := $(FC)
|
|---|
| 34 | LDFLAGS :=
|
|---|
| 35 | AR := ar
|
|---|
| 36 | ARFLAGS := -r
|
|---|
| 37 | MKDIR := mkdir -p
|
|---|
| 38 | RM := rm -f
|
|---|
| 39 | RANLIB := ranlib
|
|---|
| 40 | PERL := perl
|
|---|
| 41 | TEST := test
|
|---|
| 42 |
|
|---|
| 43 | MDEPFLAGS := --cpp --fext=f90 --file=- --objdir=$(SCRATCH_DIR)
|
|---|
| 44 |
|
|---|
| 45 | #
|
|---|
| 46 | # Library locations, can be overridden by environment variables.
|
|---|
| 47 | #
|
|---|
| 48 |
|
|---|
| 49 | MCT_LIBDIR ?= /usr/local/mct/lib
|
|---|
| 50 | NETCDF_INCDIR ?= /usr/include
|
|---|
| 51 | NETCDF_LIBDIR ?= /usr/local/lib
|
|---|
| 52 |
|
|---|
| 53 | CPPFLAGS += -I$(NETCDF_INCDIR)
|
|---|
| 54 | LIBS := -L$(NETCDF_LIBDIR) -lnetcdf
|
|---|
| 55 |
|
|---|
| 56 | ifdef USE_ARPACK
|
|---|
| 57 | ARPACK_LIBDIR ?= /usr/local/lib
|
|---|
| 58 | LIBS += -L$(ARPACK_LIBDIR) -larpack
|
|---|
| 59 | endif
|
|---|
| 60 |
|
|---|
| 61 | ifdef USE_OpenMP
|
|---|
| 62 | CPPFLAGS += -D_OPENMP
|
|---|
| 63 | FFLAGS += -fopenmp
|
|---|
| 64 | endif
|
|---|
| 65 |
|
|---|
| 66 | ifdef USE_DEBUG
|
|---|
| 67 | FFLAGS += -g -fbounds-check
|
|---|
| 68 | else
|
|---|
| 69 | FFLAGS += -O3 -ffast-math
|
|---|
| 70 | endif
|
|---|
| 71 |
|
|---|
| 72 | ifdef SWAN_COUPLE
|
|---|
| 73 | FFLAGS += -I/usr/local/mct/include
|
|---|
| 74 | LIBS += -L$(MCT_LIBDIR) -lmct -lmpeu
|
|---|
| 75 | endif
|
|---|
| 76 |
|
|---|
| 77 | # Turn off bounds checking for function def_var, as "dimension(*)"
|
|---|
| 78 | # declarations confuse Gnu Fortran 95 bounds-checking code.
|
|---|
| 79 |
|
|---|
| 80 | $(SCRATCH_DIR)/def_var.o: FFLAGS += -fno-bounds-check
|
|---|
| 81 |
|
|---|
| 82 | #
|
|---|
| 83 | # Set free form format in source files to allow long string for
|
|---|
| 84 | # local directory and compilation flags inside the code.
|
|---|
| 85 | #
|
|---|
| 86 |
|
|---|
| 87 | $(SCRATCH_DIR)/mod_ncparam.o: FFLAGS += -ffree-form
|
|---|
| 88 | $(SCRATCH_DIR)/mod_strings.o: FFLAGS += -ffree-form
|
|---|
| 89 |
|
|---|
| 90 | #
|
|---|
| 91 | # Supress free format in SWAN source files since there are comments
|
|---|
| 92 | # beyond column 72.
|
|---|
| 93 | #
|
|---|
| 94 |
|
|---|
| 95 | ifdef SWAN_COUPLE
|
|---|
| 96 |
|
|---|
| 97 | $(SCRATCH_DIR)/ocpcre.o: FFLAGS += -ffixed-form
|
|---|
| 98 | $(SCRATCH_DIR)/ocpids.o: FFLAGS += -ffixed-form
|
|---|
| 99 | $(SCRATCH_DIR)/ocpmix.o: FFLAGS += -ffixed-form
|
|---|
| 100 | $(SCRATCH_DIR)/swancom1.o: FFLAGS += -ffixed-form
|
|---|
| 101 | $(SCRATCH_DIR)/swancom2.o: FFLAGS += -ffixed-form
|
|---|
| 102 | $(SCRATCH_DIR)/swancom3.o: FFLAGS += -ffixed-form
|
|---|
| 103 | $(SCRATCH_DIR)/swancom4.o: FFLAGS += -ffixed-form
|
|---|
| 104 | $(SCRATCH_DIR)/swancom5.o: FFLAGS += -ffixed-form
|
|---|
| 105 | $(SCRATCH_DIR)/swanmain.o: FFLAGS += -ffixed-form
|
|---|
| 106 | $(SCRATCH_DIR)/swanout1.o: FFLAGS += -ffixed-form
|
|---|
| 107 | $(SCRATCH_DIR)/swanout2.o: FFLAGS += -ffixed-form
|
|---|
| 108 | $(SCRATCH_DIR)/swanparll.o: FFLAGS += -ffixed-form
|
|---|
| 109 | $(SCRATCH_DIR)/swanpre1.o: FFLAGS += -ffixed-form
|
|---|
| 110 | $(SCRATCH_DIR)/swanpre2.o: FFLAGS += -ffixed-form
|
|---|
| 111 | $(SCRATCH_DIR)/swanser.o: FFLAGS += -ffixed-form
|
|---|
| 112 | $(SCRATCH_DIR)/swmod1.o: FFLAGS += -ffixed-form
|
|---|
| 113 | $(SCRATCH_DIR)/swmod2.o: FFLAGS += -ffixed-form
|
|---|
| 114 | $(SCRATCH_DIR)/swmod3.o: FFLAGS += -ffixed-form
|
|---|
| 115 |
|
|---|
| 116 | endif
|
|---|