help-make
[Top][All Lists]
Advanced

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

another option that deserves a mention on .ONESHELL doc page is -x


From: Britton Kerin
Subject: another option that deserves a mention on .ONESHELL doc page is -x
Date: Sat, 8 Jan 2022 14:10:23 -0900

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



reply via email to

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