[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Non existing target not marked as new
From: |
Paul Smith |
Subject: |
Re: Non existing target not marked as new |
Date: |
Sun, 12 Feb 2017 16:25:10 -0500 |
On Sun, 2017-02-12 at 12:11 +0000, Raz Manor wrote:
> OK, I got it. I used .SECONDARY instead of .PRECIOUS to preserve the
> .d and .o files. I did it because I still wanted files to be deleted
> if they were stopped mid-build. Is there a way to get both of the
> behaviors?
The sample auto-dep makefile definitely does NOT mark the .o files as
.PRECIOUS. That would be a very bad idea (IMO)!
I don't think it matters whether the .d files are marked as .PRECIOUS or
not, because if the .o file is deleted (not precious) when the build is
stopped, then it will always be recreated on rebuild. So whether the .d
file is accurate or not is irrelevant (as long as it's not corrupted,
but since the rules generate the .d file to a separate name then
atomically rename it that shouldn't ever be a problem).
The reason the .d files are .PRECIOUS is so they don't get removed as
intermediate files. If you really don't want to make them precious then
you just have to ensure theyre not considered intermediate files: you
can list them as explicit prerequisites of some rule. So you could
simply create a dummy target that lists them all; something like:
.PHONY: all-deps
all-deps: $(patsubst %,$(DEPDIR)/%.d,$(basename $(SRCS))))
That should be sufficient, allowing you to remove the .PRECIOUS line.
> Also, while debugging I made a mistake not to -include the .d files,
> but they were still a precious dependency of the .o files, and there
> was the %.d: ; rule to 'make' them. That made the .o to still not
> rebuild because the .d file was not built. Why was that?
Sorry, I didn't really understand that. If you want to send an example
makefile and show the behavior you saw and explain what you expected to
see instead, we can take a look.
Re: Non existing target not marked as new, Philip Guenther, 2017/02/09