by Helge Avlesen (

A build system (yet another dependency generator) for Fortran codes that requires GNU make and Python (v2.3 or later).

It can be downloaded from here

The system has been used to sucessfully build codes like BOM, HYCOM, MICOM, ARPEGE Climat, Giss.

The main design idea is to enable a single, simple makefile to build your (large) code with GNU make taking care of dependencies via include files in the Makefile. It should be possible to override the default compilation flags for groups of files, and use the parallel make feature of GNU make.

The main motivation for writing this tool was that none of the available dependency generators on the internet were able to parse and track the dependencies of the ~500000 LOC "ARPEGE Climat" code. SCons came close but I found I could write a tool that worked for me faster than learning how to use it properly... so here we go.

Installation and basic usage

mkdep has been set up to be very easy to use on small projects.

In the directory where you want to locate your Makefile, unpack the mkdep.tgz file above

  tar xvzf mkdep.tgz
Put the path to mkdep first in the path, e.g. for "bash" like shells:
  export PATH=$PWD/mkdep:$PATH
A minimal Makefile in this directory for two source files would look like this
  SOURCEFILES= file1.f90 file2.f90
  include mkdep/rules
If a file resides in a subdirectory give the full path, e.g.
  SOURCEFILES= ./directory1/file1.f90 ./directory2/file2.f90 
then, from the command line
  mkdep reset
  make dep
to build the project. By default the fortran compiler is assumed to be "gfortran", this, and other things can be overridden. The name of the fortran compiler can be specified via FORTRANCOMPILER makefile variable. see the "rules" file for more. If you change the list of source files or modify code in such a way that dependencies between files are changed you will need to rerun
  make dep
otherwise, rebuilding the code can be done with a single "make". "mkdep reset" is only used the first time to initialize some hidden files mkdep assumes to be located in the current directory. "make dep" invokes mkdep to create a list of dependencies for the files listed in the SOURCEFILES variable. The list of object files and their dependencies are included via the "include .../rules" line.

the system has been tested with Linux, AIX and Windows XP.



I make no guarantee that it will work for everyone, it is provided on a "works for me" basis, in the hope that some may find it useful enough to use time to debug or even improve it...