Commit 30fad702 authored by Ian Lynagh's avatar Ian Lynagh

Use different CC/LD options for different stages

parent ae8cc32e
......@@ -4,6 +4,24 @@
# ensure we don't clash with any pre-supplied autoconf ones.
# FPTOOLS_SET_C_LD_FLAGS
# ----------------------------------
# Set the C and LD flags for a given platform
AC_DEFUN([FPTOOLS_SET_C_LD_FLAGS],
[
case $$1 in
i386-apple-darwin|powerpc-apple-darwin)
$2="$$2 -m32"
$3="$$3 -m32"
;;
x86_64-apple-darwin)
$2="$$2 -m64"
$3="$$3 -m64"
;;
esac
])
# FPTOOLS_FLOAT_WORD_ORDER_BIGENDIAN
# ----------------------------------
# Little endian Arm on Linux with some ABIs has big endian word order
......
......@@ -313,20 +313,18 @@ case $host in
;;
i386-apple-darwin|powerpc-apple-darwin)
soext='.dylib'
CFLAGS="$CFLAGS -m32"
LDFLAGS="$LDFLAGS -m32"
CONF_CC_OPTS="$CONF_CC_OPTS -m32"
CONF_LD_OPTS="$CONF_LD_OPTS -m32"
;;
x86_64-apple-darwin)
soext='.dylib'
CFLAGS="$CFLAGS -m64"
LDFLAGS="$LDFLAGS -m64"
CONF_CC_OPTS="$CONF_CC_OPTS -m64"
CONF_LD_OPTS="$CONF_LD_OPTS -m64"
;;
esac
FPTOOLS_SET_C_LD_FLAGS([target],[CFLAGS],[LDFLAGS])
FPTOOLS_SET_C_LD_FLAGS([build],[CONF_CC_OPTS_STAGE0],[CONF_LD_OPTS_STAGE0])
FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE1],[CONF_LD_OPTS_STAGE1])
# Stage 3 won't be supported by cross-compilation
FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE2],[CONF_LD_OPTS_STAGE2])
checkArch() {
case $1 in
alpha|arm|hppa|hppa1_1|i386|ia64|m68k|mips|mipseb|mipsel|powerpc|powerpc64|rs6000|s390|sparc|sparc64|vax|x86_64)
......@@ -569,8 +567,12 @@ FP_GCC_EXTRA_FLAGS
dnl ** figure out how to invoke cpp directly (gcc -E is no good)
AC_PROG_CPP
AC_SUBST(CONF_CC_OPTS)
AC_SUBST(CONF_LD_OPTS)
AC_SUBST(CONF_CC_OPTS_STAGE0)
AC_SUBST(CONF_CC_OPTS_STAGE1)
AC_SUBST(CONF_CC_OPTS_STAGE2)
AC_SUBST(CONF_LD_OPTS_STAGE0)
AC_SUBST(CONF_LD_OPTS_STAGE1)
AC_SUBST(CONF_LD_OPTS_STAGE2)
dnl ** figure out how to do context diffs
FP_PROG_CONTEXT_DIFF
......
......@@ -116,8 +116,8 @@ $(libffi_STAMP_CONFIGURE):
LD=$(LD) \
AR=$(AR) \
NM=$(NM) \
CFLAGS="$(SRC_CC_OPTS) $(CONF_CC_OPTS) -w" \
LDFLAGS="$(SRC_LD_OPTS) $(CONF_LD_OPTS) -w" \
CFLAGS="$(SRC_CC_OPTS) $(CONF_CC_OPTS_STAGE1) -w" \
LDFLAGS="$(SRC_LD_OPTS) $(CONF_LD_OPTS_STAGE1) -w" \
"$(SHELL)" configure \
--enable-static=yes \
--enable-shared=$(libffi_EnableShared) \
......@@ -173,7 +173,7 @@ $(eval $(call all-target,libffi,$(INSTALL_HEADERS) $(INSTALL_LIBS)))
libffi/dist-install/build/HSffi.o: libffi/dist-install/build/libHSffi.a
cd libffi/dist-install/build && \
touch empty.c && \
"$(CC)" $(SRC_CC_OPTS) $(CONF_CC_OPTS) -c empty.c -o HSffi.o
"$(CC)" $(SRC_CC_OPTS) $(CONF_CC_OPTS_STAGE1) -c empty.c -o HSffi.o
$(eval $(call all-target,libffi,libffi/dist-install/build/HSffi.o))
......
......@@ -535,14 +535,18 @@ endif
# C compiler and linker flags from configure (e.g. -m<blah> to select
# correct C compiler backend).
CONF_CC_OPTS = @CONF_CC_OPTS@
CONF_LD_OPTS = @CONF_LD_OPTS@
CONF_CC_OPTS_STAGE0 = @CONF_CC_OPTS_STAGE0@
CONF_CC_OPTS_STAGE1 = @CONF_CC_OPTS_STAGE1@
CONF_CC_OPTS_STAGE2 = @CONF_CC_OPTS_STAGE2@
CONF_LD_OPTS_STAGE0 = @CONF_LD_OPTS_STAGE0@
CONF_LD_OPTS_STAGE1 = @CONF_LD_OPTS_STAGE1@
CONF_LD_OPTS_STAGE2 = @CONF_LD_OPTS_STAGE2@
ifeq "$(TARGETPLATFORM)" "ia64-unknown-linux"
CONF_CC_OPTS += -G0
endif
SRC_HSC2HS_OPTS += $(addprefix --cflag=,$(filter-out -O,$(SRC_CC_OPTS) $(CONF_CC_OPTS)))
SRC_HSC2HS_OPTS += $(addprefix --cflag=,$(filter-out -O,$(SRC_CC_OPTS) $(CONF_CC_OPTS_STAGE0)))
SRC_HSC2HS_OPTS += $(foreach d,$(GMP_INCLUDE_DIRS),-I$(d))
#-----------------------------------------------------------------------------
......
......@@ -31,7 +31,7 @@ endif
# We filter out -Werror from SRC_CC_OPTS, because when configure tests
# for a feature it may not generate warning-free C code, and thus may
# think that the feature doesn't exist if -Werror is on.
$1_$2_CONFIGURE_OPTS += --configure-option=CFLAGS="$$(filter-out -Werror,$$(SRC_CC_OPTS)) $$(CONF_CC_OPTS) $$($1_CC_OPTS) $$($1_$2_CC_OPTS)"
$1_$2_CONFIGURE_OPTS += --configure-option=CFLAGS="$$(filter-out -Werror,$$(SRC_CC_OPTS)) $$(CONF_CC_OPTS_STAGE$3) $$($1_CC_OPTS) $$($1_$2_CC_OPTS)"
$1_$2_CONFIGURE_OPTS += --configure-option=LDFLAGS="$$(SRC_LD_OPTS) $$($1_LD_OPTS) $$($1_$2_LD_OPTS)"
ifneq "$$(ICONV_INCLUDE_DIRS)" ""
......
......@@ -82,7 +82,7 @@ $1_$2_CC_INC_FLAGS:=$$(shell for i in $$($1_$2_DEP_INCLUDE_DIRS); do echo $$($1_
endif
$1_$2_DIST_CC_OPTS = \
$$(CONF_CC_OPTS) \
$$(CONF_CC_OPTS_STAGE$4) \
$$(SRC_CC_OPTS) \
$$($1_CC_OPTS) \
$$(foreach dir,$$(filter-out /%,$$($1_$2_INCLUDE_DIRS)),-I$1/$$(dir)) \
......@@ -97,7 +97,7 @@ $1_$2_DIST_LD_LIB_DIRS:=$$(shell for i in $$($1_$2_DEP_LIB_DIRS); do echo \"-L$$
endif
$1_$2_DIST_LD_OPTS = \
$$(CONF_LD_OPTS) \
$$(CONF_LD_OPTS_STAGE$4) \
$$(SRC_LD_OPTS) \
$$($1_LD_OPTS) \
$$($1_$2_LD_OPTS) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment