#!/bin/bash

i=0

cat > Makefile <<'END'
all = 0 1 2 3 4 5 6 7 8 9
default: $(all)
$(all):
	@n=$$(($$RANDOM % 10)); sleep 0.$$n; echo $@ 0.$$n
END

while :; do
  let ++i
  echo "*** RUN: $i ***"
  make -s -j4 > stdout
  sed 's/^/ > /' stdout
  test `wc -l <stdout` -eq 10 || exit 1
done
