From 76b9444fed4c8d808df5870e6999050cda7fcb5e Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Fri, 20 Sep 2019 20:14:19 +0200 Subject: [PATCH] Build an optimized release binary when using `./all compile` by default 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 | 4 ++-- misc/infrastructure/xonotic-map-screenshot.cron | 2 +- misc/tools/all/xonotic.subr | 9 ++++++--- misc/tools/all/zsh_autocompletion/all/_all | 8 +++++--- misc/tools/the-big-benchmark/the-big-benchmark.sh | 2 +- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 2c77a917..85fbe918 100644 --- 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: diff --git a/misc/infrastructure/xonotic-map-screenshot.cron b/misc/infrastructure/xonotic-map-screenshot.cron index 688e2662..0c063752 100755 --- a/misc/infrastructure/xonotic-map-screenshot.cron +++ b/misc/infrastructure/xonotic-map-screenshot.cron @@ -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" diff --git a/misc/tools/all/xonotic.subr b/misc/tools/all/xonotic.subr index b9ddd8a3..1d5d75cb 100644 --- a/misc/tools/all/xonotic.subr +++ b/misc/tools/all/xonotic.subr @@ -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\")" diff --git a/misc/tools/all/zsh_autocompletion/all/_all b/misc/tools/all/zsh_autocompletion/all/_all index 7cd8ec2e..f4a8e6db 100644 --- a/misc/tools/all/zsh_autocompletion/all/_all +++ b/misc/tools/all/zsh_autocompletion/all/_all @@ -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) diff --git a/misc/tools/the-big-benchmark/the-big-benchmark.sh b/misc/tools/the-big-benchmark/the-big-benchmark.sh index 07b3140e..580e4dbb 100755 --- a/misc/tools/the-big-benchmark/the-big-benchmark.sh +++ b/misc/tools/the-big-benchmark/the-big-benchmark.sh @@ -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 -- 2.39.2