Follow-up Comment #1, bug #65972 (group make):

Unfortunately the output shown in the comment here is not the important part. 
The important part is why make decided that the -test file needs to be
updated, so you need to look at how make processes the target that is being
rebuilt, not the thing that depends on that target.  And, by extracting only
the "Must build" lines you've lost the information about why make decides it
must be rebuilt.

However, the log files attached do provide this information.

Let us consider for example the dmevents-test target, which 4.3 does not
rebuild but 4.4.1 does.

In the 4.3 version we see these results for this target:

     Finished prerequisites of target file 'dmevents-test'.
     Prerequisite 'dmevents.o' of target 'dmevents-test' does not exist.
     Prerequisite 'dmevents.o.wrap' of target 'dmevents-test' does not exist.
     Prerequisite '../libmultipath/devmapper.o' of target 'dmevents-test' does
not exist.
     Prerequisite 'libmultipath.so.0' is older than target 'dmevents-test'.
     Prerequisite '../libmpathutil/libmpathutil.so.0' is older than target
'dmevents-test'.
     Prerequisite '../libmpathcmd/libmpathcmd.so.0' is older than target
'dmevents-test'.
     Prerequisite 'Makefile' is older than target 'dmevents-test'.
    No need to remake target 'dmevents-test'.

while in 4.4.1 we see these results:

  Finished prerequisites of target file 'dmevents-test'.
   Prerequisite 'dmevents.o' is newer than target 'dmevents-test'.
   Prerequisite 'dmevents.o.wrap' is newer than target 'dmevents-test'.
   Prerequisite '../libmultipath/devmapper.o' is newer than target
'dmevents-test'.
   Prerequisite 'libmultipath.so.0' is older than target 'dmevents-test'.
   Prerequisite '../libmpathutil/libmpathutil.so.0' is older than target
'dmevents-test'.
   Prerequisite '../libmpathcmd/libmpathcmd.so.0' is older than target
'dmevents-test'.
   Prerequisite 'Makefile' is older than target 'dmevents-test'.
  Must remake target 'dmevents-test'.


Examining the 4.4.1 logs, it appears to me that the important difference is
actually this line:

   Prerequisite '../libmultipath/devmapper.o' is newer than target
'dmevents-test'.

Once this prerequisite is decided to be rebuilt, then all the other
prerequisites, which were considered intermediate due to the .SECONDARY
statement, also must be rebuilt.

So why is this target rebuilt?  Well, it's not marked as intermediate because
it doesn't appear in the OBJS variable, and make knows that we can build a
../libmultipath/devmapper.o from a ../libmulitpath/devmapper.c which does
exist, so this behavior makes sense to me.

In other words, to me it looks like GNU Make 4.3 is wrong and GNU Make 4.4.1
is correct.

Maybe it would help to declare all the object files .SECONDARY, not just the
TEST objects and helpers; e.g., change:

.SECONDARY: $(OBJS)

to something like this:

.SECONDARY: $(OBJS) $(foreach T,$(TESTS),$($T-test_OBJDEPS))

Does that allow it to work the way you want?


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?65972>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature

Reply via email to