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