bug-make
[Top][All Lists]
Advanced

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

[bug #60297] optimize autodeps


From: Dmitry Goncharov
Subject: [bug #60297] optimize autodeps
Date: Sat, 3 Apr 2021 11:44:49 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0

Follow-up Comment #14, bug #60297 (project make):

Let me provide a verbose description of .NOTINTERMEDIATE here.


This piece of make code allows to get rid from include directive with
generated dep files.

Motivation for this piece of make code is described as 1,2,3 and 4 in update
6.


.SECONDEXPANSION: %.o

%.o: %.c %.d $$(file <%.d)
    gcc $(CPPFLAGS) $(CFLAGS) -MD -MF $*.td -o $@ -c $<
    read obj src headers <$*.td; echo "$$headers" >$*.d
    touch -c $@

%.d: ;
%.h: ;

The only missing piece is that make considers .d and .h files intermediate.

In order for this piece of code to work we need to tell make that  files which
match %.d and %.h are not intermediate.

.SECONDARY allows us to prevent make from deleting these files.

But, preventing removal is not enough.

.SECONDARY prevents deletion, but the file is still intermediate and thus,
still gives make a green light to not rebuild a target when one of the
intermediate prerequisites is missing.


When a .d file or .h is missing (not deleted by make, but for some other
reason) we need to have the related rule run to generate a new .d file.


So, a mechanism is needed to accompany implicit rules to let the user mark
chosen patterns as not intermediate (not secondary, but  full opposite of
intermediate).


> But since the targets you are referring to are already intermediate this
isn't an issue. 

It is an issue. Because as long as .d and .h files are intermedaite make won't
rebuild, if some .d or .h file is missing.


> As far as I can tell, that's the purpose of the .NOTINTERMEDIATE target you
introduced: to prevent files from being removed so that $(file ...) can read
them.

This is one of 2 purposes of .NOTINTERMEDIATE. The other purpose is to force a
rebuild when .d or .h file is missing. That's why there are these 2 rules.
%.d: ;
%.h: ;


i am not describing why a rebuild is needed when .d or .h file is missing. You
already described that well in your Auto-Dependency Generation article.

Hope this makes it clear.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?60297>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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