makedepf90(1)
πΈ makedepf90 β the manual page, but make it make sense π
okay bestie, gather round, because this is the makedepf90(1) page from the General Commands Manual and it's genuinely iconic once you get past the boomer formatting. it makes Makefile dependency lists for Fortran source files, and it does it so well. let's go π«Ά
β¨ NAME β¨
makedepf90 β creates Makefile dependency list for Fortran source files. no cap, that's literally the whole job and she's amazing at it π
π¦ SYNOPSIS π¦
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|-B path] [-I PATH1:PATH2:...]
[-nosrc] sourcefile(s)
π DESCRIPTION π
so makedepf90 is a program for automatic creation of dependency lists and compilation rules for Makefiles. that's the whole vibe. she justβ¦ knows what depends on what, and she writes it down for you. main character energy fr π
the original idea was to provide the same functionality for Fortran as
gcc -MM *.c
does for C. and honestly? nowadays makedepf90 actually supersedes this functionality, which made the author wonder if they should extend makedepf90 to support C and C++ too ;-). lowkey obsessed with that energy.
makedepf90 supports both modules, include:s, cpp(1) #include:s, f90ppr(1) $include:s and coco(1) ??includes and set-files. yeah. all of them. she's versatile like that β¨
so here's the tea: 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. and on top of all that, makedepf90 can optionally create the dependency line and make-rule needed to link the final executable. she does it all, bestie π
π 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 namedmodulename.modor something similar, hereafter called mod-files). - Include-files (including files included and mod-files of modules
USEd from these include-files). - Coco set-files, if
coco(1)is being used and set-files exist.
okay so now the tricky part β since different compilers use different naming conventions for the mod-files, listing them in the dependency list results in non-portable makefiles. which is giving chaos, honestly π. 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 reason. she's just being sensible, okay?
π OPTIONS π
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). read that again bestie, she means it π¨
-hor--helpβ print a short help message to stdout and quit.-Vor--versionβ print version and copyright information to stdout and quit-Wor-Wmissingβ print warnings about missing modules and include files-Wconfusedβ print warnings when confused (either because of bugs inmakedepf90itself, or because of wierd things in your source files). ifmakedepf90misses some dependencies, or do other wierd things, this option might give some idea on whats going on.-m fmtβ tellmakedepf90that mod-files will have names of the format fmt. fmt may contain the modifiers%ffor filename (without file name .suffix),%mfor modulename (in lowercase),%Mfor 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-Roption. rule may contains the following modifiers:%ffor 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 bymakedepf90, not the shell. therefore pattern should be enclosed in quotes ("or'). for rule applies the same rules as for-rabove. 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. π (this one trips people up, iykyk)-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,.FORor.ftnare treated as fixed format and.f90,.F90,.f95or.F95are treated as free format.-o nameβ this option will causemakedepf90to define the Makefile macroFOBJ=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-ois used.-cocoβ look forcoco(1)set-files (coco??include:s are supported automatically). this option implies-free.-D NAMEβ 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 files.-B pathβ dependency tree and link rule will assume objects are placed in path using the same directory structure as the source files. this is useful if the build places object files in a different directory than the source files and the source directory structure is needed to avoid object name collisions.-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.
π EXAMPLES π
π« 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
FC=f90
# Compiler options
FFLAGS=-O
# List libraries used by the program here
LIBS=
# Suffix-rules: Begin by throwing away all old suffix-
# rules, and then create new ones for compiling
# *.f90-files.
.SUFFIXES:
.SUFFIXES: .f90 .o
.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
clean:
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) π¨ like, actually, this is not a drill, tabs only bestie
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.
FC=f90
FFLAGS=-O
PREPROCESSOR=coco
.SUFFIXES:
.SUFFIXES: .f .f90 .o
# Files ending in .f90 are compiled directly ...
.f90.o:
$(FC) -c $(FFLAGS) $<
# ... while those ending in .f are preprocessed first.
.f.o:
$(PREPROCESSOR) $*; $(FC) -c $(FFLAGS) $*.f90
include .depend
clean:
rm -f *.o *.mod core
depend .depend:
makedepf90 -coco -o foobar *.f90 *.f > .depend
NOTE: some implementations ofmake(1)will not execute any commands β not evenmake dependβ with the Makefiles above unless there exists a file named.depend. to overcome this problem, either runmakedepf90manually, or begin by creating an empty.dependfile with the commandtouch .depend. π yeah it's one of those problems
π₯ DIAGNOSTICS π₯
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,makedepf90has 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. π girl is telling you for your own good
π BUGS AND LIMITATIONS π
Makedepf90's support for pre processor conditionals and macro expension (#if:s, #define:s etc) is rather weak, but should work well enough for most cases. (weak but functional, we love a humble queen)
The include file search algorithm is broken. I may fix it some day. π no notes, just honesty
β SEE ALSO β
make(1), f90(1), cpp(1), fpp(1), f90ppr(1), coco(1)
the makedepf90 web site is found at http://www.iki.fi/erik.edelmann/makedepf90 π
part 1 out, part 2 loadingβ¦ don't go anywhere bestie π
π COPYING π
okay bestie, legal moment, but make it cute π
This program is free software β you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. slay, go off.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY β like, none, zero, not even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. it's giving "as-is, no take-backs" π. See the GNU General Public License for more details if you wanna know the whole situation.
You should have received a copy of the GNU General Public License along with this program; if not, write to:
Free Software Foundation, Inc.
59 Temple Place, Suite 330
Boston, MA 02111-1307 USA
no cap, that address is literally character for character what the page says. π
π AUTHOR π
Erik Edelmann <Erik.Edelmann@iki.fi>
the actual main character of this whole thing fr fr π«Ά give them their flowers
and that's a wrap on the whole page, bestie!! πβ¨ the source is makedepf90(1) and the date on it is Tue, 17 Nov 2015 23:21:02 -0500 β yes it's giving vintage, but the knowledge is timeless π go make some dependency files, you absolute icon π
ππ¦
π¦ where this page comes from
- debian bookworm: makedepf90 3.0.1-1 Β· GPL-2.0-only
- debian trixie: makedepf90 3.0.1-1 Β· GPL-2.0-only
- ubuntu jammy: makedepf90 3.0.0-1 Β· GPL-2.0-only
- ubuntu noble: makedepf90 3.0.1-1 Β· GPL-2.0-only
- ubuntu questing: makedepf90 3.0.1-2
- ubuntu resolute: makedepf90 3.0.1-3 Β· GPL-2.0-only
- ubuntu stonking: makedepf90 3.0.1-3 Β· GPL-2.0-only
- Copyright (C) 2000--2003 Erik Edelmann <eedelman@acclab.helsinki.fi>
- Copyright (C) 2015 Jason Graham <jason.graham@jhuapl.edu>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms