[bug #63867] Port to older versions of gnu tar.

2023-03-05 Thread Paul D. Smith
Follow-up Comment #2, bug #63867 (project make):

I think the recent email is because the tar options are also used to generate
the release tarball, not just to generate the tarball containing error
results.  Note that we manage these options simply by exporting the
TAR_OPTIONS variable, which means every invocation of tar by GNU make will use
these options.

Sorting the release tarball (and the other options here) is something that
people prefer, to allow for reproducible builds etc.

I think it will work better to simply reset these options when generating the
test results tarball, rather than changing the global settings.  I will do
that.


___

Reply to this item at:

  

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




[bug #63867] Port to older versions of gnu tar.

2023-03-05 Thread Paul D. Smith
Follow-up Comment #3, bug #63867 (project make):

Of course when I say "every invocation of tar by GNU make" I obviously mean,
in the GNU make source directory only.


___

Reply to this item at:

  

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




Re: 4.4.1 breaks recursive invocation with --print-directory [when adding to MAKEFLAGS]

2023-03-05 Thread Paul Smith
On Tue, 2023-02-28 at 19:02 -0600, Satish Balay via Bug reports and
discussion for GNU make wrote:
> This usage works with make-4.4 [and older versions] - but not 4.4.1
> 
> balay@p1 /home/balay/tmp
> $ cat makefile
> all:
> @MAKEFLAGS="-j1 ${MAKEFLAGS}" ${MAKE} -f makefile hello
> hello:
> @echo Hello

Sorry for the delay.  I wanted to say that, in addition to not doing
what you intended (changing the number of parallel jobs in a recursive
make), which I discussed last week, the above is actually wrong
(including in older versions of GNU make).

It will work, UNLESS you provide certain options.  I think that's what
Dmitry was getting at with the --print-options thing but it might be
easier to see with a different flag, like "-s" (silent mode).

It has always been true (not changed in 4.x) that the MAKEFLAGS
variable has a first word which is either empty, or contains the
single-letter options with no arguments, AND NO PRECEDING "-".

So if you run "make" then MAKEFLAGS has an empty value.  If you run
"make --no-print-directory" then MAKEFLAGS has the value
" --no-print-directory" (note very carefully the leading space here!)
If you run "make -s" then MAKEFLAGS has the value "s" (note, no leading
space AND no leading "-"!)

In your makefile above, if you run "make -s" then the sub-make is
invoked with MAKEFLAGS="-j1  s".  That "s" is not treated as an option:
it's ignored (probably make should warn about this) so now you've lost
your "silent" option.  You can see this with your makefile above, and
ANY version of GNU make, by removing the "@" from the echo line and
running it like this:

  $ make
  MAKEFLAGS="-j1 " make -f makefile hello
  make[1]: Entering directory '/tmp'
  echo Hello
  Hello
  make[1]: Leaving directory '/tmp'

Note how we make prints the recipe "echo hello".  Now if we ran
"make -s" instead we would expect to see that line NOT printed because
we run in silent mode; here's what we get:

  $ make -s
  make[1]: Entering directory '/tmp'
  echo Hello
  Hello
  make[1]: Leaving directory '/tmp'

Note here, the top-level makefile is silent because the "-s" option was
in effect, BUT the sub-make was not silent: we lost the "-s" option as
I described above.

Andreas is correct, if you want to add options to MAKEFLAGS you MUST
add the "-".  Luckily, make ignores a single "-" in MAKEFLAGS so you
don't have to get more complicated:

  all:
@MAKEFLAGS="-j1 -${MAKEFLAGS}" ${MAKE} -f makefile hello

I believe this works in all versions of GNU make.

But as I said in my previous email, you can't change the value of N in
-jN using this method (or any other method).




Re: 4.4.1 breaks recursive invocation with --print-directory [when adding to MAKEFLAGS]

2023-03-05 Thread Satish Balay via Bug reports and discussion for GNU make
Thanks for all the suggestions.

The code is not attempting to "change -j" - but have a "default" when the 
top-level is not invoked with '-j'. i.e:

-'make' should use the default set in the makefile
- make -j3' should use this value specified here [and ignore the default].

I'm reworking the code to avoid modifying MAKEFLAGS (as suggested in this 
thread). And using shell here [as currently this makefile can also be processed 
by non-gnu-make]. i.e something like:

if '-j' in $(MAKEFLAGS):
   usej=''
else:
   usej='-j$(DEFAULT_NP)'
${CONFIGURED_MAKE} -f makefile $$(usej)

thanks,
Satish



On Sun, 5 Mar 2023, Paul Smith wrote:

> On Tue, 2023-02-28 at 19:02 -0600, Satish Balay via Bug reports and
> discussion for GNU make wrote:
> > This usage works with make-4.4 [and older versions] - but not 4.4.1
> > 
> > balay@p1 /home/balay/tmp
> > $ cat makefile
> > all:
> > @MAKEFLAGS="-j1 ${MAKEFLAGS}" ${MAKE} -f makefile hello
> > hello:
> > @echo Hello
> 
> Sorry for the delay.  I wanted to say that, in addition to not doing
> what you intended (changing the number of parallel jobs in a recursive
> make), which I discussed last week, the above is actually wrong
> (including in older versions of GNU make).
> 
> It will work, UNLESS you provide certain options.  I think that's what
> Dmitry was getting at with the --print-options thing but it might be
> easier to see with a different flag, like "-s" (silent mode).
> 
> It has always been true (not changed in 4.x) that the MAKEFLAGS
> variable has a first word which is either empty, or contains the
> single-letter options with no arguments, AND NO PRECEDING "-".
> 
> So if you run "make" then MAKEFLAGS has an empty value.  If you run
> "make --no-print-directory" then MAKEFLAGS has the value
> " --no-print-directory" (note very carefully the leading space here!)
> If you run "make -s" then MAKEFLAGS has the value "s" (note, no leading
> space AND no leading "-"!)
> 
> In your makefile above, if you run "make -s" then the sub-make is
> invoked with MAKEFLAGS="-j1  s".  That "s" is not treated as an option:
> it's ignored (probably make should warn about this) so now you've lost
> your "silent" option.  You can see this with your makefile above, and
> ANY version of GNU make, by removing the "@" from the echo line and
> running it like this:
> 
>   $ make
>   MAKEFLAGS="-j1 " make -f makefile hello
>   make[1]: Entering directory '/tmp'
>   echo Hello
>   Hello
>   make[1]: Leaving directory '/tmp'
> 
> Note how we make prints the recipe "echo hello".  Now if we ran
> "make -s" instead we would expect to see that line NOT printed because
> we run in silent mode; here's what we get:
> 
>   $ make -s
>   make[1]: Entering directory '/tmp'
>   echo Hello
>   Hello
>   make[1]: Leaving directory '/tmp'
> 
> Note here, the top-level makefile is silent because the "-s" option was
> in effect, BUT the sub-make was not silent: we lost the "-s" option as
> I described above.
> 
> Andreas is correct, if you want to add options to MAKEFLAGS you MUST
> add the "-".  Luckily, make ignores a single "-" in MAKEFLAGS so you
> don't have to get more complicated:
> 
>   all:
>   @MAKEFLAGS="-j1 -${MAKEFLAGS}" ${MAKE} -f makefile hello
> 
> I believe this works in all versions of GNU make.
> 
> But as I said in my previous email, you can't change the value of N in
> -jN using this method (or any other method).
> 


whitespaces preceding backslash sometimes removed in POSIX mode

2023-03-05 Thread Arkadiusz Drabczyk
In the manual it says:

"If the @code{.POSIX} special target is defined then backslash/newline
handling is modified slightly to conform to POSIX.2: first, whitespace
preceding a backslash is not removed and second, consecutive
backslash/newlines are not condensed."

but I cannot reproduce it with this example makefile:

.POSIX:

var = one  \
two  \
three  \
four

define var1
a  \
b  \
c
endef

all:
echo ${var}
echo ${var1}

Output:

$ make
echo one two three four
one two three four
echo a   b   c
a b c

If I read the manual correctly whitespaces between all words should be
preserved in expansion of var too but they are not. This is how bmake
behaves for example, output of `echo ${var}' would be:

echo one   two   three   four
one two three four

For the record, I saw this
https://savannah.gnu.org/bugs/index.php?16670. Is my understanding
correct?

BTW, in make/make/src/misc.c it says:

In POSIX, each backslash/newline and is replaced by a space.  */

I believe some words are missing in this sentence?

-- 
Arkadiusz Drabczyk