Build as a native 32 or 64 bit binary by default.

This commit is contained in:
Mike Pall 2010-03-04 16:23:28 +01:00
parent 15c3bd7725
commit 3d2abf3148

View File

@ -20,16 +20,11 @@ NODOTABIVER= 51
# Turn any of the optional settings on by removing the '#' in front of them. # Turn any of the optional settings on by removing the '#' in front of them.
# You need to 'make clean' and 'make' again, if you change any options. # You need to 'make clean' and 'make' again, if you change any options.
# #
# It's recommended to compile at least for i686. By default the assembler part # LuaJIT builds as a native 32 or 64 bit binary by default.
# of the interpreter makes use of CMOV/FCOMI*/FUCOMI* instructions, anyway. CC= gcc
CC= gcc -m32 -march=i686
# Use this for GCC 4.2 or higher if you don't intend to distribute the
# binaries to a different machine:
#CC= gcc -m32 -march=native
# #
# Currently LuaJIT builds by default as a 32 bit binary. Use this to force # Use this if you want to force a 32 bit build on a 64 bit multilib OS.
# a native x64 build on Linux/x64: #CC= gcc -m32
#CC= gcc -m64
# #
# Since the assembler part does NOT maintain a frame pointer, it's pointless # Since the assembler part does NOT maintain a frame pointer, it's pointless
# to slow down the C part by not omitting it. Debugging, tracebacks and # to slow down the C part by not omitting it. Debugging, tracebacks and
@ -41,6 +36,13 @@ CCOPT= -O2 -fomit-frame-pointer
# Note: it's no longer recommended to use -O3 with GCC 4.x. # Note: it's no longer recommended to use -O3 with GCC 4.x.
# The I-Cache bloat usually outweighs the benefits from aggressive inlining. # The I-Cache bloat usually outweighs the benefits from aggressive inlining.
# #
# It's recommended to compile at least for i686. By default the assembler part
# of the interpreter makes use of CMOV/FCOMI*/FUCOMI* instructions, anyway.
# For GCC 4.2 or higher and if you don't intend to distribute the
# binaries to a different machine you could also use: -march=native
CCOPT_X86= -march=i686
CCOPT_X64=
#
CCDEBUG= CCDEBUG=
# Uncomment the next line to generate debug information: # Uncomment the next line to generate debug information:
#CCDEBUG= -g #CCDEBUG= -g
@ -127,7 +129,8 @@ BUILDMODE= mixed
# LIBS HOST_LIBS TARGET_LIBS # LIBS HOST_LIBS TARGET_LIBS
# CROSS HOST_SYS TARGET_SYS # CROSS HOST_SYS TARGET_SYS
# #
# Cross-compilation example: make CROSS=i586-mingw32msvc- TARGET_SYS=Windows # Cross-compilation example:
# make CC="gcc -m32" CROSS=i586-mingw32msvc- TARGET_SYS=Windows
CCOPTIONS= $(CCDEBUG) $(CCOPT) $(CCWARN) $(XCFLAGS) $(CFLAGS) CCOPTIONS= $(CCDEBUG) $(CCOPT) $(CCWARN) $(XCFLAGS) $(CFLAGS)
LDOPTIONS= $(CCDEBUG) $(LDFLAGS) LDOPTIONS= $(CCDEBUG) $(LDFLAGS)
@ -176,6 +179,14 @@ ifneq (,$(findstring stack-protector,$(shell $(TARGET_CC) -dumpspecs)))
TARGET_XCFLAGS+= -fno-stack-protector TARGET_XCFLAGS+= -fno-stack-protector
endif endif
ifeq (,$(findstring __i386__,$(shell echo __i386__ | $(TARGET_CC) -P -E -)))
TARGET_CCARCH= x86
TARGET_XCFLAGS+= $(CCOPT_X86)
else
TARGET_CCARCH= x64
TARGET_XCFLAGS+= $(CCOPT_X64)
endif
ifneq (,$(PREFIX)) ifneq (,$(PREFIX))
ifneq (/usr/local,$(PREFIX)) ifneq (/usr/local,$(PREFIX))
TARGET_XCFLAGS+= -DLUA_XROOT=\"$(PREFIX)/\" TARGET_XCFLAGS+= -DLUA_XROOT=\"$(PREFIX)/\"