From 6170252adc146638c283705c9f252cde66ac224e Mon Sep 17 00:00:00 2001 From: Eugene Syromyatnikov Date: Tue, 19 Feb 2019 00:01:01 +0100 Subject: [PATCH] Makefile.am: pass D variable to shell scripts' environment And set -x if D is set to 1, so the commands called by various shell scripts are easier to see during debugging. * Makefile.am (bpf_attr_check.c, sen.h, mpers-m%.stamp, $(srcdir)/CREDITS): Pass D variable in the environment to the shell script call. * gen_bpf_attr_check.sh: Set -x if D is set to 1. * generate_mpers_am.sh: Likewise. * generate_sen.sh: Likewise. * maint/gen-contributors-list.sh: Likewise. * mpers.sh: Likewise. * mpers_test.sh: Likewise. --- Makefile.am | 5 +++++ gen_bpf_attr_check.sh | 2 ++ generate_mpers_am.sh | 2 ++ generate_sen.sh | 2 ++ maint/gen-contributors-list.sh | 2 ++ mpers.sh | 2 ++ mpers_test.sh | 2 ++ 7 files changed, 17 insertions(+) diff --git a/Makefile.am b/Makefile.am index 0e26296f..de994b1c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -927,6 +927,7 @@ $(srcdir)/.version: $(AM_V_GEN)echo $(VERSION) > $@-t && mv $@-t $@ bpf_attr_check.c: $(srcdir)/bpf_attr.h $(srcdir)/gen_bpf_attr_check.sh + D="$(D)" \ $(srcdir)/gen_bpf_attr_check.sh $< > $@-t && mv $@-t $@ strace_SOURCES_c = \ @@ -946,6 +947,7 @@ syscallent_files = $(filter $(syscallent_patterns),$(EXTRA_DIST)) sen.h: $(patsubst %,$(srcdir)/%,$(syscallent_files)) for f in $^; do cat -- $$f; done | \ + D="$(D)" \ $(srcdir)/generate_sen.sh > $@ dist-hook: @@ -1037,6 +1039,7 @@ libmpers_CFLAGS = $(strace_CFLAGS) mpers-m%.stamp: $(srcdir_mpers_source_files) | printers.h for f in $^; do \ + D="$(D)" \ READELF="$(READELF)" \ CC="$(CC)" \ CFLAGS="$(mpers_sh_opts) -DMPERS_IS_$(mpers_NAME)" \ @@ -1155,6 +1158,8 @@ $(srcdir)/CREDITS: $(srcdir)/CREDITS.in $(srcdir)/.mailmap \ $(srcdir)/Makefile.in $(srcdir)/.version $(AM_V_GEN) \ ( \ + D="$(D)"; \ + export D; \ cd $(srcdir); \ sed '/^##/,$$d' CREDITS.in; \ sed -n '1,/^##>/d; s/ */\t/; s/^./&/p' CREDITS.in \ diff --git a/gen_bpf_attr_check.sh b/gen_bpf_attr_check.sh index 36e3350f..686027e9 100755 --- a/gen_bpf_attr_check.sh +++ b/gen_bpf_attr_check.sh @@ -4,6 +4,8 @@ # # SPDX-License-Identifier: LGPL-2.1-or-later +[ "x${D:-0}" != x1 ] || set -x + input="$1" shift diff --git a/generate_mpers_am.sh b/generate_mpers_am.sh index 7cd53438..b35bcc6a 100755 --- a/generate_mpers_am.sh +++ b/generate_mpers_am.sh @@ -5,6 +5,8 @@ # # SPDX-License-Identifier: LGPL-2.1-or-later +[ "x${D:-0}" != x1 ] || set -x + list="$(sed -r -n '/^strace_SOURCES[[:space:]]*=/,/^[[:space:]]*# end of strace_SOURCES/ s/^[[:space:]]*([[:alnum:]][^.]*\.c)[[:space:]]*\\$/\1/p' Makefile.am | xargs -r grep -Elx '#[[:space:]]*include[[:space:]]+MPERS_DEFS' | tr '\n' ' ')" diff --git a/generate_sen.sh b/generate_sen.sh index 39c96772..ef35fd5b 100755 --- a/generate_sen.sh +++ b/generate_sen.sh @@ -5,6 +5,8 @@ # # SPDX-License-Identifier: LGPL-2.1-or-later +[ "x${D:-0}" != x1 ] || set -x + echo 'enum {' echo 'SEN_printargs = 0,' sed -r -n '/printargs/! s/.*SEN\(([^)]+)\).*/\1/p' | diff --git a/maint/gen-contributors-list.sh b/maint/gen-contributors-list.sh index 479f08c7..8dfca4a9 100755 --- a/maint/gen-contributors-list.sh +++ b/maint/gen-contributors-list.sh @@ -5,6 +5,8 @@ # # SPDX-License-Identifier: LGPL-2.1-or-later +[ "x${D:-0}" != x1 ] || set -x + print_help() { cat <<__EOF__ diff --git a/mpers.sh b/mpers.sh index 5f451cce..7d226e07 100755 --- a/mpers.sh +++ b/mpers.sh @@ -6,6 +6,8 @@ # # SPDX-License-Identifier: LGPL-2.1-or-later +[ "x${D:-0}" != x1 ] || set -x + export LC_ALL=C MPERS_AWK="${0%/*}/mpers.awk" diff --git a/mpers_test.sh b/mpers_test.sh index dc1868e3..32e39af4 100755 --- a/mpers_test.sh +++ b/mpers_test.sh @@ -7,6 +7,8 @@ # # SPDX-License-Identifier: LGPL-2.1-or-later +[ "x${D:-0}" != x1 ] || set -x + mpers_name="$1"; shift mpers_cc_flags="$1"; shift size="$(printf %s "$mpers_name" |tr -cd '[0-9]')" -- 2.40.0