GNOME Bugzilla – Bug 172211
"make install" rebuilds gnm-marshalers.c and all targets depending on it
Last modified: 2005-03-31 12:34:01 UTC
When I run 0) ./configure 1) make 2) make install then "make install" rebuilds src/gnm-marshalers.c, src/gnm-marshalers.lo and all targets which depend on it. Thusly, it relinks gnumeric. This behaviour is dangerous, as one might run "make instal" with a modified prefix. The bug appears with GNU make.
When you change the scenario this way: 0) ./configure 1) make 2) make 3) make install then the second make does the rebuild, and the "make install" works correctly. So it's not the case that src/gnm-marshalers.c is constantly rebuilt, it's rebuilt only once.
An analysis: To create gnm-marshalers.lo, make has to use the following two implicit rules: .list.c: .c.lo: Then gnm-marshalers.c is so called "intermediate file", and make deletes it as soon as gnm-marshalers.lo is created. So the first run of make in fact doesn't create gnm-marshalers.c. But the first run of make creates file .deps/gnm-marshalers.Plo. That file specifies the dependency gnm-marshalers.lo: gnm-marshalers.c In the next run of make, .deps/gnm-marshalers.Plo is included by the Makefile. In this file, gnm-marshalers.c is mentioned explicitely as a prerequisite: this means that it can no longer be treated as an "intermediate file", and since it doesn't exist, it has to be created. Thus it is created, and all targets depending on it have to be refreshed.
There are several possible ways to fix the problem. For example, it's enough to add the following rule: gnm-marshallers-dummy: gnm-marshallers.c Since the file is mentioned explicitly as a prerequisite, it will never be treated as an "intermediate file". Another solution is to add the gnm-marshallers.c to BUILT_SOURCES. (BUILT_SOURCES are prerequisities of the targets "all", "check" and "install".) Though the former solution is more elegant, the later one has the advantage that it also fixes bug #172212, so I commit it.
IMHO, the most elegant solution is to add the rule gnm-marshallers-dummy: gnm-marshallers.c Since the file is mentioned explicitly as a prerequisite, it will never be treated as an "intermediate file".
Oops! Please forget Comment #3. The solution from Comment #4 seems to fix bug #172212, too. So I'm going to use it.