From 2bab52f3ff3104ed4f6ba9693a8935070070ea62 Mon Sep 17 00:00:00 2001 From: Evan Purcer Date: Tue, 3 Sep 2024 12:44:03 -0700 Subject: [PATCH] bugfix: inadvertent replacement of MAKEFILE_LIST var breaking tasks list --- Runfile | 3 ++- runfile.sh | 11 +++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Runfile b/Runfile index f26b7eb..3ced8ce 100644 --- a/Runfile +++ b/Runfile @@ -8,7 +8,8 @@ stop: # stop app b build: lint # build app for environment [vars: env] [[ -n $(env) ]] && echo "buiding app for $(env)" || echo "error: missing env" -t test: build # run all tests or specific tests [vars: name1, name2, etc.] +t test: # run all tests or specific tests [vars: name1, name2, etc.] + run build env=test [[ -n $(@) ]] && echo "running tests $(@)" || echo "running all tests" l lint: # lint all files or specific file [vars: file] diff --git a/runfile.sh b/runfile.sh index 9258045..7be507d 100755 --- a/runfile.sh +++ b/runfile.sh @@ -184,7 +184,10 @@ EOF if ! (( ${#cmd_args[@]} )) then # Case where no named arguments were provided: replace $(abc) $(xyz) etc. - buffer="$( echo "${buffer}" | sed -E 's!\$\([a-zA-Z_][a-zA-Z0-9_]*\)!``!g' )" + # Note: There must be at least one lowercase letter [a-z] in these matches, + # because otherwise we'd replace built in Make vars like $(MAKEFILE_LIST) + # which we want to leave alone. + buffer="$( echo "${buffer}" | sed -E 's!\$\([a-zA-Z0-9_]*[a-z][a-zA-Z0-9_]*\)!``!g' )" fi if ! (( ${#pos_args[@]} )) then @@ -247,8 +250,12 @@ EOF then make_args+=( "${cmd}" ) fi + if (( ${#cmd_args[@]} )) + then + make_args+=( -- "${cmd_args[@]}" ) + fi - make --makefile "${makefile}" "${make_args[@]}" -- "${cmd_args[@]}" + make --makefile "${makefile}" "${make_args[@]}" # Clean up temporary Makefile and exit with success: rm "${makefile}"