summaryrefslogtreecommitdiff
path: root/ghc.mk
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2012-01-30 11:19:03 +0000
committerSimon Marlow <marlowsd@gmail.com>2012-01-30 11:19:03 +0000
commit9fff25eaf08016c4c0e32a7087a1249d586550c0 (patch)
tree7a2f13260f24d610abea5cd8f8bf3a51d0787c54 /ghc.mk
parent4ff3a642fbb61cf329d468993e9f732940f9f680 (diff)
downloadhaskell-9fff25eaf08016c4c0e32a7087a1249d586550c0.tar.gz
Improve support for cross-compilation
Patchset from Stephen Blackheath <stephen.blackheath@ipwnstudios.com>
Diffstat (limited to 'ghc.mk')
-rw-r--r--ghc.mk43
1 files changed, 34 insertions, 9 deletions
diff --git a/ghc.mk b/ghc.mk
index 2ab85ec33a..fef5346838 100644
--- a/ghc.mk
+++ b/ghc.mk
@@ -380,7 +380,9 @@ endef
define addPackage # args: $1 = package, $2 = condition
ifneq "$(filter $1,$(PKGS_THAT_USE_TH)) $(GhcProfiled)" "$1 YES"
ifeq "$(filter $1,$(PKGS_THAT_BUILD_WITH_STAGE2))" "$1"
+ifneq "$(BuildingCrossCompiler)" "YES"
$(call addPackageGeneral,PACKAGES_STAGE2,$1,$2)
+endif
else
$(call addPackageGeneral,PACKAGES_STAGE1,$1,$2)
endif
@@ -574,9 +576,15 @@ BUILD_DIRS += \
$(GHC_GENPRIMOP_DIR)
endif
+ifeq "$(BuildingCrossCompiler)-$(phase)" "YES-final"
+MAYBE_GHCI=
+else
+MAYBE_GHCI=driver/ghci
+endif
+
BUILD_DIRS += \
driver \
- driver/ghci \
+ $(MAYBE_GHCI) \
driver/ghc \
driver/haddock \
libffi \
@@ -600,24 +608,38 @@ else ifneq "$(findstring clean,$(MAKECMDGOALS))" ""
BUILD_DIRS += libraries/integer-gmp/gmp
endif
+ifeq "$(BuildingCrossCompiler)-$(phase)" "YES-final"
+MAYBE_COMPILER=
+MAYBE_GHCTAGS=
+MAYBE_HPC=
+MAYBE_RUNGHC=
+else
+MAYBE_COMPILER=compiler
+MAYBE_GHCTAGS=utils/ghctags
+MAYBE_HPC=utils/hpc
+MAYBE_RUNGHC=utils/runghc
+endif
+
BUILD_DIRS += \
utils/haddock \
utils/haddock/doc \
- compiler \
+ $(MAYBE_COMPILER) \
$(GHC_HSC2HS_DIR) \
$(GHC_PKG_DIR) \
utils/testremove \
- utils/ghctags \
+ $(MAYBE_GHCTAGS) \
utils/ghc-pwd \
$(GHC_CABAL_DIR) \
- utils/hpc \
- utils/runghc \
+ $(MAYBE_HPC) \
+ $(MAYBE_RUNGHC) \
ghc
ifneq "$(BINDIST)" "YES"
+ifneq "$(BuildingCrossCompiler)-$(phase)" "YES-final"
BUILD_DIRS += \
utils/mkUserGuidePart
endif
+endif
BUILD_DIRS += utils/count_lines
BUILD_DIRS += utils/compare_sizes
@@ -810,7 +832,7 @@ else
done
# We rename ghc-stage2, so that the right program name is used in error
# messages etc.
- "$(MV)" "$(DESTDIR)$(ghclibexecdir)/ghc-stage2" "$(DESTDIR)$(ghclibexecdir)/ghc"
+ "$(MV)" "$(DESTDIR)$(ghclibexecdir)/ghc-stage$(INSTALL_GHC_STAGE)" "$(DESTDIR)$(ghclibexecdir)/ghc"
endif
install_topdirs: $(INSTALL_TOPDIRS)
@@ -855,9 +877,11 @@ INSTALLED_GHC_REAL=$(DESTDIR)$(bindir)/ghc.exe
INSTALLED_GHC_PKG_REAL=$(DESTDIR)$(bindir)/ghc-pkg.exe
endif
-INSTALLED_PKG_DIRS := $(addprefix libraries/,$(PACKAGES_STAGE1)) \
- compiler \
- $(addprefix libraries/,$(PACKAGES_STAGE2))
+INSTALLED_PKG_DIRS := $(addprefix libraries/,$(PACKAGES_STAGE1))
+ifeq "$(BuildingCrossCompiler)" "NO"
+INSTALLED_PKG_DIRS := $(INSTALLED_PKG_DIRS) compiler
+endif
+INSTALLED_PKG_DIRS := $(INSTALLED_PKG_DIRS) $(addprefix libraries/,$(PACKAGES_STAGE2))
ifeq "$(InstallExtraPackages)" "NO"
INSTALLED_PKG_DIRS := $(filter-out $(addprefix libraries/,$(EXTRA_PACKAGES)),\
$(INSTALLED_PKG_DIRS))
@@ -879,6 +903,7 @@ install_packages: rts/package.conf.install
"$(INSTALLED_GHC_PKG_REAL)" --force --global-conf "$(INSTALLED_PACKAGE_CONF)" update rts/package.conf.install
$(foreach p, $(INSTALLED_PKG_DIRS), \
$(call make-command, \
+ CROSS_COMPILE="$(CrossCompilePrefix)" \
"$(GHC_CABAL_INPLACE)" install \
"$(INSTALLED_GHC_REAL)" \
"$(INSTALLED_GHC_PKG_REAL)" \