[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
simple_move_if_change_rule breaks make build process
From: |
Rik |
Subject: |
simple_move_if_change_rule breaks make build process |
Date: |
Sat, 02 Jan 2010 09:05:46 -0800 |
1/2/10
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. A not very satisfactory way out of the problem is
to run 'make all; make -t all' to first build everything and then just
adjust the timestamps.
For a practical example, see the DOCSTRINGS file in src/Makefile.am.
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
Are there other approaches that Make wizards use?
--Rik
- simple_move_if_change_rule breaks make build process,
Rik <=