Skip to content

Commit

Permalink
Remove hardcoded list of BSD archs - implement multi-arch generically
Browse files Browse the repository at this point in the history
This extends ioquake#129 to FreeBSD/NetBSD/OpenBSD. Tested on NetBSD.
  • Loading branch information
alarixnia committed Sep 9, 2020
1 parent 8e74119 commit d69d2e4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
13 changes: 7 additions & 6 deletions Makefile
Expand Up @@ -6,8 +6,8 @@
COMPILE_PLATFORM=$(shell uname | sed -e 's/_.*//' | tr '[:upper:]' '[:lower:]' | sed -e 's/\//_/g')
COMPILE_ARCH=$(shell uname -m | sed -e 's/i.86/x86/' | sed -e 's/^arm.*/arm/')

ifeq ($(COMPILE_PLATFORM),sunos)
# Solaris uname and GNU uname differ
ifneq (,$(findstring "$(COMPILE_PLATFORM)", "sunos" "netbsd"))
# Solaris/NetBSD uname and GNU uname differ
COMPILE_ARCH=$(shell uname -p | sed -e 's/i.86/x86/')
endif

Expand Down Expand Up @@ -339,7 +339,7 @@ MKDIR=mkdir -p
EXTRA_FILES=
CLIENT_EXTRA_FILES=

ifneq (,$(findstring "$(COMPILE_PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu" "gnu"))
ifneq (,$(findstring "$(COMPILE_PLATFORM)", "linux" "bsd" "gnu"))
TOOLS_CFLAGS += -DARCH_STRING=\"$(COMPILE_ARCH)\"
endif

Expand Down Expand Up @@ -713,7 +713,7 @@ ifeq ($(PLATFORM),freebsd)
# flags
BASE_CFLAGS = \
-Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
-DUSE_ICON -DMAP_ANONYMOUS=MAP_ANON
-DUSE_ICON -DMAP_ANONYMOUS=MAP_ANON -DARCH_STRING=\\\"$(ARCH)\\\"
CLIENT_CFLAGS += $(SDL_CFLAGS)
HAVE_VM_COMPILED = true

Expand Down Expand Up @@ -767,7 +767,7 @@ else # ifeq freebsd
ifeq ($(PLATFORM),openbsd)

BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
-pipe -DUSE_ICON -DMAP_ANONYMOUS=MAP_ANON
-pipe -DUSE_ICON -DMAP_ANONYMOUS=MAP_ANON -DARCH_STRING=\\\"$(ARCH)\\\"
CLIENT_CFLAGS += $(SDL_CFLAGS)

OPTIMIZEVM = -O3
Expand Down Expand Up @@ -849,7 +849,8 @@ ifeq ($(PLATFORM),netbsd)
SHLIBLDFLAGS=-shared $(LDFLAGS)
THREAD_LIBS=-lpthread

BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
-pipe -DUSE_ICON -DARCH_STRING=\\\"$(ARCH)\\\"

ifeq ($(ARCH),x86)
HAVE_VM_COMPILED=true
Expand Down
11 changes: 5 additions & 6 deletions code/qcommon/q_platform.h
Expand Up @@ -221,14 +221,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define ID_INLINE inline
#define PATH_SEP '/'

#ifdef __i386__
#define ARCH_STRING "x86"
#elif defined __amd64__
#if !defined(ARCH_STRING)
# error ARCH_STRING should be defined by the Makefile
#endif

#if defined __x86_64__
#undef idx64
#define idx64 1
#define ARCH_STRING "x86_64"
#elif defined __axp__
#define ARCH_STRING "alpha"
#endif

#if BYTE_ORDER == BIG_ENDIAN
Expand Down

0 comments on commit d69d2e4

Please sign in to comment.