diff options
author | Nicolas Noble <nnoble@blizzard.com> | 2013-07-15 15:26:30 -0700 |
---|---|---|
committer | Nicolas Noble <nnoble@blizzard.com> | 2013-07-15 15:26:30 -0700 |
commit | a9b37ee02ae425e7292d784675ad77812dfb9c23 (patch) | |
tree | 5d86d728ccf763ada08fa92422d71a6508740529 /Makefile | |
parent | 79ed0f94c0c682e2902d8787885a007189a010b2 (diff) |
Swiching build to 64 bits, and improving Makefile to switch from gcc to clang if gcc is detected to be too old.
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 34 |
1 files changed, 26 insertions, 8 deletions
@@ -1,10 +1,10 @@ ifeq ($(SYSTEM),) - SYSTEM = $(shell uname | cut -f 1 -d_) + SYSTEM := $(shell uname | cut -f 1 -d_) endif -TRUESYSTEM = $(shell uname) -MACHINE = $(shell uname -m) -DISTRIB = $(shell cat /etc/issue | cut -f 1 -d\ | head -1) +TRUESYSTEM := $(shell uname) +MACHINE := $(shell uname -m) +DISTRIB := $(shell cat /etc/issue | cut -f 1 -d\ | head -1) CC = gcc CXX = g++ @@ -35,8 +35,8 @@ ifeq ($(SYSTEM),Darwin) LDFLAGS += -fPIC LIBS += pthread iconv CONFIG_H = darwin-config.h - ARCH_FLAGS = -arch i386 - LD = clang++ -arch i386 + ARCH_FLAGS = + LD = clang++ STRIP = strip -x endif @@ -45,9 +45,27 @@ ifeq ($(SYSTEM),Linux) LDFLAGS += -fPIC -rdynamic LIBS += pthread dl CONFIG_H = linux-config.h - ARCH_FLAGS = -march=i686 -m32 - ASFLAGS = -march=i686 --32 + ARCH_FLAGS = + ASFLAGS = STRIP = strip --strip-unneeded + + GCC_VERSION := $(shell g++ -dumpversion) + GCC_VERSION_4 := $(shell expr `g++ -dumpversion | cut -f1 -d.` \>= 4) + GCC_VERSION_x_8 := $(shell expr `g++ -dumpversion | cut -f2 -d.` >= 8) + + ifneq ($(GCC_VERSION_4),1) + USE_CLANG = true + else + ifneq ($(GCC_VERSION_x_8),1) + USE_CLANG = true + endif + endif + + ifeq ($(USE_CLANG),true) + CC = clang + CXX = clang++ + LD = clang++ + endif endif CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) -fexceptions -imacros $(CONFIG_H) |