From 49e11c494ecec36e175bb6de32c9ea5c7a2f3abc Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Fri, 8 Apr 2011 11:14:51 +0200
Subject: [PATCH] Some more changes to Makefile.am for htools

I duplicate the BINARY= rule in the ghc invocation in order to be able
to silence the if, which was confusing.

Additionally, a new target for running just the htools unit-tests is
provided.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
---
 Makefile.am | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 8efb4ff83..a9f3272d4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -450,15 +450,14 @@ $(HS_ALL_PROGS): %: %.hs $(HS_LIB_SRCS) $(HS_BUILT_SRCS) Makefile
 	  echo "Error: htools compilation disabled at configure time" 1>&2 ;\
 	  exit 1; \
 	fi
-	BINARY=$(@:htools/%=%); \
-	if [ "$$BINARY" = "test" ] && [ -z "$(GHC_PKG_QUICKCHECK)" ]; then \
+	@BINARY=$(@:htools/%=%); \
+	if [ "$BINARY" = "test" ] && [ -z "$(GHC_PKG_QUICKCHECK)" ]; then \
 	  echo "Error: cannot run unittests without the QuickCheck library (see devnotes.rst)" 1>&2; \
 	  exit 1; \
-	fi; \
-	$(GHC) --make \
+	fi
+	BINARY=$(@:htools/%=%); $(GHC) --make \
 	  $(HFLAGS) $(HEXTRA) $(HTOOLS_NOCURL) \
-	  -osuf $$BINARY.o -hisuf $$BINARY.hi \
-	  $@
+	  -osuf $$BINARY.o -hisuf $$BINARY.hi $@
 
 # for the htools/test binary, we need to enable profiling/coverage
 htools/test: HEXTRA=-fhpc -Wwarn -fno-warn-missing-signatures \
@@ -981,6 +980,11 @@ check-local: check-dirs
 	$(CHECK_VERSION) $(VERSION) $(top_srcdir)/NEWS
 	$(CHECK_NEWS) < $(top_srcdir)/NEWS
 
+.PHONY: hs-check
+hs-check: htools/test
+	@rm -f test.tix
+	./htools/test
+
 .PHONY: lint
 lint: $(BUILT_SOURCES)
 	@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
-- 
GitLab