From 63ba605f527e1c4781c076b59562eac56e60ee93 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 15 Aug 2020 21:29:02 -0700 Subject: [PATCH 1/4] Is it GCC is it gcc, is it???? (cherry picked from commit 246e71a463c88c3bbc5334f9d07caca2e1577f79) --- src/Makefile.cfg | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Makefile.cfg b/src/Makefile.cfg index 5c56978e7..81cbc1aee 100644 --- a/src/Makefile.cfg +++ b/src/Makefile.cfg @@ -48,7 +48,9 @@ endif # Automatically set version flag, but not if one was manually set ifeq (,$(filter GCC%,$(.VARIABLES))) - ifneq (,$(findstring gcc,$(shell $(CC) --version))) # if it's GCC + version:=$(shell $(CC) --version) + # check if this is in fact GCC + ifneq (,$(or $(findstring gcc,$(version)),$(findstring GCC,$(version)))) version:=$(shell $(CC) -dumpversion) # Turn version into words of major, minor From ce98fc16bd898c49d187579a12517136ec036634 Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 18 Aug 2020 16:45:00 -0700 Subject: [PATCH 2/4] Makefile: Make WARNINGMODE the default, optionally disable with RELAXWARNINGS --- src/Makefile | 3 ++- src/Makefile.cfg | 5 +---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Makefile b/src/Makefile index 606e65930..ffe4b4a16 100644 --- a/src/Makefile +++ b/src/Makefile @@ -58,7 +58,8 @@ # Compile with GCC 4.6x version, add 'GCC46=1' # Compile a profile version, add 'PROFILEMODE=1' # Compile a debug version, add 'DEBUGMODE=1' -# Compile with extra warnings, add 'WARNINGMODE=1' +# Compile with less warnings, add 'RELAXWARNINGS=1' +# Generate compiler errors for most compiler warnings, add 'ERRORMODE=1' # Compile without NASM's tmap.nas, add 'NOASM=1' # Compile without 3D hardware support, add 'NOHW=1' # Compile without 3D sound support, add 'NOHS=1' diff --git a/src/Makefile.cfg b/src/Makefile.cfg index 81cbc1aee..86d602438 100644 --- a/src/Makefile.cfg +++ b/src/Makefile.cfg @@ -210,10 +210,7 @@ WFLAGS=-Wall ifndef GCC295 #WFLAGS+=-Wno-packed endif -ifdef ERRORMODE -WARNINGMODE=1 -endif -ifdef WARNINGMODE +ifndef RELAXWARNINGS WFLAGS+=-W #WFLAGS+=-Wno-sign-compare ifndef GCC295 From fd4ab28a8408da01c5745cd2cdd7787e833028ba Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 18 Aug 2020 18:01:59 -0700 Subject: [PATCH 3/4] Makefile: automatically detect system to compile for, if no system was specified This should work for mingw and linux so far. --- src/Makefile | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/src/Makefile b/src/Makefile index 606e65930..6d8d6a89c 100644 --- a/src/Makefile +++ b/src/Makefile @@ -82,6 +82,57 @@ # ############################################################################# +ALL_SYSTEMS=\ + PANDORA\ + LINUX64\ + MINGW64\ + HAIKU\ + DUMMY\ + DJGPPDOS\ + MINGW\ + UNIX\ + LINUX\ + SOLARIS\ + FREEBSD\ + MACOSX\ + SDL\ + +# check for user specified system +ifeq (,$(filter $(ALL_SYSTEMS),$(.VARIABLES))) +ifeq ($(OS),Windows_NT) # all windows are Windows_NT... + + $(info Detected a Windows system, compiling for 32-bit MinGW SDL2...) + + # go for a 32-bit sdl mingw exe by default + MINGW=1 + SDL=1 + +else # if you on the *nix + + system:=$(shell uname -s) + + ifeq ($(system),Linux) + new_system=LINUX + else + + $(error \ + Could not automatically detect your system,\ + try specifying a system manually) + + endif + + ifeq ($(shell getconf LONG_BIT),64) + system+=64-bit + new_system:=$(new_system)64 + endif + + $(info Detected $(system) ($(new_system))...) + $(new_system)=1 + +endif +endif + + # SRB2 data files D_DIR?=../bin/Resources D_FILES=$(D_DIR)/srb2.pk3 \ From ec3dffbb94ec8c86214f632511e68fe5dbb2dd02 Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 20 Aug 2020 20:19:50 -0700 Subject: [PATCH 4/4] Makefile: add WINDOWSHELL=1 for the Windows detect --- src/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Makefile b/src/Makefile index 6d8d6a89c..23312d27e 100644 --- a/src/Makefile +++ b/src/Makefile @@ -106,6 +106,7 @@ ifeq ($(OS),Windows_NT) # all windows are Windows_NT... # go for a 32-bit sdl mingw exe by default MINGW=1 SDL=1 + WINDOWSHELL=1 else # if you on the *nix