[Top][All Lists]

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

Keeping intermediate files

From: Frank Heckenbach
Subject: Keeping intermediate files
Date: Thu, 20 May 2021 22:29:01 +0200

Is there are way to completely stop GNU make from removing
intermediate files?

When something goes wrong, I sometimes like to examine things step
by step, and intermediate files are sometimes useful in that. I fail
to see any benefit in removing them -- it's certainly not that they
blow up generated file size in any noticeable way (even just
comparing to the amount of stuff dumped by automake etc.). So in my
view, this feature is mostly of historical interest and causes
(me at least) much more trouble than benefits, so I'd like to get
rid of it entirely.

When searching for it, I see mostly 3 recommendations, but they all
have some drawbacks:

a) Listing them as targets. But that works only for files explicitly
   mentioned, where I seek a solution that prevents deletion

b) Marking files as .PRECIOUS. That would leave half-finished files
   in case of interrupts, so not suitable as a general solution.

c) Marking them as .SECONDARY, either

   - listing them explictly (same problem as a)

   - just ".SECONDARY:" with no prerequisites which makes all
     targets secondary (like I want), but also makes all targets
     immediate, e.g. with this Makefile, if y exists and x doesn't,
     it will remake x, but not y, which is not what I want:

all: x y
        touch $@
y: x
        touch $@

Am I missing a way to do it without adverse side-effects?

If not, could you add e.g. a special target to this effect, say
".KEEP_INTERMEDIATE"? It seems easy to implement (just add it to the
"punt" condition at the start of remove_intermediates).

reply via email to

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