1makedepf90(1)               General Commands Manual              makedepf90(1)
2
3
4

NAME

6       makedepf90 - creates Makefile dependency list for Fortran source files.
7
8

SYNOPSIS

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

DESCRIPTION

17       makedepf90 is a program for automatic creation of dependency lists  and
18       compilation rules for Makefiles.
19
20       The original idea was to provide the same functionality for Fortran as
21
22              gcc -MM *.c
23
24       does  for  C.  Nowadays makedepf90 actually supersedes this functional‐
25       ity, making me wonder if I should extend makedepf90 to  support  C  and
26       C++ too ;-).
27
28       makedepf90   supports   both  modules,  include:s,  cpp(1)  #include:s,
29       f90ppr(1) $include:s and coco(1) ??includes and set-files.
30
31       makedepf90 reads Fortran source files given on the  command  line,  and
32       writes  a  dependency  list  to stdout; for every file it writes a line
33       with the following format:
34
35              targets : prerequisites
36
37       Targets are the files that will be the result  of  compiling  the  file
38       with the -c option, and prerequisites are files that are needed to com‐
39       pile the file.  In  addition,  makedepf90  can  optionally  create  the
40       dependency line and make-rule needed to link the final executable.
41
42   Fortran dependencies
43       The  files  needed to compile a file, i.e the prerequisites of the file
44       are:
45
46       The source file itself
47
48       Files with interface information about USEd modules, created  by
49              the  compiler  while  compiling the modules (often named module‐
50              name.mod or something similar, hereafter called mod-files).
51
52       Include-files (including files included and mod-files of modules
53              USEd from these include-files).
54
55       —      Coco set-files, if coco(1) is being used and set-files exist.
56
57       Since different compilers use different naming conventions for the mod-
58       files, listing them in the  dependency  list  results  in  non-portable
59       makefiles.   Therefore  it's  common  practise  to list the object file
60       (filename.o) corresponding to the sourcefile containing the  USEd  mod‐
61       ules  instead.  This is the default behaviour of makedepf90.  To change
62       this, use the -m option (e.g -m "%m.mod" if your compiler names the mod
63       files modulename.mod)
64
65       Include  files not found in the working directory will not be listed in
66       the dependency list, assuming they are  part  of  a  (seldom  changing)
67       library  not  part  of  the program.  Neither will mod-files of modules
68       whose definitions aren't found be listed by the same reason.
69
70

OPTIONS

72       These options may be given anywhere, in any order, on the command line.
73       Space  between an option and its argument is optional.  Options may not
74       be grouped (-hW is not the same thing as -h -W).
75
76       -h or --help
77              Print a short help message to stdout and quit.
78
79       -V or --version
80              Print version and copyright information to stdout and quit
81
82       -W or -Wmissing
83              Print warnings about missing modules and include files
84
85       -Wconfused
86              Print  warnings  when  confused  (either  because  of  bugs   in
87              makedepf90  itself,  or  because  of wierd things in your source
88              files).  If makedepf90 misses some  dependencies,  or  do  other
89              wierd  things,  this  option might give some idea on whats going
90              on.
91
92       -m fmt Tell makedepf90 that mod-files will have  names  of  the  format
93              fmt.   fmt  may  contain  the modifiers %f for filename (without
94              file name .suffix), %m for modulename  (in  lowercase),  %M  for
95              MODULENAME (in uppercase) and %% for '%'.  Default is "%f.o".
96
97       -u modulename
98              Ignore all modules named modulename.
99
100       -d file
101              Make all targets dependent on file.
102
103       -r rule
104              Add  rule  (indented  by  a  tab) to all dependency lines except
105              lines given rule(s) with the -R option.
106
107              rule may contains the following modifiers: %f for  the  name  of
108              the  source file (without suffix) the dependency line is created
109              for, and %% for '%'.
110
111       -R 'pattern' 'rule'
112              Compile files matching the shell pattern pattern using the  rule
113              rule.   In pattern, the following wildcards can be used: * = any
114              number of any characters, ? = any character and [abc] =  any  of
115              a,  b or c.  Note that the patter-matching is to be performed by
116              makedepf90, not the shell.  Therefore pattern should be enclosed
117              in  quotes  (" or ').  For rule applies the same rules as for -r
118              above.
119
120              Note that there is a subtle difference between "-r rule" and "-R
121              '*'  rule".   In  the  former  case rule will be applied only to
122              lines not given any rule using -R, while  in  the  latter  case,
123              rule will be applied to all lines.
124
125       -fixed / -free
126              Treat  the  files  as fixed/free source format.  If both options
127              are given, the latter is used.  Default: Files with suffixes .f,
128              .F,  .for,  .FOR  or  .ftn are treated as fixed format and .f90,
129              .F90, .f95 or .F95 are treated as free format.
130
131       -o name
132              This option will cause makedepf90 to define the  Makefile  macro
133              FOBJ=objectfiles,  and  a  dependency  line + rule for the final
134              linking process to create the executable name.  To set the link‐
135              ing rule, use the option -l.
136
137       -l rule
138              Use rule when linking the executable.  The default is
139              $(FC) -o $@ $(FFLAGS) $(LDFLAGS) $(FOBJ) $(LIBS).
140              This option has no effect unless -o is used.
141
142       -coco  Look for coco(1) set-files (coco ??include:s are supported auto‐
143              matically).  This option implies -free.
144
145       -D NAME
146              Define the pre-processor symbol NAME.
147
148       -b path
149              Dependency tree and link rule will assume objects are placed  in
150              path.  This is useful if the build places object files in a dif‐
151              ferent directory than the source files.
152
153       -I list-of-paths
154              Look for source/include files in the list-of-paths, if not found
155              in  current  working  directory.  Here, list-of-paths is a colon
156              separated list of path names.
157
158       -nosrc Don't list the source file among the prerequisites.
159
160

EXAMPLES

162   Basic Usage
163       Here's an example of basic  makedepf90  usage  together  with  make(1).
164       Create a file named Makefile with the following contents:
165
166       ----------------------
167
168        # FC = the compiler to use
169        FC=f90
170
171        # Compiler options
172        FFLAGS=-O
173
174        # List libraries used by the program here
175        LIBS=
176
177        # Suffix-rules:  Begin by throwing away all old suffix-
178        # rules, and then create new ones for compiling
179        # *.f90-files.
180        .SUFFIXES:
181        .SUFFIXES: .f90 .o
182
183        .f90.o:
184            $(FC) -c $(FFLAGS) $<
185
186        # Include the dependency-list created by makedepf90 below
187        include .depend
188
189        # target 'clean' for deleting object- *.mod- and other
190        # unwanted files
191        clean:
192            rm -f *.o *.mod core
193
194        # Create a dependency list using makedepf90.  All files
195        # that needs to be compiled to build the program,
196        # i.e all source files except include files, should
197        # be given on the command line to makedepf90.
198        #
199        # The argument to the '-o' option will be the name of the
200        # resulting program when running 'make', in this case
201        # 'foobar'
202        depend .depend:
203            makedepf90 -o foobar *.f90 > .depend
204
205       -----------------------
206
207       (Note  that  all  the  indented lines should be indented with tabs, not
208       spaces)
209
210       With this makefile, the command make should perform  all  the  commands
211       needed to compile and link the program foobar out of all *.f90 files in
212       the working directory.
213
214       The dependency list .depend will  be  (re)created  if  .depend  doesn't
215       exist, or if the command make depend is run.  This should be done every
216       time changes has been made to the program that affect the  dependencies
217       of the files (e.g if new source files has been added to the project).
218
219   Example With Coco
220       If  you  are  using a pre-processor, things might get more complicated.
221       If you are lucky, your compiler supports your pre-processor and runs it
222       on  your  code  automatically,  but if it doesn't, you have to give the
223       commands to run the pre-processor yourself.  Below is an example of  an
224       Makefile for coco(1)-users.
225
226       -----------------------
227        FC=f90
228        FFLAGS=-O
229        PREPROCESSOR=coco
230
231        .SUFFIXES:
232        .SUFFIXES: .f .f90 .o
233
234        # Files ending in .f90 are compiled directly ...
235        .f90.o:
236               $(FC) -c $(FFLAGS) $<
237
238        # ... while those ending in .f are preprocessed first.
239        .f.o:
240               $(PREPROCESSOR) $*; $(FC) -c $(FFLAGS) $*.f90
241
242
243        include .depend
244
245        clean:
246            rm -f *.o *.mod core
247
248        depend .depend:
249               makedepf90 -coco -o foobar *.f90 *.f > .depend
250
251       -----------------------
252
253       NOTE:  Some  implementations of make(1) will not execute any commands —
254       not even make depend — with the Makefiles above unless there  exists  a
255       file  named  .depend.  To  overcome this problem, either run makedepf90
256       manually, or begin by creating an empty .depend file with  the  command
257       touch .depend.
258
259

DIAGNOSTICS

261       Most  error and warning messages are self explanatory, but some of them
262       might need some further explanations:
263
264       WARNING: recursion limit reached in file filename
265              When recursively parsing include files, makedepf90  has  reached
266              the recursion limit.  Possible reasons are: either you have some
267              really complicated systems of include files, or you have  recur‐
268              sive  includes  (e.g  an include file that includes itself).  In
269              the latter case; fix it, your Fortran compiler will not like  it
270              either.
271
272

BUGS AND LIMITATIONS

274       Makedepf90's support for pre processor conditionals and macro expension
275       (#if:s, #define:s etc) is rather weak, but should work well enough  for
276       most cases.
277
278       The include file search algorithm is broken.  I may fix it some day.
279
280

SEE ALSO

282       make(1), f90(1), cpp(1), fpp(1), f90ppr(1), coco(1)
283
284       The makedepf90 web site is found at
285       http://www.iki.fi/erik.edelmann/makedepf90 ⟨⟩
286
287
288

COPYING

290       This program is free software; you can redistribute it and/or modify it
291       under the terms of the GNU General Public License  version  2  as  pub‐
292       lished by the Free Software Foundation.
293
294       This  program  is  distributed  in the hope that it will be useful, but
295       WITHOUT ANY  WARRANTY;  without  even  the  implied  warranty  of  MER‐
296       CHANTABILITY  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
297       Public License for more details.
298
299       You should have received a copy of the GNU General Public License along
300       with this program; if not, write to the Free Software Foundation, Inc.,
301       59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
302
303

AUTHOR

305       Erik Edelmann <Erik.Edelmann@iki.fi>
306
307
308
309                        Thu, 06 Dec 2001 23:28:54 +0200          makedepf90(1)
Impressum