Re: Hard to understand make -B on man page

2021-04-03 Thread carl hansen
On Thu, Apr 1, 2021 at 11:52 PM 積丹尼 Dan Jacobson  wrote:
>
> On the make man page,
>
>-B, --always-make
> Unconditionally make all targets.
>
> seems to mean for Makefile
> a:; echo $@
> b:; echo $@
> c:; echo $@
> $ make -B
> should make all three.
>
> Therefore the wording should be more like the INFO page.
>
> GNU Make 4.3
>
The meaning could be better expressed.
"Unconditionally make all targets."
really means
'Make targets even if they are already made.'



[bug #60297] optimize autodeps

2021-04-03 Thread Dmitry Goncharov
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:

  

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




[bug #60297] optimize autodeps

2021-04-03 Thread Paul D. Smith
Follow-up Comment #13, bug #60297 (project make):

It may help to read the docs rather than, or at least in addition to, the
code:

https://www.gnu.org/software/make/manual/html_node/Chained-Rules.html

You're right that if a target is not intermediate then .SECONDARY will make it
intermediate.  But since the targets you are referring to are already
intermediate this isn't an issue.

The main thing .SECONDARY does is stop intermediate files from being deleted. 
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.  Maybe I didn't understand the justification for this new feature: your
note just says it's needed without describing the problems you need to be
solved.

___

Reply to this item at:

  

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




[bug #60297] optimize autodeps

2021-04-03 Thread Dmitry Goncharov
Follow-up Comment #12, bug #60297 (project make):

> Yes, I'm saying we already have a way to mark things "not intermediate"
(.SECONDARY)  The only difference between that and a brand new
.NOTINTERMEDIATE you have proposed is that .SECONDARY doesn't handle patterns
and .NOTINTERMEDIATE does. 

Paul, this must be some sort of blindness on my side. I cannot see how
.SECONDARY can be used to mark files as not intermediate.
As far as i can see, .SECONDARY does the opposite, it marks files as
intermediate. With the only difference from .INTERMEDIATE is that the files
are not getting removed.

___

Reply to this item at:

  

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




[bug #60297] optimize autodeps

2021-04-03 Thread Paul D. Smith
Follow-up Comment #11, bug #60297 (project make):

> Do you mean, that when .SECONDARY depends on a pattern the behavior is the
same as that of .NOTINTERMEDIATE (as proposed here)?
Yes, I'm saying we already have a way to mark things "not intermediate"
(.SECONDARY)  The only difference between that and a brand new
.NOTINTERMEDIATE you have proposed is that .SECONDARY doesn't handle patterns
and .NOTINTERMEDIATE does.

So, rather than introduce a new special target that overlaps partly with the
existing .SECONDARY why not just enhance .SECONDARY to do everything
.NOTINTERMEDIATE does and NOT introduce a brand new special target?

> That would be quite surprising for users, would not it?
In what way?

> make provides .NOTINTERMEDIATE to accompany implicit rules to let the user
mark a pattern of choice as not intermediate, when it otherwise would be
intermediate.
I agree that if we could go back in time (to the early 1990's or so) and
suggest a different name than .SECONDARY that would be better, but of course
we can't, and I'd rather have the name be a bit less obvious than have
multiple different ways to get the same capability.

___

Reply to this item at:

  

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