Skip to content

fobos many building modes

Stefano Zaghi edited this page Feb 10, 2015 · 1 revision

This kind of fobos file can have many building modes, as a consequence it is necessary a mechanism (a switch) to select one building mode (in the following indicated as mode) respect to the others. Such a switch mechanism is defined by a particular section defined into the fobos file, namely the section modes, that has only one option named again modes, which lists the available (admissible) modes defined into the fobos file, e.g.

[modes]
modes = debug-gnu realese-gnu dbg-intel

[debug-gnu]
help     = Compile with GNU gfortran in debug mode
compiler = gnu
cflags   = -c -cpp -O0 -C -g
...

[realese-gnu]
help     = Compile with GNU gfortran in realese mode
compiler = gnu
cflags   = -c -cpp -O3
...

[dbg-intel]
help     = Compile with Intel Fortran in debug mode
compiler = intel
cflags   = -c -cpp -O0 -debug all -warn all
...

The presence of the section and option modes distinguishes a single-building-mode fobos file from a many-building-modes one, as consequence this section should be the first defined into the fobos file. However, it is possible to place the sections in any order, even with the modes one placed at the end of the fobos file. When a many-building-modes fobos file is used, the switch -mode must be used when invoking FoBiS.py for selecting a particular mode, e.g.

FoBiS.py build -mode realese-gnu

or, if the fobos file has user-defined name

FoBiS.py build -f fobos.other.name -mode realese-gnu

In the case the switch -mode is omitted, the first defined mode is used (in the example above it is the mode debug-gnu). It is worth noting that if the switch -mode is used with a mode name not present in the list defined into the fobos file, an error message is prompted, e.g.

FoBiS.py build -mode unknown-mode

Error: the mode "unknown-mode" is not defined into the fobos file. Defined modes are:
  - "debug-gnu" Compile with GNU gfortran in debug mode
  - "realese-gnu" Compile with GNU gfortran in realese mode
  - "dbg-intel" Compile with Intel Fortran in debug mode

There is also a CLI switch, for both clean and build executions, for listing the modes defined into a fobos file

FoBiS.py build -lmodes

or

FoBiS.py clean -lmodes

than a list of modes is prompted, e.g.

FoBiS.py build -lmodes

The fobos file defines the following modes:
  - "debug-gnu" Compile with GNU gfortran in debug mode
  - "realese-gnu" Compile with GNU gfortran in realese mode
  - "dbg-intel" Compile with Intel Fortran in debug mode
Clone this wiki locally