Skip to content
Stefano Zaghi edited this page Feb 9, 2015 · 1 revision

Build a project pre-processing sources files with PreForM.py

FoBiS.py is well integrated with PreForM.py, a powerful yet simple pre-processor mainly designed for Fortran poor-men. PreForM.py is template system (besides other things such as a cpp-compatible pre-processor) that is very helpful in many circumstances. Pre-process a project with PreForM.py and automatically build it with FoBiS.py is very simple, just activate the FoBiS.py CLI switch:

FoBiS.py build --preform

or

FoBiS.py build -pfm

Doing so, each source file is pre-processed by PreForM.py before it is compiled (note that the PreForM.py outputs are not stored: they are eliminated immediately after the compilation). Obviously, PreForM.py must be in your path. In some circumstances, we would like to store the PreForM.py outputs (for checking/debuggin or distributing them). To tell FoBiS.py to store these intermediate outputs just specify the path to store them with the --pfm_dir option

FoBiS.py build -pfm --pfm_dir my-pfmed-sources

It is worth noting that this path is relative the build path as the obj and mod directories. Moreover, someone would like to preprocess only a reduced set of sources instead of preprocessing all sources. This can be accomplished by specifying the preprocessed file extensions list with the option --pfm_ext

FoBiS.py build -pfm --pfm_dir my-pfmed-sources --pfm_ext .F90 .F95 .F03

With the above specification only the sources ending with .F90, F95 and .F03 are preprocessed with PreForM.py and save into my-pdmed-sources.

Clone this wiki locally