summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ghc.mk1
-rw-r--r--rules/add-dependency.mk15
-rw-r--r--rules/build-prog.mk8
3 files changed, 24 insertions, 0 deletions
diff --git a/ghc.mk b/ghc.mk
index 8957e603c6..8bd78596a5 100644
--- a/ghc.mk
+++ b/ghc.mk
@@ -155,6 +155,7 @@ endif
include rules/prof.mk
include rules/trace.mk
include rules/library-path.mk
+include rules/add-dependency.mk
include rules/make-command.mk
include rules/pretty_commands.mk
diff --git a/rules/add-dependency.mk b/rules/add-dependency.mk
new file mode 100644
index 0000000000..d1d8562e78
--- /dev/null
+++ b/rules/add-dependency.mk
@@ -0,0 +1,15 @@
+# -----------------------------------------------------------------------------
+#
+# (c) 2010 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 add-dependency
+$1: $2
+endef
diff --git a/rules/build-prog.mk b/rules/build-prog.mk
index 4111e172b9..0419c3b4ab 100644
--- a/rules/build-prog.mk
+++ b/rules/build-prog.mk
@@ -246,4 +246,12 @@ endif
$(call dependencies,$1,$2,$3)
+# The Main module of a program implicitly depends on GHC.TopHandler
+# so we need to add a dependency for that. As we don't know which
+# module contains Main, we just make all modules in the program
+# depend on it.
+ifneq "$3" "0"
+$$(foreach o,$$($1_$2_$$($1_$2_PROGRAM_WAY)_HS_OBJS),$$(eval $$(call add-dependency,$$o,libraries/base/dist-install/build/GHC/TopHandler.$$($$($1_$2_PROGRAM_WAY)_osuf))))
+endif
+
endef