Fix a makefile include ordering sanity check
[ghc-hetmet.git] / rules / build-prog.mk
index 3fbed21..4121ca3 100644 (file)
@@ -139,13 +139,17 @@ endif
 # need to depend on the libraries too.  NB. since $(ALL_STAGE1_LIBS) and
 # $(ALL_RTS_LIBS) are not defined until after libraries/*/ghc.mk have
 # been included, this introduces an ordering dependency.
+ifneq "$$(CLEANING)" "YES"
 ifneq "$3" "0"
-ifeq "$$(ALL_STAGE1_LIBS)" ""
-$$(error ordering failure in $1: $$(ALL_STAGE1_LIBS) is empty)
+ifneq "$$($1_$2_HS_SRCS)" ""
+ifeq "$$(strip $$(ALL_STAGE1_LIBS))" ""
+$$(error ordering failure in $1 ($2): ALL_STAGE1_LIBS is empty)
+endif
 endif
 $1/$2/build/tmp/$$($1_$2_PROG) : $$(ALL_STAGE1_LIBS) $$(ALL_RTS_LIBS) $$(OTHER_LIBS)
 endif
 endif
+endif
 
 ifeq "$$($1_$2_INSTALL_INPLACE)" "NO"
 $(call all-target,$1_$2,$1/$2/build/tmp/$$($1_$2_PROG))