Blame view

src/Rules.make.template 3.41 KB
33b83817   dumoda01   Depot du modele /...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#$Id: Rules.make,v 1.17 2006-10-26 13:12:46 kbk Exp $

SHELL   = /bin/sh

# The compilation mode is obtained from $COMPILATION_MODE - 
# default production - else debug or profiling
ifndef COMPILATION_MODE
compilation=production
else
compilation=$(COMPILATION_MODE)
endif

# Force this here. Could be done in bashrc.
#FORTRAN_COMPILER=PGF90
fb704842   dumoda01   Nettoyage du fich...
15
16
#FORTRAN_COMPILER=GFORTRAN
FORTRAN_COMPILER=IFORT
33b83817   dumoda01   Depot du modele /...
17
18
19
20
21

DEFINES=-DNUDGE_VEL
DEFINES=-D$(FORTRAN_COMPILER)

# What do we include in this compilation
fb704842   dumoda01   Nettoyage du fich...
22
23
24
25
26
27
28
29
30
31
NetCDF   = true
SEDIMENT = false
SEAGRASS = false
BIO      = true

FEATURES     =
FEATURE_LIBS =
EXTRA_LIBS   =
INCDIRS	     =
LDFLAGS	     =
33b83817   dumoda01   Depot du modele /...
32
33

# If we want NetCDF - where are the include files and the library
fb704842   dumoda01   Nettoyage du fich...
34
35
NETCDFINC    = /usr/local/include 
NETCDFLIBDIR = /usr/local/lib
33b83817   dumoda01   Depot du modele /...
36
37

ifdef NETCDFINC
fb704842   dumoda01   Nettoyage du fich...
38
INCDIRS     += -I$(NETCDFINC)
33b83817   dumoda01   Depot du modele /...
39
40
endif
ifdef NETCDFLIBNAME
fb704842   dumoda01   Nettoyage du fich...
41
NETCDFLIB    = $(NETCDFLIBNAME)
33b83817   dumoda01   Depot du modele /...
42
else
fb704842   dumoda01   Nettoyage du fich...
43
NETCDFLIB    = -lnetcdf
33b83817   dumoda01   Depot du modele /...
44
45
endif
ifdef NETCDFLIBDIR
fb704842   dumoda01   Nettoyage du fich...
46
LDFLAGS     += -L$(NETCDFLIBDIR)
33b83817   dumoda01   Depot du modele /...
47
48
endif

33b83817   dumoda01   Depot du modele /...
49
# phony targets
33b83817   dumoda01   Depot du modele /...
50
51
52
53
.PHONY: clean realclean distclean dummy

# Top of this version of GOTM.
ifndef GOTMDIR
fb704842   dumoda01   Nettoyage du fich...
54
GOTMDIR := $(HOME)/gotm_ismer
33b83817   dumoda01   Depot du modele /...
55
56
endif

fb704842   dumoda01   Nettoyage du fich...
57
CPP	 = /usr/bin/cpp
33b83817   dumoda01   Depot du modele /...
58
59
60
61

# Here you can put defines for the [c|f]pp - some will also be set depending
# on compilation mode.
ifeq ($(NetCDF),true)
fb704842   dumoda01   Nettoyage du fich...
62
63
DEFINES      += -DNETCDF_FMT
EXTRA_LIBS   += $(NETCDFLIB)
33b83817   dumoda01   Depot du modele /...
64
65
endif
ifeq ($(SEDIMENT),true)
fb704842   dumoda01   Nettoyage du fich...
66
67
DEFINES      += -DSEDIMENT
FEATURES     +=  extras/sediment
33b83817   dumoda01   Depot du modele /...
68
69
70
FEATURE_LIBS += -lsediment$(buildtype)
endif
ifeq ($(SEAGRASS),true)
fb704842   dumoda01   Nettoyage du fich...
71
72
DEFINES      += -DSEAGRASS
FEATURES     +=  extras/seagrass
33b83817   dumoda01   Depot du modele /...
73
74
75
FEATURE_LIBS += -lseagrass$(buildtype)
endif
ifeq ($(BIO),true)
fb704842   dumoda01   Nettoyage du fich...
76
77
DEFINES      += -DBIO
FEATURES     +=  extras/bio
33b83817   dumoda01   Depot du modele /...
78
79
80
81
82
83
84
85
86
87
FEATURE_LIBS += -lbio$(buildtype)
endif

# Directory related settings.

ifndef BINDIR
BINDIR	= $(GOTMDIR)/bin
endif

ifndef LIBDIR
fb704842   dumoda01   Nettoyage du fich...
88
LIBDIR += $(GOTMDIR)/lib/$(FORTRAN_COMPILER)
33b83817   dumoda01   Depot du modele /...
89
90
91
92
93
94
endif

ifndef MODDIR
#MODDIR	= $(GOTMDIR)/modules
MODDIR	= $(GOTMDIR)/modules/$(FORTRAN_COMPILER)
endif
fb704842   dumoda01   Nettoyage du fich...
95
INCDIRS	+= -I/usr/local/include -I$(GOTMDIR)/include -I$(MODDIR)
33b83817   dumoda01   Depot du modele /...
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157

# Normaly this should not be changed - unless you want something very specific.

# The Fortran compiler is determined from the EV FORTRAN_COMPILER - options 
# sofar NAG(linux), FUJITSU(Linux), DECF90 (OSF1 and likely Linux on alpha),
# SunOS, PGF90 - Portland Group Fortran Compiler (on Intel Linux).

# Sets options for debug compilation
ifeq ($(compilation),debug)
buildtype = _debug
DEFINES += -DDEBUG $(STATIC)
FLAGS   = $(DEBUG_FLAGS) 
endif

# Sets options for profiling compilation
ifeq ($(compilation),profiling)
buildtype = _prof
DEFINES += -DPROFILING $(STATIC)
FLAGS   = $(PROF_FLAGS) 
endif

# Sets options for production compilation
ifeq ($(compilation),production)
buildtype = _prod
DEFINES += -DPRODUCTION $(STATIC)
FLAGS   = $(PROD_FLAGS) 
endif

include $(GOTMDIR)/compilers/compiler.$(FORTRAN_COMPILER)

#DEFINES += -DREAL_4B=$(REAL_4B)
#ifeq ($(FORTRAN_COMPILER),XLF)
#DEFINES:=-WF,"$(DEFINES)"
#DEFINES=-WF,"-DXLF -DNETCDF_FMT -DSEAGRASS -DFORTRAN95 -DPRODUCTION -DREAL_4B=real\(4\)"
#endif

# For making the source code documentation.
PROTEX	= protex -b -n -s

.SUFFIXES:
.SUFFIXES: .F90

LINKDIR	= -L$(LIBDIR)

CPPFLAGS	= $(DEFINES) $(INCDIRS)
FFLAGS  	= $(DEFINES) $(FLAGS) $(MODULES) $(INCDIRS) $(EXTRAS)
F90FLAGS  	= $(FFLAGS)
LDFLAGS		+= $(FFLAGS) $(LINKDIR)

#
# Common rules
#
ifeq  ($(can_do_F90),true)
%.o: %.F90
	$(FC) $(F90FLAGS) $(EXTRA_FFLAGS) -c $< -o $@
else
%.f90: %.F90
#	$(CPP) $(CPPFLAGS) $< -o $@
	$(F90_to_f90)
%.o: %.f90
	$(FC) $(F90FLAGS) $(EXTRA_FFLAGS) -c $< -o $@
endif