[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: notes about make docs p 3.5
From: |
Paul Smith |
Subject: |
Re: notes about make docs p 3.5 |
Date: |
Sun, 06 Dec 2020 16:46:03 -0500 |
User-agent: |
Evolution 3.36.4-0ubuntu1 |
On Thu, 2020-12-03 at 15:04 +0300, Dmitry wrote:
> > > It'll be very good to have some examples with explanations in the
> > > docs.
> > Maybe so. Concrete suggestions are easy to discuss, like:
>
> I think this example would saved me a lot of time.
>
> make -f mkfile
>
> content of mkfile:
>
> all:
> @echo total $(MAKE_RESTARTS) MAKE_RESTARTS
>
> mkfile: force
> [ x$(MAKE_RESTARTS) = x3 ] || touch mkfile ; sleep 1
>
> force: ;
I like to show useful things that people might want to do in the make
manual examples. I'm not sure what the above makefile is trying to
accomplish nor why one would want to do something like it. Also there
are a lot of more advanced concepts here like 'force:' etc.: it's
better to work with only one concept at a time if possible.
Maybe if you described the thing you were trying to accomplish or
understand, and what about the documentation made this difficult, we
could come up with a practical example or improve the documentation.
In the SO question you quote it seems like the real confusion stemmed
from other things, not related to remaking makefiles at all; for
example, the fact that a target with no prerequisites is always up to
date if the file exists and so the included makefile would never be
rebuilt if it exists, or that continuously trying to make a file up to
date could run into system limitations with timestamps.
In other words, your question seemed to be trying to force make to
constantly rebuild makefiles in an infinite loop and that was not
successful and the manual didn't explain why that should be. But the
reasons for why it didn't rebuild forever are mostly pretty esoteric
and system-specific, and to my mind don't really belong in the user's
manual.
In a real makefile no one would ever want to force their included files
to be rebuilt forever for example, and they would not run into the
issues in that SO question.
> For me (as a nube in make) would be good something like this:
> Automatic creation of makefile currently possible from only RCS /
> SCCS systems ( more about "Built-In Rules" here -
> https://www.gnu.org/software/make/manual/make.html#Catalogue-of-Rules
> ).
It's not that it's only possible from RCS or SCCS per se.
It's that make only has built-in rules that know how to check out a
makefile from RCS and SCCS.
If you don't have any makefile already, which is the situation this
paragraph is talking about, then all you have are the default rules
that are built into make: without a makefile you can't define your own
custom rules.
In modern source control systems you don't have the same use for this
behavior. When you obtain a workspace you already have all the code
checked out, not an empty directory, and it's not really appropriate to
automatically obtain a newer version of the Makefile from source
control: users want to handle that themselves.
So, it's unlikely that there will be a desire to add built-in rules for
more kinds of source control systems. Probably this paragraph could be
reworked or even mostly removed.