summaryrefslogtreecommitdiff
path: root/rules
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2010-12-10 18:54:02 +0000
committerIan Lynagh <igloo@earth.li>2010-12-10 18:54:02 +0000
commitcdeb8a20af8c0ea129a5617aa576dc40fb3f3fd2 (patch)
treeadaba76c20133f5eaaa42a6566484f7632b8da2d /rules
parente65048e372f1aa3a9a891847ca83ba537cc448b1 (diff)
downloadhaskell-cdeb8a20af8c0ea129a5617aa576dc40fb3f3fd2.tar.gz
Don't link the GHC RTS into our C-only programs
Diffstat (limited to 'rules')
-rw-r--r--rules/build-prog.mk9
1 files changed, 8 insertions, 1 deletions
diff --git a/rules/build-prog.mk b/rules/build-prog.mk
index ff8d25b689..473bae8e8d 100644
--- a/rules/build-prog.mk
+++ b/rules/build-prog.mk
@@ -124,9 +124,16 @@ ifeq "$$(BootingFromHc)" "YES"
$1_$2_LINK_WITH_GCC = YES
endif
+ifeq "$$($1_$2_v_HS_OBJS)" ""
+# We don't want to link the GHC RTS into C-only programs. There's no
+# point, and it confuses the test that all GHC-compiled programs
+# were compiled with the right GHC.
+$1_$2_GHC_LD_OPTS = -no-auto-link-packages -no-hs-main
+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_v_HS_OBJS) $$($1_$2_v_C_OBJS) $$($1_$2_v_S_OBJS) $$($1_$2_OTHER_OBJS) $$(addprefix -l,$$($1_$2_EXTRA_LIBRARIES))
+ "$$($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))
else
$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 $$$$@)/.
"$$(CC)" -o $$@ $$($1_$2_v_ALL_CC_OPTS) $$(LD_OPTS) $$($1_$2_v_HS_OBJS) $$($1_$2_v_C_OBJS) $$($1_$2_v_S_OBJS) $$($1_$2_OTHER_OBJS) $$($1_$2_v_EXTRA_CC_OPTS) $$(addprefix -l,$$($1_$2_EXTRA_LIBRARIES))