Ticket #60: CYGWIN-g95.mk

File CYGWIN-g95.mk, 3.7 KB (added by m.hadfield, 18 years ago)

Example platform-specific make file

Line 
1# svn $Id: CYGWIN-g95.mk 80 2007-07-06 02:30:52Z 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 NETCDF_INCDIR ?= /opt/g95soft/netcdf/include
50 NETCDF_LIBDIR ?= /usr/g95soft/netcdf/lib
51
52 CPPFLAGS += -I$(NETCDF_INCDIR)
53ifdef USE_NETCDF4
54 LIBS := -L$(NETCDF_LIBDIR) -lnetcdf -lhdf5_hl -lhdf5 -lz
55else
56 LIBS := -L$(NETCDF_LIBDIR) -lnetcdf
57endif
58
59ifdef USE_ARPACK
60 ifdef USE_MPI
61 PARPACK_LIBDIR ?= /usr/local/lib
62 LIBS += -L$(PARPACK_LIBDIR) -lparpack
63 endif
64 ARPACK_LIBDIR ?= /usr/local/lib
65 LIBS += -L$(ARPACK_LIBDIR) -larpack
66endif
67
68ifdef USE_DEBUG
69 FFLAGS += -g -fbounds-check -ftrace=full
70else
71 FFLAGS += -O3 -ffast-math
72endif
73
74ifdef USE_MCT
75 MCT_INCDIR ?= /usr/local/mct/include
76 MCT_LIBDIR ?= /usr/local/mct/lib
77 FFLAGS += -I$(MCT_INCDIR)
78 LIBS += -L$(MCT_LIBDIR) -lmct -lmpeu
79endif
80
81#
82# Set free form format in source files to allow long string for
83# local directory and compilation flags inside the code.
84#
85
86$(SCRATCH_DIR)/mod_ncparam.o: FFLAGS += -ffree-form
87$(SCRATCH_DIR)/mod_strings.o: FFLAGS += -ffree-form
88
89#
90# Supress free format in SWAN source files since there are comments
91# beyond column 72.
92#
93
94ifdef USE_SWAN
95
96$(SCRATCH_DIR)/ocpcre.o: FFLAGS += -ffixed-form
97$(SCRATCH_DIR)/ocpids.o: FFLAGS += -ffixed-form
98$(SCRATCH_DIR)/ocpmix.o: FFLAGS += -ffixed-form
99$(SCRATCH_DIR)/swancom1.o: FFLAGS += -ffixed-form
100$(SCRATCH_DIR)/swancom2.o: FFLAGS += -ffixed-form
101$(SCRATCH_DIR)/swancom3.o: FFLAGS += -ffixed-form
102$(SCRATCH_DIR)/swancom4.o: FFLAGS += -ffixed-form
103$(SCRATCH_DIR)/swancom5.o: FFLAGS += -ffixed-form
104$(SCRATCH_DIR)/swanmain.o: FFLAGS += -ffixed-form
105$(SCRATCH_DIR)/swanout1.o: FFLAGS += -ffixed-form
106$(SCRATCH_DIR)/swanout2.o: FFLAGS += -ffixed-form
107$(SCRATCH_DIR)/swanparll.o: FFLAGS += -ffixed-form
108$(SCRATCH_DIR)/swanpre1.o: FFLAGS += -ffixed-form
109$(SCRATCH_DIR)/swanpre2.o: FFLAGS += -ffixed-form
110$(SCRATCH_DIR)/swanser.o: FFLAGS += -ffixed-form
111$(SCRATCH_DIR)/swmod1.o: FFLAGS += -ffixed-form
112$(SCRATCH_DIR)/swmod2.o: FFLAGS += -ffixed-form
113$(SCRATCH_DIR)/swmod3.o: FFLAGS += -ffixed-form
114
115endif