on builder help sign in
text/tests/Makefile
101 lines 3.3 kB history raw
1version := $(shell awk '/^version:/{print $$2}' ../text.cabal)
2ghc-major-version := $(shell ghc --numeric-version | sed 's/\..*//')
3ghc := ghc
4ghc-opt-flags = -O0
5ghc-base-flags := -funbox-strict-fields -hide-all-packages \
6 -package base -package mtl -package random -package directory \
7 -package criterion -package deepseq -DASSERTS -DHAVE_DEEPSEQ \
8 -package bytestring -ignore-package text \
9 -fno-ignore-asserts
10ifeq ($(ghc-major-version),7)
11 ghc-base-flags += -rtsopts
12endif
13ghc-test-flags := -package QuickCheck -package test-framework -package deepseq \
14 -package test-framework-quickcheck2 -package test-framework-hunit \
15 -package HUnit -package directory
16ghc-base-flags += -Wall -fno-warn-orphans -fno-warn-missing-signatures
17ghc-flags := $(ghc-base-flags) -i../dist/build -package-name text-$(version)
18ghc-hpc-flags := $(ghc-base-flags) -fhpc -fno-ignore-asserts -odir hpcdir \
19 -hidir hpcdir -i..
20lib := ../dist/build/libHStext-$(version).a
21lib-srcs := $(shell grep '^ *Data' ../text.cabal | \
22 sed -e 's,\.,/,g' -e 's,$$,.hs,')
24cabal := $(shell which cabal 2>/dev/null)
26all: bm qc coverage regressions
28lib: $(lib)
30$(lib): $(lib-srcs:%=../%)
31ifeq ($(cabal),)
32 cd .. && runghc Setup configure --user --prefix=$(HOME)
33 cd .. && runghc Setup build
34else
35 cd .. && cabal configure
36 cd .. && cabal build
37endif
39Properties.o Regressions.o qc qc-hpc: ghc-flags += $(ghc-test-flags)
40Properties.o: QuickCheckUtils.o SlowFunctions.o TestUtils.o
42QuickCheckUtils.o: $(lib)
44qc: Properties.o QuickCheckUtils.o SlowFunctions.o TestUtils.o
45 $(ghc) $(ghc-flags) -threaded -o $@ $^ $(lib)
47sb: SearchBench.o SlowFunctions.o
48 $(ghc) $(ghc-flags) -threaded -o $@ $^ $(lib)
50qc-hpc: Properties.hs QuickCheckUtils.hs SlowFunctions.hs TestUtils.hs $(lib-srcs:%=../%)
51 -mkdir -p hpcdir
52 @rm -f $@.tix
53 $(ghc) $(ghc-hpc-flags) $(ghc-test-flags) $(ghc-opt-flags) -ihpcdir \
54 --make -threaded -o $@ $<
56stdio-hpc: StdioCoverage.hs $(lib-srcs:%=../%)
57 -mkdir -p hpcdir
58 @rm -f $@.tix
59 $(ghc) $(ghc-hpc-flags) $(ghc-test-flags) $(ghc-opt-flags) -ihpcdir \
60 --make -threaded -o $@ $<
62coverage: coverage-html/hpc_index.html
64coverage-html/hpc_index.html: qc-hpc stdio-hpc
65 @rm -f qc-hpc.tix stdio-hpc.tix coverage.tix
66 ./qc-hpc -a 100 +RTS -N
67 bash ./cover-stdio.sh
68 hpc combine --output=coverage.tix --exclude=Main \
69 qc-hpc.tix stdio-hpc.tix
70 hpc markup coverage --exclude=Main --exclude=Properties --exclude=Main \
71 --exclude=Data.Text.Fusion.CaseMapping --exclude StdioCoverage \
72 --exclude=SlowFunctions --exclude=TestUtils \
73 --exclude=QuickCheckUtils --srcdir=.. --srcdir=. --destdir=$(dir $@)
74 @echo xdg-open $@
76Regressions.o: TestUtils.o
78regressions: Regressions.o TestUtils.o
79 $(ghc) $(ghc-test-flags) -o $@ $^ $(lib)
81Benchmarks.o: ghc-opt-flags = -O
82bm Benchmarks.o: ghc-flags += -package utf8-string
83bm: Benchmarks.o
84 $(ghc) $(ghc-flags) -o $@ $^ $(lib)
86SlowFunctions.o: ghc-opt-flags = -O2
87SearchBench.o: ghc-opt-flags = -O
88%.o: %.hs
89 $(ghc) $(ghc-flags) $(ghc-opt-flags) -c -o $@ $<
91hpcdir/%.o: %.hs
92 $(ghc) $(ghc-hpc-flags) $(ghc-opt-flags) --make -c -o $@ $<
94.PHONY: testdata
95testdata: text-testdata.tar.bz2
97text-testdata.tar.bz2:
98 curl -O http://projects.haskell.org/text/text-testdata.tar.bz2
100clean:
101 -rm -rf *.o *.hi *.tix bm qc qc-hpc stdio-hpc hpcdir .hpc coverage-html