automake
[Top][All Lists]
Advanced

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

automake with fortran


From: Rudra Banerjee
Subject: automake with fortran
Date: Thu, 25 Jul 2013 17:53:38 +0100

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]