1. Bryan O'Sullivan
  2. text

Commits

Bryan O'Sullivan  committed bb16c7a

Make it possible to build tests in-place.

  • Participants
  • Parent commits b5596ba
  • Branches default

Comments (0)

Files changed (1)

File tests/Makefile

View file
-all: Properties bin/Bench
+version := $(shell awk '/^version:/{print $$2}' ../text.cabal)
+ghc := ghc
+ghcflags := -O -Wall -package bytestring -package QuickCheck \
+	-hide-package text -i../dist/build -package-name text-$(version)
+lib := ../dist/build/libHStext-$(version).a
+lib-srcs := $(shell grep '^  *Data' ../text.cabal | \
+                    sed -e 's,\.,/,g' -e 's,$$,.hs,')
 
-.PHONY: Properties
-Properties: Properties.hs QuickCheckUtils.hs
-	ghc --make -fforce-recomp Properties
+all: qc
 
-bin/Bench: dist/setup-config *.hs
-	./Setup build
-	./Setup install
+lib: $(lib)
 
-Setup: Setup.lhs
-	ghc -O --make $@
-	-rm -f $@.o $@.hi
+$(lib): $(lib-srcs:%=../%)
+	cd .. && runghc Setup configure --user --prefix=$(HOME)
+	cd .. && runghc Setup build
+
+qc: QuickCheckUtils.o Properties.o $(lib)
+	$(ghc) $(ghcflags) -o $@ $^
+
+%.o: %.hs
+	$(ghc) $(ghcflags) -c -o $@ $<
 
 .PHONY: testdata
 testdata: text-testdata.tar.bz2
 text-testdata.tar.bz2:
 	curl -O http://projects.haskell.org/text/text-testdata.tar.bz2
 
-dist/setup-config: text-tests.cabal Setup
-	./Setup configure --user --prefix=`pwd`
-
 clean:
-	-rm -f *.o *.hi Setup
-	-rm -rf dist bin
+	-rm -f *.o *.hi qc