summaryrefslogtreecommitdiff
path: root/rules/hi-rule.mk
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2013-01-11 13:21:51 +0000
committerIan Lynagh <ian@well-typed.com>2013-01-11 13:28:50 +0000
commitfb7391ae2f2bd5261fc4f70766a36ec7285c007a (patch)
treec7ef5da39d634fb51258784f7f78abeaf240e4b8 /rules/hi-rule.mk
parent96ea76c7afd6d61e499b936827e2212001065e90 (diff)
downloadhaskell-fb7391ae2f2bd5261fc4f70766a36ec7285c007a.tar.gz
Build system: Add ExtraMakefileSanityChecks for extra safety
Whether we check that .hi files have actually been created is now controlled by $(ExtraMakefileSanityChecks) (defaults to NO). Also updated comments about the .hi rule.
Diffstat (limited to 'rules/hi-rule.mk')
-rw-r--r--rules/hi-rule.mk21
1 files changed, 15 insertions, 6 deletions
diff --git a/rules/hi-rule.mk b/rules/hi-rule.mk
index a059ce1378..e478c17aea 100644
--- a/rules/hi-rule.mk
+++ b/rules/hi-rule.mk
@@ -32,11 +32,13 @@
# exit 1; \
# fi
#
-# This version adds a useful sanity check, and is a good solution on
-# platforms other than Windows. But on Windows it is expensive, as
-# spawning a shell takes a while (about 0.3s). We'd like to avoid the
-# shell if necessary. This also hides the message "nothing to be done
-# for 'all'", since make thinks it has actually done something.
+# This version adds a useful sanity check, and is a good solution,
+# except that it means spawning a shell. This can be expensive,
+# especially on Windows where spawning a shell takes about 0.3s.
+# We'd like to avoid the shell if necessary. This also hides the
+# message "nothing to be done for 'all'", since make thinks it has
+# actually done something. Therefore we only use this version
+# if ExtraMakefileSanityChecks is enabled.
#
# %.hi : %.o
#
@@ -61,6 +63,13 @@
# the ';' at the end signifies an "empty command" (see the GNU make
# documentation). An empty command is enough to get GNU make to think
# it has updated %.hi, but without actually spawning a shell to do so.
+#
+# However, given that rule, make thinks that it can make .hi files
+# for any object file, even if the object file was created from e.g.
+# a C source file. We therefore also add a dependency on the .hs/.lhs
+# source file, which means we finally end up with rules like:
+#
+# a/%.hi : a/%.o b/%.hs ;
define hi-rule # $1 = source directory, $2 = object directory, $3 = way
@@ -72,7 +81,7 @@ $(call hi-rule-helper,$2/%.$$($3_way_)hi-boot : $2/%.$$($3_way_)o-boot $1/%.lhs)
endef
-ifeq "$(TargetOS_CPP)" "mingw32"
+ifeq "$(ExtraMakefileSanityChecks)" "NO"
define hi-rule-helper # $1 = rule header
$1 ;