diff --git a/Makefile b/Makefile index 816f253d78..aacf2a96eb 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/code/qcommon/q_platform.h b/code/qcommon/q_platform.h index 27ca856e55..c39fa3f439 100644 --- a/code/qcommon/q_platform.h +++ b/code/qcommon/q_platform.h @@ -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