#!/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" # vim:ft=bash