As promised over 1 year ago[2] I've now made our dependency tracker completely
independent from autoconf. It's available[3] from the site of the library it was
originally developed in[1].
To quote from the original post:
> We use a dependency tracker, maintained by me, that currently does the following:
>
> 1. parses fortran source including cpp directives
> 2. evaluates cpp macros to determine effective USE statements,
> i.e. the tracker doesn't generate dependencies for stuff that
> is effectively inside #if 0
> 3. finds external .mod files
> 4. can handle multiple modules per source, independent of source name
> 5. only writes the dependency part of the makefile (because in our setup that
> is maintained by automake/autoconf)
For a simple experiment run it like:
perl -Iscripts scripts/makef90depends -- -- src/*.f90
if your sources are in files in subdirectory src. Feedback is very
much appreciated. To get everything right for compilers varying from
typical Linux x86_64 compilers, a number of options needs to be
set. For slow compilers (xlf, sxf90), the internal caching functions might prove
useful.
To parse preprocessor conditionals correctly, environment variables FC
and FPP should be set to appropriate commands. Compilers that need
help with that[4] because they can't write preprocessed input to
stdout need to be wrapped one of the provided wrapper scripts. How to identify a
working wrapper can be seen from the scales-ppm
configure.ac script source (see
m4/starlink_fpp.m4, macro _ACX_SL_PROG_FPP for implementation details).
Generally the following holds:
- NAG and Sun/Oracle sunf95 compilers use sunf95preproc-wrapper
- the NEC SX compiler is wrapped with sxpreproc-wrapper
- IBM xlf compilers require the xlfpreproc-wrapper
Generally options that change the behaviour of the tracker go before
the first double dash and options to the compiler (in our case
$(AM_FCFLAGS) $(FCFLAGS)) go before the second double dash so that the
tracker knows how to correctly invoke the compiler and can see
include/module directories for itself.
The distribution[5] contains a very detailed setup, but understanding
probably requires reading fluency of autoconf/automake.
The manual page can be generated with pod2man. To read it immediately
try somethng like:
$ pod2man config/makef90depends |man -l -
on a Unix system. The script is untested on Windows but should be easy
to get to work there also.
Regards, Thomas
[1]
https://www.dkrz.de/redmine/projects/scales-ppm
[2] Message-ID: <jj2do2$hhv$
1...@gwdu112.gwdg.de>
<
https://groups.google.com/group/comp.lang.fortran/msg/494c861ebdfa7f2e?dmode=source&output=gplain&noredirect>
[3]
<
https://www.dkrz.de/redmine/attachments/download/405/makef90depends-1.0.0.tar.gz>
[4] AFAIK: xlf, nagfor, sunf95, sxf90
[5] <
https://www.dkrz.de/redmine/attachments/download/382/ppm-1.0.2.tar.xz>