bug-make
[Top][All Lists]
Advanced

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

.SECONDARY: unwanted effect of not causing rebuilds when intermediate fi


From: Britton Kerin
Subject: .SECONDARY: unwanted effect of not causing rebuilds when intermediate files missing
Date: Mon, 5 Apr 2021 15:27:37 -0800

I don't like how .SECONDARY: (without prereqs) causes make to not
rebuild things wen intermediate files are missing, e.g. uncommenting
.SECONDARY in this make file causes make to not rebuild even when
foo.c.validation_stamp is removed:

     OBJS = foo.o

     #.SECONDARY:

     OBJS = foo.o bar.o

     $(OBJS): %.o: %.c
             cp $< $@   # Fake compilation

     # Extra validation requirements for foo.c in particular:
     foo.o: foo.c.validation_stamp
     foo.c.validation_stamp: foo.c
             validation_script.perl $<
             touch $@

     $(OBJS): %.o: %.c
             cp $< $@   # Fake compilation

     clean:
             rm -rf *.o *.c.validation_stamp

This behavior seems just wrong to me.  If we consider intermediate
targets to be significant enough that we don't want them to be
automagically deleted, surely they're important enough that their
absence should trigger a rebuild?

The --debug output for the above Make with .SECONDARY: is unhelpful:

     $ make foo.o --debug
     GNU Make 4.2
     Built for x86_64-pc-linux-gnu
     Copyright (C) 1988-2016 Free Software Foundation, Inc.
     License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
     This is free software: you are free to change and redistribute it.
     There is NO WARRANTY, to the extent permitted by law.
     Reading makefiles...
     Updating makefiles....
     Updating goal targets....
      Prerequisite 'foo.c.validation_stamp' of target 'foo.o' does not exist.
     make: 'foo.o' is up to date.

It would be nice if it said why it doesn't rebuild something that it
just said is a prerequisite.

Even if this behavior of .SECONDARY: is considered desirable, it would
be nice to have some way of telling make what I want to tell it, which
is simply that I want all special handling of intermediate files
disabled (i.e. no automatic removal or strangely weakened dependency
handling).

Britton



reply via email to

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