[PATCH 04/13] sim/ppc: make defines.h sed command portable

Andrew Burgess aburgess@redhat.com
Mon Aug 17 15:36:49 GMT 2026


Simon Marchi <simon.marchi@efficios.com> writes:

> When building on macOS, whose sed is the BSD one, I get:
>
>       GEN      ppc/stamp-defines
>     sed: 1: "/^#define HAVE_.*1$/{ s ...": extra characters at the end of p command
>     make[1]: *** [ppc/stamp-defines] Error 1
>
> BSD sed apparently does not accept a `}' directly after another command,
> it needs a separating semicolon.  Add one after the `p'.  GNU sed
> accepts both forms, and produces the same output either way.

Approved-By: Andrew Burgess <aburgess@redhat.com>

Thanks,
Andrew

>
> Re-generate sim/Makefile.in.
>
> Change-Id: I0709ad7b0051e08299f2576113b549aba9fc703f
> ---
>  sim/Makefile.in  | 2 +-
>  sim/ppc/local.mk | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/sim/Makefile.in b/sim/Makefile.in
> index 1f9bbfec03f1..2a23b5c2eaa9 100644
> --- a/sim/Makefile.in
> +++ b/sim/Makefile.in
> @@ -5722,7 +5722,7 @@ testsuite/common/bits64m63.c: testsuite/common/bits-gen$(EXEEXT) testsuite/commo
>  
>  @SIM_ENABLE_ARCH_ppc_TRUE@ppc/defines.h: ppc/stamp-defines ; @true
>  @SIM_ENABLE_ARCH_ppc_TRUE@ppc/stamp-defines: config.h Makefile
> -@SIM_ENABLE_ARCH_ppc_TRUE@	$(AM_V_GEN)$(SED) -n -e '/^#define HAVE_.*1$$/{ s/ 1$$/",/; s/.* HAVE_/"HAVE_/; p }' < config.h > ppc/defines.hin
> +@SIM_ENABLE_ARCH_ppc_TRUE@	$(AM_V_GEN)$(SED) -n -e '/^#define HAVE_.*1$$/{ s/ 1$$/",/; s/.* HAVE_/"HAVE_/; p; }' < config.h > ppc/defines.hin
>  @SIM_ENABLE_ARCH_ppc_TRUE@	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change ppc/defines.hin ppc/defines.h
>  @SIM_ENABLE_ARCH_ppc_TRUE@	$(AM_V_at)touch $@
>  
> diff --git a/sim/ppc/local.mk b/sim/ppc/local.mk
> index f9f134abe3c9..9aca96465acd 100644
> --- a/sim/ppc/local.mk
> +++ b/sim/ppc/local.mk
> @@ -80,7 +80,7 @@ noinst_PROGRAMS += %D%/run
>  
>  %D%/defines.h: %D%/stamp-defines ; @true
>  %D%/stamp-defines: config.h Makefile
> -	$(AM_V_GEN)$(SED) -n -e '/^#define HAVE_.*1$$/{ s/ 1$$/",/; s/.* HAVE_/"HAVE_/; p }' < config.h > %D%/defines.hin
> +	$(AM_V_GEN)$(SED) -n -e '/^#define HAVE_.*1$$/{ s/ 1$$/",/; s/.* HAVE_/"HAVE_/; p; }' < config.h > %D%/defines.hin
>  	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/defines.hin %D%/defines.h
>  	$(AM_V_at)touch $@
>  
> -- 
> 2.55.0



More information about the Binutils mailing list