From 109a1e53287f50103e8a5b592275940b6e3dbb53 Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Thu, 17 Jan 2013 11:52:15 +0000 Subject: Tidy up cross-compiling We have two cases: 1. building a cross-compiler 2. compiling GHC to run on a foreign platform These two are done with almost the same setup: (1) is the stage 1 compiler, and (2) is the stage 2 compiler, when CrossCompiling=YES. The only difference between (1) and (2) is that you if you set up the build for (1), then it stops before stage 2 and you can 'make install' to install stage 1. Unfortunately, (2) didn't work, and the build system code needed some tidying up. Change to the way the build is set up: Before ------ To build a cross-compiler: ./configure --target=<..> To compile a foreign GHC: ./configure --host=<..> --target=<..> Now --- To build a cross-compiler: ./configure --target=<..> And set "Stage1Only=YES" in mk/build.mk To compile a foreign GHC: ./configure --target=<..> --- mk/config.mk.in | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'mk') diff --git a/mk/config.mk.in b/mk/config.mk.in index 19c369dbfa..0048620a20 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -582,32 +582,37 @@ endif TargetPlatformFull = @TargetPlatformFull@ GccLT34 = @GccLT34@ GccLT46 = @GccLT46@ + CC = $(WhatGccIsCalled) CC_STAGE0 = @CC_STAGE0@ CC_STAGE1 = $(CC) CC_STAGE2 = $(CC) CC_STAGE3 = $(CC) + AS = $(WhatGccIsCalled) AS_STAGE0 = @CC_STAGE0@ AS_STAGE1 = $(AS) AS_STAGE2 = $(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 # -# 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@ -# Install stage 2 by default, or stage 1 in the cross compiler case. Can be changed to 3 -ifeq "$(BuildingCrossCompiler)" "YES" -INSTALL_GHC_STAGE=1 -else -INSTALL_GHC_STAGE=2 -endif +# Change this to YES if you're building a cross-compiler and don't +# want to build stage 2. +Stage1Only = NO + +# Install stage 2 by default, or stage 1 in the cross compiler +# 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 to select # correct C compiler backend). The stage number is the stage of GHC -- cgit v1.2.1