From 58a515d57f137b0dab9708eebaffaff6d101c98b Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Mon, 31 Mar 2025 16:19:45 +0200 Subject: [PATCH 1/2] yosys-config: Propagate exit code for help command --- misc/yosys-config.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/misc/yosys-config.in b/misc/yosys-config.in index 2d9c35e4d..34cf3b53b 100755 --- a/misc/yosys-config.in +++ b/misc/yosys-config.in @@ -37,11 +37,11 @@ help() { echo " $0 --datdir/simlib.v" echo "" } >&2 - exit 1 + exit $1 } if [ $# -eq 0 ]; then - help + help 1 fi if [ "$1" = "--build" ]; then @@ -83,7 +83,7 @@ for opt; do tokens=( "${tokens[@]}" '@DATDIR@'"${opt#${prefix}datdir}" ) ;; --help|-\?|-h) if [ ${#tokens[@]} -eq 0 ]; then - help + help 0 else tokens=( "${tokens[@]}" "$opt" ) fi ;; From 66d7ffb2c55f8e1606b20ec13f7ea566438cf017 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Tue, 1 Apr 2025 08:39:11 +0200 Subject: [PATCH 2/2] yosys-config: redirect to stderr/stdout depending of exit code --- Makefile | 4 ++-- misc/yosys-config.in | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 74128b41d..2efe23eea 100644 --- a/Makefile +++ b/Makefile @@ -1049,7 +1049,7 @@ define DOC_USAGE_STDERR docs/source/generated/$(1): $(TARGETS) docs/source/generated FORCE -$(Q) ./$(PROGRAM_PREFIX)$(1) --help 2> $$@ endef -DOCS_USAGE_STDERR := yosys-config yosys-filterlib +DOCS_USAGE_STDERR := yosys-filterlib # The in-tree ABC (yosys-abc) is only built when ABCEXTERNAL is not set. ifeq ($(ABCEXTERNAL),) @@ -1063,7 +1063,7 @@ define DOC_USAGE_STDOUT docs/source/generated/$(1): $(TARGETS) docs/source/generated $(Q) ./$(PROGRAM_PREFIX)$(1) --help > $$@ || rm $$@ endef -DOCS_USAGE_STDOUT := yosys yosys-smtbmc yosys-witness +DOCS_USAGE_STDOUT := yosys yosys-smtbmc yosys-witness yosys-config $(foreach usage,$(DOCS_USAGE_STDOUT),$(eval $(call DOC_USAGE_STDOUT,$(usage)))) docs/usage: $(addprefix docs/source/generated/,$(DOCS_USAGE_STDOUT) $(DOCS_USAGE_STDERR)) diff --git a/misc/yosys-config.in b/misc/yosys-config.in index 34cf3b53b..758ba79a9 100755 --- a/misc/yosys-config.in +++ b/misc/yosys-config.in @@ -36,7 +36,7 @@ help() { echo "" echo " $0 --datdir/simlib.v" echo "" - } >&2 + } >&$(( $1 + 1)) exit $1 }