X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=src%2Fmain.bash;h=eb488232873c629bd5ee3d786d544fb1cf325080;hb=529fe38e15c42d084b7df8c4a167d2a23a9f7002;hp=1bb450c91a008205deb9cb0628573590139901c2;hpb=46be632798ce01a88e99099a3eb8789bad087b18;p=autobuild.git diff --git a/src/main.bash b/src/main.bash index 1bb450c..eb48823 100644 --- a/src/main.bash +++ b/src/main.bash @@ -32,7 +32,7 @@ function doc () { function check () { build - runMake -C "_build" check + runMake -C "_build" check "$@" } function clean () { @@ -44,19 +44,61 @@ function dist () { runMake -C "_build" dist } +function distcheck () { + configure + runMake -C "_build" distcheck +} + 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 + runMake -C "_build" install "$0" +} + +function usage () { + cat <&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" ;; + "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 + if (( $# > 0 )); then + shift + fi + "$cmd" "$@" +} + +main "$@"