Add a $(MAKE_RESTARTS) check to ghc.mk
authorIan Lynagh <igloo@earth.li>
Sun, 27 Sep 2009 20:26:03 +0000 (20:26 +0000)
committerIan Lynagh <igloo@earth.li>
Sun, 27 Sep 2009 20:26:03 +0000 (20:26 +0000)
This should catch make going into an infinite loop.

ghc.mk

diff --git a/ghc.mk b/ghc.mk
index 719949b..ab3351d 100644 (file)
--- a/ghc.mk
+++ b/ghc.mk
 
 default : all
 
+# Catch make if it runs away into an infinite loop
+ifeq      "$(MAKE_RESTARTS)" ""
+else ifeq "$(MAKE_RESTARTS)" "1"
+else ifeq "$(MAKE_RESTARTS)" "2"
+else
+$(error Make has restarted itself $(MAKE_RESTARTS) times; is there a makefile bug?)
+endif
+
 # Just bring makefiles up to date:
 .PHONY: just-makefiles
 just-makefiles: