Bug 3475

Summary: have configure [conditionally] generate all built files
Product: frysk Reporter: Andrew Cagney <cagney>
Component: generalAssignee: Stepan Kasal <skasal>
Status: ASSIGNED ---    
Severity: normal CC: jan
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:
Bug Depends on:    
Bug Blocks: 2235    

Description Andrew Cagney 2006-11-07 15:44:54 UTC
Files such as the list of tests should be conditionally re-generated whenever
configure is run.  "conditional" in that the re-generate needs to check to see
if the file was changed and only update when really changed.  Will likely
involve a combination of both autoconf and automake foo.
Comment 1 Stepan Kasal 2006-11-14 21:33:57 UTC
Speaking about "Automake fu":

This is a conflict of different styles:

1)
"The Automake way" is to list all source files explicitely (in a variable in
Makefile.am, or in a file, it does not matter).  So if a file happens to sit in
the tree, it does not mean it is picked automatically.

2)
Our current way is to run `find' during bootstrap, and make the list of all
present files.

The disadvantage of 1) is that each time you add/remove a source file, you also
have to update the list.

The advantage of 1) is that each time you add/remove a source file, you also
update the list.  This update can be noticed by `make' and handled properly.

OTOH, with 2), you are doomed to do ``active waiting'' you have to go through
the filesystem frequently, to make sure, that no file was dropped in or deleted.

There is a tradeoff: if you check the filesystem too frequently, things get
slow.  If you do not check it frequently enough, people complain that their file
have not been noticed.

We currently check the filesystem only at bootstrap.  This bug proposes to check
it on each configure.  But wouldn't it be better to check it on each `make'?

(Please note that bug 3474 is about avoinding the need to run configure
explicitely if some packages were upgraded.  OTOH, if we implement the
Makefile.gen check as proposed, one would have to run configure explicitely each
time a *.java file is added.  Isn't this an inconsistency?)

[As you might guess, my heart is on the side of ``the Automake way'', ie. 1).
But I'm willing to implement whatever we agree upon, I just want to discuss the
parameters before the actual implementation.]
Comment 2 Stepan Kasal 2006-11-14 22:36:00 UTC
An idea:
Makefile.gen.sh could always re-create Makefile.gen only conditionally; if would
create Makefile.gen.tmp and move it to Makefile.gen only if it differs.

./configure could then call something like
  $(srcdir)/bootstrap.sh --stop-right-after-running-Makefile-gen-sh
Comment 3 Stepan Kasal 2006-11-14 22:56:17 UTC
Dear reader, please forget about comment #1.

My implementation will follow comment #2.
Comment 4 Andrew Cagney 2006-11-14 23:30:27 UTC
(In reply to comment #1)
> Speaking about "Automake fu":

This is Java; automake was never designed with Java, and what little support
there is is unfortunatly very limited.  The requirements of Java when compared
to the "The Automake Way" are in conflict by definition.

For instance, a key requirement of Java, and which serves in stark contrast to
more traditional projects such as those involving C, is the need to efficiently
and robustly handle constant and rapid file / class name changes.  "The Automake
Way", which requires the user to maintain a complex set of file lists and rules
in Makefile.am by hand, might kind of work ok when there's little change but
fails totally when the changes are on the scale that occure with Java.

Frysk's build system addresses this by automating the process of creating and
maintaining that information.  It does come at a price though, the build system
assumes that all source files are being built.  Having had to maintain lists by
hand, and use this system, I have to say that this system is far and away more
robust - only required files get added and file are never missed.
Comment 5 Andrew Cagney 2006-11-14 23:44:39 UTC
(In reply to comment #0)
> Files such as the list of tests should be conditionally re-generated whenever
> configure is run.  "conditional" in that the re-generate needs to check to see
> if the file was changed and only update when really changed.  Will likely
> involve a combination of both autoconf and automake foo.

First, note that at present, the list of tests is done by make; what at first
sight is missing is just a dependency of the tests list file on Makefile.

The problem with that dependency, and the reason it was removed, is that it
would cause that file and all downstream dependencies to be re-built when ever
the makefile changed, and not when ever tests were added or removed.

The proposal is to only update the test list when it changes (but check it when
ever there's a re-configure); that way false re-builds could be avoided.  It
could be done solely using Makefile foo, or a combination of autoconf and
makefile stuff.

The autoconf info pages discuss this further (if somewhat randomly).

Comment 6 Stepan Kasal 2006-12-14 19:36:16 UTC
A note: Jan Kratochvil has mentioned this issue in the irc today.  During our
conversation, he has convinced me that it is desirable and doable that the
generated parts of *.am are check upon every "make", not only by configure.
It might help if we require GNU make for the feature, but I doubt it is any
limitation these times.