diff options
author | Ian Lynagh <ian@well-typed.com> | 2013-03-08 14:38:47 +0000 |
---|---|---|
committer | Ian Lynagh <ian@well-typed.com> | 2013-03-09 15:39:24 +0000 |
commit | 66f97921500186b206a272a9b41d002e2d2a5cf8 (patch) | |
tree | b4f744e25ed4ab29837fc1a92b94c141dadc496d | |
parent | c5171252055bfa40dbbb11ba20323845afbecb3b (diff) | |
download | haskell-66f97921500186b206a272a9b41d002e2d2a5cf8.tar.gz |
Add some extra sanity checking to the (l)hs->o rules
-rw-r--r-- | rules/hs-suffix-way-rules-srcdir.mk | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/rules/hs-suffix-way-rules-srcdir.mk b/rules/hs-suffix-way-rules-srcdir.mk index b8b8bfd694..466b631540 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 + |