[commit: ghc] master: Add some extra sanity checking to the (l)hs->o rules (66f9792)

Ian Lynagh igloo at earth.li
Sat Mar 9 21:02:26 CET 2013


Repository : http://darcs.haskell.org/ghc.git/

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/66f97921500186b206a272a9b41d002e2d2a5cf8

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

commit 66f97921500186b206a272a9b41d002e2d2a5cf8
Author: Ian Lynagh <ian at well-typed.com>
Date:   Fri Mar 8 14:38:47 2013 +0000

    Add some extra sanity checking to the (l)hs->o rules

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

 rules/hs-suffix-way-rules-srcdir.mk | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/rules/hs-suffix-way-rules-srcdir.mk b/rules/hs-suffix-way-rules-srcdir.mk
index b8b8bfd..466b631 100644
--- a/rules/hs-suffix-way-rules-srcdir.mk
+++ b/rules/hs-suffix-way-rules-srcdir.mk
@@ -20,9 +20,11 @@ ifneq "$$(BINDIST)" "YES"
 
 $1/$2/build/%.$$($3_osuf) : $1/$4/%.hs $$(LAX_DEPS_FOLLOW) $$($1_$2_HC_DEP) $$($1_$2_PKGDATA_DEP)
 	$$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) -c $$< -o $$@ $$(if $$(findstring YES,$$($1_$2_DYNAMIC_TOO)),-dyno $$(addsuffix .$$(dyn_osuf),$$(basename $$@)))
+	$$(call ohi-sanity-check,$1,$2,$3,$1/$2/build/$$*)
 
 $1/$2/build/%.$$($3_osuf) : $1/$4/%.lhs $$(LAX_DEPS_FOLLOW) $$($1_$2_HC_DEP) $$($1_$2_PKGDATA_DEP)
 	$$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) -c $$< -o $$@ $$(if $$(findstring YES,$$($1_$2_DYNAMIC_TOO)),-dyno $$(addsuffix .$$(dyn_osuf),$$(basename $$@)))
+	$$(call ohi-sanity-check,$1,$2,$3,$1/$2/build/$$*)
 
 $1/$2/build/%.$$($3_hcsuf) : $1/$4/%.hs $$(LAX_DEPS_FOLLOW) $$($1_$2_HC_DEP) $$($1_$2_PKGDATA_DEP)
 	$$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) -C $$< -o $$@
@@ -65,3 +67,18 @@ endif
 
 endef
 
+ifeq "$(ExtraMakefileSanityChecks)" "NO"
+ohi-sanity-check =
+else
+# We don't look for the .hi file if this is for a program, as if the
+# Main module is in foo.hs then we get foo.o but Main.hi
+define ohi-sanity-check
+	@for f in $4.$($3_osuf) $(if $($1_$2_PROG),,$4.$($3_hisuf)) $(if $(findstring YES,$($1_$2_DYNAMIC_TOO)),$4.$(dyn_osuf) $4.$(dyn_hisuf)); do \
+	    if [ ! -f $$f ]; then \
+	        echo "Panic! $$f not created."; \
+	        exit 1; \
+	    fi; \
+	done
+endef
+endif
+





More information about the ghc-commits mailing list