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