summaryrefslogtreecommitdiff
path: root/rules/hi-rule.mk
diff options
context:
space:
mode:
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 ;