automake
[Top][All Lists]
Advanced

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

fortran 77 header dependencies


From: Dave Goodell
Subject: fortran 77 header dependencies
Date: Tue, 12 Jul 2011 11:23:20 -0500

I'm curious what the recommended way to deal with fortran 77 header 
dependencies is in automake.  Assume that I've got two source files, "foo.f" 
and "bar.h", that look like this (hopefully my mailer won't mangle the spacing 
too badly):

foo.f:
----8<----
      program main
      implicit none
      include 'bar.h'
C use the variable from bar.h
      x = 10
      end
----8<----

bar.h:
----8<----
      integer x
----8<----

What I want to work is: (a) build the "foo" executable via "make"; (b) "touch 
bar.h"; (c) "make" should cause "foo.o" and "foo" to be rebuilt.  Here's my 
Makefile.am that contains three different versions.  Version 3 does work, but 
seems to be in violation of an automake commandment and is IMO a bit verbose.

----8<----
noinst_PROGRAMS = foo

# version 1:
# no automatic dependencies, so bar.h is not a prereq for foo
##foo_SOURCES = foo.f
##noinst_HEADERS = bar.h

# version 2:
# "touch bar.h ; make" does not cause foo to get rebuilt
##foo_SOURCES = foo.f bar.h

# version 3:
# works, but violates rules from automake manual sec. 8.4:
# "listing a source file in _DEPENDENCIES is wrong"
foo_SOURCES = foo.f
foo_DEPENDENCIES = bar.h
# needed to distribute bar.h and get a clean "make distcheck"
noinst_HEADERS = bar.h
----8<----

Is there a better way?  I really expected version 2 to work and was surprised 
when it didn't.

The violated automake manual commandment: 
http://www.gnu.org/software/automake/manual/automake.html#index-maude_005fDEPENDENCIES-460

Thanks,
-Dave




reply via email to

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