How do I update Fortran module dependencies in the Fluidity build system?

Created by David Ham
Keywords:
make fortran modules
Last updated by:
David Ham

The build system needs to compile the Fortran source files in the right order so that the .mod file for each module is build before any module which uses it. You need to update the module build system if EITHER you add a new module or you add or remove a use statement from a Fortran module.

System requirements
------------------------------
You need a system with gfortran (>=4.5), Zoltan and libadjoint. The easiest way to achieve this is to use an Ubuntu Natty or later system.

1. Update the OBJS dependency
---------------------------------------------
If you have added a new module, it needs to be added to the list of object files in the OBJS variable in Makefile.in in the same directory as the module.

2. Configure
-----------------
./configure --with adjoint

Other configuration options (such as debugging or 2D adaptivity) will not affect dependency generation so you can include them or not at your preference.

3. Make
----------
make -j n

where n is the number of parallel make jobs you desire. This will ensure that necessary modules from libraries such as Spud are built and that as many modules as possible are built before the makefile generation process.

It does not matter if the make fails on a fluidity module as long as all the external libraries have been built.

4. Make makefiles
-------------------------
make makefiles

This will actually build the dependency tree. If run from an incompletely built tree it will have to guess the build order by a brute force process so expect to see lots of individual compile fails. This does not matter as long as the process completes.