Skip to content

Commit

Permalink
Do not assume that -m32/-m64 are always available
Browse files Browse the repository at this point in the history
  • Loading branch information
terceiro committed Sep 17, 2011
1 parent 3a796e9 commit d3885be
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions libtest/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ ifeq ($(CPU),)
CPU := $(shell uname -m | sed -e 's/i[345678]86/i386/')
endif

MODEL = 32 # Default to 32bit compiles

PLATFORM = $(CPU)-$(OS)

ifeq ($(OS), sunos)
Expand Down Expand Up @@ -96,6 +94,10 @@ ifneq ($(findstring bsd, $(OS)),)
LDFLAGS += -pthread
endif

ifeq ($(CPU), i386)
MODEL = 32
endif

ifeq ($(CPU), sparcv9)
MODEL = 64
endif
Expand All @@ -116,12 +118,17 @@ ifeq ($(CPU), powerpc64)
MODEL = 64
endif

MODELFLAG =
ifneq ($(MODEL),)
MODELFLAG = -m$(MODEL)
endif

# On platforms (linux, solaris) that support both 32bit and 64bit, force building for one or the other
ifneq ($(or $(findstring linux, $(OS)), $(findstring solaris, $(OS))),)
# Change the CC/LD instead of CFLAGS/LDFLAGS, incase other things in the flags
# makes the libffi build choke
CC += -m$(MODEL)
LD += -m$(MODEL)
CC += $(MODELFLAG)
LD += $(MODELFLAG)
endif

LIBTEST = $(BUILD_DIR)/$(LIBNAME)
Expand Down

0 comments on commit d3885be

Please sign in to comment.