From: Ron Grunwald via inline
Sent: Saturday, June 10, 2017 8:53 PM
To: inline@perl.org
Subject: Re: Inline::F2003 - New ILSM proposed
Hello all,
The example code below illustrates how Inline::F2003 could be configured
to build a shared library from the Fortran source files listed in
"SRCLIST". Also, I propose to add a new parameter called "MAKEFILE", and
this leads me into an area that I'm unsure about.
use Inline F2003 => Config => (
SRCLIST => "ModMatrixOps.f03",
LIBNAME => "libMatrixOps.so",
LIBTYPE => ".so",
MAKEFILE => "AUTOMAKE",
BUILDDIR => "BLD_Linux.AMD64_gfortran",
FOR => "gfortran",
FORFLG => "-v -g -c -std=f2003 -fpic -cpp"
);
This new parameter "MAKEFILE" is intended to allow programmers to specify
their own makefile. However, the special value "AUTOMAKE" can also be
specified (as shown above), which means that Inline::F2003 would generate
a suitable makefile, and this is where I need some advice.
Inline::C uses ExtUtils::MakeMaker to generate the makefile. I would like
to use ExtUtils::MakeMaker, but I don't think it would be possible since
it generates makefiles for C compilation, not Fortran compilation.
Both PDL and PGPLOT modules use ExtUtils::MakeMaker && perform fortran
compilations.
They make use of the ExtUtils::F77 module.
FAIK it might simply be that EU::F77's job is simply to determine the name
of the fortran compiler, and the flags that it should take ... or perhaps
there's more to it than just that.
The fortran compilations in the PDL build occur during the building of
PDL::Slatec and PDL::Minuit - there might be other places, too.
With EU::F77 installed you should be able to build PDL (such that both
PDL::Slatec and PDL::Minuit are built) with 'cpan -i PDL'.
Hopefully there's something in there that will help.
Any questions about how the fortran stuff is managed by PDL or EU::MM could
also be sent to the PDL devel mailing list. It's an active list that's
fairly well attended by informed and helpful folk.
Unless there is some clever way to configure ExtUtils::MakeMaker to output
Fortran makefiles?
Another option is to use the GNU autotools.
PDL::Audio (http://search.cpan.org/~mlehmann/PDL-Audio-1.2/) is the only
module I've ever built that makes use of autotools (in the sndlib folder in
the source distro).
It works well, though I haven't studied it.
Maybe there's something useful to be gleaned from it, too.
In this scenario, Inline::F2003 would read an existing "Makefile.in", then
use the parameters specified in the above example, and write out the final
Makefile. Sounds simple, but I've never done this before.
If anyone is able to provide advice, suggestions or opinions, I would be
really grateful.
My only other advice would be to also sound this out on perlmonks. (But that
might pay off ... or it might not :-)
Cheers,
Rob