Blame view

src/Rules.make 3.41 KB
0f87998d   Dany Dumont   Ajout du fichier ...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
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
#$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
#FORTRAN_COMPILER=GFORTRAN
FORTRAN_COMPILER=IFORT

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

# What do we include in this compilation
NetCDF   = true
SEDIMENT = false
SEAGRASS = false
BIO      = true

FEATURES     =
FEATURE_LIBS =
EXTRA_LIBS   =
INCDIRS	     =
LDFLAGS	     =

# If we want NetCDF - where are the include files and the library
NETCDFINC    = /usr/include 
NETCDFLIBDIR = /usr/lib64

ifdef NETCDFINC
INCDIRS     += -I$(NETCDFINC)
endif
ifdef NETCDFLIBNAME
NETCDFLIB    = $(NETCDFLIBNAME)
else
NETCDFLIB    = -lnetcdff
endif
ifdef NETCDFLIBDIR
LDFLAGS     += -L$(NETCDFLIBDIR)
endif

# phony targets
.PHONY: clean realclean distclean dummy

# Top of this version of GOTM.
ifndef GOTMDIR
GOTMDIR := $(HOME)/git/gotm_ismer
endif

CPP	 = /usr/bin/cpp

# Here you can put defines for the [c|f]pp - some will also be set depending
# on compilation mode.
ifeq ($(NetCDF),true)
DEFINES      += -DNETCDF_FMT
EXTRA_LIBS   += $(NETCDFLIB)
endif
ifeq ($(SEDIMENT),true)
DEFINES      += -DSEDIMENT
FEATURES     +=  extras/sediment
FEATURE_LIBS += -lsediment$(buildtype)
endif
ifeq ($(SEAGRASS),true)
DEFINES      += -DSEAGRASS
FEATURES     +=  extras/seagrass
FEATURE_LIBS += -lseagrass$(buildtype)
endif
ifeq ($(BIO),true)
DEFINES      += -DBIO
FEATURES     +=  extras/bio
FEATURE_LIBS += -lbio$(buildtype)
endif

# Directory related settings.

ifndef BINDIR
BINDIR	= $(GOTMDIR)/bin
endif

ifndef LIBDIR
LIBDIR += $(GOTMDIR)/lib/$(FORTRAN_COMPILER)
endif

ifndef MODDIR
#MODDIR	= $(GOTMDIR)/modules
MODDIR	= $(GOTMDIR)/modules/$(FORTRAN_COMPILER)
endif
INCDIRS	+= -I/usr/local/include -I$(GOTMDIR)/include -I$(MODDIR)

# 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