Ticket #41: CYGWIN-gfortran.mk

File CYGWIN-gfortran.mk, 3.7 KB (added by m.hadfield, 17 years ago)
Line 
1# svn $Id: CYGWIN-gfortran.mk 49 2007-05-10 21:40:11Z 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 Cygwin
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# NETCDF_INCDIR NetCDF include directory
17# NETCDF_LIBDIR NetCDF libary directory
18# LD Program to load the objects into an executable
19# LDFLAGS Flags to the loader
20# RANLIB Name of ranlib command
21# MDEPFLAGS Flags for sfmakedepend (-s if you keep .f files)
22#
23# First the defaults
24#
25
26 BIN := $(BIN).exe
27
28 FC := gfortran
29 FFLAGS := -frepack-arrays
30 CPP := /usr/bin/cpp
31 CPPFLAGS := -P -traditional
32 LD := $(FC)
33 LDFLAGS :=
34 AR := ar
35 ARFLAGS := -r
36 MKDIR := mkdir -p
37 RM := rm -f
38 RANLIB := ranlib
39 PERL := perl
40 TEST := test
41
42 MDEPFLAGS := --cpp --fext=f90 --file=- --objdir=$(SCRATCH_DIR)
43
44#
45# Library locations, can be overridden by environment variables.
46#
47
48 MCT_INCDIR ?= /usr/local/mct/include
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
56ifdef USE_ARPACK
57 ARPACK_LIBDIR ?= /usr/local/lib
58 LIBS += -L$(ARPACK_LIBDIR) -larpack
59endif
60
61ifdef USE_OpenMP
62 CPPFLAGS += -D_OPENMP
63 FFLAGS += -fopenmp
64endif
65
66ifdef USE_DEBUG
67 FFLAGS += -g -fbounds-check -Wall -Wno-unused-variable -Wno-unused-label
68else
69 FFLAGS += -O3 -ffast-math
70endif
71
72ifdef SWAN_COUPLE
73 FFLAGS += -I$(MCT_INCDIR)
74 LIBS += -L$(MCT_LIBDIR) -lmct -lmpeu
75endif
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
95ifdef 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
116endif