Skip to content

Commit

Permalink
Merge branch 'master' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
jameds committed Sep 13, 2020
2 parents c93d259 + 5755bab commit 6f8d246
Show file tree
Hide file tree
Showing 2 changed files with 155 additions and 29 deletions.
55 changes: 54 additions & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,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 with GDBstubs, add 'RDB=1'
Expand All @@ -80,6 +81,58 @@
#
#############################################################################

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
WINDOWSHELL=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.srb \
Expand Down
129 changes: 101 additions & 28 deletions src/Makefile.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# vim: ft=make
#
# Makefile.cfg for SRB2
#
Expand All @@ -7,7 +8,90 @@
# and other things
#

# See the following variable don't start with 'GCC'. This is
# to avoid a false positive with the version detection...

SUPPORTED_GCC_VERSIONS:=\
101 102\
91 92 93\
81 82 83 84\
71 72 73 74 75\
61 62 63 64\
51 52 53 54 55\
40 41 42 43 44 45 46 47 48 49

LATEST_GCC_VERSION=10.2

# gcc or g++
ifdef PREFIX
CC=$(PREFIX)-gcc
CXX=$(PREFIX)-g++
OBJCOPY=$(PREFIX)-objcopy
OBJDUMP=$(PREFIX)-objdump
STRIP=$(PREFIX)-strip
WINDRES=$(PREFIX)-windres
else
OBJCOPY=objcopy
OBJDUMP=objdump
STRIP=strip
WINDRES=windres
endif

# because Apple screws with us on this
# need to get bintools from homebrew
ifdef MACOSX
CC=clang
CXX=clang
OBJCOPY=gobjcopy
OBJDUMP=gobjdump
endif

# Automatically set version flag, but not if one was manually set
ifeq (,$(filter GCC%,$(.VARIABLES)))
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
v:=$(subst ., ,$(version))
# concat. major minor
v:=$(word 1,$(v))$(word 2,$(v))

# If this version is not in the list, default to the latest supported
ifeq (,$(filter $(v),$(SUPPORTED_GCC_VERSIONS)))
$(info\
Your compiler version, GCC $(version), is not supported by the Makefile.\
The Makefile will assume GCC $(LATEST_GCC_VERSION).)
GCC$(subst .,,$(LATEST_GCC_VERSION))=1
else
$(info Detected GCC $(version) (GCC$(v)))
GCC$(v)=1
endif
endif
endif

ifdef GCC102
GCC101=1
endif

ifdef GCC101
GCC93=1
endif

ifdef GCC93
GCC92=1
endif

ifdef GCC92
GCC91=1
endif

ifdef GCC91
GCC84=1
endif

ifdef GCC84
GCC83=1
endif

Expand All @@ -20,6 +104,18 @@ GCC81=1
endif

ifdef GCC81
GCC75=1
endif

ifdef GCC75
GCC74=1
endif

ifdef GCC74
GCC73=1
endif

ifdef GCC73
GCC72=1
endif

Expand All @@ -44,6 +140,10 @@ GCC61=1
endif

ifdef GCC61
GCC55=1
endif

ifdef GCC55
GCC54=1
endif

Expand Down Expand Up @@ -114,10 +214,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
Expand Down Expand Up @@ -463,30 +560,6 @@ ifdef ARCHNAME
BIN:=$(BIN)/$(ARCHNAME)
endif

# gcc or g++
ifdef PREFIX
CC=$(PREFIX)-gcc
CXX=$(PREFIX)-g++
OBJCOPY=$(PREFIX)-objcopy
OBJDUMP=$(PREFIX)-objdump
STRIP=$(PREFIX)-strip
WINDRES=$(PREFIX)-windres
else
OBJCOPY=objcopy
OBJDUMP=objdump
STRIP=strip
WINDRES=windres
endif

# because Apple screws with us on this
# need to get bintools from homebrew
ifdef MACOSX
CC=clang
CXX=clang
OBJCOPY=gobjcopy
OBJDUMP=gobjdump
endif

OBJDUMP_OPTS?=--wide --source --line-numbers
LD=$(CC)

Expand Down

0 comments on commit 6f8d246

Please sign in to comment.