OnWorks favicon

makedepf90 - Online in the Cloud

Run makedepf90 in OnWorks free hosting provider over Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

This is the command makedepf90 that can be run in the OnWorks free hosting provider using one of our multiple free online workstations such as Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator



makedepf90 - creates Makefile dependency list for Fortran source files.


makedepf90 [-h] [-V] [-W|-Wmissing] [-Wconfused] [-m fmt] [-u modulename] [-d file] [-r
rule] [-R file rule] [-fixed|-free] [-o name-of-executable] [-coco] [-D NAME] [-b path]
[-I PATH1:PATH2:...] [-nosrc] sourcefile(s)


makedepf90 is a program for automatic creation of dependency lists and compilation rules
for Makefiles.

The original idea was to provide the same functionality for Fortran as

gcc -MM *.c

does for C. Nowadays makedepf90 actually supersedes this functionality, making me wonder
if I should extend makedepf90 to support C and C++ too ;-).

makedepf90 supports both modules, include:s, cpp(1) #include:s, f90ppr(1) $include:s and
coco(1) ??includes and set-files.

makedepf90 reads Fortran source files given on the command line, and writes a dependency
list to stdout; for every file it writes a line with the following format:

targets : prerequisites

Targets are the files that will be the result of compiling the file with the -c option,
and prerequisites are files that are needed to compile the file. In addition, makedepf90
can optionally create the dependency line and make-rule needed to link the final

Fortran dependencies
The files needed to compile a file, i.e the prerequisites of the file are:

The source file itself

Files with interface information about USEd modules, created by the compiler while
compiling the modules (often named modulename.mod or something similar, hereafter
called mod-files).

Include-files (including files included and mod-files of modules USEd from these

Coco set-files, if coco(1) is being used and set-files exist.

Since different compilers use different naming conventions for the mod-files, listing them
in the dependency list results in non-portable makefiles. Therefore it's common practise
to list the object file (filename.o) corresponding to the sourcefile containing the USEd
modules instead. This is the default behaviour of makedepf90. To change this, use the -m
option (e.g -m "%m.mod" if your compiler names the mod files modulename.mod)

Include files not found in the working directory will not be listed in the dependency
list, assuming they are part of a (seldom changing) library not part of the program.
Neither will mod-files of modules whose definitions aren't found be listed by the same


These options may be given anywhere, in any order, on the command line. Space between an
option and its argument is optional. Options may not be grouped (-hW is not the same
thing as -h -W).

-h or --help
Print a short help message to stdout and quit.

-V or --version
Print version and copyright information to stdout and quit

-W or -Wmissing
Print warnings about missing modules and include files

Print warnings when confused (either because of bugs in makedepf90 itself, or
because of wierd things in your source files). If makedepf90 misses some
dependencies, or do other wierd things, this option might give some idea on whats
going on.

-m fmt Tell makedepf90 that mod-files will have names of the format fmt. fmt may contain
the modifiers %f for filename (without file name .suffix), %m for modulename (in
lowercase), %M for MODULENAME (in uppercase) and %% for '%'. Default is "%f.o".

-u modulename
Ignore all modules named modulename.

-d file
Make all targets dependent on file.

-r rule
Add rule (indented by a tab) to all dependency lines except lines given rule(s)
with the -R option.

rule may contains the following modifiers: %f for the name of the source file
(without suffix) the dependency line is created for, and %% for '%'.

-R 'pattern' 'rule'
Compile files matching the shell pattern pattern using the rule rule. In pattern,
the following wildcards can be used: * = any number of any characters, ? = any
character and [abc] = any of a, b or c. Note that the patter-matching is to be
performed by makedepf90, not the shell. Therefore pattern should be enclosed in
quotes (" or '). For rule applies the same rules as for -r above.

Note that there is a subtle difference between "-r rule" and "-R '*' rule". In the
former case rule will be applied only to lines not given any rule using -R, while
in the latter case, rule will be applied to all lines.

-fixed / -free
Treat the files as fixed/free source format. If both options are given, the latter
is used. Default: Files with suffixes .f, .F, .for, .FOR or .ftn are treated as
fixed format and .f90, .F90, .f95 or .F95 are treated as free format.

-o name
This option will cause makedepf90 to define the Makefile macro FOBJ=objectfiles,
and a dependency line + rule for the final linking process to create the executable
name. To set the linking rule, use the option -l.

-l rule
Use rule when linking the executable. The default is
$(FC) -o $@ $(FFLAGS) $(LDFLAGS) $(FOBJ) $(LIBS).
This option has no effect unless -o is used.

-coco Look for coco(1) set-files (coco ??include:s are supported automatically). This
option implies -free.

Define the pre-processor symbol NAME.

-b path
Dependency tree and link rule will assume objects are placed in path. This is
useful if the build places object files in a different directory than the source

-I list-of-paths
Look for source/include files in the list-of-paths, if not found in current working
directory. Here, list-of-paths is a colon separated list of path names.

-nosrc Don't list the source file among the prerequisites.


Basic Usage
Here's an example of basic makedepf90 usage together with make(1). Create a file named
Makefile with the following contents:


# FC = the compiler to use

# Compiler options

# List libraries used by the program here

# Suffix-rules: Begin by throwing away all old suffix-
# rules, and then create new ones for compiling
# *.f90-files.
.SUFFIXES: .f90 .o

$(FC) -c $(FFLAGS) $<

# Include the dependency-list created by makedepf90 below
include .depend

# target 'clean' for deleting object- *.mod- and other
# unwanted files
rm -f *.o *.mod core

# Create a dependency list using makedepf90. All files
# that needs to be compiled to build the program,
# i.e all source files except include files, should
# be given on the command line to makedepf90.
# The argument to the '-o' option will be the name of the
# resulting program when running 'make', in this case
# 'foobar'
depend .depend:
makedepf90 -o foobar *.f90 > .depend


(Note that all the indented lines should be indented with tabs, not spaces)

With this makefile, the command make should perform all the commands needed to compile and
link the program foobar out of all *.f90 files in the working directory.

The dependency list .depend will be (re)created if .depend doesn't exist, or if the
command make depend is run. This should be done every time changes has been made to the
program that affect the dependencies of the files (e.g if new source files has been added
to the project).

Example With Coco
If you are using a pre-processor, things might get more complicated. If you are lucky,
your compiler supports your pre-processor and runs it on your code automatically, but if
it doesn't, you have to give the commands to run the pre-processor yourself. Below is an
example of an Makefile for coco(1)-users.


.SUFFIXES: .f .f90 .o

# Files ending in .f90 are compiled directly ...
$(FC) -c $(FFLAGS) $<

# ... while those ending in .f are preprocessed first.
$(PREPROCESSOR) $*; $(FC) -c $(FFLAGS) $*.f90

include .depend

rm -f *.o *.mod core

depend .depend:
makedepf90 -coco -o foobar *.f90 *.f > .depend


NOTE: Some implementations of make(1) will not execute any commands — not even make depend
— with the Makefiles above unless there exists a file named .depend. To overcome this
problem, either run makedepf90 manually, or begin by creating an empty .depend file with
the command touch .depend.


Most error and warning messages are self explanatory, but some of them might need some
further explanations:

WARNING: recursion limit reached in file filename
When recursively parsing include files, makedepf90 has reached the recursion limit.
Possible reasons are: either you have some really complicated systems of include
files, or you have recursive includes (e.g an include file that includes itself).
In the latter case; fix it, your Fortran compiler will not like it either.

Use makedepf90 online using onworks.net services

Free Servers & Workstations

Download Windows & Linux apps

  • 1
    Firebird RDBMS offers ANSI SQL features
    & runs on Linux, Windows &
    several Unix platforms. Features
    excellent concurrency & performance
    & power...
    Download Firebird
  • 2
    KompoZer is a wysiwyg HTML editor using
    the Mozilla Composer codebase. As
    Nvu's development has been stopped
    in 2005, KompoZer fixes many bugs and
    adds a f...
    Download KompoZer
  • 3
    Free Manga Downloader
    Free Manga Downloader
    The Free Manga Downloader (FMD) is an
    open source application written in
    Object-Pascal for managing and
    downloading manga from various websites.
    This is a mirr...
    Download Free Manga Downloader
  • 4
    UNetbootin allows you to create bootable
    Live USB drives for Ubuntu, Fedora, and
    other Linux distributions without
    burning a CD. It runs on Windows, Linux,
    and ...
    Download UNetbootin
  • 5
    Dolibarr ERP - CRM
    Dolibarr ERP - CRM
    Dolibarr ERP - CRM is an easy to use
    ERP and CRM open source software package
    (run with a web php server or as
    standalone software) for businesses,
    Download Dolibarr ERP - CRM
  • 6
    SQuirreL SQL Client
    SQuirreL SQL Client
    SQuirreL SQL Client is a graphical SQL
    client written in Java that will allow
    you to view the structure of a JDBC
    compliant database, browse the data in
    Download SQuirreL SQL Client
  • More »

Linux commands