]> Git — Sourcephile - reloto.git/blob - GNUmakefile
Add Htirage.Sequence.
[reloto.git] / GNUmakefile
1 CABAL := $(shell find . -name '*.cabal' -print -quit)
2 HS := $(shell find . -name '*.hs')
3 QUICKCHECK_TESTS = 1000
4 QUICKCHECK_MAXSIZE = 100
5 TEST_FLAGS = --quickcheck-tests $(QUICKCHECK_TESTS) --quickcheck-max-size $(QUICKCHECK_MAXSIZE)
6
7 all: build
8
9 build:
10 stack $(STACK_FLAGS) build $(STACK_BUILD_FLAGS)
11
12 .PHONY: test
13 test:
14 ! grep -q '^Test-Suite\>' $(CABAL) || \
15 { stack $(STACK_FLAGS) test --test-arguments "$(TEST_FLAGS)" $(STACK_TEST_FLAGS); }
16
17 clean:
18 stack $(STACK_FLAGS) clean $(STACK_CLEAN_FLAGS)
19 cleaner:
20 stack $(STACK_FLAGS) clean --full $(STACK_CLEAN_FLAGS)
21
22 %/fast: override STACK_BUILD_FLAGS+=--fast
23 %/fast: override STACK_HADDOCK_FLAGS+=--fast
24 %/fast: override STACK_TEST_FLAGS+=--fast
25 %/fast: override QUICKCHECK_TESTS=100
26 %/fast: override QUICKCHECK_MAXSIZE=100
27 %/fast: %
28
29
30 doc:
31 stack $(STACK_FLAGS) haddock $(STACK_HADDOCK_FLAGS)
32 %.html: %.md
33 markdown $*.md >$*.html
34 %.html/view: %.html
35 sensible-browser $*.html
36
37 HLint.hs: $(HS)
38 sed -i -e '/^-- BEGIN: generated hints/,/^-- END: Generated by hlint/d' HLint.hs
39 echo '-- BEGIN: generated hints' >> HLint.hs
40 hlint --find . | grep '^'infix | sort -u >> HLint.hs
41 echo '-- END: generated hints' >> HLint.hs
42
43 lint: HLint.hs $(HS)
44 if hlint --quiet --report=hlint.html -XNoCPP \
45 $(shell cabal-cargs --format=ghc --only=default_extensions --sourcefile=$(CABAL)) $(HLINT_FLAGS) .; \
46 then rm -f hlint.html; \
47 else sensible-browser hlint.html & fi
48
49 tag:
50 name=$$(sed -ne 's/^name: *\(.*\)/\1/p' "$(CABAL)"); \
51 version=$$(sed -ne 's/^version: *\(.*\)/\1/p' "$(CABAL)"); \
52 git tag --merged | grep -Fqx "$$name-$$version" || \
53 git tag -f -s -m "$$name v$$version" $$name-$$version
54
55 tar:
56 LANG=C stack $(STACK_FLAGS) sdist $(STACK_SDIST_FLAGS)
57 upload:
58 LANG=C stack $(STACK_FLAGS) upload $(STACK_UPLOAD_FLAGS) .
59
60 .PHONY: stats
61 stats:
62 gitstats . $@
63 stats/view: stats
64 sensible-browser stats/index.html