Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #17 from smcv/portability
Be generically portable to new CPUs on all GNU platforms
  • Loading branch information
sago007 committed Jun 27, 2017
2 parents 1669e86 + 3f7769b commit 732d320
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 46 deletions.
24 changes: 7 additions & 17 deletions Makefile
Expand Up @@ -6,7 +6,7 @@

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/)
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
Expand Down Expand Up @@ -300,28 +300,17 @@ endif
# SETUP AND BUILD -- LINUX
#############################################################################

## Defaults
LIB=lib

INSTALL=install
MKDIR=mkdir

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

ifeq ($(ARCH),x86_64)
LIB=lib64
else
ifeq ($(ARCH),ppc64)
LIB=lib64
else
ifeq ($(ARCH),s390x)
LIB=lib64
endif
endif
endif
ifneq (,$(findstring "$(PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu" "gnu"))

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

OPTIMIZEVM = -O3 -funroll-loops -fomit-frame-pointer
Expand Down Expand Up @@ -799,6 +788,7 @@ else # ifeq netbsd
#############################################################################

ifeq ($(PLATFORM),irix64)
LIB=lib

ARCH=mips

Expand Down
39 changes: 10 additions & 29 deletions code/qcommon/q_platform.h
Expand Up @@ -150,42 +150,23 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

//================================================================= LINUX ===

#ifdef __linux__
#if defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__GNU__)

#include <endian.h>

#if defined(__linux__)
#define OS_STRING "linux"
#elif defined(__FreeBSD_kernel__)
#define OS_STRING "kFreeBSD"
#else
#define OS_STRING "GNU"
#endif

#define ID_INLINE inline
#define PATH_SEP '/'

#if defined __i386__
#define ARCH_STRING "i386"
#elif defined __x86_64__
#define ARCH_STRING "x86_64"
#elif defined __powerpc64__
#define ARCH_STRING "ppc64"
#elif defined __powerpc__
#define ARCH_STRING "ppc"
#elif defined __s390__
#define ARCH_STRING "s390"
#elif defined __s390x__
#define ARCH_STRING "s390x"
#elif defined __ia64__
#define ARCH_STRING "ia64"
#elif defined __alpha__
#define ARCH_STRING "alpha"
#elif defined __sparc__
#define ARCH_STRING "sparc"
#elif defined __arm__
#define ARCH_STRING "arm"
#elif defined __cris__
#define ARCH_STRING "cris"
#elif defined __hppa__
#define ARCH_STRING "hppa"
#elif defined __mips__
#define ARCH_STRING "mips"
#elif defined __sh__
#define ARCH_STRING "sh"
#if !defined(ARCH_STRING)
# error ARCH_STRING should be defined by the Makefile
#endif

#if __FLOAT_WORD_ORDER == __BIG_ENDIAN
Expand Down

0 comments on commit 732d320

Please sign in to comment.