summaryrefslogtreecommitdiff
path: root/rules/cross-compiling.mk
diff options
context:
space:
mode:
authorGabor Greif <ggreif@gmail.com>2012-07-18 15:03:31 +0200
committerGabor Greif <ggreif@gmail.com>2012-07-18 15:03:31 +0200
commit6ae696a1d1f25bf52923a3dd1c3b4a08e2033bfd (patch)
tree6b9d8f155f9c35b09ea91afe5a3c3f11c03d8633 /rules/cross-compiling.mk
parent9417612ec9d4b27cacd8100cf4831e3e703c976b (diff)
downloadhaskell-6ae696a1d1f25bf52923a3dd1c3b4a08e2033bfd.tar.gz
First batch of file additions for cross-compiler:
new file: ghc/ghc-cross.wrapper new file: includes/mkDerivedConstants.cross.awk new file: includes/mkSizeMacros.cross.awk new file: rules/cross-compiling.mk These are expected to sit quietly in the tree until the rest of the machinery matures on an (upcoming) branch. Reviews will begin to make sense as soon as that has happened. Anyway, comments are welcome. See <http://www.haskell.org/pipermail/cvs-ghc/2012-July/074456.html> for background. Disclaimer: these source files are not (yet) up to the quality standards set by the rest of the tree. Cleanups, move-arounds and rewrites (i.e. .awk -> .hs), as well as additional comments and documentation will happen as soon as the basic functionality of a cross-compiler is working reliably.
Diffstat (limited to 'rules/cross-compiling.mk')
-rw-r--r--rules/cross-compiling.mk24
1 files changed, 24 insertions, 0 deletions
diff --git a/rules/cross-compiling.mk b/rules/cross-compiling.mk
new file mode 100644
index 0000000000..9f9ec6f542
--- /dev/null
+++ b/rules/cross-compiling.mk
@@ -0,0 +1,24 @@
+# -----------------------------------------------------------------------------
+#
+# (c) 2012 The University of Glasgow
+#
+# This file is part of the GHC build system.
+#
+# To understand how the build system works and how to modify it, see
+# http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture
+# http://hackage.haskell.org/trac/ghc/wiki/Building/Modifying
+#
+# -----------------------------------------------------------------------------
+
+define cross-compiling # $1 = then, $2 = else, $3 = then, ...
+ifneq "$(TARGETPLATFORM)" "$(HOSTPLATFORM)"
+ifneq "$(BUILDPLATFORM)" "$(HOSTPLATFORM)"
+$(warning When cross-compiling, the build and host platforms must be equal (--build=$(BUILDPLATFORM) --host=$(HOSTPLATFORM) --target=$(TARGETPLATFORM)))
+endif
+$1
+$3
+else
+$2
+$4
+endif
+endef