Ticket #8: CYGWIN-g95.mk

File CYGWIN-g95.mk, 3.5 KB (added by m.hadfield, 17 years ago)
Line 
1# svn $Id: CYGWIN-g95.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 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# 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 := g95
30 FFLAGS := -fno-second-underscore
31 CPP := /usr/bin/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
56ifdef USE_ARPACK
57 ifdef USE_MPI
58 PARPACK_LIBDIR ?= /usr/local/lib
59 LIBS += -L$(PARPACK_LIBDIR) -lparpack
60 endif
61 ARPACK_LIBDIR ?= /usr/local/lib
62 LIBS += -L$(ARPACK_LIBDIR) -larpack
63endif
64
65ifdef USE_DEBUG
66 FFLAGS += -g -fbounds-check -ftrace=full
67else
68 FFLAGS += -O3 -ffast-math
69endif
70
71ifdef SWAN_COUPLE
72 FFLAGS += -I/usr/local/mct/include
73 LIBS += -L$(MCT_LIBDIR) -lmct -lmpeu
74endif
75
76#
77# Set free form format in source files to allow long string for
78# local directory and compilation flags inside the code.
79#
80
81$(SCRATCH_DIR)/mod_ncparam.o: FFLAGS += -ffree-form
82$(SCRATCH_DIR)/mod_strings.o: FFLAGS += -ffree-form
83
84#
85# Supress free format in SWAN source files since there are comments
86# beyond column 72.
87#
88
89ifdef SWAN_COUPLE
90
91$(SCRATCH_DIR)/ocpcre.o: FFLAGS += -ffixed-form
92$(SCRATCH_DIR)/ocpids.o: FFLAGS += -ffixed-form
93$(SCRATCH_DIR)/ocpmix.o: FFLAGS += -ffixed-form
94$(SCRATCH_DIR)/swancom1.o: FFLAGS += -ffixed-form
95$(SCRATCH_DIR)/swancom2.o: FFLAGS += -ffixed-form
96$(SCRATCH_DIR)/swancom3.o: FFLAGS += -ffixed-form
97$(SCRATCH_DIR)/swancom4.o: FFLAGS += -ffixed-form
98$(SCRATCH_DIR)/swancom5.o: FFLAGS += -ffixed-form
99$(SCRATCH_DIR)/swanmain.o: FFLAGS += -ffixed-form
100$(SCRATCH_DIR)/swanout1.o: FFLAGS += -ffixed-form
101$(SCRATCH_DIR)/swanout2.o: FFLAGS += -ffixed-form
102$(SCRATCH_DIR)/swanparll.o: FFLAGS += -ffixed-form
103$(SCRATCH_DIR)/swanpre1.o: FFLAGS += -ffixed-form
104$(SCRATCH_DIR)/swanpre2.o: FFLAGS += -ffixed-form
105$(SCRATCH_DIR)/swanser.o: FFLAGS += -ffixed-form
106$(SCRATCH_DIR)/swmod1.o: FFLAGS += -ffixed-form
107$(SCRATCH_DIR)/swmod2.o: FFLAGS += -ffixed-form
108$(SCRATCH_DIR)/swmod3.o: FFLAGS += -ffixed-form
109
110endif