Commit 0f87998d70a2b189d16e035e5236243a3703315f

Authored by Dany Dumont
1 parent b9e7fd9a
Exists in master and in 1 other branch snow

Ajout du fichier Rules.make

Showing 1 changed file with 157 additions and 0 deletions   Show diff stats
src/Rules.make 0 → 100755
... ... @@ -0,0 +1,157 @@
  1 +#$Id: Rules.make,v 1.17 2006-10-26 13:12:46 kbk Exp $
  2 +
  3 +SHELL = /bin/sh
  4 +
  5 +# The compilation mode is obtained from $COMPILATION_MODE -
  6 +# default production - else debug or profiling
  7 +ifndef COMPILATION_MODE
  8 +compilation=production
  9 +else
  10 +compilation=$(COMPILATION_MODE)
  11 +endif
  12 +
  13 +# Force this here. Could be done in bashrc.
  14 +#FORTRAN_COMPILER=PGF90
  15 +#FORTRAN_COMPILER=GFORTRAN
  16 +FORTRAN_COMPILER=IFORT
  17 +
  18 +DEFINES=-DNUDGE_VEL
  19 +DEFINES=-D$(FORTRAN_COMPILER)
  20 +
  21 +# What do we include in this compilation
  22 +NetCDF = true
  23 +SEDIMENT = false
  24 +SEAGRASS = false
  25 +BIO = true
  26 +
  27 +FEATURES =
  28 +FEATURE_LIBS =
  29 +EXTRA_LIBS =
  30 +INCDIRS =
  31 +LDFLAGS =
  32 +
  33 +# If we want NetCDF - where are the include files and the library
  34 +NETCDFINC = /usr/include
  35 +NETCDFLIBDIR = /usr/lib64
  36 +
  37 +ifdef NETCDFINC
  38 +INCDIRS += -I$(NETCDFINC)
  39 +endif
  40 +ifdef NETCDFLIBNAME
  41 +NETCDFLIB = $(NETCDFLIBNAME)
  42 +else
  43 +NETCDFLIB = -lnetcdff
  44 +endif
  45 +ifdef NETCDFLIBDIR
  46 +LDFLAGS += -L$(NETCDFLIBDIR)
  47 +endif
  48 +
  49 +# phony targets
  50 +.PHONY: clean realclean distclean dummy
  51 +
  52 +# Top of this version of GOTM.
  53 +ifndef GOTMDIR
  54 +GOTMDIR := $(HOME)/git/gotm_ismer
  55 +endif
  56 +
  57 +CPP = /usr/bin/cpp
  58 +
  59 +# Here you can put defines for the [c|f]pp - some will also be set depending
  60 +# on compilation mode.
  61 +ifeq ($(NetCDF),true)
  62 +DEFINES += -DNETCDF_FMT
  63 +EXTRA_LIBS += $(NETCDFLIB)
  64 +endif
  65 +ifeq ($(SEDIMENT),true)
  66 +DEFINES += -DSEDIMENT
  67 +FEATURES += extras/sediment
  68 +FEATURE_LIBS += -lsediment$(buildtype)
  69 +endif
  70 +ifeq ($(SEAGRASS),true)
  71 +DEFINES += -DSEAGRASS
  72 +FEATURES += extras/seagrass
  73 +FEATURE_LIBS += -lseagrass$(buildtype)
  74 +endif
  75 +ifeq ($(BIO),true)
  76 +DEFINES += -DBIO
  77 +FEATURES += extras/bio
  78 +FEATURE_LIBS += -lbio$(buildtype)
  79 +endif
  80 +
  81 +# Directory related settings.
  82 +
  83 +ifndef BINDIR
  84 +BINDIR = $(GOTMDIR)/bin
  85 +endif
  86 +
  87 +ifndef LIBDIR
  88 +LIBDIR += $(GOTMDIR)/lib/$(FORTRAN_COMPILER)
  89 +endif
  90 +
  91 +ifndef MODDIR
  92 +#MODDIR = $(GOTMDIR)/modules
  93 +MODDIR = $(GOTMDIR)/modules/$(FORTRAN_COMPILER)
  94 +endif
  95 +INCDIRS += -I/usr/local/include -I$(GOTMDIR)/include -I$(MODDIR)
  96 +
  97 +# Normaly this should not be changed - unless you want something very specific.
  98 +
  99 +# The Fortran compiler is determined from the EV FORTRAN_COMPILER - options
  100 +# sofar NAG(linux), FUJITSU(Linux), DECF90 (OSF1 and likely Linux on alpha),
  101 +# SunOS, PGF90 - Portland Group Fortran Compiler (on Intel Linux).
  102 +
  103 +# Sets options for debug compilation
  104 +ifeq ($(compilation),debug)
  105 +buildtype = _debug
  106 +DEFINES += -DDEBUG $(STATIC)
  107 +FLAGS = $(DEBUG_FLAGS)
  108 +endif
  109 +
  110 +# Sets options for profiling compilation
  111 +ifeq ($(compilation),profiling)
  112 +buildtype = _prof
  113 +DEFINES += -DPROFILING $(STATIC)
  114 +FLAGS = $(PROF_FLAGS)
  115 +endif
  116 +
  117 +# Sets options for production compilation
  118 +ifeq ($(compilation),production)
  119 +buildtype = _prod
  120 +DEFINES += -DPRODUCTION $(STATIC)
  121 +FLAGS = $(PROD_FLAGS)
  122 +endif
  123 +
  124 +include $(GOTMDIR)/compilers/compiler.$(FORTRAN_COMPILER)
  125 +
  126 +#DEFINES += -DREAL_4B=$(REAL_4B)
  127 +#ifeq ($(FORTRAN_COMPILER),XLF)
  128 +#DEFINES:=-WF,"$(DEFINES)"
  129 +#DEFINES=-WF,"-DXLF -DNETCDF_FMT -DSEAGRASS -DFORTRAN95 -DPRODUCTION -DREAL_4B=real\(4\)"
  130 +#endif
  131 +
  132 +# For making the source code documentation.
  133 +PROTEX = protex -b -n -s
  134 +
  135 +.SUFFIXES:
  136 +.SUFFIXES: .F90
  137 +
  138 +LINKDIR = -L$(LIBDIR)
  139 +
  140 +CPPFLAGS = $(DEFINES) $(INCDIRS)
  141 +FFLAGS = $(DEFINES) $(FLAGS) $(MODULES) $(INCDIRS) $(EXTRAS)
  142 +F90FLAGS = $(FFLAGS)
  143 +LDFLAGS += $(FFLAGS) $(LINKDIR)
  144 +
  145 +#
  146 +# Common rules
  147 +#
  148 +ifeq ($(can_do_F90),true)
  149 +%.o: %.F90
  150 + $(FC) $(F90FLAGS) $(EXTRA_FFLAGS) -c $< -o $@
  151 +else
  152 +%.f90: %.F90
  153 +# $(CPP) $(CPPFLAGS) $< -o $@
  154 + $(F90_to_f90)
  155 +%.o: %.f90
  156 + $(FC) $(F90FLAGS) $(EXTRA_FFLAGS) -c $< -o $@
  157 +endif
... ...