[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: another option that deserves a mention on .ONESHELL doc page is -x
From: |
David Boyce |
Subject: |
Re: another option that deserves a mention on .ONESHELL doc page is -x |
Date: |
Sat, 8 Jan 2022 20:40:53 -0800 |
I won't address the main point, but if you add -x to .SHELLFLAGS you ought
to add .SILENT: as well to solve the problem of "repeating the commands a
second time":
$ cat Makefile
.ONESHELL:
.SILENT:
test: .SHELLFLAGS = -e -x -c
test:
true
ls nonexistent
touch $@
$ make
+ true
+ ls nonexistent
ls: cannot access nonexistent: No such file or directory
make: *** [Makefile:6: test] Error 2
On Sat, Jan 8, 2022 at 3:11 PM Britton Kerin <britton.kerin@gmail.com>
wrote:
> I don't know how POSIX-ish it is but IMO -x deserves a mention,
> especially since -e gets one. It's a little annoying that it end up
> repeating the commands a second time, but without it you end up with
> all the commands listed, followed by an error for one of the early
> ones which is confusing at best and ambiguous about where the error
> actually occurred at worst.
>
> With -x:
>
> $ cat Makefile
> .ONESHELL:
>
> test: .SHELLFLAGS = -e -x -c
> test:
> true
> ls nonexistent
> touch $@
> $ make test
> true
> ls nonexistent
> touch test
> + true
> + ls nonexistent
> ls: cannot access 'nonexistent': No such file or directory
> make: *** [Makefile:5: test] Error 2
>
> Without -x:
>
> $ cat Makefile
> .ONESHELL:
>
> test: .SHELLFLAGS = -e -c
> test:
> true
> ls nonexistent
> touch $@
> $ make test
> true
> ls nonexistent
> touch test
> ls: cannot access 'nonexistent': No such file or directory
> make: *** [Makefile:5: test] Error 2
>
>