Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove hardcoded list of BSD archs - implement multi-arch generically #466

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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