summaryrefslogtreecommitdiff
path: root/rules/dependencies.mk
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2011-04-14 19:42:51 +0100
committerIan Lynagh <igloo@earth.li>2011-04-14 20:37:13 +0100
commitae587ec8ab4dd8414d629d3629dec0cc44b37aa7 (patch)
tree340978465ebb07e0938fdb62c1e99e52e37cba93 /rules/dependencies.mk
parent9eebc6dec9a2271a51795bcfbcf1d3be849435a6 (diff)
downloadhaskell-ae587ec8ab4dd8414d629d3629dec0cc44b37aa7.tar.gz
Refactor how dependencies are included; fixes #5109
This avoids duplicating some logic around the build system.
Diffstat (limited to 'rules/dependencies.mk')
-rw-r--r--rules/dependencies.mk38
1 files changed, 38 insertions, 0 deletions
diff --git a/rules/dependencies.mk b/rules/dependencies.mk
new file mode 100644
index 0000000000..42605a565c
--- /dev/null
+++ b/rules/dependencies.mk
@@ -0,0 +1,38 @@
+# -----------------------------------------------------------------------------
+#
+# (c) 2009 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 dependencies
+$(call trace, dependencies($1,$2,$3))
+$(call profStart, dependencies($1,$2,$3))
+# $1 = dir
+# $2 = distdir
+# $3 = GHC stage to use (0 == bootstrapping compiler)
+
+# We always have the dependency rules available, as we need to know
+# how to build hsc2hs's dependency file in phase 0
+$(call build-dependencies,$1,$2,$3)
+
+ifneq "$(phase)" "0"
+# From phase 1 we actually include the dependency files for the
+# bootstrapping stuff
+ifeq "$3" "0"
+$(call include-dependencies,$1,$2,$3)
+else ifeq "$(phase)" "final"
+# In the final phase, we also include the dependency files for
+# everything else
+$(call include-dependencies,$1,$2,$3)
+endif
+endif
+
+$(call profEnd, dependencies($1,$2,$3))
+endef
+