]> gitweb @ CieloNegro.org - autobuild.git/blobdiff - src/main.bash
New subcommand: "--"
[autobuild.git] / src / main.bash
index 73dc7cb3aeee6a61c157b4ac136324194192971c..4b7f67ecde80f89db2781521f325534bbc42339f 100644 (file)
@@ -2,6 +2,10 @@ function runMake () {
     run gmake -w -j $(detectNumCPUs) "$@"
 }
 
+function autogen () {
+    run autoreconf -v -i -f
+}
+
 function configure () {
     if [[ ! -f configure.ac && ! -f configure.in ]]; then
         echo "ERROR: Neither configure.ac nor configure.in exists in the current directory." >&2
@@ -9,7 +13,7 @@ function configure () {
     fi
 
     if [[ ! -f configure ]]; then
-        run autoreconf -v -i -f
+        autogen
     fi
 
     if [[ ! -f "_build/Makefile" ]]; then
@@ -54,6 +58,10 @@ function install () {
     runMake -C "_build" install "$@"
 }
 
+function other () {
+    runMake -C "_build" "$@"
+}
+
 function usage () {
     cat <<EOF >&2
 Usage: $0 [COMMAND]
@@ -66,14 +74,16 @@ 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
+    check [ARGS]   run "$0 build" then "make check [ARGS]"
+    autogen        run autoreconf(1)
+    configure      run "$0 autogen" 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]"
+    install [ARGS] run "$0 build" then "make install [ARGS]"
+    -- [ARGS]      run "make [ARGS]"
 
 Please report any bugs, feature requests, and pull requests (the most
 preferred!) to the maintainer presented in the preamble of the "$0" itself.
@@ -85,6 +95,7 @@ function main () {
     local cmd
     case "$1" in
         ""|"build" ) cmd="build"    ;;
+        "autogen"  ) cmd="autogen"  ;;
         "configure") cmd="configure";;
         "doc"      ) cmd="doc"      ;;
         "check"    ) cmd="check"    ;;
@@ -93,6 +104,7 @@ function main () {
         "distcheck") cmd="distcheck";;
         "help"     ) cmd="usage"    ;;
         "install"  ) cmd="install"  ;;
+        "--"       ) cmd="other"    ;;
         *)           cmd="usage"    ;;
     esac
     if (( $# > 0 )); then