[commit: ghc] master: Build system: Add ExtraMakefileSanityChecks for extra safety (fb7391a)

Ian Lynagh igloo at earth.li
Fri Jan 11 15:15:32 CET 2013


Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/fb7391ae2f2bd5261fc4f70766a36ec7285c007a

>---------------------------------------------------------------

commit fb7391ae2f2bd5261fc4f70766a36ec7285c007a
Author: Ian Lynagh <ian at well-typed.com>
Date:   Fri Jan 11 13:21:51 2013 +0000

    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.

>---------------------------------------------------------------

 mk/config.mk.in  |    2 ++
 rules/hi-rule.mk |   21 +++++++++++++++------
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/mk/config.mk.in b/mk/config.mk.in
index 3d7918d..19c369d 100644
--- a/mk/config.mk.in
+++ b/mk/config.mk.in
@@ -233,6 +233,8 @@ include $(TOP)/mk/install.mk
 # portable as possible.
 BeConservative = NO
 
+ExtraMakefileSanityChecks = NO
+
 #
 # Building various ways?
 # (right now, empty if not).
diff --git a/rules/hi-rule.mk b/rules/hi-rule.mk
index a059ce1..e478c17 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 ;





More information about the ghc-commits mailing list