#!/bin/sh set -e self="$(basename "$0")" do_make() { make CROSS_COMPILE=arm-linux-gnueabi- "$@" } distclean() { do_make distclean "$@" } config() { do_make omap3_beagle_config "$@" } build() { do_make -j2 "$@" } check_clean() { clean_output="$(git clean -x -d -n "$@" 2>&1)" if [ -n "$clean_output" ]; then echo "Expected a clean tree but got: $clean_output" >&2 exit 1 fi } objdir="" cleanup() { if [ -n "$objdir" ]; then rm -rf "$objdir" fi } trap "cleanup" 0 1 2 3 9 11 13 15 objdir="$(mktemp -dt)" # this will stop the test if the tree isn't clean to start with check_clean for with_objdir in yes no; do echo "I: objdir: $with_objdir" >&2 for seq in "distclean" "config distclean" "config build distclean"; do echo "I: sequence: $seq" >&2 for step in $seq; do echo "I: step: $step" >&2 if [ "$with_objdir" = yes ]; then $step "O=$objdir" >/dev/null 2>&1 else $step >/dev/null 2>&1 fi done check_clean done done