]> gitweb @ CieloNegro.org - autobuild.git/blobdiff - src/main.bash
src/main.bash (install): wrong arguments for runMake
[autobuild.git] / src / main.bash
index 32a49d9e0aa551e42e72311e829c74a0cde3519d..d64aaf02f3ad229620c3e44a76a1b9ddc1c70956 100644 (file)
@@ -44,25 +44,60 @@ function dist () {
     runMake -C "_build" dist
 }
 
+function distcheck () {
+    configure
+    runMake -C "_build" distcheck
+}
+
 function install () {
     build
-    runMake -C "_build" install
+    runMake -C "_build" install "$@"
+}
+
+function usage () {
+    cat <<EOF >&2
+Usage: $0 [COMMAND]
+
+This is an automation script designed to work with autotools. It creates a
+directory "./_build" and builds any files inside it. Its behaviour is
+somewhat configurable: See "./Build.rc" for details.
+
+If no COMMAND is given, it defaults to "build".
+
+Commands:
+    build          run "$0 configure" then make(1)
+    check [ARG]    run "$0 build" then "make check [ARG]"
+    configure      run autoreconf(1) and "./configure" if necessary
+    clean          run "rm -rf _build"
+    dist           run "make dist"
+    distcheck      run "$0 configure" then "make distcheck"
+    doc            similar to "$0 build" but only build the documentation
+    help           print this message
+    install [ARG]  run "$0 build" then "make install [ARG]"
+
+Please report any bugs, feature requests, and pull requests (the most
+preferred!) to the maintainer presented in the preamble of the "$0" itself.
+EOF
+    return 1
 }
 
 function main () {
     local cmd
     case "$1" in
-        ""|"build") cmd=build  ;;
-        "doc"     ) cmd=doc    ;;
-        "check"   ) cmd=check  ;;
-        "clean"   ) cmd=clean  ;;
-        "dist"    ) cmd=dist   ;;
-        "install" ) cmd=install;;
-        *)
-            echo "Usage: $0 [build | doc | check | clean | dist | install]" >&2
-            exit 1
+        ""|"build" ) cmd="build"    ;;
+        "configure") cmd="configure";;
+        "doc"      ) cmd="doc"      ;;
+        "check"    ) cmd="check"    ;;
+        "clean"    ) cmd="clean"    ;;
+        "dist"     ) cmd="dist"     ;;
+        "distcheck") cmd="distcheck";;
+        "help"     ) cmd="usage"    ;;
+        "install"  ) cmd="install"  ;;
+        *)           cmd="usage"    ;;
     esac
-    shift
+    if (( $# > 0 )); then
+        shift
+    fi
     "$cmd" "$@"
 }