]> Git — Sourcephile - haskell/localization.git/blob - GNUmakefile
stack: bump to lts-12.25
[haskell/localization.git] / GNUmakefile
1 CABAL := $(shell find . -maxdepth 1 -name '*.cabal' -print -quit)
2
3 all: build
4
5 build:
6 stack $(STACK_FLAGS) build $(STACK_BUILD_FLAGS)
7
8 .PHONY: test
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: $(shell find . -name '*.hs' -not -name 'HLint.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
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 tar:
50 stack $(STACK_FLAGS) sdist $(STACK_SDIST_FLAGS)
51 upload:
52 LANG=C stack $(STACK_FLAGS) upload $(STACK_UPLOAD_FLAGS) .
53
54 .PHONY: stats
55 stats:
56 gitstats . $@
57 stats/view: stats
58 sensible-browser stats/index.html