Difference between revisions of "Compiling and Linking"

From WikiROMS
Jump to navigationJump to search
(first draft)   (change visibility)
 
 
(16 intermediate revisions by 3 users not shown)
Line 1: Line 1:
==Gnu make==
<div class="title">Compiling and Linking</div>
<!--Pre-TOC text here-->
__TOC__
==GNU make==


To compile ROMS, first check to make sure that you have '''Gnu make''' on your system. Typing "'''make -v'''" or "'''gmamke -v'''" should bring up a message such as:
To compile ROMS, first check to make sure that you have '''GNU make''' on your system. Typing "'''make -v'''" or "'''gmake -v'''" should bring up a message such as:
:GNU Make 3.80
:GNU Make 3.81
:Copyright (C) 2002 Free Software Foundation, Inc.
:Copyright (C) 2006 Free Software Foundation, Inc.
:This is free software; see the source for copying conditions.
:This is free software; see the source for copying conditions.
:There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
:There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
:PARTICULAR PURPOSE.
:PARTICULAR PURPOSE.


You want to have at least version 3.77. If you don't have a fairly modern [http://www.gnu.org/software/make/ Gnu make], it is freely available and quite portable.
You want to have at least version 3.80, and 3.81 behaves better on some systems. If you don't have a fairly modern [http://www.gnu.org/software/make/ GNU make], it is freely available and quite portable.


==NetCDF==
==NetCDF==


You will also need to have the [http://www.unidata.ucar.edu/software/netcdf/ Netcdf] library installed on your system. Tell ROMS how to find it according to the directions in [[makefile]].  
You will also need to have the [http://www.unidata.ucar.edu/software/netcdf/ Netcdf] library, F90 interface, installed on your system. Tell ROMS how to find it according to the directions in [[makefile]]. Notice that there are several machine-dependent make include files in the '''Compilers''' sub-directory. For example, the locations of the NetCDF include and library directories are specified in file '''Linux-pgi.mk''' as:
<div class="box"><span class="red">NETCDF_INCDIR ?= </span>/opt/pgisoft/netcdf/include<br /><span class="red">NETCDF_LIBDIR ?=</span> /opt/pgisoft/netcdf/lib</div>
We recommend you to install both the Fortran F77 and F90 interfaces of the NetCDF library.


==User Changes==
==User Changes==


There are several user-defined switches in [[makefile]], as described there.
There are several user-defined switches in the '''makefile''', as described [[makefile|here]].


==Compiling==
==Compiling==


Check over your [[cppdefs.h]] one last time, then you should '''cd''' to the top-level ROMS directory. From here, type "'''make'''" or "'''gmake'''" (I create an alias so as to be typing "'''make'''" on all systems). It should now be compiling and linking for you. The final executable will be called '''oceanS''', '''oceanG''', '''oceanM''', or '''oceanO''' for '''serial''', '''debug''', '''MPI''', or '''OpenMP''' code, respectively.
Check over your [[cppdefs.h]] and [[Functionals]] one last time, check your choices as listed in [[makefile]], then launch '''make''' or the [[build Script]].
 
To understand the compilation process and the ROMS [[makefile]], read about [[make]] and [[gmake]].

Latest revision as of 22:11, 16 June 2008

Compiling and Linking

GNU make

To compile ROMS, first check to make sure that you have GNU make on your system. Typing "make -v" or "gmake -v" should bring up a message such as:

GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

You want to have at least version 3.80, and 3.81 behaves better on some systems. If you don't have a fairly modern GNU make, it is freely available and quite portable.

NetCDF

You will also need to have the Netcdf library, F90 interface, installed on your system. Tell ROMS how to find it according to the directions in makefile. Notice that there are several machine-dependent make include files in the Compilers sub-directory. For example, the locations of the NetCDF include and library directories are specified in file Linux-pgi.mk as:

NETCDF_INCDIR ?= /opt/pgisoft/netcdf/include
NETCDF_LIBDIR ?= /opt/pgisoft/netcdf/lib

We recommend you to install both the Fortran F77 and F90 interfaces of the NetCDF library.

User Changes

There are several user-defined switches in the makefile, as described here.

Compiling

Check over your cppdefs.h and Functionals one last time, check your choices as listed in makefile, then launch make or the build Script.

To understand the compilation process and the ROMS makefile, read about make and gmake.