Commit 81f4cd3e authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

Merge branch 'master' of http://darcs.haskell.org/ghc

parents 057384f9 109a1e53
...@@ -61,18 +61,25 @@ AC_DEFUN([FPTOOLS_SET_PLATFORM_VARS], ...@@ -61,18 +61,25 @@ AC_DEFUN([FPTOOLS_SET_PLATFORM_VARS],
if test "$target_alias" = "" if test "$target_alias" = ""
then then
if test "$bootstrap_target" != "" if test "$host_alias" != ""
then then
target=$bootstrap_target GHC_CONVERT_CPU([$host_cpu], [TargetArch])
echo "Target platform inferred as: $target" GHC_CONVERT_VENDOR([$host_vendor], [TargetVendor])
GHC_CONVERT_OS([$host_os], [TargetOS])
else else
echo "Can't work out target platform" if test "$bootstrap_target" != ""
exit 1 then
target=$bootstrap_target
echo "Target platform inferred as: $target"
else
echo "Can't work out target platform"
exit 1
fi
TargetArch=`echo "$target" | sed 's/-.*//'`
TargetVendor=`echo "$target" | sed -e 's/.*-\(.*\)-.*/\1/'`
TargetOS=`echo "$target" | sed 's/.*-//'`
fi fi
TargetArch=`echo "$target" | sed 's/-.*//'`
TargetVendor=`echo "$target" | sed -e 's/.*-\(.*\)-.*/\1/'`
TargetOS=`echo "$target" | sed 's/.*-//'`
else else
GHC_CONVERT_CPU([$target_cpu], [TargetArch]) GHC_CONVERT_CPU([$target_cpu], [TargetArch])
GHC_CONVERT_VENDOR([$target_vendor], [TargetVendor]) GHC_CONVERT_VENDOR([$target_vendor], [TargetVendor])
...@@ -377,6 +384,7 @@ AC_DEFUN([FP_SETTINGS], ...@@ -377,6 +384,7 @@ AC_DEFUN([FP_SETTINGS],
then then
mingw_bin_prefix=mingw/bin/ mingw_bin_prefix=mingw/bin/
SettingsCCompilerCommand="\$topdir/../${mingw_bin_prefix}gcc.exe" SettingsCCompilerCommand="\$topdir/../${mingw_bin_prefix}gcc.exe"
SettingsLdCommand="\$topdir/../${mingw_bin_prefix}ld.exe"
SettingsArCommand="\$topdir/../${mingw_bin_prefix}ar.exe" SettingsArCommand="\$topdir/../${mingw_bin_prefix}ar.exe"
SettingsPerlCommand='$topdir/../perl/perl.exe' SettingsPerlCommand='$topdir/../perl/perl.exe'
SettingsDllWrapCommand="\$topdir/../${mingw_bin_prefix}dllwrap.exe" SettingsDllWrapCommand="\$topdir/../${mingw_bin_prefix}dllwrap.exe"
...@@ -384,6 +392,7 @@ AC_DEFUN([FP_SETTINGS], ...@@ -384,6 +392,7 @@ AC_DEFUN([FP_SETTINGS],
SettingsTouchCommand='$topdir/touchy.exe' SettingsTouchCommand='$topdir/touchy.exe'
else else
SettingsCCompilerCommand="$WhatGccIsCalled" SettingsCCompilerCommand="$WhatGccIsCalled"
SettingsLdCommand="$LdCmd"
SettingsArCommand="$ArCmd" SettingsArCommand="$ArCmd"
SettingsPerlCommand="$PerlCmd" SettingsPerlCommand="$PerlCmd"
SettingsDllWrapCommand="/bin/false" SettingsDllWrapCommand="/bin/false"
...@@ -406,6 +415,7 @@ AC_DEFUN([FP_SETTINGS], ...@@ -406,6 +415,7 @@ AC_DEFUN([FP_SETTINGS],
SettingsLdFlags="$CONF_LD_LINKER_OPTS_STAGE2" SettingsLdFlags="$CONF_LD_LINKER_OPTS_STAGE2"
AC_SUBST(SettingsCCompilerCommand) AC_SUBST(SettingsCCompilerCommand)
AC_SUBST(SettingsCCompilerFlags) AC_SUBST(SettingsCCompilerFlags)
AC_SUBST(SettingsLdCommand)
AC_SUBST(SettingsLdFlags) AC_SUBST(SettingsLdFlags)
AC_SUBST(SettingsArCommand) AC_SUBST(SettingsArCommand)
AC_SUBST(SettingsPerlCommand) AC_SUBST(SettingsPerlCommand)
......
...@@ -130,53 +130,48 @@ endif ...@@ -130,53 +130,48 @@ endif
PLATFORM_H = ghc_boot_platform.h PLATFORM_H = ghc_boot_platform.h
ifeq "$(BuildingCrossCompiler)" "YES"
compiler/stage1/$(PLATFORM_H) : compiler/stage2/$(PLATFORM_H)
cp $< $@
else
compiler/stage1/$(PLATFORM_H) : mk/config.mk mk/project.mk | $$(dir $$@)/. compiler/stage1/$(PLATFORM_H) : mk/config.mk mk/project.mk | $$(dir $$@)/.
$(call removeFiles,$@) $(call removeFiles,$@)
@echo "Creating $@..." @echo "Creating $@..."
@echo "#ifndef __PLATFORM_H__" >> $@ @echo "#ifndef __PLATFORM_H__" >> $@
@echo "#define __PLATFORM_H__" >> $@ @echo "#define __PLATFORM_H__" >> $@
@echo >> $@ @echo >> $@
@echo "#define BuildPlatform_NAME \"$(BUILDPLATFORM)\"" >> $@ @echo "#define BuildPlatform_NAME \"$(BUILDPLATFORM)\"" >> $@
@echo "#define HostPlatform_NAME \"$(BUILDPLATFORM)\"" >> $@ @echo "#define HostPlatform_NAME \"$(HOSTPLATFORM)\"" >> $@
@echo "#define TargetPlatform_NAME \"$(HOSTPLATFORM)\"" >> $@ @echo "#define TargetPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@
@echo >> $@ @echo >> $@
@echo "#define $(BuildPlatform_CPP)_BUILD 1" >> $@ @echo "#define $(BuildPlatform_CPP)_BUILD 1" >> $@
@echo "#define $(BuildPlatform_CPP)_HOST 1" >> $@ @echo "#define $(HostPlatform_CPP)_HOST 1" >> $@
@echo "#define $(HostPlatform_CPP)_TARGET 1" >> $@ @echo "#define $(TargetPlatform_CPP)_TARGET 1" >> $@
@echo >> $@ @echo >> $@
@echo "#define $(BuildArch_CPP)_BUILD_ARCH 1" >> $@ @echo "#define $(BuildArch_CPP)_BUILD_ARCH 1" >> $@
@echo "#define $(BuildArch_CPP)_HOST_ARCH 1" >> $@ @echo "#define $(HostArch_CPP)_HOST_ARCH 1" >> $@
@echo "#define $(HostArch_CPP)_TARGET_ARCH 1" >> $@ @echo "#define $(TargetArch_CPP)_TARGET_ARCH 1" >> $@
@echo "#define BUILD_ARCH \"$(BuildArch_CPP)\"" >> $@ @echo "#define BUILD_ARCH \"$(BuildArch_CPP)\"" >> $@
@echo "#define HOST_ARCH \"$(BuildArch_CPP)\"" >> $@ @echo "#define HOST_ARCH \"$(HostArch_CPP)\"" >> $@
@echo "#define TARGET_ARCH \"$(HostArch_CPP)\"" >> $@ @echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@
@echo >> $@ @echo >> $@
@echo "#define $(BuildOS_CPP)_BUILD_OS 1" >> $@ @echo "#define $(BuildOS_CPP)_BUILD_OS 1" >> $@
@echo "#define $(BuildOS_CPP)_HOST_OS 1" >> $@ @echo "#define $(HostOS_CPP)_HOST_OS 1" >> $@
@echo "#define $(HostOS_CPP)_TARGET_OS 1" >> $@ @echo "#define $(TargetOS_CPP)_TARGET_OS 1" >> $@
@echo "#define BUILD_OS \"$(BuildOS_CPP)\"" >> $@ @echo "#define BUILD_OS \"$(BuildOS_CPP)\"" >> $@
@echo "#define HOST_OS \"$(BuildOS_CPP)\"" >> $@ @echo "#define HOST_OS \"$(HostOS_CPP)\"" >> $@
@echo "#define TARGET_OS \"$(HostOS_CPP)\"" >> $@ @echo "#define TARGET_OS \"$(TargetOS_CPP)\"" >> $@
ifeq "$(HostOS_CPP)" "irix" ifeq "$(TargetOS_CPP)" "irix"
@echo "#ifndef $(IRIX_MAJOR)_TARGET_OS" >> $@ @echo "#ifndef $(IRIX_MAJOR)_TARGET_OS" >> $@
@echo "#define $(IRIX_MAJOR)_TARGET_OS 1" >> $@ @echo "#define $(IRIX_MAJOR)_TARGET_OS 1" >> $@
@echo "#endif" >> $@ @echo "#endif" >> $@
endif endif
@echo >> $@ @echo >> $@
@echo "#define $(BuildVendor_CPP)_BUILD_VENDOR 1" >> $@ @echo "#define $(BuildVendor_CPP)_BUILD_VENDOR 1" >> $@
@echo "#define $(BuildVendor_CPP)_HOST_VENDOR 1" >> $@ @echo "#define $(HostVendor_CPP)_HOST_VENDOR 1" >> $@
@echo "#define $(HostVendor_CPP)_TARGET_VENDOR 1" >> $@ @echo "#define $(TargetVendor_CPP)_TARGET_VENDOR 1" >> $@
@echo "#define BUILD_VENDOR \"$(BuildVendor_CPP)\"" >> $@ @echo "#define BUILD_VENDOR \"$(BuildVendor_CPP)\"" >> $@
@echo "#define HOST_VENDOR \"$(BuildVendor_CPP)\"" >> $@ @echo "#define HOST_VENDOR \"$(HostVendor_CPP)\"" >> $@
@echo "#define TARGET_VENDOR \"$(HostVendor_CPP)\"" >> $@ @echo "#define TARGET_VENDOR \"$(TargetVendor_CPP)\"" >> $@
@echo >> $@ @echo >> $@
@echo "#endif /* __PLATFORM_H__ */" >> $@ @echo "#endif /* __PLATFORM_H__ */" >> $@
@echo "Done." @echo "Done."
endif
# For stage2 and above, the BUILD platform is the HOST of stage1, and # For stage2 and above, the BUILD platform is the HOST of stage1, and
# the HOST platform is the TARGET of stage1. The TARGET remains the same # the HOST platform is the TARGET of stage1. The TARGET remains the same
...@@ -187,26 +182,26 @@ compiler/stage2/$(PLATFORM_H) : mk/config.mk mk/project.mk | $$(dir $$@)/. ...@@ -187,26 +182,26 @@ compiler/stage2/$(PLATFORM_H) : mk/config.mk mk/project.mk | $$(dir $$@)/.
@echo "#ifndef __PLATFORM_H__" >> $@ @echo "#ifndef __PLATFORM_H__" >> $@
@echo "#define __PLATFORM_H__" >> $@ @echo "#define __PLATFORM_H__" >> $@
@echo >> $@ @echo >> $@
@echo "#define BuildPlatform_NAME \"$(BUILDPLATFORM)\"" >> $@ @echo "#define BuildPlatform_NAME \"$(HOSTPLATFORM)\"" >> $@
@echo "#define HostPlatform_NAME \"$(HOSTPLATFORM)\"" >> $@ @echo "#define HostPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@
@echo "#define TargetPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@ @echo "#define TargetPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@
@echo >> $@ @echo >> $@
@echo "#define $(BuildPlatform_CPP)_BUILD 1" >> $@ @echo "#define $(HostPlatform_CPP)_BUILD 1" >> $@
@echo "#define $(HostPlatform_CPP)_HOST 1" >> $@ @echo "#define $(TargetPlatform_CPP)_HOST 1" >> $@
@echo "#define $(TargetPlatform_CPP)_TARGET 1" >> $@ @echo "#define $(TargetPlatform_CPP)_TARGET 1" >> $@
@echo >> $@ @echo >> $@
@echo "#define $(BuildArch_CPP)_BUILD_ARCH 1" >> $@ @echo "#define $(HostArch_CPP)_BUILD_ARCH 1" >> $@
@echo "#define $(HostArch_CPP)_HOST_ARCH 1" >> $@ @echo "#define $(TargetArch_CPP)_HOST_ARCH 1" >> $@
@echo "#define $(TargetArch_CPP)_TARGET_ARCH 1" >> $@ @echo "#define $(TargetArch_CPP)_TARGET_ARCH 1" >> $@
@echo "#define BUILD_ARCH \"$(HostArch_CPP)\"" >> $@ @echo "#define BUILD_ARCH \"$(HostArch_CPP)\"" >> $@
@echo "#define HOST_ARCH \"$(HostArch_CPP)\"" >> $@ @echo "#define HOST_ARCH \"$(TargetArch_CPP)\"" >> $@
@echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@ @echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@
@echo >> $@ @echo >> $@
@echo "#define $(HostOS_CPP)_BUILD_OS 1" >> $@ @echo "#define $(HostOS_CPP)_BUILD_OS 1" >> $@
@echo "#define $(HostOS_CPP)_HOST_OS 1" >> $@ @echo "#define $(TargetOS_CPP)_HOST_OS 1" >> $@
@echo "#define $(TargetOS_CPP)_TARGET_OS 1" >> $@ @echo "#define $(TargetOS_CPP)_TARGET_OS 1" >> $@
@echo "#define BUILD_OS \"$(HostOS_CPP)\"" >> $@ @echo "#define BUILD_OS \"$(HostOS_CPP)\"" >> $@
@echo "#define HOST_OS \"$(HostOS_CPP)\"" >> $@ @echo "#define HOST_OS \"$(TargetOS_CPP)\"" >> $@
@echo "#define TARGET_OS \"$(TargetOS_CPP)\"" >> $@ @echo "#define TARGET_OS \"$(TargetOS_CPP)\"" >> $@
ifeq "$(TargetOS_CPP)" "irix" ifeq "$(TargetOS_CPP)" "irix"
@echo "#ifndef $(IRIX_MAJOR)_TARGET_OS" >> $@ @echo "#ifndef $(IRIX_MAJOR)_TARGET_OS" >> $@
...@@ -214,11 +209,11 @@ ifeq "$(TargetOS_CPP)" "irix" ...@@ -214,11 +209,11 @@ ifeq "$(TargetOS_CPP)" "irix"
@echo "#endif" >> $@ @echo "#endif" >> $@
endif endif
@echo >> $@ @echo >> $@
@echo "#define $(BuildVendor_CPP)_BUILD_VENDOR 1" >> $@ @echo "#define $(HostVendor_CPP)_BUILD_VENDOR 1" >> $@
@echo "#define $(HostVendor_CPP)_HOST_VENDOR 1" >> $@ @echo "#define $(TargetVendor_CPP)_HOST_VENDOR 1" >> $@
@echo "#define $(TargetVendor_CPP)_TARGET_VENDOR 1" >> $@ @echo "#define $(TargetVendor_CPP)_TARGET_VENDOR 1" >> $@
@echo "#define BUILD_VENDOR \"$(BuildVendor_CPP)\"" >> $@ @echo "#define BUILD_VENDOR \"$(HostVendor_CPP)\"" >> $@
@echo "#define HOST_VENDOR \"$(HostVendor_CPP)\"" >> $@ @echo "#define HOST_VENDOR \"$(TargetVendor_CPP)\"" >> $@
@echo "#define TARGET_VENDOR \"$(TargetVendor_CPP)\"" >> $@ @echo "#define TARGET_VENDOR \"$(TargetVendor_CPP)\"" >> $@
@echo >> $@ @echo >> $@
@echo "#endif /* __PLATFORM_H__ */" >> $@ @echo "#endif /* __PLATFORM_H__ */" >> $@
......
...@@ -210,7 +210,6 @@ AC_CANONICAL_TARGET ...@@ -210,7 +210,6 @@ AC_CANONICAL_TARGET
# Testing ARM ABI # Testing ARM ABI
# required for code generation (LLVM options) # required for code generation (LLVM options)
ARM_ABI=SOFT ARM_ABI=SOFT
echo HOST: $host
case $host in case $host in
arm*-*-linux-gnueabihf) arm*-*-linux-gnueabihf)
...@@ -451,12 +450,9 @@ AC_SUBST([SplitObjsBroken]) ...@@ -451,12 +450,9 @@ AC_SUBST([SplitObjsBroken])
dnl ** Building a cross compiler? dnl ** Building a cross compiler?
dnl -------------------------------------------------------------- dnl --------------------------------------------------------------
BuildingCrossCompiler=NO
PortingCompiler=NO
CrossCompiling=NO CrossCompiling=NO
# If 'host' and 'target' differ, then this means we are building a cross-compiler. # If 'host' and 'target' differ, then this means we are building a cross-compiler.
if test "$host" != "$target" ; then if test "$target" != "$host" ; then
BuildingCrossCompiler=YES
CrossCompiling=YES CrossCompiling=YES
cross_compiling=yes # This tells configure that it can accept just 'target', cross_compiling=yes # This tells configure that it can accept just 'target',
# otherwise you get # otherwise you get
...@@ -464,25 +460,17 @@ if test "$host" != "$target" ; then ...@@ -464,25 +460,17 @@ if test "$host" != "$target" ; then
# If you meant to cross compile, use `--host'. # If you meant to cross compile, use `--host'.
fi fi
if test "$build" != "$host" ; then if test "$build" != "$host" ; then
CrossCompiling=YES
PortingCompiler=YES
fi
# Note: cross_compiling is set to 'yes' in both 'port' and 'toolchain' cases
if ! test "$host" = "$target" -o "$host" = "$build" ; then
AC_MSG_ERROR([ AC_MSG_ERROR([
You've selected: You've selected:
build: $build (the architecture we're building on) BUILD: $build (the architecture we're building on)
host: $host (the architecture the compiler we're building will execute on) HOST: $host (the architecture the compiler we're building will execute on)
target: $target (the architecture the compiler we're building will produce code for) TARGET: $target (the architecture the compiler we're building will produce code for)
host must equal build or target. The two allowed cases are:
--host=<arch> --target=<arch> to _port_ GHC to run on a foreign architecture BUILD must equal HOST; that is, we do not support building GHC itself
and produce code for that architecture with a cross-compiler. To cross-compile GHC itself, set TARGET: stage
--target=<arch> to build a cross compiler _toolchain_ that runs 1 will be a cross-compiler, and stage 2 will be the cross-compiled
locally but produces code for a foreign GHC.
architecture
]) ])
fi fi
if test "$CrossCompiling" = "YES" if test "$CrossCompiling" = "YES"
...@@ -492,9 +480,7 @@ else ...@@ -492,9 +480,7 @@ else
CrossCompilePrefix="" CrossCompilePrefix=""
fi fi
TargetPlatformFull="${target}" TargetPlatformFull="${target}"
AC_SUBST(BuildingCrossCompiler) # 'toolchain' case AC_SUBST(CrossCompiling)
AC_SUBST(PortingCompiler) # 'port' case
AC_SUBST(CrossCompiling) # BuildingCrossCompiler OR PortingCompiler
AC_SUBST(CrossCompilePrefix) AC_SUBST(CrossCompilePrefix)
AC_SUBST(TargetPlatformFull) AC_SUBST(TargetPlatformFull)
AC_ARG_WITH([alien], AC_ARG_WITH([alien],
...@@ -1019,8 +1005,7 @@ fi ...@@ -1019,8 +1005,7 @@ fi
echo ["\ echo ["\
Using GCC : $WhatGccIsCalled Using GCC : $WhatGccIsCalled
which is version : $GccVersion which is version : $GccVersion
Building a cross compiler : $BuildingCrossCompiler Building a cross compiler : $CrossCompiling
Porting to foreign arch : $PortingCompiler
Alien script : $AlienScript Alien script : $AlienScript
ld : $LdCmd ld : $LdCmd
......
...@@ -397,7 +397,7 @@ endef ...@@ -397,7 +397,7 @@ endef
define addPackage # args: $1 = package, $2 = condition define addPackage # args: $1 = package, $2 = condition
ifneq "$(filter $1,$(PKGS_THAT_USE_TH)) $(GhcProfiled)" "$1 YES" ifneq "$(filter $1,$(PKGS_THAT_USE_TH)) $(GhcProfiled)" "$1 YES"
ifeq "$(filter $1,$(PKGS_THAT_BUILD_WITH_STAGE2))" "$1" ifeq "$(filter $1,$(PKGS_THAT_BUILD_WITH_STAGE2))" "$1"
ifneq "$(BuildingCrossCompiler)" "YES" ifneq "$(Stage1Only)" "YES"
$(call addPackageGeneral,PACKAGES_STAGE2,$1,$2) $(call addPackageGeneral,PACKAGES_STAGE2,$1,$2)
endif endif
else else
...@@ -608,7 +608,7 @@ BUILD_DIRS += \ ...@@ -608,7 +608,7 @@ BUILD_DIRS += \
$(GHC_GENPRIMOP_DIR) $(GHC_GENPRIMOP_DIR)
endif endif
ifeq "$(BuildingCrossCompiler)-$(phase)" "YES-final" ifeq "$(Stage1Only)-$(phase)" "YES-final"
MAYBE_GHCI= MAYBE_GHCI=
else else
MAYBE_GHCI=driver/ghci MAYBE_GHCI=driver/ghci
...@@ -640,7 +640,7 @@ else ifneq "$(findstring clean,$(MAKECMDGOALS))" "" ...@@ -640,7 +640,7 @@ else ifneq "$(findstring clean,$(MAKECMDGOALS))" ""
BUILD_DIRS += libraries/integer-gmp/gmp BUILD_DIRS += libraries/integer-gmp/gmp
endif endif
ifeq "$(BuildingCrossCompiler)-$(phase)" "YES-final" ifeq "$(Stage1Only)-$(phase)" "YES-final"
MAYBE_COMPILER= MAYBE_COMPILER=
MAYBE_GHCTAGS= MAYBE_GHCTAGS=
MAYBE_HPC= MAYBE_HPC=
...@@ -668,7 +668,7 @@ BUILD_DIRS += \ ...@@ -668,7 +668,7 @@ BUILD_DIRS += \
ghc ghc
ifneq "$(BINDIST)" "YES" ifneq "$(BINDIST)" "YES"
ifneq "$(BuildingCrossCompiler)-$(phase)" "YES-final" ifneq "$(Stage1Only)-$(phase)" "YES-final"
BUILD_DIRS += \ BUILD_DIRS += \
utils/mkUserGuidePart utils/mkUserGuidePart
endif endif
...@@ -911,7 +911,7 @@ INSTALLED_GHC_PKG_REAL=$(DESTDIR)$(bindir)/ghc-pkg.exe ...@@ -911,7 +911,7 @@ INSTALLED_GHC_PKG_REAL=$(DESTDIR)$(bindir)/ghc-pkg.exe
endif endif
INSTALLED_PKG_DIRS := $(addprefix libraries/,$(PACKAGES_STAGE1)) INSTALLED_PKG_DIRS := $(addprefix libraries/,$(PACKAGES_STAGE1))
ifeq "$(BuildingCrossCompiler)" "NO" ifeq "$(Stage1Only)" "NO"
INSTALLED_PKG_DIRS := $(INSTALLED_PKG_DIRS) compiler INSTALLED_PKG_DIRS := $(INSTALLED_PKG_DIRS) compiler
endif endif
INSTALLED_PKG_DIRS := $(INSTALLED_PKG_DIRS) $(addprefix libraries/,$(PACKAGES_STAGE2)) INSTALLED_PKG_DIRS := $(INSTALLED_PKG_DIRS) $(addprefix libraries/,$(PACKAGES_STAGE2))
......
...@@ -99,7 +99,7 @@ ifneq "$(filter-out 2,$(stage))" "" ...@@ -99,7 +99,7 @@ ifneq "$(filter-out 2,$(stage))" ""
ghc_stage2_NOT_NEEDED = YES ghc_stage2_NOT_NEEDED = YES
endif endif
# When cross-compiling, the stage 1 compiler is our release compiler, so omit stage 2 # When cross-compiling, the stage 1 compiler is our release compiler, so omit stage 2
ifeq "$(BuildingCrossCompiler)" "YES" ifeq "$(Stage1Only)" "YES"
ghc_stage2_NOT_NEEDED = YES ghc_stage2_NOT_NEEDED = YES
endif endif
# stage 3 has to be requested explicitly with stage=3 # stage 3 has to be requested explicitly with stage=3
......
primitive @ 75c3379b
Subproject commit 75c3379b6d76e914cc3c7ffd290b6b1cad7ea3e6
vector @ c4c5a740
Subproject commit c4c5a740ec977a4300449bc85f4707ec641be923
...@@ -582,32 +582,37 @@ endif ...@@ -582,32 +582,37 @@ endif
TargetPlatformFull = @TargetPlatformFull@ TargetPlatformFull = @TargetPlatformFull@
GccLT34 = @GccLT34@ GccLT34 = @GccLT34@
GccLT46 = @GccLT46@ GccLT46 = @GccLT46@
CC = $(WhatGccIsCalled) CC = $(WhatGccIsCalled)
CC_STAGE0 = @CC_STAGE0@ CC_STAGE0 = @CC_STAGE0@
CC_STAGE1 = $(CC) CC_STAGE1 = $(CC)
CC_STAGE2 = $(CC) CC_STAGE2 = $(CC)
CC_STAGE3 = $(CC) CC_STAGE3 = $(CC)
AS = $(WhatGccIsCalled) AS = $(WhatGccIsCalled)
AS_STAGE0 = @CC_STAGE0@ AS_STAGE0 = @CC_STAGE0@
AS_STAGE1 = $(AS) AS_STAGE1 = $(AS)
AS_STAGE2 = $(AS) AS_STAGE2 = $(AS)
AS_STAGE3 = $(AS) AS_STAGE3 = $(AS)
# We don't have an LD_STAGE0. CC_STAGE0 is determined by asking "ghc
# --info", and it doesn't report an LD.
LD_STAGE0 = error-no-ld-stage0
LD_STAGE1 = $(LD)
LD_STAGE2 = $(LD)
LD_STAGE3 = $(LD)
# Cross-compiling options # Cross-compiling options
# #
# The 'toolchain' case: Cross-compiler to run locally:
BuildingCrossCompiler = @BuildingCrossCompiler@
# The 'port' case: Porting to a foreign architecture:
PortingCompiler = @PortingCompiler@
# BuildingCrossCompiler OR PortingCompiler
CrossCompiling = @CrossCompiling@ CrossCompiling = @CrossCompiling@
# Install stage 2 by default, or stage 1 in the cross compiler case. Can be changed to 3 # Change this to YES if you're building a cross-compiler and don't
ifeq "$(BuildingCrossCompiler)" "YES" # want to build stage 2.
INSTALL_GHC_STAGE=1 Stage1Only = NO
else
INSTALL_GHC_STAGE=2 # Install stage 2 by default, or stage 1 in the cross compiler
endif # case. Can be changed to 3
INSTALL_GHC_STAGE= $(if $(filter YES,$(Stage1Only)),1,2)
# C compiler and linker flags from configure (e.g. -m<blah> to select # C compiler and linker flags from configure (e.g. -m<blah> to select
# correct C compiler backend). The stage number is the stage of GHC # correct C compiler backend). The stage number is the stage of GHC
......
...@@ -81,7 +81,12 @@ $1_$2_CONFIGURE_OPTS += $$(BOOT_PKG_CONSTRAINTS) ...@@ -81,7 +81,12 @@ $1_$2_CONFIGURE_OPTS += $$(BOOT_PKG_CONSTRAINTS)
endif endif
$1_$2_CONFIGURE_OPTS += --with-gcc="$$(CC_STAGE$3)" $1_$2_CONFIGURE_OPTS += --with-gcc="$$(CC_STAGE$3)"
$1_$2_CONFIGURE_OPTS += --with-ld="$$(LD)"
ifneq "$3" "0"
# There is no LD_STAGE0, Cabal will figure it out
$1_$2_CONFIGURE_OPTS += --with-ld="$$(LD_STAGE$3)"
endif
$1_$2_CONFIGURE_OPTS += --configure-option=--with-cc="$$(CC_STAGE$3)" $1_$2_CONFIGURE_OPTS += --configure-option=--with-cc="$$(CC_STAGE$3)"
$1_$2_CONFIGURE_OPTS += --with-ar="$$(AR_STAGE$3)" $1_$2_CONFIGURE_OPTS += --with-ar="$$(AR_STAGE$3)"
$1_$2_CONFIGURE_OPTS += --with-ranlib="$$(RANLIB)" $1_$2_CONFIGURE_OPTS += --with-ranlib="$$(RANLIB)"
......
[("GCC extra via C opts", "@GccExtraViaCOpts@"), [("GCC extra via C opts", "@GccExtraViaCOpts@"),
("C compiler command", "@SettingsCCompilerCommand@"), ("C compiler command", "@SettingsCCompilerCommand@"),
("C compiler flags", "@SettingsCCompilerFlags@"), ("C compiler flags", "@SettingsCCompilerFlags@"),
("ld command", "@SettingsLdCommand@"),
("ld flags", "@SettingsLdFlags@"), ("ld flags", "@SettingsLdFlags@"),
("ld supports compact unwind", "@LdHasNoCompactUnwind@"), ("ld supports compact unwind", "@LdHasNoCompactUnwind@"),
("ld supports build-id", "@LdHasBuildId@"), ("ld supports build-id", "@LdHasBuildId@"),
......
...@@ -85,7 +85,7 @@ $(eval $(call clean-target,utils/ghc-pkg,dist,utils/ghc-pkg/dist)) ...@@ -85,7 +85,7 @@ $(eval $(call clean-target,utils/ghc-pkg,dist,utils/ghc-pkg/dist))
# Cross-compile case: Install our dist version # Cross-compile case: Install our dist version
# Normal case: Build ghc-pkg with stage 1 # Normal case: Build ghc-pkg with stage 1
ifeq "$(BuildingCrossCompiler)" "YES" ifeq "$(Stage1Only)" "YES"
GHC_PKG_DISTDIR=dist GHC_PKG_DISTDIR=dist
else else
GHC_PKG_DISTDIR=dist-install GHC_PKG_DISTDIR=dist-install
...@@ -104,7 +104,7 @@ ifeq "$(BootingFromHc)" "YES" ...@@ -104,7 +104,7 @@ ifeq "$(BootingFromHc)" "YES"
utils/ghc-pkg_dist-install_OTHER_OBJS += $(ALL_STAGE1_LIBS) $(ALL_STAGE1_LIBS) $(ALL_STAGE1_LIBS) $(ALL_RTS_LIBS) $(libffi_STATIC_LIB) utils/ghc-pkg_dist-install_OTHER_OBJS += $(ALL_STAGE1_LIBS) $(ALL_STAGE1_LIBS) $(ALL_STAGE1_LIBS) $(ALL_RTS_LIBS) $(libffi_STATIC_LIB)
endif endif
ifeq "$(BuildingCrossCompiler)" "YES" ifeq "$(Stage1Only)" "YES"
$(eval $(call shell-wrapper,utils/ghc-pkg,dist)) $(eval $(call shell-wrapper,utils/ghc-pkg,dist))
else else
$(eval $(call build-prog,utils/ghc-pkg,dist-install,1)) $(eval $(call build-prog,utils/ghc-pkg,dist-install,1))
......
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