commit 8a33768a5d3cbe0a7f082502a7966981287306aa
parent 211ede871569f33a23256664283442019c018417
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Mon, 17 Oct 2022 14:02:26 +0200
Fix the showvar function of the configure.sh script
Diffstat:
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/Makefile b/Makefile
@@ -58,6 +58,7 @@ sgs: $(OBJ)
@$(CC) $(CFLAGS) -o $@ $(OBJ) $(LDFLAGS)
.config_program: config.mk configure.sh
+ @echo "configure $(MAKE)"
@$(SHELL) configure.sh program && echo "config done" > $@ || exit 1
.SUFFIXES: .c .d .o
diff --git a/configure.sh b/configure.sh
@@ -24,17 +24,16 @@
# Print the value of a variable in config.mk
showvar()
{
- # We want to avoid various make messages being displayed (eg "Entering
- # directory..." with GNU Make). However, we still want to display the value
- # of the variable printed by the Makefile. To correct this contradiction, we
- # print the variable in stderr which we then redirect to stdout while stdout
- # is redirected to /dev/null
- make -f 2>&1 1>/dev/null - << EOF
+ # To avoid messages from Make being displayed instead of the value of the
+ # queried variable, we redirect its output to /dev/null and open a new file
+ # descriptor to stdout to print the variable
+<< EOF make -f 3>&1 1>/dev/null 2>&1 - || kill -HUP $$
.POSIX:
include config.mk
showvar:
- @1>&2 echo \$(${1})
+ @1>&3 echo \$(${1})
EOF
+ exec 3<&- # Close file descriptor 3
}
check_programs()