1

At the end of my build, make deletes a file:

Removing intermediate files...
rm some/dir/myfile.inc

I want to keep it to make later builds faster, but I have not been able to. Either one of these two lines should force make to keep all intermediate files, as in this question, but they have no effect:

.SECONDARY:
.PRECIOUS:

If I spell out the exact file path it does keep the file:

.SECONDARY: some/dir/myfile.inc

If but this does not work

.SECONDARY: %.inc

Is the .SECONDARY rules being ignored because of a later rule like this is more specific?

%foo.o %foo.h %foo.inc: some_other_file
    dosomething
Community
  • 1
  • 1
Tor Klingberg
  • 4,790
  • 6
  • 41
  • 51
  • What version of make are you using? I don't think `.SECONDARY` takes patterns only explicit targets. `.PRECIOUS` takes patterns but I think they need to exactly match the pattern of a pattern rule. – Etan Reisner Mar 24 '15 at 15:32
  • GNU Make 3.81. The accepted answer to [Undo intermediate files deletion - how to?](http://stackoverflow.com/questions/9638275/undo-intermediate-files-deletion-how-to) implies that patterns should work. – Tor Klingberg Mar 24 '15 at 15:45
  • Yes. Patterns do work for `.PRECIOUS` (which I said). You are trying them with `.SECONDARY` (which is different). But I think `.SECONDARY:` with no prerequisites should work for 3.81 (but wouldn't with 3.80 and earlier I believe). (And `.PRECIOUS:` with no prerequisites doesn't mean anything I don't think.) – Etan Reisner Mar 24 '15 at 15:59
  • I remember hitting a similar issue, updating make version helped that time. Too bad I can't remember make versions involved. – Maxim Egorushkin Mar 24 '15 at 16:27
  • 2
    possible duplicate of [Why .SECONDARY does not work with patterns (%) while .PRECIOUS does?](http://stackoverflow.com/questions/27090032/why-secondary-does-not-work-with-patterns-while-precious-does) – Louis Mar 25 '15 at 10:41

0 Answers0