# Integration: a tiny make: rebuild targets whose inputs are newer. printf 'a\n' >a.src; printf 'b\n' >b.src build() { # target: deps... target=$1; shift need=0 [ -e "$target" ] || need=1 for d in "$@"; do [ "$d" -nt "$target" ] && need=1 done if [ $need = 1 ]; then echo "building $target" cat "$@" >"$target" else echo "$target is up to date" fi } all() { build a.o a.src build b.o b.src build prog a.o b.o } all sleep 1.1 all sleep 1.1 printf 'b2\n' >b.src all cat prog