Skip to content
Stefano Zaghi edited this page Feb 16, 2015 · 3 revisions

Let us assume we have the following tree

└── src
    ├── cumbersome.f90
    └── nested-1
        ├── first_dep.f90
        └── nested-2
            └── second_dep.inc

This is just a cumbersome example... There are use hierarchy-dependency and include one. To correctly build such a project you must respect its own hierarchy of compilations. FoBiS.py can do it for you :-)

Build all programs found

FoBiS.py build

FoBiS.py will recursively search for program files in the directories nested in "./". Program files are captured by parsing each file found: a file is a program-file if it contains the Fortran statement program. It is worth noting that the above FoBiS.py call will use the default compilations options. Moreover, by default the parsed files have the following extensions:

  • modern standards:
    • .f90, .F90;
    • .f95, .F95;
    • .f03, .F03;
    • .f08, .F08;
    • .f2k, .F2k;
  • old standards:
    • .f, .F;
    • .for, .FOR;
    • .fpp, .FPP;
    • .fortran;
    • .f77, .F77;
  • included sources:
    • .inc, .INC;
    • .h, .H.

This list can be expanded adding custom included sources extensions. To this aim use the CLI option -inc

FoBiS.py build -inc .newF .oldF

For building our prototype example, FoBiS.py first include second_dep.inc where it is requested, then compile first_dep.f90 and finally build the main program contained into cumbersome.f90. This is a general rule.

The default build directory is ./ thus our tree after the building process should be similar to the following

└── mod
└── obj
└── src

Two new directories, mod and obj are created: they contain the compiled objects and the module interfaces (if any). The path of these directory can be customized as well as the path of the build directory

FoBiS.py build -dobj my-objs -dmod my-mods -dbld my-build

It is worthy to note that the path of obj and mod directories are always relative the build one, thus with the above FoBiS.py invocation our tree will result in

└── my-build
    ├── my-mods
    └── my-objs
└── src

Clean project tree

Clean project tree is simple as the build phase

FoBiS.py clean

The above command will simply remove the all the compiled objects, namely *.o and *.mod, contained into obj and mod directories. If in the build phase other paths have been used, they must be repeated for a correct clean, for example

FoBiS.py clean -dobj my-objs -dmod my-mods -dbld my-build

Moreover, the cleaning can be specialized for only the compiled objects and/or for only the target

FoBiS.py clean -only_obj

FoBiS.py clean -only_target
Clone this wiki locally