After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 172211 - "make install" rebuilds gnm-marshalers.c and all targets depending on it
"make install" rebuilds gnm-marshalers.c and all targets depending on it
Status: RESOLVED FIXED
Product: Gnumeric
Classification: Applications
Component: Compilation
git master
Other All
: Normal normal
: ---
Assigned To: Stepan Kasal
Stepan Kasal
Depends on:
Blocks:
 
 
Reported: 2005-03-31 10:05 UTC by Stepan Kasal
Modified: 2005-03-31 12:34 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Stepan Kasal 2005-03-31 10:05:49 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.
Comment 1 Stepan Kasal 2005-03-31 10:10:17 UTC
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.
Comment 2 Stepan Kasal 2005-03-31 10:49:00 UTC
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.
Comment 3 Stepan Kasal 2005-03-31 11:03:01 UTC
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.
Comment 4 Stepan Kasal 2005-03-31 12:28:57 UTC
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".
Comment 5 Stepan Kasal 2005-03-31 12:34:01 UTC
Oops!  Please forget Comment #3.

The solution from Comment #4 seems to fix bug #172212, too.
So I'm going to use it.