bug-make
[Top][All Lists]
Advanced

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

Re: [bug #61226] A regression prevents generation of missing included de


From: Alejandro Colomar (man-pages)
Subject: Re: [bug #61226] A regression prevents generation of missing included dependency files.
Date: Tue, 26 Oct 2021 16:13:00 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0

On 10/26/21 3:20 PM, Alejandro Colomar (man-pages) wrote:
Hi Paul and Dmitry,

On 10/26/21 1:16 AM, Paul Smith wrote:
On Mon, 2021-10-25 at 17:51 -0400, Dmitry Goncharov via Bug reports and
discussion for GNU make wrote:
On Monday, October 25, 2021, Alejandro Colomar (man-pages) <
alx.manpages@gmail.com> wrote:
Why do I do this?  Because, if you remove a file from your tree, an
old .d file will require that file and make your build fail,
requiring you to clean before making again.

This has been solved long ago. Check the awesome advanced dependency
generation article by Paul.

FYI:

http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/

The issue you raise (as well as others) is discussed, hopefully
clearly, in this article [*].


[*] http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/#depdelete


Thanks for sharing that great article!

I'll definitely have to have a look at many or all of the articles in that website!

I've already applied some of the improvements there, reducing no-op make times to 0.7 s in single-process and 0.35 with 'make -j'.  I'll keep adding the other improvements too.

In the end, I couldn't use all of the features that the article shows.

Since I do a lot of static analysis to the files, I also have *.checkpatch.touch (and similar) targets created in the dependencies files, and since those tools can't generate dependencies files as side effects, I need an explicit rule for creating them. Otherwise, if I create all of them at the compilation stage, it is very likely that at some point I only run static analysis and not compilation, and I'll have outdated dependencies files the next time I run static analysis, and I won't notice.

Maybe I could overcome this with some complicated workaround, but I don't think it's worth it: 0.7 s is already a very acceptable time :-) And it would probably be a bit obscure and maybe slower for full builds.

So I'm forced to create dependencies files not as side effects, but as real targets:


DEPTARGETS = -MT $<.checkpatch.touch -MT $<.clang-tidy.touch \
             -MT $<.cppcheck.touch -MT $<.cpplint.touch
DEPHTARGETS = $(DEPTARGETS) -MT $<.gch
DEPCTARGETS = $(DEPTARGETS) -MT $(builddir_)/$*.i
$(UNITS_h_d):   $(builddir)/%.d: $(INCLUDEDIR)/% $(mk) | $$(@D)/.
        $(CC)  $(CFLAGS)   -I $(INCLUDEDIR) -M -MP $(DEPHTARGETS) -MF $@ $<
$(UNITS_hxx_d): $(builddir)/%.d: $(INCLUDEDIR)/% $(mk) | $$(@D)/.
        $(CXX) $(CXXFLAGS) -I $(INCLUDEDIR) -M -MP $(DEPHTARGETS) -MF $@ $<

$(UNITS_c_d):   $(builddir_)/%.d: $(SRCDIR)/% $(mk) | $$(@D)/.
        $(CC)  $(CFLAGS)   -I $(INCLUDEDIR) -M -MP $(DEPCTARGETS) -MF $@ $<
$(UNITS_cxx_d): $(builddir_)/%.d: $(SRCDIR)/% $(mk) | $$(@D)/.
        $(CXX) $(CXXFLAGS) -I $(INCLUDEDIR) -M -MP $(DEPCTARGETS) -MF $@ $<

<https://github.com/alejandro-colomar/libalx>



Thanks!

Alex


Cheers,

Alex




--
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/



reply via email to

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