Provided by: makedepf90_3.0.1-1_amd64
NAME
makedepf90 - creates Makefile dependency list for Fortran source files.
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
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 executable. 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 include-files). — 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 reason.
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). -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 -Wconfused 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. -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) 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 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.
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, 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.
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. The include file search algorithm is broken. I may fix it some day.
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 ⟨⟩
COPYING
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. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
AUTHOR
Erik Edelmann <Erik.Edelmann@iki.fi> Tue, 17 Nov 2015 23:21:02 -0500 makedepf90(1)