Commit fb7391ae authored by ian@well-typed.com's avatar ian@well-typed.com

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.
parent 96ea76c7
......@@ -233,6 +233,8 @@ include $(TOP)/mk/install.mk
# portable as possible.
BeConservative = NO
ExtraMakefileSanityChecks = NO
#
# Building various ways?
# (right now, empty if not).
......
......@@ -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 ;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment