diff --git a/makesure.awk b/makesure.awk index 94ad78e..2627969 100755 --- a/makesure.awk +++ b/makesure.awk @@ -391,19 +391,6 @@ body,goalBody,goalBodies,resolvedGoals,exitCode, t0,t1,t2, goalTimed, list) { } goalBody[0] = "" - if (!("silent" in Options)) { - addStr(goalBody, "echo \" goal '" goalName "' ") - if (reachedGoals[goalName]) - addStr(goalBody, "[already satisfied].") - else if (emptyGoals[goalName]) - addStr(goalBody, "[empty].") - else - addStr(goalBody, "...") - addStr(goalBody, "\"") - } - if (reachedGoals[goalName]) - addLine(goalBody, "exit 0") - addLine(goalBody, definesLine[0]) if (goalName in GoalToLib) addLine(goalBody, Lib[GoalToLib[goalName]]) @@ -428,7 +415,11 @@ body,goalBody,goalBodies,resolvedGoals,exitCode, t0,t1,t2, goalTimed, list) { goalTimed = "timing" in Options && !reachedGoals[goalName] && !emptyGoals[goalName] if (goalTimed) t1 = t2 ? t2 : currentTimeMillis() - exitCode = shellExec(goalBodies[goalName]) + + if (!("silent" in Options)) + print " goal '" goalName "' " (reachedGoals[goalName] ? "[already satisfied]." : emptyGoals[goalName] ? "[empty]." : "...") + + exitCode = (reachedGoals[goalName] || emptyGoals[goalName]) ? 0 : shellExec(goalBodies[goalName]) if (exitCode != 0) print " goal '" goalName "' failed" if (goalTimed) { diff --git a/tests/18_empty_prelude.tush b/tests/18_empty_prelude.tush index cdbd08e..36e94eb 100644 --- a/tests/18_empty_prelude.tush +++ b/tests/18_empty_prelude.tush @@ -1,5 +1,5 @@ $ cd "$MYDIR"; PATH=tests/wrapper/bash:$PATH ./$MAKESURE -f tests/18_empty_prelude.sh -| running bash | goal 'default' ... +| running bash | hello diff --git a/tests/20_optimize_goals.sh b/tests/20_optimize_goals.sh new file mode 100644 index 0000000..0ce1c40 --- /dev/null +++ b/tests/20_optimize_goals.sh @@ -0,0 +1,6 @@ + +@goal hello + echo "Hello world" + +@goal hello_empty +@depends_on hello \ No newline at end of file diff --git a/tests/20_optimize_goals.tush b/tests/20_optimize_goals.tush new file mode 100644 index 0000000..22fdfac --- /dev/null +++ b/tests/20_optimize_goals.tush @@ -0,0 +1,6 @@ + +$ cd "$MYDIR"; PATH=tests/wrapper/bash:$PATH ./$MAKESURE -f tests/20_optimize_goals.sh hello_empty +| goal 'hello' ... +| running bash +| Hello world +| goal 'hello_empty' [empty].