Merge pull request #129 from smcv/generic-platform

Implement Linux architecture support generically
This commit is contained in:
Tim Angus 2015-07-15 13:37:51 +00:00
commit 61a49ba1db
2 changed files with 12 additions and 52 deletions

View file

@ -6,7 +6,7 @@
COMPILE_PLATFORM=$(shell uname|sed -e s/_.*//|tr '[:upper:]' '[:lower:]'|sed -e 's/\//_/g') 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) ifeq ($(COMPILE_PLATFORM),sunos)
# Solaris uname and GNU uname differ # Solaris uname and GNU uname differ
@ -317,34 +317,18 @@ endif
# SETUP AND BUILD -- LINUX # SETUP AND BUILD -- LINUX
############################################################################# #############################################################################
## Defaults
LIB=lib
INSTALL=install INSTALL=install
MKDIR=mkdir MKDIR=mkdir
EXTRA_FILES= EXTRA_FILES=
CLIENT_EXTRA_FILES= CLIENT_EXTRA_FILES=
ifneq (,$(findstring "$(COMPILE_PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu" "gnu"))
TOOLS_CFLAGS += -DARCH_STRING=\"$(COMPILE_ARCH)\"
endif
ifneq (,$(findstring "$(PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu" "gnu")) ifneq (,$(findstring "$(PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu" "gnu"))
ifeq ($(ARCH),x86_64)
LIB=lib64
else
ifeq ($(ARCH),ppc64)
LIB=lib64
else
ifeq ($(ARCH),s390x)
LIB=lib64
else
ifeq ($(ARCH),aarch64)
LIB=lib64
endif
endif
endif
endif
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \ BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
-pipe -DUSE_ICON -pipe -DUSE_ICON -DARCH_STRING=\\\"$(ARCH)\\\"
CLIENT_CFLAGS += $(SDL_CFLAGS) CLIENT_CFLAGS += $(SDL_CFLAGS)
OPTIMIZEVM = -O3 OPTIMIZEVM = -O3
@ -824,6 +808,7 @@ else # ifeq netbsd
############################################################################# #############################################################################
ifeq ($(PLATFORM),irix64) ifeq ($(PLATFORM),irix64)
LIB=lib
ARCH=mips ARCH=mips

View file

@ -185,38 +185,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define PATH_SEP '/' #define PATH_SEP '/'
#if defined __i386__ #if !defined(ARCH_STRING)
#define ARCH_STRING "x86" # error ARCH_STRING should be defined by the Makefile
#elif defined __x86_64__ #endif
#if defined __x86_64__
#undef idx64 #undef idx64
#define idx64 1 #define idx64 1
#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 __aarch64__
#define ARCH_STRING "aarch64"
#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"
#endif #endif
#if __FLOAT_WORD_ORDER == __BIG_ENDIAN #if __FLOAT_WORD_ORDER == __BIG_ENDIAN