@@ -163,7 +163,7 @@ function print-file-smartcase() {
163163}
164164
165165function print-makefile() {
166- sed -E " s!\t ${at} make --makefile ${makefile} !\t ${at} make !" " $@ "
166+ sed -E " s!\tmake --makefile ${makefile} !\tmake !" " $@ "
167167}
168168
169169function print-runfile-commands() {
@@ -403,7 +403,7 @@ function wizard() {
403403}
404404
405405function run() ( set -euo pipefail
406- local makefile=' ' buffer=' ' at= ' ' task=' '
406+ local makefile=' ' buffer=' ' task=' '
407407 local arg=' ' make_args=() named_args=() pos_args=() pos_arg_idx=0
408408
409409 local runfile_variables=' ' runfile_variable_re=' '
@@ -469,13 +469,6 @@ function run() ( set -euo pipefail
469469 # Temporary Makefile which we will pass to make:
470470 makefile="$( mktemp )"
471471
472- # @-prefix causes Make to execute tasks silently (without printing task code):
473- at="@"
474- [[ " $* " == *' --verbose '* ]] || \
475- [[ "${RUNFILE_VERBOSE:- } " =~ ^(1 | true| TRUE| True)$ ]] || \
476- [[ " $* " == *' --make-dry-run '* ]] && \
477- at="" # Remove @-prefix so that Make prints task code before executing tasks.
478-
479472 # Separate arguments into categories:
480473 # make_args · Arguments that will be passed on to Make.
481474 # named_args · name=value arguments interpolated into $(name) within task code.
558551 | sed -E \
559552 -e ' s/[[:space:]]*$//' \
560553 ` # trim any trailing whitespace from lines` \
561- -e " s!^[[:space:]]*([^[:space:]])!\t${at} \1!" \
562- ` # prefix every non-blank line with TAB-@ (or just TAB, if verbose) ` \
563- -e " s!^\t${at}${ task_re} (.*)\$ !\n.PHONY: \1\n\1:${subtask_re} \#\3!" \
564- ` # remove TAB (or TAB-@) prefix from lines that match task pattern` \
565- -e " s!^\t${at} ((then|do|else| elif|\||&&|\|\| )[[:space:]]+.*|fi|done )\$ !\t\1!" \
566- ` # remove TAB (or TAB-@) prefix from bash-keyword lines ` \
567- -e " s!^\t(@?)(if|for|while| then|do|else|elif)[[:space:]](.*) \$ !\t\1\2 \3; \\\\ !" \
568- ` # automatically add backslashes to multiline statements` \
554+ -e " s!^[[:space:]]*([^[:space:]])!\t\1!" \
555+ ` # prefix every non-blank line with TAB` \
556+ -e " s!^\t${task_re} (.*)\$ !\n.PHONY: \1\n\1:${subtask_re} \#\3!" \
557+ ` # remove TAB prefix from lines that match task pattern` \
558+ -e " s!^\t(if| elif|then|else|for|while )[[:space:]](.*;.* )\$ !\t\1 \2 \\\\ !" \
559+ -e " s!^\t(if|elif|then|else|for|while)[[:space:]]([^;]*) \$ !\t\1 \2; \\\\ ! " \
560+ -e " s!^\t(then|do|else|elif)\$ !\t\1 \\\\ !" \
561+ ` # automatically add backslashes to multiline statements (if, for, while) ` \
569562 | cat -s
570563)
571564
680673 then
681674 # If a specific runfile trap is being triggered, remove that trap' s prefix
682675 # (eg. EXIT) from lines in makefile so they can be executed normally:
683- buffer= " $( sed -E " s!^\t${at}${ RUNFILE_TRAP} !\t${at} !" " ${makefile} " ) "
676+ buffer= " $( sed -E " s!^\t${RUNFILE_TRAP} !\t!" " ${makefile} " ) "
684677
685678 # Write buffer back to temporary makefile:
686679 echo " ${buffer} " > " ${makefile} "
692685 fi
693686
694687 # Main Path · Invoke Make with generated Makefile and prepared arguments:
695- make --makefile " ${makefile} " " ${make_args[@]} "
688+ if [[ " $* " == * ' --verbose ' * ]] \
689+ || [[ " ${RUNFILE_VERBOSE:- } " =~ ^(1| true| TRUE| True)$ ]] \
690+ || [[ " $* " == * ' --make-dry-run ' * ]]
691+ then
692+ make --makefile " ${makefile} " " ${make_args[@]} "
693+ else
694+ make --silent --makefile " ${makefile} " " ${make_args[@]} "
695+ fi
696696
697697 # Main Path · Clean up temporary Makefile and exit with success:
698698 rm " ${makefile} "
0 commit comments