1 2 3 4 5 6 7 8 9 10 11 12
#!/usr/bin/env bash set -e src=${1%.cmd}.c if grep -q '@BUILD_CC host' "$src"; then tool=compile-host.tool else tool=compile.tool fi redo-ifchange "$tool" "$src" . ./"$tool" "${1%.cmd}.o" "$2" "$3" jq -n --arg d "$PWD" --arg c "${cmd[*]@Q}" --arg f "$src" \ '{directory:$d, command:$c, file:$f}' >"$3"