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