add a feature to run the game. NOTE: the option -xonotic is not implemented yet.
authorRudolf Polzer <rpolzer@grawp.(none)>
Thu, 25 Mar 2010 08:18:19 +0000 (09:18 +0100)
committerRudolf Polzer <rpolzer@grawp.(none)>
Thu, 25 Mar 2010 08:18:19 +0000 (09:18 +0100)
all

diff --git a/all b/all
index bfca7a2b69e472769d186d3cc85e1dd3bd62fa1c..4e1a63e1ca38c17b472a1eb0af37838c6e8dc69f 100755 (executable)
--- a/all
+++ b/all
@@ -121,14 +121,46 @@ case "$cmd" in
                done
                ;;
        compile)
                done
                ;;
        compile)
-               (
-                       cd darkplaces
-                       make nexuiz
-               )
                (
                        cd data/xonotic-data.pk3dir
                (
                        cd data/xonotic-data.pk3dir
-                       make
-               )
+                       make $MAKEFLAGS
+               ) || exit $?
+               (
+                       if [ -z "$MAKEFLAGS" ]; then
+                               if [ -f /proc/cpuinfo ]; then
+                                       ncpus=$((`grep -c '^processor   :' /proc/cpuinfo`+0))
+                                       if [ $ncpus -gt 1 ]; then
+                                               MAKEFLAGS=-j$ncpus
+                                       fi
+                               fi
+                       fi
+                       cd darkplaces
+                       make $MAKEFLAGS sv-debug
+                       make $MAKEFLAGS cl-debug
+                       make $MAKEFLAGS sdl-debug
+               ) || exit $?
+               ;;
+       run)
+               client=-sdl
+               case "$1" in
+                       sdl|glx|agl|dedicated)
+                               client=-$1
+                               shift
+                               ;;
+                       wgl)
+                               client=
+                               shift
+                               ;;
+               esac
+               if ! [ -x "darkplaces/darkplaces$client" ]; then
+                       if [ -x "darkplaces/darkplaces$client.exe" ]; then
+                               client=$client.exe
+                       else
+                               echo "Client darkplaces/darkplaces$client not found, aborting"
+                               exit 1
+                       fi
+               fi
+               exec "darkplaces/darkplaces$client" -xonotic $@
                ;;
        *)
                echo "Usage:"
                ;;
        *)
                echo "Usage:"
@@ -138,5 +170,6 @@ case "$cmd" in
                echo "  $0 branch <remote> <branchname>"
                echo "  $0 checkout"
                echo "  $0 compile"
                echo "  $0 branch <remote> <branchname>"
                echo "  $0 checkout"
                echo "  $0 compile"
+               echo "  $0 run <client> <options>"
                ;;
 esac
                ;;
 esac