summaryrefslogtreecommitdiff
path: root/rules
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2011-01-16 15:56:27 +0000
committerIan Lynagh <igloo@earth.li>2011-01-16 15:56:27 +0000
commit5bde27949bdda22c9d5dac254a3c783eb0f6839f (patch)
tree74165459347e6e9fd11335b26072eb39b196e876 /rules
parent2a1db1613dfa6b7cb982daa98987aee2c4eb12b1 (diff)
downloadhaskell-5bde27949bdda22c9d5dac254a3c783eb0f6839f.tar.gz
Handle dependencies of programs on libraries correctly
Diffstat (limited to 'rules')
-rw-r--r--rules/build-package-way.mk11
-rw-r--r--rules/build-prog.mk8
2 files changed, 19 insertions, 0 deletions
diff --git a/rules/build-package-way.mk b/rules/build-package-way.mk
index ed81d6d532..b4cd3bc590 100644
--- a/rules/build-package-way.mk
+++ b/rules/build-package-way.mk
@@ -51,6 +51,17 @@ endif
$1_$2_$3_NON_HS_OBJS = $$($1_$2_$3_CMM_OBJS) $$($1_$2_$3_C_OBJS) $$($1_$2_$3_S_OBJS) $$($1_$2_EXTRA_OBJS)
$1_$2_$3_ALL_OBJS = $$($1_$2_$3_HS_OBJS) $$($1_$2_$3_NON_HS_OBJS)
+# The quadrupled $'s here are because the _v_LIB variables aren't
+# necessarily set when this part of the makefile is read.
+# These deps aren't technically necessary in themselves, but they
+# turn the dependencies of programs on libraries into transitive
+# dependencies.
+ifeq "$4" "0"
+$$($1_$2_$3_LIB) : $$(foreach dep,$$($1_$2_DEP_NAMES),$$$$(libraries/$$(dep)_dist-boot_v_LIB))
+else
+$$($1_$2_$3_LIB) : $$(foreach dep,$$($1_$2_DEP_NAMES),$$$$(libraries/$$(dep)_dist-install_v_LIB))
+endif
+
ifeq "$3" "dyn"
# Link a dynamic library
diff --git a/rules/build-prog.mk b/rules/build-prog.mk
index e303a44f1c..99b24de5cd 100644
--- a/rules/build-prog.mk
+++ b/rules/build-prog.mk
@@ -192,6 +192,14 @@ ifeq "$$($1_$2_v_HS_OBJS)" ""
$1_$2_GHC_LD_OPTS = -no-auto-link-packages -no-hs-main
endif
+# The quadrupled $'s here are because the _v_LIB variables aren't
+# necessarily set when this part of the makefile is read
+ifeq "$3" "0"
+$1/$2/build/tmp/$$($1_$2_PROG) : $$(foreach dep,$$($1_$2_DEP_NAMES),$$$$(libraries/$$(dep)_dist-boot_v_LIB))
+else
+$1/$2/build/tmp/$$($1_$2_PROG) : $$(foreach dep,$$($1_$2_DEP_NAMES),$$$$(libraries/$$(dep)_dist-install_v_LIB))
+endif
+
ifeq "$$($1_$2_LINK_WITH_GCC)" "NO"
$1/$2/build/tmp/$$($1_$2_PROG) : $$($1_$2_v_HS_OBJS) $$($1_$2_v_C_OBJS) $$($1_$2_v_S_OBJS) $$($1_$2_OTHER_OBJS) | $$$$(dir $$$$@)/.
"$$($1_$2_HC)" -o $$@ $$($1_$2_v_ALL_HC_OPTS) $$(LD_OPTS) $$($1_$2_GHC_LD_OPTS) $$($1_$2_v_HS_OBJS) $$($1_$2_v_C_OBJS) $$($1_$2_v_S_OBJS) $$($1_$2_OTHER_OBJS) $$(addprefix -l,$$($1_$2_EXTRA_LIBRARIES))