function runMake () { run gmake -w -j $(detectNumCPUs) $@ } function configure () { if [[ ! -f configure.ac && ! -f configure.in ]]; then echo "ERROR: Neither configure.ac nor configure.in exists in the current directory." >&2 return 1 fi if [[ ! -f configure ]]; then run autoreconf -v -i -f fi if [[ ! -f "_build/Makefile" ]]; then run mkdir -p _build run pushd _build run ../configure "${configArgs[@]}" run popd fi } function build () { configure runMake -C "_build" $buildTarget } function doc () { configure runMake -C "_build/$docDirectory" $docTarget } function check () { build runMake -C "_build" check } function clean () { run rm -rf "_build" } function dist () { configure runMake -C "_build" dist } function install () { build runMake -C "_build" install } case "$1" in ""|"build") build ;; "doc" ) doc ;; "check" ) check ;; "clean" ) clean ;; "dist" ) dist ;; "install" ) install;; *) echo "Usage: $0 [build | doc | check | clean | dist | install]" >&2 exit 1 esac