Fix a build issue with gen/strgen.sh

This boolean can be passed empty, so we need to check that too. However,
I'd still like the test to exist since there is a use that requires a
number.

I also fixed the Makefile to always pass all arguments, and I fixed
strgen.c to respect a `0` argument for remove_tabs. (If the argument
existed at all, tabs were removed. This was different from strgen.sh,
and it was not what I intended.)

Signed-off-by: Gavin D. Howard <[email protected]>
This commit is contained in:
Gavin D. Howard 2023-02-06 14:22:18 -07:00
parent 1f36d5283c
commit 51ca77bd1a
Signed by: gavin
GPG Key ID: 93D31C8CA4AB6C63
3 changed files with 8 additions and 6 deletions

View File

@ -239,25 +239,25 @@ $(GEN_EXEC): $(GEN_DIR)
%%GEN_EXEC_TARGET%%
$(BC_LIB_C): $(GEN_EXEC) $(BC_LIB)
$(GEN_EMU) $(GEN_EXEC) $(BC_LIB) $(BC_LIB_C) $(BC_EXCLUDE_EXTRA_MATH) $(BC_LIB_C_ARGS)
$(GEN_EMU) $(GEN_EXEC) $(BC_LIB) $(BC_LIB_C) $(BC_EXCLUDE_EXTRA_MATH) $(BC_LIB_C_ARGS) "" "" 1
$(BC_LIB_O): $(BC_LIB_C)
$(CC) $(CFLAGS) -o $@ -c $<
$(BC_LIB2_C): $(GEN_EXEC) $(BC_LIB2)
$(GEN_EMU) $(GEN_EXEC) $(BC_LIB2) $(BC_LIB2_C) $(BC_EXCLUDE_EXTRA_MATH) $(BC_LIB2_C_ARGS)
$(GEN_EMU) $(GEN_EXEC) $(BC_LIB2) $(BC_LIB2_C) $(BC_EXCLUDE_EXTRA_MATH) $(BC_LIB2_C_ARGS) "" "" 1
$(BC_LIB2_O): $(BC_LIB2_C)
$(CC) $(CFLAGS) -o $@ -c $<
$(BC_HELP_C): $(GEN_EXEC) $(BC_HELP)
$(GEN_EMU) $(GEN_EXEC) $(BC_HELP) $(BC_HELP_C) $(BC_EXCLUDE_EXTRA_MATH) bc_help "" $(BC_ENABLED_NAME)
$(GEN_EMU) $(GEN_EXEC) $(BC_HELP) $(BC_HELP_C) $(BC_EXCLUDE_EXTRA_MATH) bc_help "" $(BC_ENABLED_NAME) 0
$(BC_HELP_O): $(BC_HELP_C)
$(CC) $(CFLAGS) -o $@ -c $<
$(DC_HELP_C): $(GEN_EXEC) $(DC_HELP)
$(GEN_EMU) $(GEN_EXEC) $(DC_HELP) $(DC_HELP_C) $(BC_EXCLUDE_EXTRA_MATH) dc_help "" $(DC_ENABLED_NAME)
$(GEN_EMU) $(GEN_EXEC) $(DC_HELP) $(DC_HELP_C) $(BC_EXCLUDE_EXTRA_MATH) dc_help "" $(DC_ENABLED_NAME) 0
$(DC_HELP_O): $(DC_HELP_C)
$(CC) $(CFLAGS) -o $@ -c $<

View File

@ -360,7 +360,7 @@ main(int argc, char* argv[])
has_define = (argc > 6 && strcmp("", argv[6]) != 0);
define = has_define ? argv[6] : "";
remove_tabs = (argc > 7);
remove_tabs = (argc > 7 && atoi(argv[7]) != 0);
in = bc_read_file(argv[1]);
if (in == NULL) return INVALID_INPUT_FILE;

View File

@ -62,7 +62,9 @@ name="$4"
label="$5"
define="$6"
remove_tabs="$7"
check_bool_arg "$remove_tabs"
if [ "$remove_tabs" != "" ]; then
check_bool_arg "$remove_tabs"
fi
tmpinput=$(mktemp -t "${input##*/}_XXXXXX")