octave-maintainers
[Top][All Lists]
Advanced

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

simple_move_if_change_rule breaks make build process


From: John W. Eaton
Subject: simple_move_if_change_rule breaks make build process
Date: Mon, 4 Jan 2010 02:29:19 -0500

On  2-Jan-2010, Rik wrote:

| The make process relies on the timestamps of files to determine when a
| dependency is newer than its target and therefore has to be re-made. 
| The move_if_change rule was designed to prevent unnecessary compilations
| by only updating a file when it was changed.  Unfortunately, this has a
| perverse effect where a dependency has been changed, causing make to
| rebuild the target, but the move_if_change rule prevents the target from
| acquiring a new timestamp.  At this point make will always attempt to
| rebuild the target since the timestamp of the target is always older
| than that of the dependency.
| 
| Example
| 
| A : B
|     command1 to make A
|     command2 to make A
|     ...
|     $(simple_move_if_change_rule)
| 
| If B is updated for any reason then make will use the commands listed to
| re-make A.  The move_if_change rule will only update A if some change
| has actually occurred.  Most of the time there hasn't been a change and
| so A will not acquire a new timestamp.  The next time make is run it
| will determine again that A is older than B and it will re-run the
| commands to make A.

That's just the way move-if-change works.  It works OK and still saves
time if making A and then deleting it because there was no significant
change is much faster than running all the commands that depend on A,
and that would have to be run if A is touched, even though it has not
really changed.

| For a practical example, see the DOCSTRINGS file in src/Makefile.am.

Isn't that move-if-change rule necessary if we want to avoid building
the documentation when Octave is built from a distribution tar file?
Or is that a separate issue?

| One solution would be to get rid of the move_if_change rule and revert
| to using just 'mv address@hidden $@'.  Another solution is to depend on an
| intermediate timestamp file which can be updated by make.
| 
| A.ts : B
|     command to make A.ts
|     compare A, A.ts && cp A.ts to A if they are different

I'd be happy to eliminate move-if-change if there is a better way.

jwe


reply via email to

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