Build an optimized release binary when using `./all compile` by default 60/head
authorHugo Locurcio <hugo.locurcio@hugo.pro>
Fri, 20 Sep 2019 18:14:19 +0000 (20:14 +0200)
committerHugo Locurcio <hugo.locurcio@hugo.pro>
Fri, 27 Sep 2019 11:34:48 +0000 (13:34 +0200)
This prevents players who download the source code to build and play
from using an unoptimized debug build by forgetting to pass the `-r`
switch.

Compiling a debug build is now done by passing `-d`.

The `-r` flag is still supported for compatibility with existing
scripts.

Makefile
misc/infrastructure/xonotic-map-screenshot.cron
misc/tools/all/xonotic.subr
misc/tools/all/zsh_autocompletion/all/_all
misc/tools/the-big-benchmark/the-big-benchmark.sh

index 2c77a91..85fbe91 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-DESTDIR ?= 
+DESTDIR ?=
 PREFIX ?= /usr/local
 BINDIR ?= $(PREFIX)/bin
 LIBDIR ?= $(PREFIX)/lib/xonotic
@@ -19,7 +19,7 @@ all: all-$(SUFFIX)
 
 .PHONY: all-git
 all-git:
-       ./all compile -r
+       ./all compile
 
 .PHONY: all-zip-binary
 all-zip-binary:
index 688e266..0c06375 100755 (executable)
@@ -8,7 +8,7 @@ set -e
 cd xonotic
 ./all clean -m -fU -D
 # like reclone but do not delete untracked, so q3map2.x86 compile stays
-./all compile -r
+./all compile
 export DRIVER=soft
 #export DRIVERFLAGS="+gl_texturecompression 1 -nofbo"
 #export DRIVERFLAGS="+gl_texturecompression 1"
index b9ddd8a..1d5d75c 100644 (file)
@@ -27,7 +27,7 @@ case "$cmd" in
                cleanqcc=false
                cleanqc=false
                compiled0=
-               debug=debug
+               debug=release
                if [ -z "$CC" ]; then
                        export CC="gcc"
                fi
@@ -53,8 +53,11 @@ case "$cmd" in
                                        cleanqc=true
                                        shift
                                        ;;
-                               -r|-p)
+                               -d|-p|-r)
                                        case "$1" in
+                                               -d)
+                                                       debug=debug
+                                                       ;;
                                                -p)
                                                        debug=profile
                                                        ;;
@@ -384,7 +387,7 @@ case "$cmd" in
                fi
                ;;
        help)
-               $ECHO "  $SELF compile [-c] [-qc] [-r|-p] [-0] [-1] [sdl|glx|dedicated]"
+               $ECHO "  $SELF compile [-c] [-qc] [-d|-p|-r] [-0] [-1] [sdl|glx|dedicated]"
                $ECHO "  $SELF update-maps"
                $ECHO "  $SELF run [sdl|glx|dedicated] options..."
                $ECHO "  $SELF compile-map mapname1 mapname2... (e.g. \"./all compile-map dance drain fuse\")"
index 7cd8ec2..f4a8e6d 100644 (file)
@@ -54,10 +54,12 @@ case $state in
                 "-1[don't compile d0_blind_id]" \
                 '-c[clean all before building]' \
                 '-qc[clean QuakeC binaries]' \
-                - '(release)' \
-                    '-r[build in release mode]' \
+                - '(debug)' \
+                    '-d[build in debug mode]' \
                 - '(profile)' \
-                    '-p[build in profile mode]' && ret=0
+                    '-p[build in profile mode]' \
+                - '(release)' \
+                    '-r[build in release mode (default)]' && ret=0
             ;;
 
         compile-map)
index 07b3140..580e4db 100755 (executable)
@@ -36,7 +36,7 @@ fi
 
 if [ -f ./all ]; then
        ./all clean -fU -m -r
-       ./all compile -r
+       ./all compile
        export USE_GDB=no
        set -- ./all run "$@"
 elif [ -z "$*" ]; then