automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: automake with fortran


From: Fabrício Zimmerer Murta
Subject: Re: automake with fortran
Date: Thu, 25 Jul 2013 14:11:01 -0300

I implemented GNU Build System on a fortran project I work with..

I've created a 'Makefile.am' inside src/ (src/Makefile.am) thus my PACKAGE_ROOT/Makefile.am has a 'SUBDIRS=src'.

This will make 'GNU Make' to chdir into src/ dir and the created modules works just fine. I think this 'subdirs' and sub-makefiles-am are the way gnu build system is intended to work.

For example, for distributed 'datadir' files (who get into PREFIX/share), I have Makefile.am's into each directory, the inside Makefile.am's actually determines what is installed to localstatedir, datadir, as fitting.

I hope this helps.

- fabrício

-----Original Message----- From: Rudra Banerjee
Sent: Thursday, July 25, 2013 1:53 PM
To: address@hidden
Subject: automake with fortran

Hello friends,
I am facing a small problem when trying to build my code with autotools.
My file structure is:
$ tree
.
|-- configure.ac
|-- Makefile.am
`-- src
   |-- constants.f90
   |-- environment.f90
   |-- init.f90
   |-- main.f90
   `-- util.f90
(deleted possibly unnecessary lines)
and my Makefile.am is:
#SUBDIRS= help
bin_PROGRAMS = scasr
scasr_SOURCES = \
               src/constants.f90  src/environment.f90  src/util.f90 \
src/init.f90 src/main.f90
scasr_LDADD =
EXTRA_DIST= autogen.sh
CLEANFILES =*.mod

The problem is src/(*.f90)'s except main.f90 are module. Hence, if I
have to write the makefile by hand, I will have:
constants.o : constants.f90
environment.o : environment.f90
init.o : init.f90 util.o constants.o
main.o : main.f90 init.o constants.o environment.o
util.o : util.f90 constants.o

so, for Makefile.am, I have to make a strict order of files in
scasr_SOURCES. i.e.
with the sources as :
scasr_SOURCES = \
               src/constants.f90  src/environment.f90  src/util.f90 \
src/init.f90 src/main.f90

It compiles fine.
But if I have as:
scasr_SOURCES = src/main.f90 \
               src/constants.f90  src/environment.f90  src/util.f90 \
src/init.f90
I get error:
ake  all-am
make[1]: Entering directory `/home/rudra/Programs/ScASR/trunk'
gfortran  -g -O2 -c -o src/main.o src/main.f90
src/main.f90:7.4:

use mget_env
   1
Fatal Error: Can't open module file 'mget_env.mod' for reading at (1):
No such file or directory
make[1]: *** [src/main.o] Error 1

Is there any way out so that make/configure will check the dependency by
itself?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]