[commit: ghc] master: Enable the .hi file sanity check when not on Windows (1353b4a)
Ian Lynagh
igloo at earth.li
Thu Jan 10 21:20:38 CET 2013
Repository : ssh://darcs.haskell.org//srv/darcs/ghc
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/1353b4a1e774cafbfce41bf977ed7458b989e287
>---------------------------------------------------------------
commit 1353b4a1e774cafbfce41bf977ed7458b989e287
Author: Ian Lynagh <ian at well-typed.com>
Date: Sun Jan 6 17:36:45 2013 +0000
Enable the .hi file sanity check when not on Windows
We don't want the overhead of spawning a shell on Windows, but on other
platforms it's a useful sanity check.
>---------------------------------------------------------------
rules/hi-rule.mk | 37 ++++++++++++++++++++++++++++---------
1 files changed, 28 insertions(+), 9 deletions(-)
diff --git a/rules/hi-rule.mk b/rules/hi-rule.mk
index c1e7502..a059ce1 100644
--- a/rules/hi-rule.mk
+++ b/rules/hi-rule.mk
@@ -32,11 +32,11 @@
# exit 1; \
# fi
#
-# This version adds a useful sanity check; but it is also expensive on
-# Windows where 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 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.
#
# %.hi : %.o
#
@@ -64,11 +64,30 @@
define hi-rule # $1 = source directory, $2 = object directory, $3 = way
-$2/%.$$($3_hisuf) : $2/%.$$($3_osuf) $1/%.hs ;
-$2/%.$$($3_hisuf) : $2/%.$$($3_osuf) $1/%.lhs ;
+$(call hi-rule-helper,$2/%.$$($3_hisuf) : $2/%.$$($3_osuf) $1/%.hs)
+$(call hi-rule-helper,$2/%.$$($3_hisuf) : $2/%.$$($3_osuf) $1/%.lhs)
-$2/%.$$($3_way_)hi-boot : $2/%.$$($3_way_)o-boot $1/%.hs ;
-$2/%.$$($3_way_)hi-boot : $2/%.$$($3_way_)o-boot $1/%.lhs ;
+$(call hi-rule-helper,$2/%.$$($3_way_)hi-boot : $2/%.$$($3_way_)o-boot $1/%.hs)
+$(call hi-rule-helper,$2/%.$$($3_way_)hi-boot : $2/%.$$($3_way_)o-boot $1/%.lhs)
endef
+ifeq "$(TargetOS_CPP)" "mingw32"
+
+define hi-rule-helper # $1 = rule header
+$1 ;
+endef
+
+else
+
+define hi-rule-helper # $1 = rule header
+$1
+ @if [ ! -f $$@ ] ; then \
+ echo "Panic! $$< exists, but $$@ does not."; \
+ exit 1; \
+ fi
+
+endef
+
+endif
+
More information about the ghc-commits
mailing list